주요사건처리현황 일괄 다운로드 기능 추가.

master
강석 최 2023-03-28 16:39:11 +09:00
parent a6fd1099bd
commit 903973a873
11 changed files with 88 additions and 49 deletions

View File

@ -131,6 +131,22 @@ public class FileController extends BaseService{
HttpServletResponse response,
@RequestParam(value="affairKeyList") List<Integer> affairKeyList){
List<FileInfo> fileList = affairService.selectAffairFileList(affairKeyList);
makeZipAndOut(request, response, "견문보고서 첨부파일_", fileList);
}
@GetMapping("/downloadMajorStatusFiles")
public void downloadMajorStatusFiles(HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value="majorKeyList") List<Integer> majorKeyList){
List<FileInfo> fileList = majorStatusService.selectMajorFileList(majorKeyList);
makeZipAndOut(request, response, "주요사건처리현황 첨부파일_", fileList);
}
private void makeZipAndOut(HttpServletRequest request,
HttpServletResponse response,
String fileName, List<FileInfo> fileList) {
List<Map<String, String>> fileInfoList = new ArrayList<>();
for(FileInfo file: fileList){
Map<String, String> fileInfoMap = new HashMap<>();
@ -145,7 +161,7 @@ public class FileController extends BaseService{
if (!saveFolder.exists() || saveFolder.isFile()) {
saveFolder.mkdirs();
}
String downloadFileName = "견문보고서 첨부파일_"+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))+".zip";
String downloadFileName = fileName+ LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))+".zip";
zipFile += File.separator+downloadFileName;
try{
// ZipOutputStream을 FileOutputStream 으로 감쌈

View File

@ -1,5 +1,6 @@
package com.dbnt.faisp.main.fpiMgt.affair.repository;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairFile;
import org.springframework.data.jpa.repository.JpaRepository;
@ -8,6 +9,8 @@ import java.util.Optional;
public interface AffairFileRepository extends JpaRepository<AffairFile, AffairFile.AffairFileId> {
List<AffairFile> findByAffairKey(Integer affairKey);
Optional<AffairFile> findTopByAffairKeyOrderByFileSeqDesc(Integer planKey);
List<AffairFile> findByAffairKey(Integer affairKey);
Optional<AffairFile> findTopByAffairKeyOrderByFileSeqDesc(Integer planKey);
List<FileInfo> findByAffairKeyIn(List<Integer> affairKeyList);
}

View File

@ -292,12 +292,7 @@ public class AffairService extends BaseService { // 견문보고
}
public List<FileInfo> selectAffairFileList(List<Integer> affairKeyList) {
List<FileInfo> fileList = new ArrayList<>();
for(Integer affairKey: affairKeyList){
List<AffairFile> affairFileList = affairFileRepository.findByAffairKey(affairKey);
fileList.addAll(affairFileList);
}
return fileList;
return affairFileRepository.findByAffairKeyIn(affairKeyList);
}
public List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics) {

View File

@ -92,7 +92,7 @@ public class IvsgtController {
investigationBoard.setRowCnt(10);
investigationBoard.setFirstIndex(0);
investigationBoard.setQueryInfo();
investigationBoard.setWrtUserSeq(loginUser.getUserSeq());
investigationBoard.setWrtOrgan(loginUser.getOgCd());
mav.addObject("investigationList", ivsgtService.selectBoardInvestigationList(investigationBoard));
investigationBoard.setContentCnt(ivsgtService.selectBoardInvestigationListCnt(investigationBoard));
investigationBoard.setPaginationInfo();

View File

@ -1,16 +1,19 @@
package com.dbnt.faisp.main.ivsgtMgt.majorStatus.repository;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.main.ivsgtMgt.majorStatus.model.MajorFile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Optional;
public interface MajorFileRepository extends JpaRepository<MajorFile, MajorFile.MajorFileId> {
List<MajorFile> findByMajorKey(Integer majorKey);
Optional<MajorFile> findTopByMajorKeyOrderByFileSeq(Integer majorKey);
List<MajorFile> findByMajorKey(Integer majorKey);
Optional<MajorFile> findTopByMajorKeyOrderByFileSeq(Integer majorKey);
void deleteByMajorKey(Integer majorKey);
void deleteByMajorKey(Integer majorKey);
List<FileInfo> findByMajorKeyIn(List<Integer> majorKeyList);
}

View File

@ -93,4 +93,8 @@ public class MajorStatusService extends BaseService {
public FileInfo selectMajorFile(Integer majorKey, Integer fileSeq){
return majorFileRepository.findById(new MajorFile.MajorFileId(majorKey, fileSeq)).orElse(null);
}
public List<FileInfo> selectMajorFileList(List<Integer> majorKeyList) {
return majorFileRepository.findByMajorKeyIn(majorKeyList);
}
}

View File

@ -7,12 +7,6 @@ $(document).on('change', '#pressurizedYn', function (){
}
})
$("#jqueryBtn").click(function(){
$(".quiz-text").text("Javascript");
$(".quiz-text").css('color', 'blue');
});
$(document).on('click', '#saveBtn', function (){
if(confirm("저장하시겠습니까?")){

View File

@ -20,7 +20,10 @@ $(document).on('click', '.reportTypeTab', function (){
$(document).on('click', '.affairTr', function (event){
const target = event.target;
if(!(target.className === "apprvTd" || $(target).parents(".apprvTd").length>0)){
if(!(target.className === "chkBoxTd"
|| $(target).parents(".chkBoxTd").length>0
|| target.className === "apprvTd"
|| $(target).parents(".apprvTd").length>0)){
const chkBox = $(this).find(".trChkBox");
if(chkBox.length>0){
$(".trChkBox").prop("checked", false);

View File

@ -1,11 +1,10 @@
$("#jqueryBtn").click(function(){
$(".quiz-text").text("Javascript");
$(".quiz-text").css('color', 'blue');
});
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
})
$(document).on('click', '#saveBtn', function (){
if(confirm("저장하시겠습니까?")){
@ -45,10 +44,12 @@ $(document).on('click', '#addMajorBtn', function (){
getEditModal(null)
})
$(document).on('click', '.tr', function (){
$(".trChkBox").prop("checked", false);
$(this).find(".trChkBox").prop("checked", true);
$(document).on('click', '.tr', function (event){
const target = event.target;
if(!(target.className === "chkBoxTd"
|| $(target).parents(".chkBoxTd").length>0)){
getViewModal(Number($(this).find(".majorKey").val()));
}
})
@ -63,14 +64,19 @@ $(document).on('click', '#editBtn', function (){
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko",
autoclose: true
});
$(document).on('click', '#fileDownBtn', function (){
const selectedList = $(".majorChkBox:checked")
if(selectedList.length<1){
alert("대상이 없습니다.");
return false;
}
if(confirm("선택된 문서의 파일을 다운로드 하시겠습니까?")){
let url = "/file/downloadMajorStatusFiles?majorKeyList="
$.each(selectedList, function(idx, chkBox){
url += $(chkBox).parents("tr").find(".majorKey").val()+",";
})
window.open(encodeURI(url.slice(0, -1)));
}
})

View File

@ -160,7 +160,7 @@
<tbody class="table-group-divider">
<tr class="affairTr" th:each="affair:${affairList}">
<input type="hidden" class="affairKey" th:value="${affair.affairKey}">
<td><input type="checkbox" class="trChkBox"></td>
<td class="chkBoxTd"><input type="checkbox" class="trChkBox"></td>
<td th:text="${affair.docNo}"></td>
<td>
<th:block th:each="code:${session.commonCode.get('DC01')}">
@ -227,7 +227,7 @@
<div class="row justify-content-center">
<div class="col-auto">
<input type="radio" class="apprvChkbox" th:id="|apprvChkbox${affair.affairKey}DST006|" th:name="|apprvChkbox${affair.affairKey}|" value="DST006">
<label th:for="|apprvChkbox${affair.affairKey}DST006|">결재</label>
<label th:for="|apprvChkbox${affair.affairKey}DST006|">승인</label>
<input type="radio" class="apprvChkbox" th:id="|apprvChkbox${affair.affairKey}DST005|" th:name="|apprvChkbox${affair.affairKey}|" value="DST005">
<label th:for="|apprvChkbox${affair.affairKey}DST005|">반려</label>
<input type="radio" th:id="|apprvChkbox${affair.affairKey}|" th:name="|apprvChkbox${affair.affairKey}|" value="" checked>

View File

@ -66,23 +66,36 @@
<div class="row">
<div class="col-12">
<table class="table table-sm table-hover table-bordered">
<colgroup>
<col style="width: 2%">
<col style="width: 3%">
<col style="width: 7%">
<col>
<col>
<col style="width: 5%">
<col style="width: 10%">
</colgroup>
<thead>
<tr class="table-secondary">
<th width="5%">순번</th>
<th width="10%">분류</th>
<th><input type="checkbox" class="allChk"> </th>
<th>순번</th>
<th>분류</th>
<th>제목</th>
<th>내용</th>
<th width="10%">첨부파일</th>
<th width="10%">작성일시</th>
<th>첨부파일</th>
<th>작성일시</th>
</tr>
</thead>
<tbody class="table-group-divider">
<tr class="tr" th:each="major, cnt:${majorList}">
<input type="hidden" class="majorKey" th:value="${major.majorKey}">
<td class="chkBoxTd"><input type="checkbox" class="majorChkBox"> </td>
<td th:text="${cnt.count}"></td>
<th:block th:each="commonCode:${session.commonCode.get('MST')}">
<td th:if="${major.majorType eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<td>
<th:block th:each="code:${session.commonCode.get('MST')}">
<th:block th:if="${major.majorType eq code.itemCd}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td class="titleLeft" th:text="|${major.contentStatus eq 'DST001'?'[임시]':''}${major.contentTitle}|"></td>
<td class="titleLeft" th:utext="${major.contentInfo}"></td>
<td th:text="${major.fileCnt eq null?'파일 없음':#strings.concat(major.fileCnt,' 건')}"></td>
@ -93,7 +106,9 @@
</div>
</div>
<div class="row justify-content-between">
<div class="col-auto"></div>
<div class="col-auto">
<button type="button" class="btn btn-sm btn-info" id="fileDownBtn">첨부파일 다운로드</button>
</div>
<div class="col-auto">
<nav aria-label="Page navigation">
<ul class="pagination mb-0">