no message
parent
2c7604f3fa
commit
3079a00832
|
|
@ -1,11 +1,14 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { SERVER_URL } from 'config';
|
import * as File from "utils/file"
|
||||||
import {Button, Modal, Nav} from "react-bootstrap";
|
import {Button, Modal, Nav} from "react-bootstrap";
|
||||||
|
|
||||||
function HistoryModal({closeFn, standardCode}){
|
function HistoryModal({closeFn, standardCode}){
|
||||||
|
function fileDownloadStandardCode(fileSeq){
|
||||||
|
File.standardCode(fileSeq);
|
||||||
|
}
|
||||||
|
|
||||||
function fileDownload(fileSeq){
|
function fileDownload(fileSeq){
|
||||||
window.open(encodeURI(SERVER_URL+'/file/download?fileSeq='+fileSeq));
|
File.download(fileSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
|
|
@ -30,7 +33,7 @@ function HistoryModal({closeFn, standardCode}){
|
||||||
<div className="mainCategory">{history.rvsnYmd.split('T')[0]}</div>
|
<div className="mainCategory">{history.rvsnYmd.split('T')[0]}</div>
|
||||||
<div className="middleCategory">
|
<div className="middleCategory">
|
||||||
{history.docFileGrpId}
|
{history.docFileGrpId}
|
||||||
{history.docFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownload(history.docFileGrpId)}>다운로드 </Button>:''}
|
{history.docFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownloadStandardCode(history.docFileGrpId)}>다운로드 </Button>:''}
|
||||||
</div>
|
</div>
|
||||||
<div className="kcscCd">
|
<div className="kcscCd">
|
||||||
{history.rvsnFileGrpId}
|
{history.rvsnFileGrpId}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import {SERVER_URL} from "../config";
|
||||||
|
import {parseJwt} from "./parseJwt";
|
||||||
|
import {getLocalItem} from "./storage";
|
||||||
|
|
||||||
|
export function download(fileSeq){
|
||||||
|
window.open(encodeURI(SERVER_URL+'/file/download?fileSeq='+fileSeq));
|
||||||
|
}
|
||||||
|
export function standardCode(fileSeq){
|
||||||
|
const sessionUser = parseJwt(getLocalItem('accessToken'));
|
||||||
|
window.open(encodeURI(SERVER_URL+'/file/standardCode-download?userId='+sessionUser.id+'&fileSeq='+fileSeq));
|
||||||
|
}
|
||||||
|
|
@ -9,8 +9,6 @@ import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,16 @@
|
||||||
package com.dbnt.kcscbackend.admin.logs.service;
|
package com.dbnt.kcscbackend.admin.logs.service;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.entity.ThAttachFileLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.ThLoginLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
|
||||||
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
import com.dbnt.kcscbackend.admin.logs.entity.TnDailyUserLog;
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.repository.FileLogsRepository;
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.ThLoginLogRepository;
|
import com.dbnt.kcscbackend.admin.logs.repository.ThLoginLogRepository;
|
||||||
import com.dbnt.kcscbackend.admin.logs.repository.UserLogsRepository;
|
import com.dbnt.kcscbackend.admin.logs.repository.UserLogsRepository;
|
||||||
|
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
||||||
|
import com.dbnt.kcscbackend.standardCode.entity.TnDocumentInfo;
|
||||||
|
import com.dbnt.kcscbackend.standardCode.repository.TnDocumentInfoRepository;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -24,6 +29,8 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
private final PrivacyLogsRepository privacyLogsRepository;
|
private final PrivacyLogsRepository privacyLogsRepository;
|
||||||
private final ThLoginLogRepository loginLogRepository;
|
private final ThLoginLogRepository loginLogRepository;
|
||||||
private final UserLogsRepository userLogsRepository;
|
private final UserLogsRepository userLogsRepository;
|
||||||
|
private final FileLogsRepository fileLogsRepository;
|
||||||
|
private final TnDocumentInfoRepository documentInfoRepository;
|
||||||
|
|
||||||
public Map<String, Object> selectPrivacyList() {
|
public Map<String, Object> selectPrivacyList() {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
@ -93,4 +100,26 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void insertFileLog(TnAttachFile tnAttachFile, String accessId, String ipAddress){
|
||||||
|
TnDocumentInfo documentInfo = documentInfoRepository.findByDocFileGrpId(tnAttachFile.getFileSeq().toString()).orElse(null);
|
||||||
|
ThAttachFileLog fileLog = new ThAttachFileLog();
|
||||||
|
fileLog.setFileSeq((long)tnAttachFile.getFileSeq());
|
||||||
|
fileLog.setAccessType("FILE_DOWN");
|
||||||
|
fileLog.setAccessId(accessId);
|
||||||
|
fileLog.setAccessDt(LocalDateTime.now());
|
||||||
|
fileLog.setIpAddress(ipAddress);
|
||||||
|
switch (documentInfo.getKcscCd().split(" ")[0]){
|
||||||
|
case "KDS": fileLog.setGroupCurCd("10"); break;
|
||||||
|
case "KCS": fileLog.setGroupCurCd("20"); break;
|
||||||
|
case "SMCS": fileLog.setGroupCurCd("40"); break;
|
||||||
|
case "EXCS": fileLog.setGroupCurCd("50"); break;
|
||||||
|
case "KRCCS": fileLog.setGroupCurCd("60"); break;
|
||||||
|
case "KRACS": fileLog.setGroupCurCd("70"); break;
|
||||||
|
case "LHCS": fileLog.setGroupCurCd("80"); break;
|
||||||
|
case "KWCS": fileLog.setGroupCurCd("90"); break;
|
||||||
|
}
|
||||||
|
fileLogsRepository.save(fileLog);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,7 @@ public class SecurityConfig {
|
||||||
"/cmm/main/**.do", // 메인페이지
|
"/cmm/main/**.do", // 메인페이지
|
||||||
"/cmm/fms/FileDown.do", //파일 다운로드
|
"/cmm/fms/FileDown.do", //파일 다운로드
|
||||||
"/file/download", //파일 다운로드
|
"/file/download", //파일 다운로드
|
||||||
|
"/file/standardCode-download", //파일 다운로드
|
||||||
"/cmm/fms/getImage.do", //갤러리 이미지보기
|
"/cmm/fms/getImage.do", //갤러리 이미지보기
|
||||||
|
|
||||||
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회
|
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
package com.dbnt.kcscbackend.file;
|
package com.dbnt.kcscbackend.file;
|
||||||
|
|
||||||
|
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
|
||||||
|
import com.dbnt.kcscbackend.auth.entity.LoginVO;
|
||||||
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
import com.dbnt.kcscbackend.config.util.ClientUtils;
|
||||||
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
import com.dbnt.kcscbackend.file.entity.TnAttachFile;
|
||||||
import com.dbnt.kcscbackend.file.service.FileService;
|
import com.dbnt.kcscbackend.file.service.FileService;
|
||||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeService;
|
import com.dbnt.kcscbackend.standardCode.service.StandardCodeService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
@ -20,37 +23,22 @@ import java.io.*;
|
||||||
public class FileController {
|
public class FileController {
|
||||||
|
|
||||||
private final FileService fileService;
|
private final FileService fileService;
|
||||||
private final StandardCodeService standardCodeService;
|
private final AdminLogsService adminLogsService;
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/download")
|
@RequestMapping(method = RequestMethod.GET, value = "/download")
|
||||||
public void download(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
|
public void download(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
|
||||||
|
|
||||||
tnAttachFile = fileService.selectTnAttachFile(tnAttachFile);
|
tnAttachFile = fileService.selectTnAttachFile(tnAttachFile);
|
||||||
|
fileDownload(request, response, tnAttachFile);
|
||||||
if(tnAttachFile != null){
|
|
||||||
BufferedInputStream in;
|
|
||||||
BufferedOutputStream out;
|
|
||||||
try {
|
|
||||||
File file = new File(tnAttachFile.getFilePath());
|
|
||||||
|
|
||||||
ClientUtils.setDisposition(tnAttachFile.getFileOldName(), request, response);
|
|
||||||
in = new BufferedInputStream(new FileInputStream(file));
|
|
||||||
out = new BufferedOutputStream(response.getOutputStream());
|
|
||||||
FileCopyUtils.copy(in, out);
|
|
||||||
out.flush();
|
|
||||||
if(out!=null) out.close();
|
|
||||||
if(in!=null )in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = "/standardCode/download")
|
@RequestMapping(method = RequestMethod.GET, value = "/standardCode-download")
|
||||||
public void standardCodeDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
|
public void standardCodeDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile, String userId) throws Exception{
|
||||||
|
|
||||||
tnAttachFile = fileService.selectTnAttachFile(tnAttachFile);
|
tnAttachFile = fileService.selectTnAttachFile(tnAttachFile);
|
||||||
|
adminLogsService.insertFileLog(tnAttachFile, userId, ClientUtils.getRemoteIP(request));
|
||||||
|
fileDownload(request, response, tnAttachFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fileDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile){
|
||||||
if(tnAttachFile != null){
|
if(tnAttachFile != null){
|
||||||
BufferedInputStream in;
|
BufferedInputStream in;
|
||||||
BufferedOutputStream out;
|
BufferedOutputStream out;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package com.dbnt.kcscbackend.standardCode.entity;
|
package com.dbnt.kcscbackend.standardCode.entity;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
@ -22,9 +21,9 @@ public class TnDocumentInfo {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@Column(name = "doc_info_seq")
|
@Column(name = "doc_info_seq")
|
||||||
private int docInfoSeq;
|
private Integer docInfoSeq;
|
||||||
@Column(name = "group_seq", nullable = false)
|
@Column(name = "group_seq", nullable = false)
|
||||||
private int groupSeq;
|
private Integer groupSeq;
|
||||||
@Column(name = "kcsc_cd")
|
@Column(name = "kcsc_cd")
|
||||||
private String kcscCd;
|
private String kcscCd;
|
||||||
@Column(name = "old_kcsc_cd")
|
@Column(name = "old_kcsc_cd")
|
||||||
|
|
@ -34,7 +33,7 @@ public class TnDocumentInfo {
|
||||||
@Column(name = "doc_yr", nullable = false)
|
@Column(name = "doc_yr", nullable = false)
|
||||||
private String docYr;
|
private String docYr;
|
||||||
@Column(name = "doc_cycl", nullable = false)
|
@Column(name = "doc_cycl", nullable = false)
|
||||||
private int docCycl;
|
private Integer docCycl;
|
||||||
@Column(name = "doc_er", nullable = false)
|
@Column(name = "doc_er", nullable = false)
|
||||||
private String docEr;
|
private String docEr;
|
||||||
@Column(name = "estb_ymd")
|
@Column(name = "estb_ymd")
|
||||||
|
|
@ -44,7 +43,7 @@ public class TnDocumentInfo {
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date rvsnYmd;
|
private Date rvsnYmd;
|
||||||
@Column(name = "doc_rev_hist_seq")
|
@Column(name = "doc_rev_hist_seq")
|
||||||
private int docRevHistSeq;
|
private Integer docRevHistSeq;
|
||||||
@Column(name = "doc_brief", length = 1000)
|
@Column(name = "doc_brief", length = 1000)
|
||||||
private String docBrief;
|
private String docBrief;
|
||||||
@Column(name = "doc_rvsn_remark", length = 1000)
|
@Column(name = "doc_rvsn_remark", length = 1000)
|
||||||
|
|
@ -66,7 +65,7 @@ public class TnDocumentInfo {
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date aplcnEndYmd;
|
private Date aplcnEndYmd;
|
||||||
@Column(name = "doc_order", nullable = false)
|
@Column(name = "doc_order", nullable = false)
|
||||||
private int docOrder;
|
private Integer docOrder;
|
||||||
@Column(name = "last_yn", nullable = false)
|
@Column(name = "last_yn", nullable = false)
|
||||||
private char lastYn;
|
private char lastYn;
|
||||||
@Column(name = "doc_file_grp_id")
|
@Column(name = "doc_file_grp_id")
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,11 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
public interface TnDocumentInfoRepository extends JpaRepository<TnDocumentInfo, Integer> {
|
public interface TnDocumentInfoRepository extends JpaRepository<TnDocumentInfo, Integer> {
|
||||||
@Query(value = "select * from sp_get_tn_document_info_by_group_cd(null, :docCode)", nativeQuery = true)
|
@Query(value = "select * from sp_get_tn_document_info_by_group_cd(null, :docCode)", nativeQuery = true)
|
||||||
List<TnDocumentInfoInterface> spGetTnDocumentInfoByGroupCd(String docCode);
|
List<TnDocumentInfoInterface> spGetTnDocumentInfoByGroupCd(String docCode);
|
||||||
|
|
||||||
|
Optional<TnDocumentInfo> findByDocFileGrpId(String fileSeq);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue