다운로드시 이력 생성 추가.
parent
8457e3343d
commit
5c236aea6c
|
|
@ -78,8 +78,8 @@ public class BoardController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/fileDownload")
|
@GetMapping("/fileDownload")
|
||||||
public void fileDownload(Integer contentSeq, Integer fileSeq, HttpServletRequest request, HttpServletResponse response){
|
public void fileDownload(Principal principal, Integer contentSeq, Integer fileSeq, HttpServletRequest request, HttpServletResponse response){
|
||||||
FileInfo downlodFileInfo = boardService.selectDownloadFileInfo(contentSeq, fileSeq);
|
FileInfo downlodFileInfo = boardService.selectDownloadFileInfo(contentSeq, fileSeq, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId());
|
||||||
|
|
||||||
BufferedInputStream in;
|
BufferedInputStream in;
|
||||||
BufferedOutputStream out;
|
BufferedOutputStream out;
|
||||||
|
|
@ -98,8 +98,8 @@ public class BoardController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/fileDownloadToZip")
|
@GetMapping("/fileDownloadToZip")
|
||||||
public void fileDownloadToZip(Integer contentSeq, @RequestParam(value = "fileSeq") List<Integer> fileSeqList, HttpServletResponse response){
|
public void fileDownloadToZip(Principal principal, Integer contentSeq, @RequestParam(value = "fileSeq") List<Integer> fileSeqList, HttpServletResponse response){
|
||||||
List<FileInfo> targetList = boardService.selectDownloadFileInfoList(contentSeq, fileSeqList);
|
List<FileInfo> targetList = boardService.selectDownloadFileInfoList(contentSeq, fileSeqList, ((UserInfo)((UsernamePasswordAuthenticationToken) principal).getPrincipal()).getUserId());
|
||||||
|
|
||||||
BufferedInputStream in;
|
BufferedInputStream in;
|
||||||
BufferedOutputStream out;
|
BufferedOutputStream out;
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ public class BoardService {
|
||||||
fileInfo.setFileSize(calculationFileSize(file.getSize()));
|
fileInfo.setFileSize(calculationFileSize(file.getSize()));
|
||||||
fileInfo.setSavePath(path);
|
fileInfo.setSavePath(path);
|
||||||
fileInfoRepository.save(fileInfo);
|
fileInfoRepository.save(fileInfo);
|
||||||
saveBoardLog(content.getContentSeq(), LogStatus.FILE_ADD, file.getOriginalFilename(), content.getCreateId());
|
saveBoardLog(content.getContentSeq(), LogStatus.FILE_ADD, fileInfo.getFullName(), content.getCreateId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -130,18 +130,21 @@ public class BoardService {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FileInfo> selectDownloadFileInfoList(Integer contentSeq, List<Integer> fileSeqList) {
|
public List<FileInfo> selectDownloadFileInfoList(Integer contentSeq, List<Integer> fileSeqList, String userId) {
|
||||||
List<FileInfo> fileList = fileInfoRepository.findByContentSeqOrderByFileSeqAsc(contentSeq);
|
List<FileInfo> fileList = fileInfoRepository.findByContentSeqOrderByFileSeqAsc(contentSeq);
|
||||||
List<FileInfo> targetList = new ArrayList<>();
|
List<FileInfo> targetList = new ArrayList<>();
|
||||||
for(FileInfo file: fileList){
|
for(FileInfo file: fileList){
|
||||||
if(fileSeqList.contains(file.getFileSeq())){
|
if(fileSeqList.contains(file.getFileSeq())){
|
||||||
targetList.add(file);
|
targetList.add(file);
|
||||||
|
saveBoardLog(contentSeq, LogStatus.FILE_DOWN, file.getFullName(), userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
public FileInfo selectDownloadFileInfo(Integer contestSeq, Integer fileSeq){
|
public FileInfo selectDownloadFileInfo(Integer contestSeq, Integer fileSeq, String userId){
|
||||||
return fileInfoRepository.findById(new FileInfo.FileInfoId(contestSeq, fileSeq)).orElse(null);
|
FileInfo fileInfo = fileInfoRepository.findById(new FileInfo.FileInfoId(contestSeq, fileSeq)).orElse(null);
|
||||||
|
saveBoardLog(contestSeq, LogStatus.FILE_DOWN, fileInfo.getFullName(), userId);
|
||||||
|
return fileInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BoardLog> selectContentLog(Integer contentSeq){
|
public List<BoardLog> selectContentLog(Integer contentSeq){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue