견문보고 파일 다운로드 오류 수정.

DESKTOP-NQTA8OG\lcks0 2022-09-30 10:28:06 +09:00
parent 8e97cb8860
commit 184c87e581
4 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package com.dbnt.faisp.config;
import com.dbnt.faisp.fpiMgt.affair.service.AffairService;
import com.dbnt.faisp.fpiMgt.affairPlan.service.PlanService;
import com.dbnt.faisp.publicBoard.service.PublicBoardService;
import lombok.RequiredArgsConstructor;
@ -18,6 +19,7 @@ public class FileController {
private final PlanService planService;
private final PublicBoardService publicBoardService;
private final AffairService affairService;
@GetMapping("/file/fileDownload")
public void fileDownload(HttpServletRequest request,
@ -27,12 +29,15 @@ public class FileController {
Integer fileSeq) {
FileInfo downloadFile = null;
switch (board){
case "monthPlan":
case "affairPlan":
downloadFile = planService.selectPlanFile(parentKey, fileSeq);
break;
case "publicFile":
downloadFile = publicBoardService.selectPublicFile(parentKey, fileSeq);
break;
case "affair":
downloadFile = affairService.selectAffairFile(parentKey, fileSeq);
break;
}
BufferedInputStream in;

View File

@ -2,6 +2,7 @@ package com.dbnt.faisp.fpiMgt.affair.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.fpiMgt.affair.mapper.AffairMapper;
import com.dbnt.faisp.fpiMgt.affair.model.*;
import com.dbnt.faisp.fpiMgt.affair.repository.*;
@ -149,4 +150,8 @@ public class AffairService extends BaseService { // 견문보고
}
return rating.getAffairKey();
}
public FileInfo selectAffairFile(Integer parentKey, Integer fileSeq) {
return affairFileRepository.findById(new AffairFile.AffairFileId(parentKey, fileSeq)).orElse(null);
}
}

View File

@ -127,7 +127,7 @@
<th:block th:unless="${#lists.isEmpty(affair.fileList)}">
<th:block th:each="file:${affair.fileList}">
<tr class="fileInfoTr">
<td><a href="#" class="fileDownLink" data-board="monthAffair"
<td><a href="#" class="fileDownLink" data-board="affair"
th:data-parentkey="${file.affairKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a></td>
<td th:text="${file.fileSize}"></td>
</tr>

View File

@ -79,7 +79,7 @@
<th:block th:unless="${#lists.isEmpty(plan.fileList)}">
<th:block th:each="file:${plan.fileList}">
<tr class="fileInfoTr">
<td><a href="#" class="fileDownLink" data-board="monthPlan"
<td><a href="#" class="fileDownLink" data-board="affairPlan"
th:data-parentkey="${file.planKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a></td>
<td th:text="${file.fileSize}"></td>
</tr>