Merge branch 'dev' into first_open_fetch
This commit is contained in:
@@ -6,11 +6,9 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableCaching
|
||||
@EnableScheduling
|
||||
@ComponentScan(basePackages = "app.module")
|
||||
public class AdminApplication extends SpringBootServletInitializer {
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ public class AdminURIInterceptor implements HandlerInterceptor {
|
||||
private final URICurrentMatchingPortIn uriCurrentMatchingPortIn;
|
||||
private final URIAncestryPortIn uriAncestryPortIn;
|
||||
private final URITopTierPortIn topTierPortIn;
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfiles;
|
||||
|
||||
@@ -39,6 +40,11 @@ public class AdminURIInterceptor implements HandlerInterceptor {
|
||||
@Value("${app.aws.s3.bucketFolder:null}")
|
||||
private String bucketFolder;
|
||||
|
||||
/**
|
||||
* AttributeName: currentURI
|
||||
*/
|
||||
private static final String ATTR_NAME_URI = "currentURI";
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler)
|
||||
@@ -57,7 +63,7 @@ public class AdminURIInterceptor implements HandlerInterceptor {
|
||||
throw new NoMatchingURIException(String.format("매핑되는 않은 URI - %s", requestURI));
|
||||
}
|
||||
|
||||
request.setAttribute("currentURI", currentURI);
|
||||
request.setAttribute(ATTR_NAME_URI, currentURI);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -83,8 +89,8 @@ public class AdminURIInterceptor implements HandlerInterceptor {
|
||||
URITopTier topTierOutput = topTierPortIn.connectRoleId(AppType.ADMIN,roleId);
|
||||
modelAndView.addObject("topNode", recursiveMapping(topTierOutput));
|
||||
|
||||
if (modelAndView.getModelMap().getAttribute("currentURI") == null) {
|
||||
modelAndView.addObject("currentURI", request.getAttribute("currentURI"));
|
||||
if (modelAndView.getModelMap().getAttribute(ATTR_NAME_URI) == null) {
|
||||
modelAndView.addObject(ATTR_NAME_URI, request.getAttribute(ATTR_NAME_URI));
|
||||
}
|
||||
|
||||
modelAndView.addObject("menuHierarchy", uriAncestryPortIn.connect(AppType.ADMIN, request.getRequestURI()));
|
||||
|
||||
@@ -3,7 +3,10 @@ package app.module.admin.config.application.batch;
|
||||
import app.module.admin.usecase.batchLog.ports.BatchLogPortIn;
|
||||
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -21,17 +24,25 @@ public class BatchLogRunner {
|
||||
return;
|
||||
}
|
||||
|
||||
// 실행 로그 insert (RUNNING)
|
||||
Long logId = batchLogPortIn.create(batchType);
|
||||
// dev 환경 + 실제 날짜에 실행 로그 insert (RUNNING)
|
||||
Long logId = batchLogPortIn.create(batchType, getIpAddress(), "RUNNING");
|
||||
|
||||
try {
|
||||
action.run();
|
||||
// 성공 처리
|
||||
batchLogPortIn.update(logId, "SUCCESS", null);
|
||||
batchLogPortIn.update(logId, getIpAddress(),"SUCCESS", null);
|
||||
} catch (Exception e) {
|
||||
// 실패 처리
|
||||
batchLogPortIn.update(logId, "FAIL", e.getMessage());
|
||||
batchLogPortIn.update(logId, getIpAddress(),"FAIL", e.getMessage());
|
||||
safeLogger.error("[{}] 배치 실패: {}", batchType.name(), e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private String getIpAddress() {
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ public class MMSDBConfig {
|
||||
@Value("${mybatis.mapper-locations.mms}")
|
||||
private String mybatisMapper;
|
||||
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties(prefix = "spring.datasource.mms")
|
||||
public DataSource mmsDataSource() {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package app.module.admin.config.application.bean;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
public class SchedulingConfig {
|
||||
|
||||
@Bean
|
||||
public ThreadPoolTaskScheduler taskScheduler() {
|
||||
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
|
||||
scheduler.setPoolSize(5);
|
||||
scheduler.setThreadNamePrefix("scheduled-task-");
|
||||
scheduler.setWaitForTasksToCompleteOnShutdown(true);
|
||||
scheduler.setAwaitTerminationSeconds(60);
|
||||
return scheduler;
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,14 @@ class ExcelSaveAdminController {
|
||||
|
||||
@PostMapping("/api/settings/admin/excelUpload")
|
||||
ResponseEntity<?> excelUploadSaveAdmin(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(excelSaveAdminPortIn.operate(file));
|
||||
try {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(excelSaveAdminPortIn.operate(file));
|
||||
} catch (IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body("엑셀 파일 처리 중 오류가 발생했습니다: " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
||||
.body("잘못된 데이터 형식입니다: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,83 +0,0 @@
|
||||
package app.module.admin.usecase.admin.getAdmins.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.admin.getAdmins.adapters.web.model.AdminListFilterVO;
|
||||
import app.module.core.config.application.util.ExcelUtil;
|
||||
import app.module.core.usecase.admin.getAdmins.ports.GetAdminsPortIn;
|
||||
import app.module.core.usecase.admin.getAdmins.ports.application.domain.GetAdmins;
|
||||
import app.module.core.usecase.admin.getAdmins.ports.application.domain.GetAdminsCmd;
|
||||
import app.module.core.usecase.admin.getAdmins.ports.application.domain.GetAdminsRole;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class AdminExcelController {
|
||||
|
||||
private final GetAdminsPortIn getAdminsPortIn;
|
||||
private final ExcelUtil excelUtil;
|
||||
|
||||
@PostMapping(path = "/settings/admins/excel")
|
||||
void excelDownload(
|
||||
HttpServletResponse response,
|
||||
@PageableDefault(sort = "createdAt") Pageable pageable,
|
||||
@ModelAttribute("paramDto") AdminListFilterVO adminListFilterVO) {
|
||||
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("예제 관리자 목록");
|
||||
|
||||
Page<GetAdmins> listOutput =
|
||||
getAdminsPortIn.connect(
|
||||
pageable,
|
||||
new GetAdminsCmd(
|
||||
adminListFilterVO.getSearchField(),
|
||||
adminListFilterVO.getSearchValue(),
|
||||
adminListFilterVO.getSearchRole(),
|
||||
adminListFilterVO.getSearchArea(),
|
||||
adminListFilterVO.getSearchDisabled()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
||||
// Header
|
||||
Row headerRow = sheet.createRow(sheet.getPhysicalNumberOfRows());
|
||||
excelUtil.createCells(headerRow, "번호", "이메일", "권한", "등록일", "최근 수정일");
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
|
||||
listOutput
|
||||
.getContent()
|
||||
.forEach(
|
||||
item -> {
|
||||
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
|
||||
excelUtil.createCells(
|
||||
row,
|
||||
item.getId(),
|
||||
item.getEmail(),
|
||||
item.getRoles().stream()
|
||||
.map(GetAdminsRole::getId)
|
||||
.collect(Collectors.joining(", ")),
|
||||
Optional.ofNullable(item.getCreatedAt())
|
||||
.map(localDateTime -> localDateTime.format(formatter))
|
||||
.orElse(""),
|
||||
Optional.ofNullable(item.getUpdatedAt())
|
||||
.map(localDateTime -> localDateTime.format(formatter))
|
||||
.orElse(""));
|
||||
});
|
||||
}
|
||||
|
||||
excelUtil.generateWithPassword(response, wb, "admin-list");
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package app.module.admin.usecase.admin.removeAdmins.adapters.web;
|
||||
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.usecase.admin.removeAdmin.ports.RemoveAdminPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class AdminRemoveController {
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
private final RemoveAdminPortIn removeAdminPortIn;
|
||||
|
||||
@PostMapping(path = "/settings/admins/delete")
|
||||
String operate(RedirectAttributes redirectAttributes, @RequestParam List<String> checkedIds) {
|
||||
|
||||
if (CollectionUtils.isNotEmpty(checkedIds)) {
|
||||
removeAdminPortIn.connect(checkedIds);
|
||||
redirectAttributes.addFlashAttribute(
|
||||
"operationMessage", messageUtil.getMessage("operation.settings.admin.removed"));
|
||||
}
|
||||
|
||||
return "redirect:/settings/admins";
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminCreateBindingVO;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
@@ -12,6 +14,9 @@ import java.util.Optional;
|
||||
@Component
|
||||
public class AdminCreateValidator implements Validator {
|
||||
|
||||
@Autowired
|
||||
private MessageUtil messageUtil;
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return AdminCreateBindingVO.class.equals(clazz);
|
||||
@@ -23,30 +28,30 @@ public class AdminCreateValidator implements Validator {
|
||||
|
||||
// [1] 필수값 누락 체크
|
||||
if(StringUtils.isBlank(vo.getRoleId())) {
|
||||
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("roleId", "error.roleId", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(StringUtils.isBlank(vo.getId())) {
|
||||
errors.rejectValue("id", "error.id", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("id", "error.id", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(StringUtils.isBlank(vo.getPassword())) {
|
||||
errors.rejectValue("password", "error.password", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("password", "error.password", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
|
||||
// 권한 조사원으로 선택했을 경우
|
||||
if("ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if(StringUtils.isBlank(vo.getName())) {
|
||||
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("name", "error.name", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(StringUtils.isBlank(vo.getPhone1())) {
|
||||
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("phone1", "error.phone1", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(StringUtils.isBlank(vo.getPhone2())) {
|
||||
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("phone2", "error.phone2", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||
@@ -60,7 +65,7 @@ public class AdminCreateValidator implements Validator {
|
||||
}
|
||||
|
||||
if(vo.getAccountDisabled() == null) {
|
||||
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("accountDisabled", "error.accountDisabled", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +74,7 @@ public class AdminCreateValidator implements Validator {
|
||||
.filter(id -> !id.equals("ROLE_ADMIN"))
|
||||
.ifPresent(nonAdmins -> {
|
||||
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("regionMainCode", "valid.common.required.ask");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBindingVO;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
import org.springframework.validation.Validator;
|
||||
@@ -11,6 +13,9 @@ import java.util.Optional;
|
||||
@Component
|
||||
public class AdminUpdateValidator implements Validator {
|
||||
|
||||
@Autowired
|
||||
private MessageUtil messageUtil;
|
||||
|
||||
@Override
|
||||
public boolean supports(Class<?> clazz) {
|
||||
return AdminUpdateBindingVO.class.equals(clazz);
|
||||
@@ -22,22 +27,22 @@ public class AdminUpdateValidator implements Validator {
|
||||
|
||||
// [1] 필수값 누락 체크
|
||||
if(vo.getRoleId() == null || vo.getRoleId().isEmpty()) {
|
||||
errors.rejectValue("roleId", "error.roleId", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("roleId", "error.roleId", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
|
||||
// 권한 조사원으로 선택했을 경우
|
||||
if(vo.getRoleId() != null && "ROLE_RESEARCHER".equals(vo.getRoleId())) {
|
||||
if(vo.getName() == null || vo.getName().isEmpty()) {
|
||||
errors.rejectValue("name", "error.name", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("name", "error.name", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(vo.getPhone1() == null || vo.getPhone1().isBlank()) {
|
||||
errors.rejectValue("phone1", "error.phone1", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("phone1", "error.phone1", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if(vo.getPhone2() == null || vo.getPhone2().isBlank()) {
|
||||
errors.rejectValue("phone2", "error.phone2", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("phone2", "error.phone2", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
if (!vo.getPhone1().matches("^\\d{4}$")) {
|
||||
@@ -52,7 +57,7 @@ public class AdminUpdateValidator implements Validator {
|
||||
|
||||
// 사용여부
|
||||
if(vo.getAccountDisabled() == null) {
|
||||
errors.rejectValue("accountDisabled", "error.accountDisabled", "필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("accountDisabled", "error.accountDisabled", messageUtil.getMessage("valid.common.required.ask"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -61,7 +66,7 @@ public class AdminUpdateValidator implements Validator {
|
||||
.filter(id -> !id.equals("ROLE_ADMIN"))
|
||||
.ifPresent(nonAdmins -> {
|
||||
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||
errors.rejectValue("regionMainCode", "valid.common.required","필수입력항목을 확인해주세요.");
|
||||
errors.rejectValue("regionMainCode", "valid.common.required",messageUtil.getMessage("valid.common.required.ask"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package app.module.admin.usecase.batchCheck.adapters.persistence;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckOutCmd;
|
||||
import app.module.admin.usecase.batchCheck.ports.BatchCheckPortOut;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class BatchCheckDao implements BatchCheckPortOut {
|
||||
private final BatchCheckMapper mapper;
|
||||
|
||||
@Override
|
||||
public void operate(BatchCheckOutCmd outCmd) {
|
||||
mapper.create(outCmd);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.module.admin.usecase.batchCheck.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckOutCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface BatchCheckMapper {
|
||||
void create(BatchCheckOutCmd outCmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.batchCheck.ports;
|
||||
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckInCmd;
|
||||
|
||||
public interface BatchCheckPortIn {
|
||||
boolean operate(BatchCheckInCmd inCmd);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.module.admin.usecase.batchCheck.ports;
|
||||
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckOutCmd;
|
||||
|
||||
public interface BatchCheckPortOut {
|
||||
void operate(BatchCheckOutCmd outCmd);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package app.module.admin.usecase.batchCheck.ports.application;
|
||||
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckInCmd;
|
||||
import app.module.admin.usecase.batchLog.ports.BatchLogPortIn;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckOutCmd;
|
||||
import app.module.admin.usecase.batchCheck.ports.BatchCheckPortIn;
|
||||
import app.module.admin.usecase.batchCheck.ports.BatchCheckPortOut;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class BatchCheckService implements BatchCheckPortIn {
|
||||
private final BatchCheckPortOut portOut;
|
||||
private final BatchLogPortIn batchLogPortIn;
|
||||
|
||||
@Override
|
||||
public boolean operate(BatchCheckInCmd inCmd) {
|
||||
try {
|
||||
portOut.operate(new BatchCheckOutCmd(inCmd.getType(), inCmd.getRunDate(), getIpAddress()));
|
||||
|
||||
return true;
|
||||
} catch (DuplicateKeyException e) {
|
||||
log.warn("[batch] {} 가 이미 실행 중입니다. 중복 실행을 건너뜁니다.", inCmd.getMethodName());
|
||||
|
||||
batchLogPortIn.createError(inCmd.getType(), getIpAddress(), "WARNING",
|
||||
"[batch]" + inCmd.getMethodName() + " 가 이미 실행 중입니다. 중복 실행을 건너뜁니다.");
|
||||
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
log.error("[batch] 중복 실행 체크 예외 발생 : {} / {}", inCmd.getMethodName(), e.getMessage(), e);
|
||||
|
||||
batchLogPortIn.createError(inCmd.getType(), getIpAddress(), "ERROR",
|
||||
"[batch]" + inCmd.getMethodName() + " 중복 체크 중 예외 발생: " + e.getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private String getIpAddress() {
|
||||
try {
|
||||
return InetAddress.getLocalHost().getHostAddress();
|
||||
} catch (UnknownHostException e) {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.admin.usecase.batchCheck.ports.application.domain;
|
||||
|
||||
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
import java.util.Date;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class BatchCheckInCmd {
|
||||
private String methodName;
|
||||
private BatchLogType type;
|
||||
private Date runDate;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package app.module.admin.usecase.batchCheck.ports.application.domain;
|
||||
|
||||
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
import java.util.Date;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class BatchCheckOutCmd {
|
||||
private BatchLogType type;
|
||||
private Date runDate;
|
||||
private String ip;
|
||||
}
|
||||
@@ -19,14 +19,19 @@ class BatchLogDao implements BatchLogPortOut {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(BatchLogType type) {
|
||||
BatchLogCmd cmd = new BatchLogCmd(null, type.name(), "RUNNING", LocalDateTime.now());
|
||||
public Long create(BatchLogType type, String ip, String status) {
|
||||
BatchLogCmd cmd = new BatchLogCmd(null, type.name(), status, ip, LocalDateTime.now());
|
||||
mapper.create(cmd);
|
||||
return cmd.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Long id, String status, String errorMessage) {
|
||||
mapper.update(id, status, errorMessage);
|
||||
public void createError(BatchLogType type, String ip, String status, String errorMessage) {
|
||||
mapper.createError(type.name(), ip, status, errorMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Long id, String ip, String status, String errorMessage) {
|
||||
mapper.update(id, ip, status, errorMessage);
|
||||
}
|
||||
}
|
||||
@@ -7,5 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface BatchLogMapper {
|
||||
boolean exists(String type);
|
||||
Long create(BatchLogCmd cmd);
|
||||
void update(Long id, String status, String errorMessage);
|
||||
Long createError(String type, String ip, String status, String errorMessage);
|
||||
void update(Long id, String ip, String status, String errorMessage);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
|
||||
public interface BatchLogPortIn {
|
||||
boolean exists(BatchLogType type);
|
||||
Long create(BatchLogType type);
|
||||
void update(Long id, String status, String errorMessage);
|
||||
Long create(BatchLogType type, String ip, String status);
|
||||
void createError(BatchLogType type, String ip, String status, String errorMessage);
|
||||
void update(Long id, String ip, String status, String errorMessage);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
|
||||
public interface BatchLogPortOut {
|
||||
boolean exists(BatchLogType type);
|
||||
Long create(BatchLogType type);
|
||||
void update(Long id, String status, String errorMessage);
|
||||
Long create(BatchLogType type, String ip, String status);
|
||||
void createError(BatchLogType type, String ip, String status, String errorMessage);
|
||||
void update(Long id, String ip, String status, String errorMessage);
|
||||
}
|
||||
@@ -17,12 +17,17 @@ class BatchLogService implements BatchLogPortIn {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(BatchLogType type) {
|
||||
return portOut.create(type);
|
||||
public Long create(BatchLogType type, String ip, String status) {
|
||||
return portOut.create(type, ip, status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Long id, String status, String errorMessage) {
|
||||
portOut.update(id, status, errorMessage);
|
||||
public void createError(BatchLogType type, String ip, String status, String errorMessage) {
|
||||
portOut.createError(type, ip, status, errorMessage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(Long id, String ip, String status, String errorMessage) {
|
||||
portOut.update(id, ip, status, errorMessage);
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ public class BatchLogCmd {
|
||||
private Long id;
|
||||
private String type;
|
||||
private String status;
|
||||
private String ip;
|
||||
private LocalDateTime startAt;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class GetNoticeDao implements GetNoticePortOut {
|
||||
|
||||
return uploadFile;
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
|
||||
return Optional.of(secArticle);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.communication.notice.getNotice.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.communication.notice.getNotice.ports.GetNoticePortIn;
|
||||
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNotice;
|
||||
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -15,7 +16,7 @@ class GetNoticeController {
|
||||
private final GetNoticePortIn getNoticePortIn;
|
||||
|
||||
@GetMapping(path = "/api/communication/notices/{id}")
|
||||
ResponseEntity<?> operate(@PathVariable Long id) {
|
||||
ResponseEntity<GetNotice> operate(@PathVariable Long id) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(getNoticePortIn.operate(new GetNoticeCmd(id)).orElseThrow());
|
||||
}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package app.module.admin.usecase.communication.notice.updateNotice.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.communication.notice.updateNotice.ports.UpdateNoticePortIn;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@@ -13,14 +10,9 @@ import org.springframework.web.bind.annotation.PathVariable;
|
||||
@RequiredArgsConstructor
|
||||
class UpdateNoticeUIController {
|
||||
|
||||
private final UpdateNoticePortIn updateNoticePortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
@GetMapping(path = "/communication/notices/{id}")
|
||||
String operate(@PathVariable @ModelAttribute("id") Long id) {
|
||||
|
||||
@GetMapping(path = "/communication/notices/{id}")
|
||||
String operate(Model model
|
||||
, @PathVariable @ModelAttribute("id") Long id) {
|
||||
|
||||
|
||||
return "communication/notice/{id}";
|
||||
}
|
||||
return "communication/notice/{id}";
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package app.module.admin.usecase.communication.sms.getSmsUI;
|
||||
|
||||
import app.module.admin.usecase.communication.sms.getSmsUI.model.GetSmsReqVO;
|
||||
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 GetSmsController {
|
||||
|
||||
@GetMapping(path = "/communication/sms")
|
||||
String operate(
|
||||
Model model,
|
||||
@ModelAttribute("reqVO") GetSmsReqVO reqVO) {
|
||||
|
||||
return "communication/sms";
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package app.module.admin.usecase.communication.sms.getSmsUI.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode
|
||||
public class GetSmsReqVO {
|
||||
}
|
||||
@@ -10,4 +10,5 @@ public interface CreateHouseholdMapper {
|
||||
Integer createHousehold(CreateHouseholdOutCmd outCmd);
|
||||
void createHouseholdHasRole(CreateHouseholdHasRoleCmd cmd);
|
||||
void createResearcherHasHousehold(CreateResearcherHasHouseholdCmd cmd);
|
||||
void createHouseholdMonthlyInputStatus();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
@Transactional
|
||||
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||
// 엑셀 파일 읽기
|
||||
|
||||
Workbook workbook = WorkbookFactory.create(file.getInputStream());
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
int success = 0;
|
||||
@@ -60,6 +59,8 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
List<UICodeElement> IndustryMiddleCodeList = uiCodeListMapper.findByLikeId("code.industry.middle");
|
||||
|
||||
List<String> errorList = new ArrayList<>();
|
||||
int flag = 0;
|
||||
|
||||
// 첫 번째 행은 헤더로 간주하고 스킵
|
||||
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
@@ -68,30 +69,29 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
CheckHouseholdNum checkHouseholdNum = checkHouseholdNumMapper.checkHouseholdNum(new CheckHouseholdNumCmd(getCellValue(row.getCell(0)))).orElse(null);
|
||||
ExcelUploadContactVO contactVO = getDivisionContact(row.getCell(3));
|
||||
|
||||
if(checkHouseholdNum != null && !checkHouseholdNum.getIsDuplicated() && contactVO != null) {
|
||||
int flag = 0;
|
||||
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
|
||||
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
|
||||
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
|
||||
household.setOwnerAge(getCellNumberValue(row.getCell(2))); // 연령
|
||||
household.setTel(contactVO.getTel()); // 가구 연락처
|
||||
household.setPhone(contactVO.getPhone()); // 연락처
|
||||
household.setEncodedPassword(passwordEncoder.encode(contactVO.getPhoneLast())); // 비밀번호
|
||||
household.setRegionMainCode(getUiCode(row.getCell(4),RegionMainCodeList,"code.region.main")); // 실사
|
||||
household.setRegionSubCode(getUiCode(row.getCell(5),RegionSubCodeList,"code.region.sub")); // 지역
|
||||
household.setRegionDetailCode(getUiCode(row.getCell(6),RegionDetailCodeList,"code.region.detail")); // 세부지역
|
||||
household.setAddress(getCellValue(row.getCell(7))); // 전체주소
|
||||
household.setIndustryLargeCode(getUiCode(row.getCell(8),IndustryLargeCodeList,"code.industry.large")); // 업종 대분류
|
||||
household.setIndustryMiddleCode(getUiCode(row.getCell(9),IndustryMiddleCodeList,"code.industry.middle")); // 업종 중분류
|
||||
household.setIndustrySubMiddle(getCellValue(row.getCell(10))); // 업종 중분류2
|
||||
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
|
||||
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
|
||||
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
|
||||
household.setUsageType(getUsageType(row.getCell(14))); // 구분
|
||||
household.setMemo(getCellValue(row.getCell(15))); // 비고
|
||||
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
|
||||
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
|
||||
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
|
||||
household.setOwnerAge(getCellNumberValue(row.getCell(2))); // 연령
|
||||
household.setTel(contactVO.getTel()); // 가구 연락처
|
||||
household.setPhone(contactVO.getPhone()); // 연락처
|
||||
household.setEncodedPassword(passwordEncoder.encode(contactVO.getPhoneLast())); // 비밀번호
|
||||
household.setRegionMainCode(getUiCode(row.getCell(4),RegionMainCodeList,"code.region.main")); // 실사
|
||||
household.setRegionSubCode(getUiCode(row.getCell(5),RegionSubCodeList,"code.region.sub")); // 지역
|
||||
household.setRegionDetailCode(getUiCode(row.getCell(6),RegionDetailCodeList,"code.region.detail")); // 세부지역
|
||||
household.setAddress(getCellValue(row.getCell(7))); // 전체주소
|
||||
household.setIndustryLargeCode(getUiCode(row.getCell(8),IndustryLargeCodeList,"code.industry.large")); // 업종 대분류
|
||||
household.setIndustryMiddleCode(getUiCode(row.getCell(9),IndustryMiddleCodeList,"code.industry.middle")); // 업종 중분류
|
||||
household.setIndustrySubMiddle(getCellValue(row.getCell(10))); // 업종 중분류2
|
||||
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
|
||||
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
|
||||
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
|
||||
household.setUsageType(getUsageType(row.getCell(14))); // 구분
|
||||
household.setMemo(getCellValue(row.getCell(15))); // 비고
|
||||
|
||||
if (isValidHousehold(household, checkHouseholdNum, contactVO)) {
|
||||
CreateHouseholdOutCmd cmd = new CreateHouseholdOutCmd(
|
||||
null,
|
||||
null,
|
||||
household.getHouseholdNum(),
|
||||
household.getOwnerName(),
|
||||
household.getOwnerAge(),
|
||||
@@ -118,20 +118,38 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
|
||||
success += flag;
|
||||
|
||||
if(cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
|
||||
if (cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
|
||||
createHouseholdMapper.createHouseholdHasRole(AuditUtil.create(new CreateHouseholdHasRoleCmd(cmd.getSeq(), cmd.getRoleIds())));
|
||||
}
|
||||
|
||||
if(cmd.getResearcherSeq() != null) {
|
||||
if (cmd.getResearcherSeq() != null) {
|
||||
createHouseholdMapper.createResearcherHasHousehold(AuditUtil.create(new CreateResearcherHasHouseholdCmd(cmd.getSeq(), cmd.getResearcherSeq())));
|
||||
}
|
||||
} else {
|
||||
errorList.add(getCellValue(row.getCell(0)));
|
||||
safeLogger.warn("[ EXCEL 누락 ] 임가번호={} 핸드폰번호={}", getCellValue(row.getCell(0)),getCellValue(row.getCell(3)));
|
||||
errorList.add(household.getHouseholdNum());
|
||||
safeLogger.warn(
|
||||
"[EXCEL 누락] 임가번호={} 필수 필드 누락: checkHouseholdNum={}, isDuplicated={}, contactVO={}, householdNum={}, ownerName={}, ownerAge={}, tel={}, phone={}, regionMainCode={}, regionSubCode={}, regionDetailCode={}, address={}",
|
||||
household.getHouseholdNum(),
|
||||
checkHouseholdNum != null,
|
||||
checkHouseholdNum != null ? checkHouseholdNum.getIsDuplicated() : null,
|
||||
contactVO != null?contactVO:null,
|
||||
household.getHouseholdNum(),
|
||||
household.getOwnerName(),
|
||||
household.getOwnerAge(),
|
||||
household.getTel(),
|
||||
household.getPhone(),
|
||||
household.getRegionMainCode(),
|
||||
household.getRegionSubCode(),
|
||||
household.getRegionDetailCode(),
|
||||
household.getAddress()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
workbook.close();
|
||||
return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success, errorList);
|
||||
|
||||
createHouseholdMapper.createHouseholdMonthlyInputStatus();
|
||||
return new ExcelUploadResultVO(sheet.getLastRowNum() , success, errorList);
|
||||
}
|
||||
|
||||
// 셀 값을 문자열로 변환
|
||||
@@ -149,6 +167,20 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
if (cell == null) return null;
|
||||
return switch (cell.getCellType()) {
|
||||
case NUMERIC -> (int) cell.getNumericCellValue();
|
||||
case STRING -> {
|
||||
try {
|
||||
yield Integer.parseInt(cell.getStringCellValue().trim());
|
||||
} catch (NumberFormatException e) {
|
||||
yield null;
|
||||
}
|
||||
}
|
||||
case FORMULA -> {
|
||||
try {
|
||||
yield (int) cell.getNumericCellValue();
|
||||
} catch (Exception e) {
|
||||
yield null;
|
||||
}
|
||||
}
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
@@ -156,16 +188,16 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
private String getUiCode(Cell cell,List<UICodeElement> uiCodeElementList,String codeId){
|
||||
if (cell == null) return "";
|
||||
try {
|
||||
String cellValue = cell.getStringCellValue().trim();
|
||||
String[] cellValueParts = cellValue.split("\\.");
|
||||
String cellValue = cell.getStringCellValue().trim();
|
||||
String[] cellValueParts = cellValue.split("\\.");
|
||||
|
||||
return uiCodeElementList.stream().filter(code -> {
|
||||
if(cellValueParts.length == 1 ) return code.getCodeText().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[0]) ;
|
||||
if(cellValueParts.length == 2 ) return code.getId().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[1]) ;
|
||||
return Boolean.parseBoolean(null);
|
||||
} )
|
||||
.findFirst()
|
||||
.map(UICodeElement::getId).orElse("");
|
||||
return uiCodeElementList.stream().filter(code -> {
|
||||
if(cellValueParts.length == 1 ) return code.getCodeText().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[0]) ;
|
||||
if(cellValueParts.length == 2 ) return code.getId().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[1]) ;
|
||||
return Boolean.parseBoolean(null);
|
||||
} )
|
||||
.findFirst()
|
||||
.map(UICodeElement::getId).orElse("");
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
return null;
|
||||
}
|
||||
@@ -179,7 +211,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
|
||||
ExcelUploadContactVO contactVO = new ExcelUploadContactVO();
|
||||
|
||||
if(contact[2].length() == 4) {
|
||||
if(contact.length == 3 && contact[2].length() == 4) {
|
||||
if (contact[0].equals("010") || contact[0].equals("011")) {
|
||||
contactVO.setPhone(getCellValue(cell));
|
||||
contactVO.setPhoneLast(contact[2]);
|
||||
@@ -195,7 +227,9 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
private Boolean getIsPanel(Cell cell){
|
||||
if (cell == null) return null;
|
||||
String[] isPanel = cell.getStringCellValue().trim().split("\\.");
|
||||
return "1".equals(isPanel[0]) || "유지".equals(isPanel[1]);
|
||||
if(isPanel.length == 1 ) return "1".equals(isPanel[0]) || "유지".equals(isPanel[0]);
|
||||
if(isPanel.length == 2 ) return "1".equals(isPanel[0]) || "유지".equals(isPanel[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
private Long getResearcherSeq(Cell cell){
|
||||
@@ -204,10 +238,36 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
}
|
||||
|
||||
private String getUsageType(Cell cell){
|
||||
if (cell == null) return "MOBILE";
|
||||
String returnValue = "MOBILE";
|
||||
if (cell == null) {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
String usageType = cell.getStringCellValue().trim();
|
||||
if("모바일".equals(usageType) ) return "MOBILE";
|
||||
if("지류".equals(usageType) ) return "PAPER";
|
||||
return "MOBILE";
|
||||
if ("모바일".equals(usageType)) {
|
||||
returnValue = "MOBILE";
|
||||
}
|
||||
if ("지류".equals(usageType)) {
|
||||
returnValue = "PAPER";
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private boolean isValidHousehold(ExcelCreateHouseholdVO household, CheckHouseholdNum checkHouseholdNum, ExcelUploadContactVO contactVO) {
|
||||
// checkHouseholdNum과 contactVO 유효성 검사
|
||||
if (checkHouseholdNum == null || checkHouseholdNum.getIsDuplicated() || contactVO == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 필수 필드 검사: 임가번호, 경영주명, 연령, 연락처(tel 또는 phone), 실사, 지역, 세부지역, 전체 주소
|
||||
return household.getHouseholdNum() != null && !household.getHouseholdNum().isEmpty() &&
|
||||
household.getOwnerName() != null && !household.getOwnerName().isEmpty() &&
|
||||
household.getOwnerAge() != null &&
|
||||
(household.getTel() != null && !household.getTel().isEmpty() ||
|
||||
household.getPhone() != null && !household.getPhone().isEmpty()) &&
|
||||
household.getRegionMainCode() != null && !household.getRegionMainCode().isEmpty() &&
|
||||
household.getRegionSubCode() != null && !household.getRegionSubCode().isEmpty() &&
|
||||
household.getRegionDetailCode() != null && !household.getRegionDetailCode().isEmpty() &&
|
||||
household.getAddress() != null && !household.getAddress().isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,14 @@ class ExcelUploadCreateHouseholdController {
|
||||
|
||||
@PostMapping(path = "/api/household/excelUpload")
|
||||
ResponseEntity<?> operate(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(excelUploadCreateHouseholdPortIn.operate(file));
|
||||
try {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(excelUploadCreateHouseholdPortIn.operate(file));
|
||||
} catch (IOException e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||
.body("엑셀 파일 처리 중 오류가 발생했습니다: " + e.getMessage());
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
||||
.body("잘못된 데이터 형식입니다: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,28 +23,28 @@ public class SaveDailyExpenseValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"price", "valid.common.required",
|
||||
"price", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,31 +22,31 @@ public class SaveDailyFarmingValidator implements Validator {
|
||||
|
||||
if ("code.record.farming.self".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
|
||||
errors.rejectValue(
|
||||
"productSelf", "valid.common.required",
|
||||
"productSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"생산물을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,25 +22,25 @@ public class SaveDailyForestryValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.adapters.web.model.SaveDailyIncomeReqVO;
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.tika.utils.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -22,28 +23,28 @@ public class SaveDailyIncomeValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if ("code.record.unit.self".equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"price", "valid.common.required",
|
||||
"price", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.validator;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.adapters.web.model.SaveDailyPowerReqVO;
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.Errors;
|
||||
@@ -20,10 +21,10 @@ public class SaveDailyPowerValidator implements Validator {
|
||||
|
||||
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
|
||||
errors.rejectValue(
|
||||
"ownedHours", "valid.common.required",
|
||||
"ownedHours", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"leasedHours", "valid.common.required",
|
||||
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,37 +22,37 @@ public class SaveDailyWorkValidator implements Validator {
|
||||
|
||||
if (vo.getWorkLandArea() == null && !StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"workLandArea", "valid.common.required",
|
||||
"workLandArea", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"작업 면적을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getWorkLandArea() != null && StringUtils.isBlank(vo.getAreaUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"areaUnitCode", "valid.common.required",
|
||||
"areaUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.AREA_CODE_OTHER.equals(vo.getAreaUnitCode()) && StringUtils.isBlank(vo.getAreaUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"areaUnitSelf", "valid.common.required",
|
||||
"areaUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getHarvestQuantity() == null && !StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"harvestQuantity", "valid.common.required",
|
||||
"harvestQuantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수확량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getHarvestQuantity() != null && StringUtils.isBlank(vo.getHarvestUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"harvestUnitCode", "valid.common.required",
|
||||
"harvestUnitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getHarvestUnitCode()) && StringUtils.isBlank(vo.getHarvestUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"harvestUnitSelf", "valid.common.required",
|
||||
"harvestUnitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ public class SaveDailyWorkValidator implements Validator {
|
||||
&& vo.getHiredMHours() == null && vo.getHiredFHours() == null
|
||||
&& vo.getSharedMHours() == null && vo.getSharedFHours() == null
|
||||
&& vo.getVolunteerMHours() == null && vo.getVolunteerFHours() == null) {
|
||||
errors.rejectValue("ownerTime", "valid.common.required", "최소 1개의 노동투입시간을 입력해 주세요.");
|
||||
errors.rejectValue("spouseTime", "valid.common.required");
|
||||
errors.rejectValue("familyMHours", "valid.common.required");
|
||||
errors.rejectValue("familyFHours", "valid.common.required");
|
||||
errors.rejectValue("hiredMHours", "valid.common.required");
|
||||
errors.rejectValue("hiredFHours", "valid.common.required");
|
||||
errors.rejectValue("sharedMHours", "valid.common.required");
|
||||
errors.rejectValue("sharedFHours", "valid.common.required");
|
||||
errors.rejectValue("volunteerMHours", "valid.common.required");
|
||||
errors.rejectValue("volunteerFHours", "valid.common.required");
|
||||
errors.rejectValue("ownerTime", CommonConstants.VALID_CODE_NOTBLANK, "최소 1개의 노동투입시간을 입력해 주세요.");
|
||||
errors.rejectValue("spouseTime", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("familyMHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("familyFHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("hiredMHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("hiredFHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("sharedMHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("sharedFHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("volunteerMHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
errors.rejectValue("volunteerFHours", CommonConstants.VALID_CODE_NOTBLANK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package app.module.admin.usecase.operationlog.list.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.operationlog.list.adapters.web.model.OperationLogListFilterVO;
|
||||
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
|
||||
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
|
||||
import app.module.core.usecase.operationlog.list.application.port.in.OperationLogListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
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
|
||||
public class OperationLogListController {
|
||||
|
||||
private final OperationLogListPortIn operationLogListPortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping("/analysis/operationlog")
|
||||
String operate(
|
||||
Model model,
|
||||
@PageableDefault(sort = "createdAt", direction = Direction.DESC) Pageable pageable,
|
||||
@ModelAttribute("paramDto") OperationLogListFilterVO statusVO) {
|
||||
|
||||
Page<OperationLogElement> listOutput =
|
||||
operationLogListPortIn.connect(
|
||||
pageable,
|
||||
new OperationLogListFilterCommand(
|
||||
statusVO.getSearchField(),
|
||||
statusVO.getSearchValue(),
|
||||
statusVO.getSearchAppType(),
|
||||
statusVO.getSearchOperationType()));
|
||||
|
||||
model.addAttribute("listOutput", listOutput);
|
||||
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
||||
|
||||
return "operationLog/operationLogList";
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package app.module.admin.usecase.operationlog.list.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.operationlog.list.adapters.web.model.OperationLogListFilterVO;
|
||||
import app.module.core.config.application.util.ExcelUtil;
|
||||
import app.module.core.usecase.operationlog.list.application.domain.OperationLogElement;
|
||||
import app.module.core.usecase.operationlog.list.application.domain.OperationLogListFilterCommand;
|
||||
import app.module.core.usecase.operationlog.list.application.port.in.OperationLogListPortIn;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.web.PageableDefault;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Optional;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class OperationLogListExcelController {
|
||||
|
||||
private final ExcelUtil excelUtil;
|
||||
private final OperationLogListPortIn operationLogListPortIn;
|
||||
|
||||
@GetMapping("/analysis/operationlog/excel")
|
||||
public void operate(
|
||||
HttpServletResponse response,
|
||||
@PageableDefault(sort = "createdAt", direction = Direction.DESC) Pageable pageable,
|
||||
@ModelAttribute("paramDto") OperationLogListFilterVO statusVO) {
|
||||
Workbook wb = new XSSFWorkbook();
|
||||
Sheet sheet = wb.createSheet("수행로그 목록");
|
||||
|
||||
Page<OperationLogElement> listOutput =
|
||||
operationLogListPortIn.connect(
|
||||
pageable,
|
||||
new OperationLogListFilterCommand(
|
||||
statusVO.getSearchField(),
|
||||
statusVO.getSearchValue(),
|
||||
statusVO.getSearchAppType(),
|
||||
statusVO.getSearchOperationType()));
|
||||
|
||||
if (CollectionUtils.isNotEmpty(listOutput.getContent())) {
|
||||
// Header
|
||||
Row headerRow = sheet.createRow(sheet.getPhysicalNumberOfRows());
|
||||
excelUtil.createCells(
|
||||
headerRow, "로그 ID", "App Type", "Operation Type", "IP", "수행일", "수행자", "피수행자",
|
||||
"수행 내용");
|
||||
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||
|
||||
listOutput
|
||||
.getContent()
|
||||
.forEach(
|
||||
item -> {
|
||||
Row row = sheet.createRow(sheet.getPhysicalNumberOfRows());
|
||||
|
||||
excelUtil.createCells(
|
||||
row,
|
||||
item.getId(),
|
||||
item.getAppType().name(),
|
||||
item.getOperationLogType().name(),
|
||||
item.getIp(),
|
||||
Optional.ofNullable(item.getCreatedAt())
|
||||
.map(localDateTime -> localDateTime.format(formatter))
|
||||
.orElse(""),
|
||||
item.getCreatedBy(),
|
||||
item.getTargetId(),
|
||||
item.getTaskDesc());
|
||||
});
|
||||
}
|
||||
|
||||
excelUtil.generateWithPassword(response, wb, "operation-logs");
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package app.module.admin.usecase.operationlog.list.adapters.web.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class OperationLogListFilterVO {
|
||||
|
||||
private String searchField;
|
||||
private String searchValue;
|
||||
private String searchAppType;
|
||||
private String searchOperationType;
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package app.module.admin.usecase.schedule.autoSchedules.adapters.web;
|
||||
|
||||
import app.module.admin.usecase.batchCheck.ports.BatchCheckPortIn;
|
||||
import app.module.admin.usecase.batchCheck.ports.application.domain.BatchCheckInCmd;
|
||||
import app.module.admin.usecase.batchLog.ports.application.domain.BatchLogType;
|
||||
import app.module.admin.usecase.schedule.autoSchedules.ports.AutoSchedulesPortIn;
|
||||
import java.util.Date;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -10,28 +15,49 @@ import org.springframework.stereotype.Component;
|
||||
public class AutoSchedulesController {
|
||||
|
||||
private final AutoSchedulesPortIn portIn;
|
||||
private final BatchCheckPortIn batchCheckPortIn;
|
||||
|
||||
public AutoSchedulesController(AutoSchedulesPortIn portIn) {
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfiles;
|
||||
|
||||
@Value("${scheduler.enabled}")
|
||||
private boolean schedulerEnabled;
|
||||
|
||||
public AutoSchedulesController(AutoSchedulesPortIn portIn, BatchCheckPortIn batchCheckPortIn) {
|
||||
this.portIn = portIn;
|
||||
}
|
||||
this.batchCheckPortIn = batchCheckPortIn;
|
||||
}
|
||||
|
||||
/**
|
||||
* 월별입력상태 등록
|
||||
* 매 월 1일 0초 마다 실행되는 스케줄러
|
||||
*/
|
||||
//@Scheduled(cron = "0 0 0 1 * *")
|
||||
@Scheduled(cron = "1 0 0 19,20 * *")
|
||||
@Scheduled(cron = "0 0 0 1 * *")
|
||||
public void fetchMonthlyStatus() {
|
||||
String methodName = "fetchMonthlyStatus";
|
||||
|
||||
if (!schedulerEnabled) {
|
||||
log.info("[batch] {} 는 {} 환경에서는 실행되지 않습니다.", methodName, activeProfiles);
|
||||
return;
|
||||
}
|
||||
|
||||
// 중복 실행 여부 체크
|
||||
if (!batchCheckPortIn.operate(
|
||||
new BatchCheckInCmd(methodName, BatchLogType.MONTHLY_STATUS, new Date()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("[batch] 스케줄 실행 : {} / {} / {} / {} / {}",
|
||||
methodName, java.net.InetAddress.getLocalHost().getHostAddress(), this,
|
||||
+System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
String host = java.net.InetAddress.getLocalHost().getHostName();
|
||||
|
||||
log.info("스케줄 실행 : fetchMonthlyStatus / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
// 월별입력상태 실행
|
||||
portIn.operate();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
log.error("[batch] 예외 발생 : {} / {}", methodName, e.getMessage(), e);
|
||||
} finally {
|
||||
log.info("[batch] 스케줄 종료 : {}", methodName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,16 +67,30 @@ public class AutoSchedulesController {
|
||||
*/
|
||||
@Scheduled(cron = "0 0 17 * * ?")
|
||||
public void fetchSmsAutoSend() {
|
||||
String methodName = "fetchSmsAutoSend";
|
||||
|
||||
if (!schedulerEnabled) {
|
||||
log.info("[batch] {} 는 {} 환경에서는 실행되지 않습니다.", methodName, activeProfiles);
|
||||
return;
|
||||
}
|
||||
|
||||
// 중복 실행 여부 체크
|
||||
if (!batchCheckPortIn.operate(
|
||||
new BatchCheckInCmd(methodName, BatchLogType.AUTO_SMS, new Date()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("[batch] 스케줄 실행 : {} / {} / {} / {} / {}",
|
||||
methodName, java.net.InetAddress.getLocalHost().getHostAddress(), this,
|
||||
+System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
String host = java.net.InetAddress.getLocalHost().getHostName();
|
||||
|
||||
log.info("스케줄 실행 : fetchSmsAutoSend / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
// 문자자동발송 실행
|
||||
portIn.sendAutoSms();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
log.error("[batch] 예외 발생 : {} / {}", methodName, e.getMessage(), e);
|
||||
} finally {
|
||||
log.info("[batch] 스케줄 종료 : {}", methodName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,19 +98,32 @@ public class AutoSchedulesController {
|
||||
* 월초이월금 계산하여 등록
|
||||
* 매월 16일 0시 0초에 실행되는 스케줄러
|
||||
*/
|
||||
// @Scheduled(cron = "0 0 0 16 * *")
|
||||
@Scheduled(cron = "0 0 0 19,20 * *")
|
||||
@Scheduled(cron = "0 0 0 16 * *")
|
||||
public void fetchMonthlyCarryOver() {
|
||||
String methodName = "fetchMonthlyCarryOver";
|
||||
|
||||
if (!schedulerEnabled) {
|
||||
log.info("[batch] {} 는 {} 환경에서는 실행되지 않습니다.", methodName, activeProfiles);
|
||||
return;
|
||||
}
|
||||
|
||||
// 중복 실행 여부 체크
|
||||
if (!batchCheckPortIn.operate(
|
||||
new BatchCheckInCmd(methodName, BatchLogType.CARRYOVER, new Date()))) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
log.info("[batch] 스케줄 실행 : {} / {} / {} / {} / {}",
|
||||
methodName, java.net.InetAddress.getLocalHost().getHostAddress(), this,
|
||||
+System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
String host = java.net.InetAddress.getLocalHost().getHostName();
|
||||
|
||||
log.info("스케줄 실행 : fetchMonthlyCarryOver / {} / {} / {} / {}", host, this, + System.identityHashCode(this), Thread.currentThread().getName());
|
||||
|
||||
// 월초이월금 실행
|
||||
portIn.monthlyCarryOver();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
log.error("[batch] 예외 발생 : {} / {}", methodName, e.getMessage(), e);
|
||||
} finally {
|
||||
log.info("[batch] 스케줄 종료 : {}", methodName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,8 +34,6 @@ class AutoSchedulesService implements AutoSchedulesPortIn {
|
||||
private final GetSmsAutoStatusPortIn getSmsAutoStatusPortIn;
|
||||
private final GetIncompleteHouseholdsPortIn getIncompleteHouseholdsPortIn;
|
||||
private final BatchLogRunner batchLogRunner;
|
||||
|
||||
// TODO(ks) : 문자발송 테스트
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfiles;
|
||||
|
||||
@@ -48,44 +46,43 @@ class AutoSchedulesService implements AutoSchedulesPortIn {
|
||||
@Override
|
||||
@Transactional
|
||||
public Optional<Boolean> sendAutoSms() {
|
||||
if ("dev".equals(activeProfiles)) { // TODO(ks) : 문자발송 테스트
|
||||
GetSmsAutoStatus getSmsAutoStatus = getSmsAutoStatusPortIn.operate().orElse(null);
|
||||
GetSmsAutoStatus getSmsAutoStatus = getSmsAutoStatusPortIn.operate().orElse(null);
|
||||
|
||||
if (getSmsAutoStatus == null || Boolean.FALSE.equals(getSmsAutoStatus.getActive())) {
|
||||
log.info("문자 발송 비활성화 상태");
|
||||
if (getSmsAutoStatus == null || Boolean.FALSE.equals(getSmsAutoStatus.getActive())) {
|
||||
log.info("문자 발송 비활성화 상태");
|
||||
return Optional.of(false);
|
||||
}
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
int day = today.getDayOfMonth();
|
||||
|
||||
if (day == 8 || day == 15 || day == 22 || day == 1) {
|
||||
DayRange dayRange = DateUiUtil.getDayRange(today).orElse(null);
|
||||
if (dayRange == null) {
|
||||
log.error("잘못된 날짜({})에 문자 자동 발송 로직이 실행됨 - 발송 대상일이 아님", today);
|
||||
return Optional.of(false);
|
||||
}
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
int day = today.getDayOfMonth();
|
||||
LocalDate baseDate = (day == 1) ? today.minusMonths(1) : today;
|
||||
String targetMonth = DateUiUtil.getMonthValue(baseDate);
|
||||
|
||||
if (day == 8 || day == 15 || day == 22 || day == 1) {
|
||||
DayRange dayRange = DateUiUtil.getDayRange(today).orElse(null);
|
||||
if (dayRange == null) {
|
||||
log.error("잘못된 날짜({})에 문자 자동 발송 로직이 실행됨 - 발송 대상일이 아님", today);
|
||||
return Optional.of(false);
|
||||
}
|
||||
// activeProfiles 가 'dev'인 경우일 때 테스트용 임가 데이터만 조회합니다.
|
||||
List<GetIncompleteHouseholds> incompleteHouseholds = getIncompleteHouseholdsPortIn.operate(
|
||||
new GetIncompleteHouseholdsCmd(targetMonth, dayRange.getFromDay(),
|
||||
dayRange.getToDay(), activeProfiles));
|
||||
|
||||
LocalDate baseDate = (day == 1) ? today.minusMonths(1) : today;
|
||||
String targetMonth = DateUiUtil.getMonthValue(baseDate);
|
||||
|
||||
List<GetIncompleteHouseholds> incompleteHouseholds = getIncompleteHouseholdsPortIn.operate(
|
||||
new GetIncompleteHouseholdsCmd(targetMonth, dayRange.getFromDay(), dayRange.getToDay())
|
||||
);
|
||||
|
||||
if (!CollectionUtils.isEmpty(incompleteHouseholds)) {
|
||||
batchLogRunner.run(BatchLogType.AUTO_SMS, () -> {
|
||||
mmsPortIn.sendAutoSms(new CreateSmsAutoSendCmd(
|
||||
incompleteHouseholds,
|
||||
getSmsAutoStatus.getSendPhone(),
|
||||
getSmsAutoStatus.getMessage()
|
||||
));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log.info("문자 발송 날짜 아님.");
|
||||
return Optional.of(false);
|
||||
if (!CollectionUtils.isEmpty(incompleteHouseholds)) {
|
||||
batchLogRunner.run(BatchLogType.AUTO_SMS, () -> {
|
||||
mmsPortIn.sendAutoSms(new CreateSmsAutoSendCmd(
|
||||
incompleteHouseholds,
|
||||
getSmsAutoStatus.getSendPhone(),
|
||||
getSmsAutoStatus.getMessage()
|
||||
));
|
||||
});
|
||||
}
|
||||
} else {
|
||||
log.info("문자 발송 날짜 아님.");
|
||||
return Optional.of(false);
|
||||
}
|
||||
|
||||
return Optional.of(true);
|
||||
|
||||
@@ -13,4 +13,5 @@ public class GetIncompleteHouseholdsCmd {
|
||||
private String recordMonth;
|
||||
private int fromDay;
|
||||
private int toDay;
|
||||
private String activeProfiles;
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package app.module.admin.usecase.uri.index.adapter.web;
|
||||
|
||||
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.application.domain.RoleElement;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
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;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class URIIndexController {
|
||||
|
||||
private final RoleListPortIn<RoleElement> roleListPortIn;
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
|
||||
@GetMapping(path = "/settings/uri/{appType}")
|
||||
String intro(Model model, @PathVariable AppType appType) {
|
||||
model.addAttribute("roles", roleListPortIn.connect(appType));
|
||||
model.addAttribute("appType", appType);
|
||||
model.addAttribute("pageRows", uiCodeListPortIn.connect("code.pageable.rows"));
|
||||
|
||||
return "uri/uriList";
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package app.module.admin.usecase.uri.remove.adapter.web;
|
||||
|
||||
import app.module.core.config.adapters.web.rest.response.RestResponse;
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import app.module.core.config.application.exception.NonRemovableItemException;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.usecase.uri.remove.ports.URIRemovePortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class URIRemoveController {
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final MessageUtil messageUtil;
|
||||
private final URIRemovePortIn uriRemovePortIn;
|
||||
|
||||
@PostMapping(path = "/api/uri/remove")
|
||||
ResponseEntity<?> remove(@Valid URIRemoveVO removeVO, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
}
|
||||
|
||||
try {
|
||||
uriRemovePortIn.connect(AppType.ADMIN, removeVO.getId());
|
||||
} catch (NonRemovableItemException e) {
|
||||
bindingResult.reject("", e.getMessage());
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(
|
||||
RestResponse.builder()
|
||||
.message(messageUtil.getMessage("operation.common.remove.done"))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package app.module.admin.usecase.uri.remove.adapter.web;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class URIRemoveVO {
|
||||
|
||||
@NotEmpty(message = "{valid.common.required}")
|
||||
private String id;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package app.module.admin.usecase.uri.save.adapter.web.web;
|
||||
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import app.module.core.config.application.enums.SaveType;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class URISaveBindingVO {
|
||||
|
||||
private String id;
|
||||
private AppType appType;
|
||||
|
||||
@NotEmpty(message = "{valid.uri.text}")
|
||||
private String text;
|
||||
|
||||
@NotEmpty(message = "{valid.uri.uri}")
|
||||
@Pattern(regexp = "^(/)|(/).+", message = "{valid.uri.must.startWith.slash}")
|
||||
@Pattern(regexp = "^(/)|.*[^/]$", message = "{valid.uri.mustNot.endWith.slash}")
|
||||
private String uri;
|
||||
|
||||
private String type;
|
||||
|
||||
@NotEmpty(message = "{valid.common.required}")
|
||||
private String parentId;
|
||||
|
||||
private Integer orderNo;
|
||||
private boolean showOnNavi;
|
||||
|
||||
private String ogTitle;
|
||||
private String ogDesc;
|
||||
private String ogKeywords;
|
||||
private String ogImage;
|
||||
|
||||
private MultipartFile ogImageFile;
|
||||
|
||||
private Set<String> roles;
|
||||
|
||||
private SaveType saveType;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package app.module.admin.usecase.uri.save.adapter.web.web;
|
||||
|
||||
import app.module.core.config.adapters.web.rest.response.RestResponse;
|
||||
import app.module.core.config.application.enums.SaveType;
|
||||
import app.module.core.config.application.exception.AlreadyExistItemException;
|
||||
import app.module.core.config.application.exception.UnAcceptableFileException;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.usecase.uri.save.ports.URISavePortIn;
|
||||
import app.module.core.usecase.uri.save.ports.application.domain.URISaveCommand;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class URISaveController {
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final URISavePortIn uriSavePortIn;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@PostMapping(path = "/api/uri/save")
|
||||
public ResponseEntity<?> save(@Valid URISaveBindingVO saveVO, BindingResult bindingResult)
|
||||
throws IOException {
|
||||
|
||||
if (bindingResult.hasErrors()) {
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
}
|
||||
|
||||
String createdId;
|
||||
try {
|
||||
createdId =
|
||||
uriSavePortIn.connect(
|
||||
new URISaveCommand(
|
||||
saveVO.getId(),
|
||||
saveVO.getParentId(),
|
||||
saveVO.getAppType(),
|
||||
saveVO.getUri(),
|
||||
saveVO.isShowOnNavi(),
|
||||
saveVO.getText(),
|
||||
saveVO.getOrderNo(),
|
||||
saveVO.getOgTitle(),
|
||||
saveVO.getOgDesc(),
|
||||
saveVO.getOgKeywords(),
|
||||
saveVO.getOgImage(),
|
||||
saveVO.getRoles()),
|
||||
saveVO.getOgImageFile(),
|
||||
saveVO.getSaveType().equals(SaveType.CREATE));
|
||||
|
||||
} catch (UnAcceptableFileException e) {
|
||||
bindingResult.rejectValue("ogImageFile", "", e.getMessage());
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
|
||||
} catch (AlreadyExistItemException e) {
|
||||
bindingResult.rejectValue("uri", "", new String[]{"URI"}, e.getMessage());
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
}
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(
|
||||
RestResponse.builder()
|
||||
.item(createdId)
|
||||
.message(messageUtil.getMessage("operation.common.save.done"))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package app.module.admin.usecase.uri.sort.adapter.web;
|
||||
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.uri.sort.ports.URISortPortIn;
|
||||
import app.module.core.usecase.uri.sort.ports.application.domain.URISortCommand;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class URISortController {
|
||||
|
||||
private final URISortPortIn uriSortPortIn;
|
||||
private final CoreUtil coreUtil;
|
||||
|
||||
@PostMapping(path = "/api/uri/switchOrderNo")
|
||||
ResponseEntity<?> switchOrderNo(
|
||||
@Valid @RequestBody List<URISortVO> sortVOs, BindingResult bindingResult) {
|
||||
if (bindingResult.hasErrors()) {
|
||||
return coreUtil.getErrorInfo(bindingResult);
|
||||
}
|
||||
|
||||
uriSortPortIn.connect(
|
||||
sortVOs.stream()
|
||||
.map(item -> new URISortCommand(item.getId(), item.getOrderNo()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(null);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package app.module.admin.usecase.uri.sort.adapter.web;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class URISortVO {
|
||||
|
||||
@NotBlank(message = "{valid.common.required}")
|
||||
private String id;
|
||||
|
||||
private Integer orderNo;
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package app.module.admin.usecase.uri.toptier.adapter.web;
|
||||
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import app.module.core.usecase.uri.toptier.ports.URITopTierPortIn;
|
||||
import app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
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;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class URITopTierController {
|
||||
|
||||
private final URITopTierPortIn topTierPortIn;
|
||||
|
||||
@GetMapping(path = "/api/uri/topTier/{appType}")
|
||||
ResponseEntity<?> recursiveItems(@PathVariable AppType appType) {
|
||||
URITopTier topTierOutput = topTierPortIn.connect(appType);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(recursiveMapping(topTierOutput));
|
||||
}
|
||||
|
||||
private URITreeVO recursiveMapping(URITopTier output) {
|
||||
return new URITreeVO(
|
||||
output.getId(),
|
||||
output.getText(),
|
||||
output.getUri(),
|
||||
output.getOrderNo(),
|
||||
CollectionUtils.emptyIfNull(output.getChildren()).stream()
|
||||
.map(this::recursiveMapping)
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package app.module.admin.usecase.uri.toptier.adapter.web;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class URITreeVO {
|
||||
|
||||
private String id;
|
||||
private String text;
|
||||
private String uri;
|
||||
private Integer orderNo;
|
||||
private List<URITreeVO> nodes;
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package app.module.admin.usecase.uri.view.adapter.web;
|
||||
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class URIBindingVO {
|
||||
|
||||
private String id;
|
||||
private AppType appType;
|
||||
private String text;
|
||||
private String uri;
|
||||
private String parentId;
|
||||
private Integer orderNo;
|
||||
private boolean showOnNavi;
|
||||
private String ogTitle;
|
||||
private String ogDesc;
|
||||
private String ogKeywords;
|
||||
private String ogImage;
|
||||
private Set<String> roles;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package app.module.admin.usecase.uri.view.adapter.web;
|
||||
|
||||
import app.module.core.config.adapters.web.rest.response.RestResponse;
|
||||
import app.module.core.config.application.enums.AppType;
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import app.module.core.usecase.uri.view.ports.URIViewPortIn;
|
||||
import app.module.core.usecase.uri.view.ports.application.domain.URIView;
|
||||
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;
|
||||
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class URIViewController {
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
private final URIViewPortIn uriViewPortIn;
|
||||
|
||||
@GetMapping(path = "/api/uri/{appType}/{id}")
|
||||
ResponseEntity<?> operate(@PathVariable AppType appType, @PathVariable String id) {
|
||||
URIView output =
|
||||
uriViewPortIn
|
||||
.connect(appType, id)
|
||||
.orElseThrow(
|
||||
() ->
|
||||
new NoSuchElementException(
|
||||
messageUtil.getMessage("exception.noSuchElement", id, "URI")));
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(
|
||||
RestResponse.builder()
|
||||
.item(
|
||||
new URIBindingVO(
|
||||
output.getId(),
|
||||
output.getAppType(),
|
||||
output.getText(),
|
||||
output.getUri(),
|
||||
output.getParentId(),
|
||||
output.getOrderNo(),
|
||||
output.getShowOnNavi(),
|
||||
output.getOgTitle(),
|
||||
output.getOgDesc(),
|
||||
output.getOgKeywords(),
|
||||
output.getOgImage(),
|
||||
output.getRoles()))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
@@ -23,9 +23,9 @@ spring:
|
||||
password: ENC(uBHyXdI39UzPNvYNHDGfjmMMuhN83xoP8F3wDq/S9DxizhFwbMeEqa36oZ205CBg)
|
||||
mms:
|
||||
driver-class-name: org.postgresql.Driver
|
||||
jdbc-url: jdbc:postgresql://15.165.180.203:5432/ko_research_hyunjoo
|
||||
username: hyunjoo
|
||||
password: hyunjoo1@#4
|
||||
jdbc-url: ENC(SH5G+4mdOrW3PpVEmVyNXIFyV7eFC6uLTa0e18qa+7ueQeWrduIeGVJLrQP3mUw86dzqLK7AUHjTRuex4ud+rTt026L7csDLFYzLWGkGCTEqfFBOwHng3uQ7n+qmkKiW)
|
||||
username: ENC(37ccHxlpbsEz8vVcZUZA/j6azKYhP3eHwhOYVjYGf+zKC3u/qc+khKcKuBuE8+Ck)
|
||||
password: ENC(uBHyXdI39UzPNvYNHDGfjmMMuhN83xoP8F3wDq/S9DxizhFwbMeEqa36oZ205CBg)
|
||||
maximum-pool-size: 2
|
||||
minimum-idle: 1
|
||||
|
||||
@@ -37,6 +37,7 @@ logging:
|
||||
app:
|
||||
module: DEBUG # 애플리케이션 기본 패키지 로깅 레벨 (패키지 경로 변경 필요시 수정)
|
||||
|
||||
|
||||
# ==============================================
|
||||
# 암호화 설정
|
||||
# ==============================================
|
||||
|
||||
@@ -46,3 +46,9 @@ jasypt:
|
||||
encryptor:
|
||||
password: etribe
|
||||
algorithm: PBEWITHHMACSHA512ANDAES_256
|
||||
|
||||
# ==============================================
|
||||
# local 환경에서는 배치 스케줄러 미실행
|
||||
# ==============================================
|
||||
scheduler:
|
||||
enabled: false
|
||||
@@ -117,3 +117,9 @@ jasypt:
|
||||
encryptor:
|
||||
password: #별도관리
|
||||
algorithm: #별도관리
|
||||
|
||||
# ==============================================
|
||||
# 배치 스케줄러 실행 여부 (true: 실행, false: 미실행)
|
||||
# ==============================================
|
||||
scheduler:
|
||||
enabled: true
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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.batchCheck.adapters.persistence.BatchCheckMapper" >
|
||||
<insert id="create">
|
||||
/* create : 배치 중복 실행 방지를 위한 등록 */
|
||||
INSERT INTO batch_check(type, run_date, created_ip, created_at)
|
||||
VALUES (#{type}, #{runDate}, #{ip}, now())
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -19,8 +19,18 @@
|
||||
SELECT nextval('batch_log_seq')
|
||||
</selectKey>
|
||||
|
||||
INSERT INTO batch_log (id, type, status, start_at, created_at)
|
||||
VALUES (#{id}, #{type}, #{status}, #{startAt}, now())
|
||||
INSERT INTO batch_log (id, type, status, start_at, created_at, created_ip)
|
||||
VALUES (#{id}, #{type}, #{status}, #{startAt}, now(), #{ip})
|
||||
</insert>
|
||||
|
||||
<!-- 에러 로그 insert -->
|
||||
<insert id="createError">
|
||||
<selectKey keyProperty="id" resultType="long" order="BEFORE">
|
||||
SELECT nextval('batch_log_seq')
|
||||
</selectKey>
|
||||
|
||||
INSERT INTO batch_log (id, type, status, error_message, start_at, created_at, created_ip)
|
||||
VALUES (#{id}, #{type}, #{status}, #{errorMessage}, now(), now(), #{ip})
|
||||
</insert>
|
||||
|
||||
<!-- 상태 업데이트 -->
|
||||
@@ -28,7 +38,8 @@
|
||||
UPDATE batch_log
|
||||
SET status = #{status},
|
||||
error_message = #{errorMessage},
|
||||
end_at = now()
|
||||
end_at = now(),
|
||||
created_ip = #{ip}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -93,4 +93,8 @@
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="createHouseholdMonthlyInputStatus" resultType="java.lang.String">
|
||||
select fn_monthly_input_status()
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,25 +6,26 @@
|
||||
<select id="operate"
|
||||
resultType="app.module.admin.usecase.schedule.getIncompleteHouseholds.ports.application.domain.GetIncompleteHouseholds">
|
||||
/* operate : 문자 발송 일계부 미완료된 대상자 조회 */
|
||||
SELECT h.seq,
|
||||
h.household_num,
|
||||
h.owner_name,
|
||||
h.phone
|
||||
FROM household h
|
||||
WHERE h.seq IN (
|
||||
SELECT DISTINCT dr.household_seq
|
||||
FROM daily_record dr
|
||||
WHERE dr.record_month = #{recordMonth}
|
||||
AND dr.day_group_no IN (
|
||||
SELECT ddg.group_no
|
||||
FROM daily_day_group ddg
|
||||
WHERE ddg.is_deleted = false
|
||||
AND ddg.start_day >= #{fromDay}
|
||||
AND ddg.end_day < #{toDay}
|
||||
)
|
||||
AND dr.all_status NOT IN ('DONE', 'TODAY_NONE')
|
||||
)
|
||||
AND region_main_code = 'code.region.main.99' /* TODO(ks) : 문자발송 테스트 */
|
||||
AND phone != '010-1111-1111' /* TODO(ks) : 문자발송 테스트 */
|
||||
SELECT DISTINCT h.seq,
|
||||
h.household_num,
|
||||
h.owner_name,
|
||||
h.phone
|
||||
FROM household h
|
||||
LEFT JOIN daily_record dr ON dr.household_seq = h.seq
|
||||
AND dr.is_deleted = false
|
||||
AND dr.record_month = #{recordMonth}
|
||||
AND dr.all_status NOT IN ('DONE', 'TODAY_NONE')
|
||||
AND dr.day_group_no IN (
|
||||
SELECT ddg.group_no
|
||||
FROM daily_day_group ddg
|
||||
WHERE ddg.is_deleted = false
|
||||
AND ddg.start_day >= #{fromDay}
|
||||
AND ddg.end_day < #{toDay}
|
||||
)
|
||||
WHERE h.is_deleted = false
|
||||
<if test="activeProfiles != null and activeProfiles == 'dev'">
|
||||
AND h.region_main_code = 'code.region.main.99'
|
||||
AND h.phone != '010-1111-1111'
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,4 +1,5 @@
|
||||
valid.common.required=\uD544\uC218\uC785\uB825 \uD56D\uBAA9\uC785\uB2C8\uB2E4.
|
||||
valid.common.required.ask=\uD544\uC218\uC785\uB825\uD56D\uBAA9\uC744 \uD655\uC778\uD574\uC8FC\uC138\uC694.
|
||||
valid.common.required.size={0} \uAC1C \uD56D\uBAA9\uC774 \uB2F4\uACA8\uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4.
|
||||
valid.common.required.size.min={0} \uAC1C \uC774\uC0C1 \uD56D\uBAA9\uC774 \uD544\uC694\uD569\uB2C8\uB2E4.
|
||||
valid.common.required.remove.item=\uC0AD\uC81C\uD560 \uC544\uC774\uD15C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
|
||||
|
||||
@@ -128,9 +128,6 @@
|
||||
|
||||
<div class="component-btns bottom-btn-group">
|
||||
<div class="btns-row align-right">
|
||||
<button class="btn" onclick="showAdminExcelUploadModal();" type="button">
|
||||
<span class="btn-txt">엑셀 업로드</span>
|
||||
</button>
|
||||
<!-- <button class="btn" onclick="goExcel();" type="button"><span class="btn-txt" th:unless="${activeProfile != 'local'}">엑셀 다운로드</span></button>-->
|
||||
<button class="btn" onclick="location.href='/settings/admins/create';" type="button"><span class="btn-txt">등록</span></button>
|
||||
<button class="btn" onclick="goRemove();" type="button"><span class="btn-txt">삭제</span></button>
|
||||
@@ -138,7 +135,6 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div th:replace="admin/modal/modal-admin-excel:: modalFragment"></div>
|
||||
</form>
|
||||
|
||||
</section>
|
||||
@@ -214,52 +210,6 @@
|
||||
// f.submit();
|
||||
// }
|
||||
|
||||
function showAdminExcelUploadModal() {
|
||||
const modal = document.querySelector(".modal02");
|
||||
modal.ui.open();
|
||||
|
||||
}
|
||||
|
||||
const uploadAdminExcel = () => {
|
||||
event.preventDefault();
|
||||
|
||||
const fileInput = document.getElementById('file');
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', fileInput.files[0]);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/api/settings/admin/excelUpload',
|
||||
data: formData,
|
||||
contentType: false, // * 중요 *
|
||||
processData: false, // * 중요 *
|
||||
enctype: 'multipart/form-data', // * 중요 *
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
|
||||
},
|
||||
statusCode: {
|
||||
422: (res) => {
|
||||
const resJson = res.responseJSON;
|
||||
$(input).parent().find('.invalid-feedback').text(resJson.message);
|
||||
$(input).addClass('is-invalid');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
document.querySelector(".modal02").ui.close();
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
// 임가방문정보 모달창 띄우기
|
||||
const showExcelHouseholdModal = () => {
|
||||
document.querySelector(".modal-excel-household").ui.open();
|
||||
const fileInput = document.getElementById("householdFile");
|
||||
if (fileInput) {
|
||||
fileInput.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
// 임가방문정보 등록
|
||||
@@ -72,14 +76,19 @@
|
||||
},
|
||||
success(res) {
|
||||
ajaxUtil._hideWaiting(); // 로딩바 hide
|
||||
|
||||
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
|
||||
document.querySelector(".modal-excel-household").ui.close();
|
||||
},
|
||||
statusCode: {
|
||||
422: (res) => {
|
||||
const resJson = res.responseJSON;
|
||||
$(input).parent().find('.invalid-feedback').text(resJson.message);
|
||||
$(input).addClass('is-invalid');
|
||||
400: () => {
|
||||
ajaxUtil._hideWaiting();
|
||||
alert("잘못된 엑셀파일입니다.");
|
||||
document.querySelector(".modal-excel-household").ui.close();
|
||||
},
|
||||
500: () => {
|
||||
ajaxUtil._hideWaiting();
|
||||
alert("엑셀 업로드에 실패하였습니다.");
|
||||
document.querySelector(".modal-excel-household").ui.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,185 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
|
||||
<section layout:fragment="content">
|
||||
|
||||
<form method="get" name="paramForm" onsubmit="goSearch();"
|
||||
th:action="@{/analysis/operationlog}" th:object="${paramDto}">
|
||||
<!-- hidden parameters -->
|
||||
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
|
||||
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
|
||||
|
||||
<div class="row bg-secondary p-2 mb-2" style="--bs-bg-opacity: .2;">
|
||||
<div class="col">
|
||||
<label class="col-form-label" for="searchAppType">App Type</label>
|
||||
<select class="form-select d-inline" id="searchAppType" style="width: 110px;"
|
||||
th:field="*{searchAppType}">
|
||||
<option selected value="">전체</option>
|
||||
<option
|
||||
th:each="appType : ${T(app.module.core.config.application.enums.AppType).values()}"
|
||||
th:value="${appType.name}">
|
||||
[[${appType.name}]]
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col">
|
||||
<label class="col-form-label" for="searchOperationType">Operation Type</label>
|
||||
<select class="form-select d-inline" id="searchOperationType" style="width: 110px;"
|
||||
th:field="*{searchOperationType}">
|
||||
<option selected value="">전체</option>
|
||||
<option
|
||||
th:each="operationType : ${T(app.module.core.config.application.enums.OperationLogType).values()}"
|
||||
th:value="${operationType.name}">[[${operationType.name}]] ([[${operationType.desc}]])
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-auto">
|
||||
<label class="col-form-label" for="searchField">검색필드</label>
|
||||
<select class="form-select d-inline w-auto" id="searchField"
|
||||
th:field="*{searchField}">
|
||||
<option selected value="">선택</option>
|
||||
<option value="id">로그 ID</option>
|
||||
<option value="operatorId">수행자</option>
|
||||
<option value="targetId">피수행자</option>
|
||||
</select>
|
||||
<label>
|
||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||
style="" th:field="*{searchValue}"
|
||||
type="text">
|
||||
</label>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<button class="btn btn-secondary" onclick="goSearch();"
|
||||
type="button">검색
|
||||
</button>
|
||||
<button class="btn btn-light" onclick="goInit();" type="button">초기화
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<div class="fw-bolder text-muted">
|
||||
Total: <span th:text="${listOutput.totalElements}"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
<i class="bi bi-list-ol"></i> <label> <select
|
||||
class="form-select form-select-sm" id="pageSize" name="pageSize"
|
||||
onchange="goSearch()">
|
||||
<option
|
||||
th:each="item : ${pageRows}"
|
||||
th:text="${item.codeText}" th:value="${item.codeValue}"></option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">#</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="appType"
|
||||
href="#">App Type</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="operationLogType"
|
||||
href="#">Operation Type</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="ip"
|
||||
href="#">IP</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="createdBy"
|
||||
href="#">수행자</a></th>
|
||||
<th scope="col"><a class="order-able" data-sort-field="targetId"
|
||||
href="#">피수행자</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sortable">
|
||||
|
||||
<div th:each="item, status : ${listOutput.content}" th:remove="tag">
|
||||
<tr>
|
||||
<td class="row">[[${status.count + (listOutput.pageable.pageNumber *
|
||||
listOutput.pageable.pageSize)}]]
|
||||
</td>
|
||||
<th class="bg-info">[[${item.id}]]</th>
|
||||
<td>[[${item.appType}]]</td>
|
||||
<td>[[${item.operationLogType}]]</td>
|
||||
<td>
|
||||
<span th:if="${not #strings.isEmpty(item.ip)}" th:remove="tag">[[${item.ip}]]</span>
|
||||
<span th:if="${#strings.isEmpty(item.ip)}" th:remove="tag"><i
|
||||
class="bi bi-slash-circle"></i></span>
|
||||
</td>
|
||||
<td>[[${#temporals.format(item.createdAt, 'yyyy-MM-dd HH:mm')}]]</td>
|
||||
<td>[[${item.createdBy}]]</td>
|
||||
<td>
|
||||
<span th:if="${not #strings.isEmpty(item.targetId)}" th:remove="tag">[[${item.targetId}]]</span>
|
||||
<span th:if="${#strings.isEmpty(item.targetId)}" th:remove="tag"><i
|
||||
class="bi bi-slash-circle"></i></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td colspan="8"><i class="bi bi-arrow-right"></i> [[${item.taskDesc}]]</td>
|
||||
</tr>
|
||||
</div>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
||||
<div th:replace="common/list-components :: pagination(${listOutput})"></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col text-start">
|
||||
<button class="btn btn-success" onclick="goExcel();" type="button">엑셀 다운로드</button>
|
||||
</div>
|
||||
<div class="col text-end">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
<section layout:fragment="script">
|
||||
<script th:inline="javascript">
|
||||
// 목록 정렬 표기 및 갱신 기능 적용
|
||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
||||
[[${listOutput.pageable.sort.toString()}]]);
|
||||
</script>
|
||||
|
||||
<script th:inline="javascript">
|
||||
// 검색
|
||||
function goSearch() {
|
||||
const f = document.paramForm;
|
||||
f.action = '/analysis/operationlog';
|
||||
f.page.value = 0;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
|
||||
// 초기화
|
||||
function goInit() {
|
||||
const f = document.paramForm;
|
||||
f.searchField.value = '';
|
||||
f.searchValue.value = '';
|
||||
f.searchAppType.value = '';
|
||||
f.searchOperationType.value = '';
|
||||
}
|
||||
|
||||
function goExcel() {
|
||||
const f = document.paramForm;
|
||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||
f.action = '/analysis/operationlog/excel';
|
||||
f.method = 'get';
|
||||
f.submit();
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
</html>
|
||||
@@ -3,12 +3,12 @@
|
||||
layout:decorate="~{layout/layout}">
|
||||
|
||||
<div class="layer-wrap" th:fragment="modalFragment">
|
||||
<div class="component-modal modal02" id="test" data-props-dimm-click="true" data-state="close">
|
||||
<div class="component-modal modal01 modal-researcher-excel" id="test" data-props-dimm-click="true" data-state="close">
|
||||
<div class="modal-dimm"></div>
|
||||
<div class="modal-frame">
|
||||
<div class="modal-container type-small">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-tit" >관리자 등록 엑셀업로드</h3>
|
||||
<h3 class="modal-tit">조사원 등록 엑셀업로드</h3>
|
||||
</div>
|
||||
<div class="modal-content">
|
||||
<div class="modal-content-inner">
|
||||
@@ -19,7 +19,7 @@
|
||||
</label>
|
||||
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||
<div class="btns-row align-right">
|
||||
<button type="button" class="btn btn-primary" onclick="uploadAdminExcel()">
|
||||
<button type="button" class="btn btn-primary" onclick="uploadExcel()">
|
||||
<span class="btn-txt">등록</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -97,11 +97,15 @@
|
||||
|
||||
<div class="component-btns bottom-btn-group" >
|
||||
<div class="btns-row align-right">
|
||||
<button class="btn" onclick="showExcelUploadModal();" type="button">
|
||||
<span class="btn-txt">엑셀 업로드</span>
|
||||
</button>
|
||||
<button type="button" class="btn" onclick="goExcel();">
|
||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div th:replace="researcher/modal/modal-researcher-excel:: modalFragment"></div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
@@ -238,6 +242,61 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
function showExcelUploadModal() {
|
||||
const modal = document.querySelector(".modal-researcher-excel");
|
||||
const fileInput = document.getElementById("file");
|
||||
if (fileInput) {
|
||||
fileInput.value = '';
|
||||
}
|
||||
modal.ui.open();
|
||||
|
||||
}
|
||||
|
||||
const uploadExcel = () => {
|
||||
event.preventDefault();
|
||||
|
||||
const fileInput = document.getElementById('file');
|
||||
if (fileInput.files.length === 0) {
|
||||
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||
return;
|
||||
}
|
||||
|
||||
let formData = new FormData();
|
||||
formData.append('file', fileInput.files[0]);
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/api/settings/admin/excelUpload',
|
||||
data: formData,
|
||||
contentType: false, // * 중요 *
|
||||
processData: false, // * 중요 *
|
||||
enctype: 'multipart/form-data', // * 중요 *
|
||||
beforeSend: function (xhr) {
|
||||
xhr.setRequestHeader(
|
||||
$("meta[name='_csrf_header']").attr("content"),
|
||||
$("meta[name='_csrf']").attr("content"));
|
||||
},
|
||||
success(res) {
|
||||
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
|
||||
},
|
||||
statusCode: {
|
||||
400:() => {
|
||||
ajaxUtil._hideWaiting();
|
||||
alert("잘못된 엑셀파일입니다.");
|
||||
document.querySelector(".modal-researcher-excel").ui.close();
|
||||
},
|
||||
500: () => {
|
||||
ajaxUtil._hideWaiting();
|
||||
alert("엑셀 업로드에 실패하였습니다.");
|
||||
document.querySelector(".modal-researcher-excel").ui.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const closeModal = () => {
|
||||
document.querySelector(".modal-researcher-excel").ui.close();
|
||||
};
|
||||
</script>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -315,6 +315,7 @@
|
||||
|
||||
function refreshTree(currentId) {
|
||||
loadTree(currentId);
|
||||
document.formDto.reset();
|
||||
}
|
||||
|
||||
function getInfo(data) {
|
||||
|
||||
@@ -62,21 +62,21 @@ public class TestJasyptConfig {
|
||||
|
||||
System.out.println("운영서버 정보 MMS 엔코딩" );
|
||||
String url3 = "jdbc:postgresql://115.68.193.117:5432/ppurio";
|
||||
String encryptUrl3 = jasyptEncryptPrd(url3);
|
||||
String encryptUrl3 = jasyptEncrypt(url3);
|
||||
|
||||
System.out.println("encryptUrl3 : " + encryptUrl3);
|
||||
Assertions.assertThat(url3).isEqualTo(jasyptDecrytPrd(encryptUrl3));
|
||||
/* Assertions.assertThat(url3).isEqualTo(jasyptEncrypt(encryptUrl3));*/
|
||||
|
||||
|
||||
String username3 = "etribe";
|
||||
String encryptUsername3 = jasyptEncryptPrd(username3);
|
||||
String encryptUsername3 = jasyptEncrypt(username3);
|
||||
|
||||
System.out.println("encryptUsername3 : " + encryptUsername3);
|
||||
Assertions.assertThat(username3).isEqualTo(jasyptDecrytPrd(encryptUsername3));
|
||||
/* Assertions.assertThat(username3).isEqualTo(jasyptEncrypt(encryptUsername3));*/
|
||||
|
||||
|
||||
String password3 = "Etribe@3415";
|
||||
String encryptPassword3 = jasyptEncryptPrd(password3);
|
||||
String encryptPassword3 = jasyptEncrypt(password3);
|
||||
System.out.println("encryptPassword3 : " + encryptPassword3);
|
||||
|
||||
}
|
||||
|
||||
@@ -272,36 +272,6 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
// 커뮤니케이션 메뉴 끝
|
||||
|
||||
|
||||
// 분석 메뉴 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_ANALYSIS,
|
||||
ADMIN_ANALYSIS_OPERATION_LOG,
|
||||
"Operation Log (수행로그)",
|
||||
"/analysis/operationlog",
|
||||
true,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_ANALYSIS,
|
||||
ADMIN_ANALYSIS_OPERATION_LOG_UPDATE,
|
||||
"수행로그 상세",
|
||||
"/analysis/operationlog/{{pathVar}}",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_ANALYSIS_OPERATION_LOG,
|
||||
ADMIN_ANALYSIS_OPERATION_LOG_EXCEL,
|
||||
"수행로그 Excel",
|
||||
"/analysis/operationlog/excel",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
// 분석 메뉴 끝
|
||||
|
||||
|
||||
// 관리자 시작
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
@@ -330,15 +300,6 @@ public class InitUriAdminData implements ApplicationRunner {
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_SETTINGS_ADMIN,
|
||||
ADMIN_SETTINGS_ADMIN_DELETE,
|
||||
"관리자 삭제",
|
||||
"/settings/admins/delete",
|
||||
false,
|
||||
Set.of("ROLE_ADMIN"));
|
||||
|
||||
appendURI(
|
||||
AppType.ADMIN,
|
||||
ADMIN_SETTINGS_ADMIN,
|
||||
|
||||
@@ -91,7 +91,10 @@ public class DailyUtil {
|
||||
* @return true=수정 가능, false=수정 불가
|
||||
*/
|
||||
public boolean isModifiable(LocalDate startDate, LocalDate endDate) {
|
||||
LocalDate limitStart = LocalDate.now().minusDays(DailyRecordConstants.MODIFIY_LIMIT_DAY);
|
||||
LocalDate today = LocalDate.now();
|
||||
boolean isModifyPeriod = today.getDayOfMonth() <= DailyRecordConstants.MODIFY_LIMIT_DAY;
|
||||
|
||||
LocalDate limitStart = isModifyPeriod? today.minusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH).withDayOfMonth(1):today.minusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH-1).withDayOfMonth(1);
|
||||
|
||||
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate) || limitStart.isEqual(endDate));
|
||||
}
|
||||
@@ -104,11 +107,27 @@ public class DailyUtil {
|
||||
* @return true=등록 가능, false=등록 불가
|
||||
*/
|
||||
public boolean isRegisterPossible(LocalDate startDate, LocalDate endDate) {
|
||||
LocalDate limitStart = LocalDate.now().minusDays(DailyRecordConstants.REGISTER_LIMIT_DAY);
|
||||
LocalDate today = LocalDate.now();
|
||||
boolean isModifyPeriod = today.getDayOfMonth() <= DailyRecordConstants.REGISTER_LIMIT_DAY;
|
||||
|
||||
LocalDate limitStart = isModifyPeriod? today.minusMonths(DailyRecordConstants.REGISTER_LIMIT_MONTH).withDayOfMonth(1):today.minusMonths(DailyRecordConstants.REGISTER_LIMIT_MONTH-1).withDayOfMonth(1);
|
||||
|
||||
return (limitStart.isBefore(startDate) || limitStart.isEqual(startDate) || limitStart.isEqual(endDate));
|
||||
}
|
||||
|
||||
/**
|
||||
* 오늘 날짜 기준으로 등록/수정 가능한 날짜 가져오기
|
||||
*
|
||||
*/
|
||||
public LocalDate getLimitDate(){
|
||||
LocalDate today = LocalDate.now();
|
||||
boolean isModifyPeriod = today.getDayOfMonth() <= DailyRecordConstants.REGISTER_LIMIT_DAY;
|
||||
|
||||
return isModifyPeriod? today.minusMonths(DailyRecordConstants.REGISTER_LIMIT_MONTH).withDayOfMonth(1):today.minusMonths(DailyRecordConstants.REGISTER_LIMIT_MONTH-1).withDayOfMonth(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 문자형 타입의 숫자에 콤마 적용
|
||||
*
|
||||
|
||||
@@ -36,4 +36,15 @@ public final class CommonConstants {
|
||||
* 관리자 비밀번호 유효성 실패 메시지
|
||||
*/
|
||||
public static final String ADMIN_PASSWORD_MSG = "비밀번호는 5자, 숫자 + 특수문자(!@#$%_-) 1개 이상입니다.";
|
||||
|
||||
/**
|
||||
* Validator NotBlank errorCode
|
||||
*/
|
||||
public static final String VALID_CODE_NOTBLANK = "valid.common.required";
|
||||
|
||||
/**
|
||||
* 핸드폰 번호 규칙
|
||||
*/
|
||||
public static final String PHONE_REGEX = "^01([0|1|6|7|8|9])-?([0-9]{3,4})-?([0-9]{4})$";
|
||||
|
||||
}
|
||||
|
||||
@@ -36,14 +36,33 @@ public final class DailyRecordConstants {
|
||||
public static final String FORESTRY_EXPENSE_MARK = "81011";
|
||||
|
||||
/**
|
||||
* 일계부 등록 가능 일
|
||||
* [정책] 15일전까지 데이터 등록 가능
|
||||
* 일계부 등록 가능 월
|
||||
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
||||
* 이전 달을 의미하는 상수
|
||||
*/
|
||||
public static final int REGISTER_LIMIT_DAY = 15;
|
||||
public static final int REGISTER_LIMIT_MONTH = 1;
|
||||
|
||||
/**
|
||||
* 일계부 등록 가능 일
|
||||
* [정책] 해당월 15일까지는 이전달 데이터 등록 가능
|
||||
* 날짜 기준 정책
|
||||
* TODO 15로 변경
|
||||
*/
|
||||
public static final int REGISTER_LIMIT_DAY = 31;
|
||||
|
||||
/**
|
||||
* 일계부 수정 가능 월
|
||||
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
||||
* 이전 달을 의미하는 상수
|
||||
*/
|
||||
public static final int MODIFY_LIMIT_MONTH = 1;
|
||||
|
||||
/**
|
||||
* 일계부 수정 가능 일
|
||||
* [정책] 15일전까지 데이터 수정 가능
|
||||
* [정책] 해당월 15일까지는 이전달 데이터 수정 가능
|
||||
* 날짜 기준 정책
|
||||
* TODO : 15로 변경
|
||||
*/
|
||||
public static final int MODIFIY_LIMIT_DAY = 15;
|
||||
public static final int MODIFY_LIMIT_DAY = 31;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import app.module.core.config.application.util.CommonUtil;
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import app.module.core.usecase.admin.checkAdminId.persistence.CheckAdminIdMapper;
|
||||
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelAdminCreateVO;
|
||||
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelResultVO;
|
||||
@@ -13,6 +15,7 @@ import app.module.core.usecase.uicode.list.adapters.persistence.UICodeListMapper
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -21,11 +24,14 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(ExcelSaveAdminIdDao.class));
|
||||
|
||||
@Value("${spring.profiles.active}")
|
||||
private String activeProfiles;
|
||||
|
||||
@@ -42,6 +48,8 @@ class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
Integer success = 0;
|
||||
List<UICodeElement> uiCodeElementList = uiCodeListMapper.findByParentId("code.region.main", CommonUtil.getLoginUserRole(),activeProfiles);
|
||||
List<String> errorList = new ArrayList<>();
|
||||
|
||||
// 첫 번째 행은 헤더로 간주하고 스킵
|
||||
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
|
||||
Row row = sheet.getRow(i);
|
||||
@@ -57,7 +65,14 @@ class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
|
||||
Integer duplicate = checkAdminIdMapper.checkAdminId(admin.getId());
|
||||
|
||||
if(duplicate == 0) {
|
||||
if(duplicate == 0
|
||||
&& !admin.getId().isEmpty()
|
||||
&& admin.getId().matches(CommonConstants.ADMIN_ID_REGEX)
|
||||
&& !admin.getRoleId().isEmpty()
|
||||
&& !admin.getPassword().isEmpty()
|
||||
&& admin.getPassword().matches(CommonConstants.ADMIN_PASSWORD_REGEX)
|
||||
&& !admin.getPhone().isEmpty()
|
||||
&& admin.getPhone().matches(CommonConstants.PHONE_REGEX) ) {
|
||||
SaveAdminCmd cmd = new SaveAdminCmd(
|
||||
null,
|
||||
admin.getId(),
|
||||
@@ -76,6 +91,18 @@ class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
saveAdminMapper.insertAdminHasRoles(
|
||||
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), admin.getRoleId())));
|
||||
}
|
||||
}else{
|
||||
errorList.add(admin.getId());
|
||||
safeLogger.warn(
|
||||
"[EXCEL 누락] 관리자 아이디={} 필수 필드 누락: duplicate={}, role={}, name={}, password={}, regionMainCode={}, phone={} ",
|
||||
admin.getId(),
|
||||
duplicate == 0,
|
||||
admin.getRoleId(),
|
||||
admin.getName(),
|
||||
admin.getPassword(),
|
||||
admin.getRegionMainCode(),
|
||||
admin.getPhone()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +126,7 @@ class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
case "관리자" -> "ROLE_ADMIN";
|
||||
case "지방실사" -> "ROLE_LOCAL_INSPECTOR";
|
||||
case "조사원" -> "ROLE_RESEARCHER";
|
||||
default -> "";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,7 +135,7 @@ class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||
|
||||
return uiCodeElementList.stream().filter(code -> code.getCodeText().equals(cell.getStringCellValue().trim()))
|
||||
.findFirst()
|
||||
.map(UICodeElement::getId).orElse("");
|
||||
.map(UICodeElement::getId).orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortOut;
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -15,7 +14,6 @@ class UICodeListService implements UICodeListPortIn {
|
||||
|
||||
private final UICodeListPortOut uiCodeListPortOut;
|
||||
|
||||
@Cacheable("ChildUICodesByParentIdCache")
|
||||
@Override
|
||||
public List<UICodeElement> connect(String parentId) {
|
||||
return uiCodeListPortOut.connect(parentId);
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
AND dr.day_group_no = g.day_group_no
|
||||
LEFT JOIN daily_day_group ddg
|
||||
ON ddg.group_no = g.day_group_no
|
||||
WHERE dr.all_status != 'DONE' OR dr.id is null
|
||||
WHERE dr.all_status not in('DONE','TODAY_NONE') OR dr.id is null
|
||||
ORDER BY g.day_group_no
|
||||
</select>
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
#{parentId},
|
||||
#{orderNo},
|
||||
#{codeText},
|
||||
#{codeType},
|
||||
#{codeValue},
|
||||
#{codeType},
|
||||
#{msgCode},
|
||||
#{inUse},
|
||||
<include refid="common.fields.CreateUpdateBaseValues"/>)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
FROM uicode
|
||||
WHERE id = #{id}
|
||||
AND is_deleted = false
|
||||
ORDER BY order_no ASC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -73,6 +73,20 @@ DROP TABLE IF EXISTS article ;
|
||||
|
||||
DROP SEQUENCE IF EXISTS article_comment_seq ;
|
||||
|
||||
-- 미사용 테이블 삭제
|
||||
drop table IF EXISTS address;
|
||||
drop sequence IF EXISTS address_seq;
|
||||
drop table IF EXISTS notice_has_upload_file ;
|
||||
drop table IF EXISTS operation_log ;
|
||||
drop sequence IF EXISTS operation_log_seq;
|
||||
drop table IF EXISTS researcher_has_area ;
|
||||
drop sequence IF EXISTS researcher_has_area_seq;
|
||||
drop table IF EXISTS research_area ;
|
||||
drop sequence IF EXISTS research_area_seq;
|
||||
drop table IF EXISTS upload_receipt_files ;
|
||||
drop sequence IF EXISTS upload_receipt_files_seq;
|
||||
|
||||
|
||||
delete from uri_has_role where uri_id in (
|
||||
'uri.admin.board.article.excel',
|
||||
'uri.admin.board.article.delete',
|
||||
@@ -401,6 +415,7 @@ CREATE TABLE batch_log (
|
||||
end_at TIMESTAMP,
|
||||
error_message VARCHAR(2000),
|
||||
created_at TIMESTAMP DEFAULT now(),
|
||||
created_ip VARCHAR(50),
|
||||
|
||||
CONSTRAINT batch_log_pkey PRIMARY KEY (id)
|
||||
);
|
||||
@@ -412,6 +427,27 @@ COMMENT ON COLUMN batch_log.start_at IS '배치 시작 시간';
|
||||
COMMENT ON COLUMN batch_log.end_at IS '배치 종료 시간';
|
||||
COMMENT ON COLUMN batch_log.error_message IS '에러 메시지 (실패한 경우)';
|
||||
COMMENT ON COLUMN batch_log.created_at IS '생성일';
|
||||
COMMENT ON COLUMN batch_log.created_ip IS '생성 IP';
|
||||
|
||||
|
||||
|
||||
-- ====================================================================================================================
|
||||
-- 배치 실행 여부
|
||||
-- ====================================================================================================================
|
||||
CREATE TABLE batch_check (
|
||||
type VARCHAR(50) NOT NULL,
|
||||
run_date DATE NOT NULL,
|
||||
created_ip VARCHAR(50) NOT NULL,
|
||||
created_at TIMESTAMP DEFAULT now(),
|
||||
PRIMARY KEY (type, run_date)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE batch_check IS '배치 실행 여부 테이블';
|
||||
|
||||
COMMENT ON COLUMN batch_check.type IS '배치 타입';
|
||||
COMMENT ON COLUMN batch_check.run_date IS '배치 실행 날짜';
|
||||
COMMENT ON COLUMN batch_check.created_ip IS '실행 IP';
|
||||
COMMENT ON COLUMN batch_check.created_at IS '생성일';
|
||||
|
||||
|
||||
|
||||
@@ -576,7 +612,7 @@ as WITH param_matrix AS (
|
||||
SELECT p.household_seq,
|
||||
p.record_month,
|
||||
count(*) AS total_day_groups,
|
||||
case when to_char(CURRENT_DATE,'YYYYMM')::text = p.record_month then sum(case when to_char(CURRENT_DATE,'dd')::integer >= g.start_day then 1 else 0 end)else count(*) end as current_day_groups
|
||||
case when to_char(CURRENT_DATE,'YYYYMM')::text = p.record_month then sum(case when to_char(CURRENT_DATE,'dd')::integer >= g.start_day then 1 else 0 end) else count(*) end as current_day_groups
|
||||
FROM param_matrix p
|
||||
JOIN daily_day_group g ON g.start_day <= p.last_day
|
||||
GROUP BY p.household_seq, p.record_month;
|
||||
@@ -792,4 +828,9 @@ SELECT setval('suggestion_seq', (SELECT COALESCE(MAX(id), 0) FROM
|
||||
SELECT setval('term_agreement_seq', (SELECT COALESCE(MAX(id), 0) FROM term_agreement));
|
||||
SELECT setval('upload_file_seq', (SELECT COALESCE(MAX(id), 0) FROM upload_file));
|
||||
SELECT setval('upload_receipt_files_seq', (SELECT COALESCE(MAX(id), 0) FROM upload_receipt_files));
|
||||
SELECT setval('uri_has_role_seq', (SELECT COALESCE(MAX(id), 0) FROM uri_has_role));
|
||||
SELECT setval('uri_has_role_seq', (SELECT COALESCE(MAX(id), 0) FROM uri_has_role));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ public class FrontURIInterceptor implements HandlerInterceptor {
|
||||
private final URIAncestryPortIn uriAncestryPortIn;
|
||||
private final URITopTierPortIn topTierPortIn;
|
||||
|
||||
/**
|
||||
* AttributeName: currentURI
|
||||
*/
|
||||
private static final String ATTR_NAME_URI = "currentURI";
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
|
||||
Object handler)
|
||||
@@ -47,7 +52,7 @@ public class FrontURIInterceptor implements HandlerInterceptor {
|
||||
throw new NoMatchingURIException(String.format("매핑되는 않은 URI - %s", requestURI));
|
||||
}
|
||||
|
||||
request.setAttribute("currentURI", currentURI);
|
||||
request.setAttribute(ATTR_NAME_URI, currentURI);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -69,8 +74,8 @@ public class FrontURIInterceptor implements HandlerInterceptor {
|
||||
URITopTier topTierOutput = topTierPortIn.connect(AppType.FRONT);
|
||||
modelAndView.addObject("topNode", recursiveMapping(topTierOutput));
|
||||
|
||||
if (modelAndView.getModelMap().getAttribute("currentURI") == null) {
|
||||
modelAndView.addObject("currentURI", request.getAttribute("currentURI"));
|
||||
if (modelAndView.getModelMap().getAttribute(ATTR_NAME_URI) == null) {
|
||||
modelAndView.addObject(ATTR_NAME_URI, request.getAttribute(ATTR_NAME_URI));
|
||||
}
|
||||
|
||||
modelAndView.addObject(
|
||||
@@ -86,6 +91,6 @@ public class FrontURIInterceptor implements HandlerInterceptor {
|
||||
output.getShowOnNavi(),
|
||||
CollectionUtils.emptyIfNull(output.getChildren()).stream()
|
||||
.map(this::recursiveMapping)
|
||||
.collect(Collectors.toList()));
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class FrontDetailService implements UserDetailsService {
|
||||
private Collection<? extends GrantedAuthority> getAuthorities(Collection<CoreRole> roles) {
|
||||
return Stream.concat(getRoles(roles), getPrivileges(roles))
|
||||
.map(SimpleGrantedAuthority::new)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private Stream<String> getRoles(Collection<CoreRole> roles) {
|
||||
@@ -70,17 +70,4 @@ public class FrontDetailService implements UserDetailsService {
|
||||
.flatMap(roleOutput -> roleOutput.getPrivileges().stream())
|
||||
.map(CorePrivilege::getId);
|
||||
}
|
||||
|
||||
// 패스워드 만료 여부체크. 이 기능이 필요하지 않다면 항상 true 를 반환하도록 변경하면 된다.
|
||||
private boolean isCredentialsNonExpired(LocalDateTime passwordUpdatedAt) {
|
||||
// return passwordValidPeriodDays == -1
|
||||
// || getDaysPassedFrom(passwordUpdatedAt) <= passwordValidPeriodDays;
|
||||
return true;
|
||||
}
|
||||
|
||||
// 패스워드 만료일 정보를 반환. 이 기능이 필요하지 않다면 항상 0L 을 반환하도록 변경하면 된다.
|
||||
private long getDaysPassedFrom(LocalDateTime passwordUpdatedAt) {
|
||||
// return Duration.between(passwordUpdatedAt, LocalDateTime.now()).toDays();
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,19 +8,22 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AuthUtil {
|
||||
public static Long getUserSeq() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null) {
|
||||
return null;
|
||||
private AuthUtil() {
|
||||
}
|
||||
|
||||
Object principal = authentication.getPrincipal();
|
||||
Long userseq = null;
|
||||
public static Long getUserSeq() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (principal instanceof UserDetails) {
|
||||
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||
Object principal = authentication.getPrincipal();
|
||||
Long userseq = null;
|
||||
|
||||
if (principal instanceof UserDetails) {
|
||||
userseq = ((FrontHouseholdUser) principal).getHouseholdSeq();
|
||||
}
|
||||
|
||||
return userseq;
|
||||
}
|
||||
|
||||
return userseq;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.YearMonth;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -48,12 +49,17 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
monthlyStatus.isForestNone() ? 0 : 1,
|
||||
monthlyStatus.isForestNone() ? "/info/monthly" : String.format("/info/monthly/month/%s", command.getSearchMonth())));
|
||||
|
||||
YearMonth yearMonth = YearMonth.parse(command.getSearchMonth(), DateTimeFormatter.ofPattern("yyyyMM"));
|
||||
LocalDate maxMonth = DailyRecordConstants.MODIFY_LIMIT_DAY == 31 ?
|
||||
yearMonth.plusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH).atEndOfMonth() : yearMonth.plusMonths(DailyRecordConstants.MODIFY_LIMIT_MONTH).atDay(DailyRecordConstants.MODIFY_LIMIT_DAY);
|
||||
boolean editable = !LocalDate.now().isAfter(maxMonth);
|
||||
|
||||
monthlyList.add(new CalendarChildren(
|
||||
"BANK",
|
||||
"은행 자동이체 내역 등록",
|
||||
null,
|
||||
monthlyStatus.isBankNone() ? 0 : 1,
|
||||
(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM")).equals(command.getSearchMonth())) ? "/info/bank" : null));
|
||||
editable ? String.format("/info/bank/%s", command.getSearchMonth()) : null));
|
||||
|
||||
List<RecordCalendar> refineList = new ArrayList<>();
|
||||
for (DailyRecordCalendarDto calendar : calendarList) {
|
||||
@@ -156,10 +162,8 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
|
||||
@Override
|
||||
public int getDataNoneCountBySomeDayAfter(Long householdSeq) {
|
||||
// 검색 당일을 제외하여 -1 처리
|
||||
int limitDay = DailyRecordConstants.REGISTER_LIMIT_DAY - 1;
|
||||
|
||||
return recordCalendarMapper.getDataNoneCountBySomeDayAfter(householdSeq, limitDay);
|
||||
LocalDate limitDate = dailyUtil.getLimitDate();
|
||||
return recordCalendarMapper.getDataNoneCountBySomeDayAfter(householdSeq, limitDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,6 +7,7 @@ import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCa
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@@ -38,10 +39,10 @@ public interface RecordCalendarMapper {
|
||||
* 등록가능 기간에 미등록된 데이터 개수 조회
|
||||
*
|
||||
* @param householdSeq 임가회원 일련번호
|
||||
* @param limitDay 전일로부터 x일전 검색 일
|
||||
* @param limitDate 입력 가능한 최소 날짜
|
||||
* @return 미등록 건 수
|
||||
*/
|
||||
Integer getDataNoneCountBySomeDayAfter(@Param("householdSeq") Long householdSeq, @Param("limitDay") Integer limitDay);
|
||||
Integer getDataNoneCountBySomeDayAfter(@Param("householdSeq") Long householdSeq, @Param("limitDate") LocalDate limitDate);
|
||||
|
||||
/**
|
||||
* 최신 등록일 데이터 조회
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.expense.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/expense")
|
||||
public class DailyExpenseController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyExpenseController.class));
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
@@ -52,7 +55,7 @@ public class DailyExpenseController {
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("createFormVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.create(formVO);
|
||||
|
||||
@@ -71,7 +74,7 @@ public class DailyExpenseController {
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyExpenseReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
log.debug("before formVO: {}", formVO);
|
||||
safeLogger.debug("before formVO: {}", formVO);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
@@ -82,7 +85,7 @@ public class DailyExpenseController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeFormVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.remove(formVO);
|
||||
|
||||
@@ -104,7 +107,7 @@ public class DailyExpenseController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeAllFormVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.remove(formVO);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class DailyExpenseController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.expense.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.expense.adapters.web.model.DailyExpenseUIR
|
||||
import app.module.front.usecase.daily.expense.ports.DailyExpensePortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/expense")
|
||||
public class DailyExpenseUIController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyExpenseUIController.class));
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyExpensePortIn dailyExpensePortIn;
|
||||
@@ -48,7 +51,7 @@ public class DailyExpenseUIController {
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
|
||||
|
||||
DailyExpenseUIReqVO reqVO = new DailyExpenseUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyExpenseDto> expenseList = dailyExpensePortIn.list(reqVO);
|
||||
|
||||
@@ -79,7 +82,7 @@ public class DailyExpenseUIController {
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyExpenseDto detail = new DailyExpenseDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
@@ -106,7 +109,7 @@ public class DailyExpenseUIController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -23,28 +23,28 @@ public class CreateDailyExpenseValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"price", "valid.common.required",
|
||||
"price", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.farming.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.farming.ports.application.DailyFarmingServ
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/farming")
|
||||
public class DailyFarmingController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyFarmingController.class));
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyFarmingService dailyFarmingPortIn;
|
||||
@@ -52,7 +55,7 @@ public class DailyFarmingController {
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("createFormVO: {}", formVO);
|
||||
|
||||
dailyFarmingPortIn.create(formVO);
|
||||
|
||||
@@ -71,7 +74,7 @@ public class DailyFarmingController {
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyFarmingReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
log.debug("before formVO: {}", formVO);
|
||||
safeLogger.debug("before formVO: {}", formVO);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
@@ -82,7 +85,7 @@ public class DailyFarmingController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeFormVO: {}", formVO);
|
||||
|
||||
dailyFarmingPortIn.remove(formVO);
|
||||
|
||||
@@ -104,7 +107,7 @@ public class DailyFarmingController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeAllFormVO: {}", formVO);
|
||||
|
||||
dailyFarmingPortIn.remove(formVO);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class DailyFarmingController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.farming.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.farming.adapters.web.model.DailyFarmingUIR
|
||||
import app.module.front.usecase.daily.farming.ports.application.DailyFarmingService;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/farming")
|
||||
public class DailyFarmingUIController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyFarmingUIController.class));
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyFarmingService dailyFarmingPortIn;
|
||||
@@ -48,7 +51,7 @@ public class DailyFarmingUIController {
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
|
||||
|
||||
DailyFarmingUIReqVO reqVO = new DailyFarmingUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyFarmingDto> farmingList = dailyFarmingPortIn.list(reqVO);
|
||||
|
||||
@@ -79,7 +82,7 @@ public class DailyFarmingUIController {
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyFarmingDto detail = new DailyFarmingDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
@@ -106,7 +109,7 @@ public class DailyFarmingUIController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -23,31 +23,31 @@ public class CreateDailyFarmingValidator implements Validator {
|
||||
|
||||
if ("code.record.farming.self".equals(vo.getProductCode()) && StringUtils.isBlank(vo.getProductSelf())) {
|
||||
errors.rejectValue(
|
||||
"productSelf", "valid.common.required",
|
||||
"productSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"생산물을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.forestry.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.forestry.ports.DailyForestryPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/forestry")
|
||||
public class DailyForestryController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyForestryController.class));
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordService;
|
||||
private final DailyForestryPortIn dailyForestryPortIn;
|
||||
@@ -52,7 +55,7 @@ public class DailyForestryController {
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("createFormVO: {}", formVO);
|
||||
|
||||
dailyForestryPortIn.create(formVO);
|
||||
|
||||
@@ -71,7 +74,7 @@ public class DailyForestryController {
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyForestryReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
log.debug("before formVO: {}", formVO);
|
||||
safeLogger.debug("before formVO: {}", formVO);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
@@ -82,7 +85,7 @@ public class DailyForestryController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeFormVO: {}", formVO);
|
||||
|
||||
dailyForestryPortIn.remove(formVO);
|
||||
|
||||
@@ -104,7 +107,7 @@ public class DailyForestryController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeAllFormVO: {}", formVO);
|
||||
|
||||
dailyForestryPortIn.remove(formVO);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class DailyForestryController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordService.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.forestry.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
@@ -10,7 +11,8 @@ import app.module.front.usecase.daily.forestry.adapters.web.model.DailyForestryU
|
||||
import app.module.front.usecase.daily.forestry.ports.DailyForestryPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -22,11 +24,12 @@ import org.thymeleaf.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/forestry")
|
||||
public class DailyForestryUIController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyForestryUIController.class));
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyForestryPortIn dailyForestryPortIn;
|
||||
@@ -48,7 +51,7 @@ public class DailyForestryUIController {
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
|
||||
|
||||
DailyForestryUIReqVO reqVO = new DailyForestryUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyForestryDto> forestryList = dailyForestryPortIn.list(reqVO);
|
||||
|
||||
@@ -79,7 +82,7 @@ public class DailyForestryUIController {
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyForestryDto detail = new DailyForestryDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
@@ -106,7 +109,7 @@ public class DailyForestryUIController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -23,25 +23,25 @@ public class CreateDailyForestryValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class DailyForestryService implements DailyForestryPortIn {
|
||||
|
||||
@Override
|
||||
public List<DailyForestryDto> list(DailyForestryUIReqVO reqVO) {
|
||||
return this.getRefineList(reqVO, false);
|
||||
return this.getRefineList(reqVO, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.income.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/income")
|
||||
public class DailyIncomeController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyIncomeController.class));
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
@@ -52,7 +55,7 @@ public class DailyIncomeController {
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("createFormVO: {}", formVO);
|
||||
|
||||
dailyIncomePortIn.create(formVO);
|
||||
|
||||
@@ -71,7 +74,7 @@ public class DailyIncomeController {
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyIncomeReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
log.debug("before formVO: {}", formVO);
|
||||
safeLogger.debug("before formVO: {}", formVO);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
@@ -82,7 +85,7 @@ public class DailyIncomeController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeFormVO: {}", formVO);
|
||||
|
||||
dailyIncomePortIn.remove(formVO);
|
||||
|
||||
@@ -104,7 +107,7 @@ public class DailyIncomeController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeAllFormVO: {}", formVO);
|
||||
|
||||
dailyIncomePortIn.remove(formVO);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class DailyIncomeController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.income.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||
@@ -10,8 +11,9 @@ import app.module.front.usecase.daily.income.adapters.web.model.DailyIncomeUIReq
|
||||
import app.module.front.usecase.daily.income.ports.DailyIncomePortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -22,11 +24,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/income")
|
||||
public class DailyIncomeUIController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyIncomeUIController.class));
|
||||
|
||||
private final UICodeListPortIn uiCodeListPortIn;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyIncomePortIn dailyIncomePortIn;
|
||||
@@ -48,7 +51,7 @@ public class DailyIncomeUIController {
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
|
||||
|
||||
DailyIncomeUIReqVO reqVO = new DailyIncomeUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyIncomeDto> incomeList = dailyIncomePortIn.list(reqVO);
|
||||
|
||||
@@ -80,7 +83,7 @@ public class DailyIncomeUIController {
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyIncomeDto detail = new DailyIncomeDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
@@ -107,7 +110,7 @@ public class DailyIncomeUIController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -23,28 +23,28 @@ public class CreateDailyIncomeValidator implements Validator {
|
||||
|
||||
if (vo.getQuantity() == null && !StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"quantity", "valid.common.required",
|
||||
"quantity", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"수량을 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getQuantity() != null && StringUtils.isBlank(vo.getUnitCode())) {
|
||||
errors.rejectValue(
|
||||
"unitCode", "valid.common.required",
|
||||
"unitCode", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 선택해 주세요.");
|
||||
}
|
||||
|
||||
if (CommonConstants.UNIT_CODE_SELF.equals(vo.getUnitCode()) && StringUtils.isBlank(vo.getUnitSelf())) {
|
||||
errors.rejectValue(
|
||||
"unitSelf", "valid.common.required",
|
||||
"unitSelf", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"단위를 입력해 주세요.");
|
||||
}
|
||||
|
||||
if (vo.getPrice() == null && vo.getEstimatedValue() == null) {
|
||||
errors.rejectValue(
|
||||
"price", "valid.common.required",
|
||||
"price", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"estimatedValue", "valid.common.required",
|
||||
"estimatedValue", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"현금 또는 현물평가액을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package app.module.front.usecase.daily.power.adapters.web;
|
||||
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.config.application.util.CoreUtil;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
@@ -11,17 +12,19 @@ import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/record/power")
|
||||
public class DailyPowerController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyPowerController.class));
|
||||
|
||||
private final CoreUtil coreUtil;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyPowerPortIn dailyPowerPortIn;
|
||||
@@ -52,7 +55,7 @@ public class DailyPowerController {
|
||||
formVO.setGroupNo(Integer.parseInt(groupNo));
|
||||
formVO.setId(Long.parseLong(id));
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("createFormVO: {}", formVO);
|
||||
|
||||
dailyPowerPortIn.create(formVO);
|
||||
|
||||
@@ -71,7 +74,7 @@ public class DailyPowerController {
|
||||
ResponseEntity<?> remove(@PathVariable("searchMonth") String searchMonth, @PathVariable("groupNo") String groupNo
|
||||
, @Valid @RequestBody RemoveDailyPowerReqVO formVO, BindingResult bindingResult) {
|
||||
|
||||
log.debug("before formVO: {}", formVO);
|
||||
safeLogger.debug("before formVO: {}", formVO);
|
||||
if (bindingResult.hasErrors()) {
|
||||
return ResponseEntity.status(HttpStatus.UNPROCESSABLE_ENTITY)
|
||||
.body(bindingResult.getFieldErrors());
|
||||
@@ -82,7 +85,7 @@ public class DailyPowerController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeFormVO: {}", formVO);
|
||||
|
||||
dailyPowerPortIn.remove(formVO);
|
||||
|
||||
@@ -104,7 +107,7 @@ public class DailyPowerController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyRecordSeq(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
safeLogger.debug("removeAllFormVO: {}", formVO);
|
||||
|
||||
dailyPowerPortIn.remove(formVO);
|
||||
|
||||
@@ -119,7 +122,7 @@ public class DailyPowerController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.power.adapters.web;
|
||||
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.exception.NoRecordDataException;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import app.module.front.usecase.daily.power.adapters.persistence.model.DailyPowerDto;
|
||||
@@ -9,7 +10,8 @@ import app.module.front.usecase.daily.power.adapters.web.model.DailyPowerUIReqVO
|
||||
import app.module.front.usecase.daily.power.ports.DailyPowerPortIn;
|
||||
import app.module.front.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -21,11 +23,12 @@ import org.thymeleaf.util.StringUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/record/power")
|
||||
public class DailyPowerUIController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(DailyPowerUIController.class));
|
||||
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
private final DailyPowerPortIn dailyPowerPortIn;
|
||||
|
||||
@@ -46,7 +49,7 @@ public class DailyPowerUIController {
|
||||
DailyRecordDto dailyRecord = this.vaildGetDailyRecord(searchMonth, groupNo, targetList);
|
||||
|
||||
DailyPowerUIReqVO reqVO = new DailyPowerUIReqVO(searchMonth, groupNo);
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
List<DailyPowerDto> powerList = dailyPowerPortIn.list(reqVO);
|
||||
|
||||
@@ -77,7 +80,7 @@ public class DailyPowerUIController {
|
||||
} else {
|
||||
reqVO.setId(Long.parseLong(id));
|
||||
}
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyPowerDto detail = new DailyPowerDto();
|
||||
if (reqVO.getId() != 0L) {
|
||||
@@ -101,7 +104,7 @@ public class DailyPowerUIController {
|
||||
*/
|
||||
private DailyRecordDto vaildGetDailyRecord(String searchMonth, String groupNo, String targetList) {
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(searchMonth, groupNo);
|
||||
log.debug("getRecordUIReq: {}", reqVO);
|
||||
safeLogger.debug("getRecordUIReq: {}", reqVO);
|
||||
|
||||
DailyRecordDto dailyRecord = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
if (dailyRecord == null || dailyRecord.getId() == null) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.front.usecase.daily.power.adapters.web.validator;
|
||||
|
||||
import app.module.core.config.constants.CommonConstants;
|
||||
import app.module.front.usecase.daily.power.adapters.web.model.CreateDailyPowerReqVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -21,10 +22,10 @@ public class CreateDailyPowerValidator implements Validator {
|
||||
|
||||
if (vo.getOwnedHours() == null && vo.getLeasedHours() == null) {
|
||||
errors.rejectValue(
|
||||
"ownedHours", "valid.common.required",
|
||||
"ownedHours", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||
errors.rejectValue(
|
||||
"leasedHours", "valid.common.required",
|
||||
"leasedHours", CommonConstants.VALID_CODE_NOTBLANK,
|
||||
"자가 사용시간 또는 임차 사용시간을 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user