Compare commits
3 Commits
458594779c
...
f1f0602d4e
| Author | SHA1 | Date |
|---|---|---|
|
|
f1f0602d4e | |
|
|
38edb60201 | |
|
|
3079a00832 |
|
|
@ -1,13 +1,9 @@
|
|||
import React from "react";
|
||||
import { SERVER_URL } from 'config';
|
||||
import * as File from "utils/file"
|
||||
import {Button, Modal, Nav} from "react-bootstrap";
|
||||
|
||||
function HistoryModal({closeFn, standardCode}){
|
||||
|
||||
function fileDownload(fileSeq){
|
||||
window.open(encodeURI(SERVER_URL+'/file/download?fileSeq='+fileSeq));
|
||||
}
|
||||
|
||||
return(
|
||||
<>
|
||||
<Modal.Header closeButton>
|
||||
|
|
@ -30,11 +26,11 @@ function HistoryModal({closeFn, standardCode}){
|
|||
<div className="mainCategory">{history.rvsnYmd.split('T')[0]}</div>
|
||||
<div className="middleCategory">
|
||||
{history.docFileGrpId}
|
||||
{history.docFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownload(history.docFileGrpId)}>다운로드 </Button>:''}
|
||||
{history.docFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>File.standardCode(history.docFileGrpId)}>다운로드 </Button>:''}
|
||||
</div>
|
||||
<div className="kcscCd">
|
||||
{history.rvsnFileGrpId}
|
||||
{history.rvsnFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownload(history.rvsnFileGrpId)}>다운로드 </Button>:''}
|
||||
{history.rvsnFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>File.download(history.rvsnFileGrpId)}>다운로드 </Button>:''}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
import React, { useState, useEffect, useCallback } from 'react';
|
||||
import { useLocation, useParams } from 'react-router-dom';
|
||||
import SbItem from './SbItem'
|
||||
import Loading from 'components/Loading'
|
||||
import BookmarkModal from './BookmarkModal';
|
||||
import {SbContainer} from './Sb.style'
|
||||
import {VwDiv, VwPtag} from './Vw.style'
|
||||
import Form from 'react-bootstrap/Form'
|
||||
import Row from 'react-bootstrap/Row';
|
||||
|
|
@ -16,6 +14,7 @@ import {parseJwt} from "utils/parseJwt";
|
|||
import Button from "react-bootstrap/Button";
|
||||
import {InputGroup} from "react-bootstrap";
|
||||
import ViewerTree from "./ViewerTree";
|
||||
import * as File from "utils/file";
|
||||
|
||||
function CodeViewer(props) {
|
||||
const [treeLoading, setTreeLoading] = useState(true);
|
||||
|
|
@ -73,6 +72,8 @@ function CodeViewer(props) {
|
|||
let optionTag = [];
|
||||
let activeIndex = 0;
|
||||
let docTitle = "";
|
||||
let docFileGrpId = "";
|
||||
let rvsnFileGrpId = "";
|
||||
if(ymd===undefined){
|
||||
activeIndex = docInfo.length-1
|
||||
docTitle = docInfo[docInfo.length-1].doc_nm
|
||||
|
|
@ -95,7 +96,10 @@ function CodeViewer(props) {
|
|||
if(index === activeIndex){
|
||||
buttonClass += "docInfoActive"
|
||||
pClass += "yearInfoActive"
|
||||
docFileGrpId = item.doc_file_grp_id;
|
||||
rvsnFileGrpId = item.rvsn_file_grp_id;
|
||||
}
|
||||
|
||||
optionTag.push(
|
||||
<Col>
|
||||
<input type="button"
|
||||
|
|
@ -109,7 +113,22 @@ function CodeViewer(props) {
|
|||
<p className={pClass}>{item.doc_yr}</p>
|
||||
</Col>)
|
||||
})
|
||||
headTag.push(<Row className="docInfoRow"><Col className="docInfoTitle">{docCode} {docTitle}</Col>{optionTag}</Row>)
|
||||
headTag.push(
|
||||
<>
|
||||
<Col xs={"auto"}>
|
||||
<Row className="docInfoRow">
|
||||
<Col className="docInfoTitle">{docCode} {docTitle}</Col>
|
||||
{optionTag}
|
||||
</Row>
|
||||
</Col>
|
||||
<Col>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="연혁"/>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="2단비교"/>
|
||||
{rvsnFileGrpId?<input type="button" className="btn btn-sm btn-primary optionBtn" value="신구조문" onClick={()=>{File.download(rvsnFileGrpId)}}/>:''}
|
||||
{docFileGrpId?<input type="button" className="btn btn-sm btn-primary optionBtn" value="첨부파일" onClick={()=>{File.standardCode(docFileGrpId)}}/>:''}
|
||||
</Col>
|
||||
</>
|
||||
)
|
||||
}else{
|
||||
headTag.push(<div>검색된 결과가 없습니다.</div>); // 코드 목록 초기값
|
||||
}
|
||||
|
|
@ -409,13 +428,7 @@ function CodeViewer(props) {
|
|||
<Row className="justify-content-between">
|
||||
<Col xs={"auto"}>
|
||||
<Row>
|
||||
<Col xs={"auto"}>{docInfo}</Col>
|
||||
<Col>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="연혁"/>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="2단비교"/>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="신구조문"/>
|
||||
<input type="button" className="btn btn-sm btn-primary optionBtn" value="첨부파일"/>
|
||||
</Col>
|
||||
{docInfo}
|
||||
</Row>
|
||||
</Col>
|
||||
<Col xs={"auto"}>
|
||||
|
|
|
|||
|
|
@ -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 javax.persistence.*;
|
||||
import java.time.LocalDate;
|
||||
import java.awt.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Getter
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
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.ThPrivacyLog;
|
||||
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.ThLoginLogRepository;
|
||||
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 org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -24,6 +29,8 @@ public class AdminLogsService extends EgovAbstractServiceImpl {
|
|||
private final PrivacyLogsRepository privacyLogsRepository;
|
||||
private final ThLoginLogRepository loginLogRepository;
|
||||
private final UserLogsRepository userLogsRepository;
|
||||
private final FileLogsRepository fileLogsRepository;
|
||||
private final TnDocumentInfoRepository documentInfoRepository;
|
||||
|
||||
public Map<String, Object> selectPrivacyList() {
|
||||
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/fms/FileDown.do", //파일 다운로드
|
||||
"/file/download", //파일 다운로드
|
||||
"/file/standardCode-download", //파일 다운로드
|
||||
"/cmm/fms/getImage.do", //갤러리 이미지보기
|
||||
|
||||
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
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.file.entity.TnAttachFile;
|
||||
import com.dbnt.kcscbackend.file.service.FileService;
|
||||
import com.dbnt.kcscbackend.standardCode.service.StandardCodeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
|
@ -20,37 +23,22 @@ import java.io.*;
|
|||
public class FileController {
|
||||
|
||||
private final FileService fileService;
|
||||
private final StandardCodeService standardCodeService;
|
||||
private final AdminLogsService adminLogsService;
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/download")
|
||||
public void download(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
|
||||
|
||||
tnAttachFile = fileService.selectTnAttachFile(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();
|
||||
}
|
||||
}
|
||||
fileDownload(request, response, tnAttachFile);
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/standardCode/download")
|
||||
public void standardCodeDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = "/standardCode-download")
|
||||
public void standardCodeDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile, String userId) throws Exception{
|
||||
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){
|
||||
BufferedInputStream in;
|
||||
BufferedOutputStream out;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package com.dbnt.kcscbackend.standardCode.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
|
@ -22,9 +21,9 @@ public class TnDocumentInfo {
|
|||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "doc_info_seq")
|
||||
private int docInfoSeq;
|
||||
private Integer docInfoSeq;
|
||||
@Column(name = "group_seq", nullable = false)
|
||||
private int groupSeq;
|
||||
private Integer groupSeq;
|
||||
@Column(name = "kcsc_cd")
|
||||
private String kcscCd;
|
||||
@Column(name = "old_kcsc_cd")
|
||||
|
|
@ -34,7 +33,7 @@ public class TnDocumentInfo {
|
|||
@Column(name = "doc_yr", nullable = false)
|
||||
private String docYr;
|
||||
@Column(name = "doc_cycl", nullable = false)
|
||||
private int docCycl;
|
||||
private Integer docCycl;
|
||||
@Column(name = "doc_er", nullable = false)
|
||||
private String docEr;
|
||||
@Column(name = "estb_ymd")
|
||||
|
|
@ -44,7 +43,7 @@ public class TnDocumentInfo {
|
|||
@Temporal(TemporalType.DATE)
|
||||
private Date rvsnYmd;
|
||||
@Column(name = "doc_rev_hist_seq")
|
||||
private int docRevHistSeq;
|
||||
private Integer docRevHistSeq;
|
||||
@Column(name = "doc_brief", length = 1000)
|
||||
private String docBrief;
|
||||
@Column(name = "doc_rvsn_remark", length = 1000)
|
||||
|
|
@ -66,7 +65,7 @@ public class TnDocumentInfo {
|
|||
@Temporal(TemporalType.DATE)
|
||||
private Date aplcnEndYmd;
|
||||
@Column(name = "doc_order", nullable = false)
|
||||
private int docOrder;
|
||||
private Integer docOrder;
|
||||
@Column(name = "last_yn", nullable = false)
|
||||
private char lastYn;
|
||||
@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 java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface TnDocumentInfoRepository extends JpaRepository<TnDocumentInfo, Integer> {
|
||||
@Query(value = "select * from sp_get_tn_document_info_by_group_cd(null, :docCode)", nativeQuery = true)
|
||||
List<TnDocumentInfoInterface> spGetTnDocumentInfoByGroupCd(String docCode);
|
||||
|
||||
Optional<TnDocumentInfo> findByDocFileGrpId(String fileSeq);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue