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);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user