BO 일계부 수입/수출 영수증 다운로드 버튼 추가

This commit is contained in:
주수현
2025-07-04 11:40:36 +09:00
parent 38a9ca2997
commit 69b7bda52a
5 changed files with 62 additions and 5 deletions

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -43,7 +43,11 @@
di.price, /* 현금 */
di.estimated_value, /* 현물평가액 */
di.updated_by, /* 최종수정자 */
TO_CHAR(di.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
TO_CHAR(di.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at, /* 최종수정날짜 */
uf.id AS file_id,
uf.name AS file_name,
uf.origin_name AS file_origin_name,
uf.path AS file_path
<if test="searchMonth == true">
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
@@ -55,6 +59,11 @@
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = di.unit_code
LEFT JOIN receipt_has_record rhr
ON rhr.receipt_type_id = di.id
AND rhr.type = 'INCOME' AND rhr.is_deleted = false
LEFT JOIN upload_file uf
ON uf.id = rhr.file_id and uf.type = 'INCOME'
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = di.daily_record_seq
@@ -150,7 +159,11 @@
de.price, /* 현금 */
de.estimated_value, /* 현물평가액 */
de.updated_by, /* 최종수정자 */
TO_CHAR(de.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at /* 최종수정날짜 */
TO_CHAR(de.updated_at, 'YYYY-MM-DD HH24:MI') AS updated_at, /* 최종수정날짜 */
uf.id AS file_id,
uf.name AS file_name,
uf.origin_name AS file_origin_name,
uf.path AS file_path
<if test="searchMonth == true">
, EXTRACT(DAY FROM CAST(dr.start_date as date)) as start_day
, EXTRACT(DAY FROM CAST(dr.end_date as date)) as end_day
@@ -159,6 +172,11 @@
LEFT JOIN uicode ui_unit
ON ui_unit.parent_id = 'code.record.unit'
AND ui_unit.id = de.unit_code
LEFT JOIN receipt_has_record rhr
ON rhr.receipt_type_id = de.id
AND rhr.type = 'EXPENSE' AND rhr.is_deleted = false
LEFT JOIN upload_file uf
ON uf.id = rhr.file_id and uf.type = 'EXPENSE'
<if test="searchMonth == true">
INNER JOIN daily_record dr
ON dr.id = de.daily_record_seq

View File

@@ -78,9 +78,6 @@
<h3>수입 <strong>(<span id="incomeCount">0</span>건)</strong></h3>
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn small">
<span class="btn-txt">영수증 다운로드 <i class="ico-download" aria-hidden="true"></i></span>
</button>
<button type="button" class="btn small">
<span class="btn-txt">
<label class="radio-inner">
@@ -112,6 +109,7 @@
<th>단위</th>
<th>현금(원)</th>
<th>현물평가액</th>
<th>영수증</th>
<th>최종 수정자</th>
</tr>
</thead>
@@ -219,6 +217,7 @@
<th>단위</th>
<th>현금(원)</th>
<th>현물평가액</th>
<th>영수증</th>
<th>최종 수정자</th>
</tr>
</thead>
@@ -514,6 +513,9 @@
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td class="align-center">
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
</td>
<td>
${item.updatedBy}<br>
(${item.updatedAt})
@@ -605,6 +607,9 @@
<td>${ifNullHyphen(item.unitText)}</td><!-- 단위 -->
<td class="align-right">${formatNumberWithComma(item.price)}</td><!-- 현금(원) -->
<td class="align-right">${formatNumberWithComma(item.estimatedValue)}</td><!-- 현물평가액 -->
<td class="align-center">
${item.fileId ? `<a href="${item.attachmentURL}" download>다운로드</a>` : '-'}
</td>
<td>
${item.updatedBy}<br>
(${item.updatedAt})