[FindBugs] CRLF_INJECTION_LOGS - SafeLogger 추가 또는 log.debug 삭제
This commit is contained in:
@@ -2,20 +2,23 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class BatchLogRunner {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(BatchLogRunner.class));
|
||||
|
||||
private final BatchLogPortIn batchLogPortIn;
|
||||
|
||||
public void run(BatchLogType batchType, Runnable action) {
|
||||
// 이미 실행 중인지 확인
|
||||
if (batchLogPortIn.exists(batchType)) {
|
||||
log.warn("[{}] 배치가 이미 실행 중 입니다.", batchType.name());
|
||||
safeLogger.warn("[{}] 배치가 이미 실행 중 입니다.", batchType.name());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,7 +32,7 @@ public class BatchLogRunner {
|
||||
} catch (Exception e) {
|
||||
// 실패 처리
|
||||
batchLogPortIn.update(logId, "FAIL", e.getMessage());
|
||||
log.error("[{}] 배치 실패: {}", batchType.name(), e.getMessage(), e);
|
||||
safeLogger.error("[{}] 배치 실패: {}", batchType.name(), e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,8 +12,10 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.event.EventListener;
|
||||
import org.springframework.security.authentication.event.AbstractAuthenticationFailureEvent;
|
||||
@@ -25,8 +27,8 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AdminAuthSuccessEvent {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(AdminAuthSuccessEvent.class));
|
||||
|
||||
private final MessageUtil messageUtil;
|
||||
private final AdminViewPortIn adminViewPortIn;
|
||||
@@ -85,6 +87,6 @@ public class AdminAuthSuccessEvent {
|
||||
public void handleAuthenticationFailureEvent(AbstractAuthenticationFailureEvent event) {
|
||||
Exception e = event.getException();
|
||||
Authentication authentication = event.getAuthentication();
|
||||
log.warn("Unsuccessful authentication result: {}", authentication, e);
|
||||
safeLogger.warn("Unsuccessful authentication result: {}", authentication, e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import app.module.admin.usecase.dashboard.updateSmsAutoStatus.ports.application.
|
||||
import app.module.core.config.application.util.MessageUtil;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
@@ -15,11 +14,10 @@ import org.springframework.validation.BindingResult;
|
||||
import app.module.admin.usecase.dashboard.updateSmsAutoStatus.adapters.web.model.UpdateSmsAutoStatusReqVO;
|
||||
import app.module.admin.usecase.dashboard.updateSmsAutoStatus.adapters.web.model.UpdateSmsAutoStatusResVO;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class UpdateSmsAutoStatusController {
|
||||
private final UpdateSmsAutoStatusPortIn portIn;
|
||||
private final UpdateSmsAutoStatusPortIn portIn;
|
||||
private final MessageUtil messageUtil;
|
||||
|
||||
@PatchMapping(path = "/api/smsAutoStatus/update")
|
||||
@@ -35,7 +33,6 @@ class UpdateSmsAutoStatusController {
|
||||
portIn.operate(new UpdateSmsAutoStatusCmd(reqVO.getActive()));
|
||||
} catch (Exception e) {
|
||||
// update 실패
|
||||
log.info(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,18 +8,20 @@ import app.module.admin.usecase.household.createHousehold.ports.CreateHouseholdP
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdInCmd;
|
||||
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdOutCmd;
|
||||
import app.module.admin.usecase.schedule.autoSchedules.ports.AutoSchedulesPortIn;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
class CreateHouseholdService implements CreateHouseholdPortIn {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(CreateHouseholdService.class));
|
||||
|
||||
private final CreateHouseholdPortOut portOut;
|
||||
private final BCryptPasswordEncoder passwordEncoder;
|
||||
@@ -72,8 +74,7 @@ class CreateHouseholdService implements CreateHouseholdPortIn {
|
||||
autoSchedulesPortIn.operate();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info(e.getMessage());
|
||||
throw e;
|
||||
safeLogger.error("Exception: {}", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,10 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import app.module.core.config.application.util.DailyUtil;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -34,8 +36,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
class GetHouseholdsExcelController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(GetHouseholdsExcelController.class));
|
||||
|
||||
private final GetHouseholdsStatusPortIn getHouseholdsStatusPortIn;
|
||||
private final GetHouseholdsExcelPortIn getHouseholdsExcelPortIn;
|
||||
private final DailyUtil dailyUtil;
|
||||
@@ -120,7 +123,7 @@ class GetHouseholdsExcelController {
|
||||
};
|
||||
|
||||
if (result == null) {
|
||||
log.warn("[엑셀 다운로드 실패] 템플릿 타입 '{}' 에 대한 처리 결과가 null입니다.", reqVO.getTemplateType());
|
||||
safeLogger.warn("[엑셀 다운로드 실패] 템플릿 타입 '{}' 에 대한 처리 결과가 null입니다.", reqVO.getTemplateType());
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@ import app.module.admin.usecase.researcher.adpaters.persistence.ResearcherMapper
|
||||
import app.module.core.config.application.util.AuditUtil;
|
||||
import app.module.core.usecase.uicode.list.adapters.persistence.UICodeListMapper;
|
||||
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -29,10 +31,11 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(ExcelUploadCreateHouseholdDao.class));
|
||||
|
||||
private final CreateHouseholdMapper createHouseholdMapper;
|
||||
private final CheckHouseholdNumMapper checkHouseholdNumMapper;
|
||||
private final UICodeListMapper uiCodeListMapper;
|
||||
@@ -122,7 +125,7 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
||||
}
|
||||
} else {
|
||||
errorList.add(getCellValue(row.getCell(0)));
|
||||
log.warn("[ EXCEL 누락 ] 임가번호={} 핸드폰번호={}",getCellValue(row.getCell(0)),getCellValue(row.getCell(3)));
|
||||
safeLogger.warn("[ EXCEL 누락 ] 임가번호={} 핸드폰번호={}", getCellValue(row.getCell(0)),getCellValue(row.getCell(3)));
|
||||
}
|
||||
}
|
||||
workbook.close();
|
||||
|
||||
@@ -5,12 +5,10 @@ import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecord
|
||||
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class CreateDailyRecordController {
|
||||
@@ -27,7 +25,6 @@ public class CreateDailyRecordController {
|
||||
formVO.setTodayNone("Y");
|
||||
|
||||
DailyUIReqVO reqVO = new DailyUIReqVO(formVO.getRecordMonth(), formVO.getDayGroupNo(), formVO.getHouseholdSeq());
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
|
||||
DailyRecordDto detail = dailyRecordPortIn.detail(reqVO.getSearchMonth(), reqVO.getGroupNo(), reqVO.getHouseholdSeq());
|
||||
formVO.setRecordMonth(reqVO.getSearchMonth());
|
||||
@@ -36,7 +33,6 @@ public class CreateDailyRecordController {
|
||||
formVO.setEndDate(detail.getEndDate());
|
||||
formVO.setFarming(detail.isFarmingOpen());
|
||||
formVO.setHouseholdSeq(reqVO.getHouseholdSeq());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyRecordPortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -4,21 +4,24 @@ import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.Remo
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.application.domain.RemoveDailyCmd;
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class RemoveDailyDao implements RemoveDailyPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(RemoveDailyDao.class));
|
||||
|
||||
private final RemoveDailyMapper mapper;
|
||||
|
||||
@UpdateCommand
|
||||
@Override
|
||||
public void operate(RemoveDailyCmd command) {
|
||||
if (command.getCurrentStep() != null) {
|
||||
log.error("[RemoveDaily] cmd: {}", command);
|
||||
safeLogger.error("[RemoveDaily] cmd: {}", command);
|
||||
|
||||
if (DailySort.INCOME.equals(command.getCurrentStep())) {
|
||||
mapper.removeDailyIncome(command);
|
||||
@@ -37,7 +40,7 @@ public class RemoveDailyDao implements RemoveDailyPortOut {
|
||||
}
|
||||
|
||||
} else {
|
||||
log.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
||||
safeLogger.error("[RemoveDaily] Current step is null. cmd: {}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,26 @@ package app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.adapters.web.modal.RemoveDailyReqVO;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.removeDaily.ports.RemoveDailyPortIn;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class RemoveDailyController {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(RemoveDailyController.class));
|
||||
|
||||
private final RemoveDailyPortIn removeDailyNonePortIn;
|
||||
|
||||
@PostMapping(path = "/api/household/daily/remove")
|
||||
ResponseEntity<?> remove(@RequestBody RemoveDailyReqVO reqVO) {
|
||||
log.debug("reqVO: {}", reqVO);
|
||||
safeLogger.debug("reqVO: {}", reqVO);
|
||||
|
||||
if (!reqVO.getSelectedIds().isEmpty()) {
|
||||
removeDailyNonePortIn.operate(reqVO);
|
||||
|
||||
@@ -5,14 +5,17 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.GetDailyExpenseCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyExpense.ports.application.domain.SaveDailyExpenseCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyExpenseDao.class));
|
||||
|
||||
private final SaveDailyExpenseMapper dailyExpenseMapper;
|
||||
|
||||
@Override
|
||||
@@ -28,11 +31,11 @@ public class SaveDailyExpenseDao implements SaveDailyExpensePortOut {
|
||||
if (existCount == 0) {
|
||||
dailyExpenseMapper.createDailyExpense(command);
|
||||
|
||||
log.debug("[CreateDailyExpense] command={}", command);
|
||||
safeLogger.debug("[CreateDailyExpense] command={}", command);
|
||||
} else {
|
||||
dailyExpenseMapper.updateDailyExpense(command);
|
||||
|
||||
log.debug("[UpdateDailyExpense] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyExpense] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/expense")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyExpenseController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyExpensePortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -1,39 +1,41 @@
|
||||
package app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence;
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.SaveDailyFarmingMapper;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.adapters.persistence.modal.GetDailyFarmingDto;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.SaveDailyFarmingPortOut;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.GetDailyFarmingCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyFarming.ports.application.domain.SaveDailyFarmingCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyFarmingDao implements SaveDailyFarmingPortOut {
|
||||
private final SaveDailyFarmingMapper DailyFarmingMapper;
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyFarmingDao.class));
|
||||
|
||||
private final SaveDailyFarmingMapper dailyFarmingMapper;
|
||||
|
||||
@Override
|
||||
public GetDailyFarmingDto detail(GetDailyFarmingCmd command) {
|
||||
|
||||
return DailyFarmingMapper.getDailyFarming(command);
|
||||
return dailyFarmingMapper.getDailyFarming(command);
|
||||
}
|
||||
|
||||
@CreateCommand
|
||||
@Override
|
||||
public void create(GetDailyFarmingCmd findCmd, SaveDailyFarmingCmd command) {
|
||||
Integer existCount = DailyFarmingMapper.getRecordExistCount(findCmd);
|
||||
Integer existCount = dailyFarmingMapper.getRecordExistCount(findCmd);
|
||||
if (existCount == 0) {
|
||||
DailyFarmingMapper.createDailyFarming(command);
|
||||
dailyFarmingMapper.createDailyFarming(command);
|
||||
|
||||
log.debug("[CreateDailyFarming] command={}", command);
|
||||
safeLogger.debug("[CreateDailyFarming] command={}", command);
|
||||
} else {
|
||||
DailyFarmingMapper.updateDailyFarming(command);
|
||||
dailyFarmingMapper.updateDailyFarming(command);
|
||||
|
||||
log.debug("[UpdateDailyFarming] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyFarming] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/farming")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyFarmingController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
DailyFarmingPortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -5,14 +5,17 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.port
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.GetDailyForestryCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyForestry.ports.application.domain.SaveDailyForestryCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyForestryDao implements SaveDailyForestryPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyForestryDao.class));
|
||||
|
||||
private final SaveDailyForestryMapper dailyForestryMapper;
|
||||
|
||||
@Override
|
||||
@@ -28,11 +31,11 @@ public class SaveDailyForestryDao implements SaveDailyForestryPortOut {
|
||||
if (existCount == 0) {
|
||||
dailyForestryMapper.createDailyForestry(command);
|
||||
|
||||
log.debug("[CreateDailyForestry] command={}", command);
|
||||
safeLogger.debug("[CreateDailyForestry] command={}", command);
|
||||
} else {
|
||||
dailyForestryMapper.updateDailyForestry(command);
|
||||
|
||||
log.debug("[UpdateDailyForestry] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyForestry] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/forestry")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyForestryController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyForestryPortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -5,15 +5,17 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.SaveDailyIncomeCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyIncome.ports.application.domain.GetDailyIncomeCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyIncomeDao implements SaveDailyIncomePortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyIncomeDao.class));
|
||||
|
||||
private final SaveDailyIncomeMapper dailyIncomeMapper;
|
||||
|
||||
@Override
|
||||
@@ -29,11 +31,11 @@ public class SaveDailyIncomeDao implements SaveDailyIncomePortOut {
|
||||
if (existCount == 0) {
|
||||
dailyIncomeMapper.createDailyIncome(command);
|
||||
|
||||
log.debug("[CreateDailyIncome] command={}", command);
|
||||
safeLogger.debug("[CreateDailyIncome] command={}", command);
|
||||
} else {
|
||||
dailyIncomeMapper.updateDailyIncome(command);
|
||||
|
||||
log.debug("[UpdateDailyIncome] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyIncome] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/income")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyIncomeController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyIncomePortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -5,14 +5,17 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.S
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.GetDailyPowerCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyPower.ports.application.domain.SaveDailyPowerCmd;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyPowerDao implements SaveDailyPowerPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyPowerDao.class));
|
||||
|
||||
private final SaveDailyPowerMapper dailyPowerMapper;
|
||||
|
||||
@Override
|
||||
@@ -28,11 +31,11 @@ public class SaveDailyPowerDao implements SaveDailyPowerPortOut {
|
||||
if (existCount == 0) {
|
||||
dailyPowerMapper.createDailyPower(command);
|
||||
|
||||
log.debug("[CreateDailyPower] command={}", command);
|
||||
safeLogger.debug("[CreateDailyPower] command={}", command);
|
||||
} else {
|
||||
dailyPowerMapper.updateDailyPower(command);
|
||||
|
||||
log.debug("[UpdateDailyPower] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyPower] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/power")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyPowerController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyPowerPortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.ap
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.application.domain.SaveDailyWorkCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.saveDailyWork.ports.SaveDailyWorkPortOut;
|
||||
import app.module.core.config.application.annotation.CreateCommand;
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -14,6 +16,8 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SaveDailyWorkDao implements SaveDailyWorkPortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(SaveDailyWorkDao.class));
|
||||
|
||||
private final SaveDailyWorkMapper dailyWorkMapper;
|
||||
|
||||
@Override
|
||||
@@ -29,11 +33,11 @@ public class SaveDailyWorkDao implements SaveDailyWorkPortOut {
|
||||
if (existCount == 0) {
|
||||
dailyWorkMapper.createDailyWork(command);
|
||||
|
||||
log.debug("[CreateDailyWork] command={}", command);
|
||||
safeLogger.debug("[CreateDailyWork] command={}", command);
|
||||
} else {
|
||||
dailyWorkMapper.updateDailyWork(command);
|
||||
|
||||
log.debug("[UpdateDailyWork] command={}", command);
|
||||
safeLogger.debug("[UpdateDailyWork] command={}", command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,11 @@ import app.module.core.usecase.daily.record.adapters.persistence.model.DailyReco
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping(path = "/api/household/daily/work")
|
||||
@@ -64,7 +62,6 @@ public class SaveDailyWorkController {
|
||||
formVO.setSearchMonth(dailyRecord.getRecordMonth());
|
||||
formVO.setGroupNo(dailyRecord.getGroupNo());
|
||||
formVO.setDailyId(dailyRecord.getId());
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
dailyWorkPortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -5,15 +5,18 @@ import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.
|
||||
import app.module.core.config.application.annotation.UpdateCommand;
|
||||
import app.module.core.config.application.enums.DailySort;
|
||||
import app.module.core.config.application.enums.DailyTargetStatus;
|
||||
import app.module.core.config.application.logging.SafeLogger;
|
||||
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Slf4j
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class UpdateDailyNoneDao implements UpdateDailyNonePortOut {
|
||||
SafeLogger safeLogger = new SafeLogger(LoggerFactory.getLogger(UpdateDailyNoneDao.class));
|
||||
|
||||
private final UpdateDailyNoneMapper mapper;
|
||||
private final DailyRecordPortIn dailyRecordPortIn;
|
||||
|
||||
@@ -43,7 +46,7 @@ class UpdateDailyNoneDao implements UpdateDailyNonePortOut {
|
||||
dailyRecordPortIn.updateByStatus(command.getSearchMonth(), command.getGroupNo(), command.getHouseholdSeq(), command.getCurrentStep().name(), command.getCurrentStatus().name());
|
||||
|
||||
} else {
|
||||
log.error("[UpdateDailyNone] Current step is null. cmd: {}", command);
|
||||
safeLogger.error("[UpdateDailyNone] Current step is null. cmd: {}", command);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,14 @@ package app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapt
|
||||
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.adapters.web.modal.UpdateDailyNoneReqVO;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.updateDailyNone.ports.UpdateDailyNonePortIn;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
class UpdateDailyNoneController {
|
||||
@@ -18,7 +17,6 @@ class UpdateDailyNoneController {
|
||||
|
||||
@PostMapping(path = "/api/household/daily/today-none")
|
||||
ResponseEntity<?> create(@RequestBody UpdateDailyNoneReqVO formVO) {
|
||||
log.debug("formVO: {}", formVO);
|
||||
|
||||
updateDailyNonePortIn.create(formVO);
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package app.module.core.config.application.logging;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.security.core.Authentication;
|
||||
|
||||
public class SafeLogger {
|
||||
private final Logger logger;
|
||||
public SafeLogger(Logger logger) { this.logger = logger; }
|
||||
|
||||
// 가변 인자 지원 및 CRLF 이스케이프 처리 유틸리티
|
||||
private Object sanitizeForLog(Object arg) {
|
||||
if (arg == null) return null;
|
||||
String str = arg.toString();
|
||||
return str.replace("\n", "\\n").replace("\r", "\\r");
|
||||
}
|
||||
|
||||
public void info(String msg, Object... args) {
|
||||
Object[] safeArgs = new Object[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
safeArgs[i] = sanitizeForLog(args[i]);
|
||||
}
|
||||
logger.info(msg, safeArgs);
|
||||
}
|
||||
|
||||
public void error(String msg, Object... args) {
|
||||
Object[] safeArgs = new Object[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
safeArgs[i] = sanitizeForLog(args[i]);
|
||||
}
|
||||
logger.error(msg, safeArgs);
|
||||
}
|
||||
|
||||
public void warn(String msg, Object... args) {
|
||||
Object[] safeArgs = new Object[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
safeArgs[i] = sanitizeForLog(args[i]);
|
||||
}
|
||||
logger.warn(msg, safeArgs);
|
||||
}
|
||||
|
||||
public void debug(String msg, Object... args) {
|
||||
Object[] safeArgs = new Object[args.length];
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
safeArgs[i] = sanitizeForLog(args[i]);
|
||||
}
|
||||
logger.debug(msg, safeArgs);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user