BO 일계부 수입/수출 영수증 다운로드 버튼 추가
This commit is contained in:
@@ -8,25 +8,53 @@ import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDe
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatus;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyWorkRecords;
|
||||
import java.util.List;
|
||||
|
||||
import app.module.core.config.application.enums.FileStorageType;
|
||||
import app.module.core.usecase.file.url.application.port.in.FileUrlPortIn;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusDetail;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.application.domain.GetDailyRecordStatusCmd;
|
||||
import app.module.admin.usecase.household.tab.dailyRecord.getDailyRecordStatusDetail.ports.GetDailyRecordStatusDetailPortOut;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
class GetDailyRecordStatusDetailDao implements GetDailyRecordStatusDetailPortOut {
|
||||
private final GetDailyRecordStatusDetailMapper mapper;
|
||||
private final FileUrlPortIn fileUrlPortIn;
|
||||
|
||||
@Value("${path.upload.storage}")
|
||||
private String uploadStorageType;
|
||||
|
||||
@Override
|
||||
public Optional<GetDailyRecordStatusDetail> operate(GetDailyRecordStatusCmd cmd) {
|
||||
|
||||
GetDailyRecordStatus status = mapper.getDailyRecordStatus(cmd);
|
||||
List<GetDailyIncomeRecords> incomes = mapper.getDailyIncomeRecords(cmd);
|
||||
incomes.stream().map(income ->{
|
||||
if(income.getFileId() != null) {
|
||||
income.setAttachmentURL(
|
||||
fileUrlPortIn.getAttachment(
|
||||
FileStorageType.valueOf(uploadStorageType), income.getFileId()));
|
||||
}
|
||||
return income;
|
||||
}).toList();
|
||||
|
||||
List<GetDailyWorkRecords> works = mapper.getDailyWorkRecords(cmd);
|
||||
List<GetDailyExpenseRecords> expenses = mapper.getDailyExpenseRecords(cmd);
|
||||
expenses.stream().map(expense ->{
|
||||
if(expense.getFileId() != null) {
|
||||
expense.setAttachmentURL(
|
||||
fileUrlPortIn.getAttachment(
|
||||
FileStorageType.valueOf(uploadStorageType), expense.getFileId()));
|
||||
}
|
||||
return expense;
|
||||
}).toList();
|
||||
|
||||
List<GetDailyPowerRecords> powers = mapper.getDailyPowerRecords(cmd);
|
||||
List<GetDailyForestryRecords> forestries = mapper.getDailyForestryRecords(cmd);
|
||||
List<GetDailyFarmingRecords> farmings = mapper.getDailyFarmingRecords(cmd);
|
||||
|
||||
@@ -24,6 +24,9 @@ public class GetDailyExpenseRecords {
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private Long fileId;
|
||||
private String fileOriginName;
|
||||
private String attachmentURL;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ public class GetDailyIncomeRecords {
|
||||
private String estimatedValue;
|
||||
private String updatedBy;
|
||||
private String updatedAt;
|
||||
private Long fileId;
|
||||
private String fileOriginName;
|
||||
private String attachmentURL;
|
||||
private String startDay;
|
||||
private String endDay;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user