Compare commits

..

No commits in common. "f1f0602d4e372033b93f712dd3d0f7300700cfa5" and "458594779c3cbff3c360f96c4122672103811839" have entirely different histories.

9 changed files with 49 additions and 87 deletions

View File

@ -1,9 +1,13 @@
import React from "react";
import * as File from "utils/file"
import { SERVER_URL } from 'config';
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>
@ -26,11 +30,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={()=>File.standardCode(history.docFileGrpId)}>다운로드 </Button>:''}
{history.docFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownload(history.docFileGrpId)}>다운로드 </Button>:''}
</div>
<div className="kcscCd">
{history.rvsnFileGrpId}
{history.rvsnFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>File.download(history.rvsnFileGrpId)}>다운로드 </Button>:''}
{history.rvsnFileGrpId?<Button size={"sm"} variant={"outline-secondary"} onClick={()=>fileDownload(history.rvsnFileGrpId)}>다운로드 </Button>:''}
</div>
</div>
)

View File

@ -1,7 +1,9 @@
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';
@ -14,7 +16,6 @@ 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);
@ -72,8 +73,6 @@ 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
@ -96,10 +95,7 @@ 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"
@ -113,22 +109,7 @@ function CodeViewer(props) {
<p className={pClass}>{item.doc_yr}</p>
</Col>)
})
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>
</>
)
headTag.push(<Row className="docInfoRow"><Col className="docInfoTitle">{docCode} {docTitle}</Col>{optionTag}</Row>)
}else{
headTag.push(<div>검색된 결과가 없습니다.</div>); //
}
@ -428,7 +409,13 @@ function CodeViewer(props) {
<Row className="justify-content-between">
<Col xs={"auto"}>
<Row>
{docInfo}
<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>
</Row>
</Col>
<Col xs={"auto"}>

View File

@ -1,11 +0,0 @@
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));
}

View File

@ -9,6 +9,8 @@ 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

View File

@ -1,16 +1,11 @@
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;
@ -29,8 +24,6 @@ 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<>();
@ -100,26 +93,4 @@ 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);
}
}

View File

@ -72,7 +72,6 @@ public class SecurityConfig {
"/cmm/main/**.do", // 메인페이지
"/cmm/fms/FileDown.do", //파일 다운로드
"/file/download", //파일 다운로드
"/file/standardCode-download", //파일 다운로드
"/cmm/fms/getImage.do", //갤러리 이미지보기
"/cop/bbs/selectUserBBSMasterInfAPI.do", //게시판 마스터 상세 조회

View File

@ -1,13 +1,10 @@
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;
@ -23,22 +20,37 @@ import java.io.*;
public class FileController {
private final FileService fileService;
private final AdminLogsService adminLogsService;
private final StandardCodeService standardCodeService;
@RequestMapping(method = RequestMethod.GET, value = "/download")
public void download(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
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")
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);
}
@RequestMapping(method = RequestMethod.GET, value = "/standardCode/download")
public void standardCodeDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile) throws Exception{
tnAttachFile = fileService.selectTnAttachFile(tnAttachFile);
private void fileDownload(HttpServletRequest request, HttpServletResponse response, TnAttachFile tnAttachFile){
if(tnAttachFile != null){
BufferedInputStream in;
BufferedOutputStream out;

View File

@ -1,6 +1,7 @@
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;
@ -21,9 +22,9 @@ public class TnDocumentInfo {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "doc_info_seq")
private Integer docInfoSeq;
private int docInfoSeq;
@Column(name = "group_seq", nullable = false)
private Integer groupSeq;
private int groupSeq;
@Column(name = "kcsc_cd")
private String kcscCd;
@Column(name = "old_kcsc_cd")
@ -33,7 +34,7 @@ public class TnDocumentInfo {
@Column(name = "doc_yr", nullable = false)
private String docYr;
@Column(name = "doc_cycl", nullable = false)
private Integer docCycl;
private int docCycl;
@Column(name = "doc_er", nullable = false)
private String docEr;
@Column(name = "estb_ymd")
@ -43,7 +44,7 @@ public class TnDocumentInfo {
@Temporal(TemporalType.DATE)
private Date rvsnYmd;
@Column(name = "doc_rev_hist_seq")
private Integer docRevHistSeq;
private int docRevHistSeq;
@Column(name = "doc_brief", length = 1000)
private String docBrief;
@Column(name = "doc_rvsn_remark", length = 1000)
@ -65,7 +66,7 @@ public class TnDocumentInfo {
@Temporal(TemporalType.DATE)
private Date aplcnEndYmd;
@Column(name = "doc_order", nullable = false)
private Integer docOrder;
private int docOrder;
@Column(name = "last_yn", nullable = false)
private char lastYn;
@Column(name = "doc_file_grp_id")

View File

@ -6,11 +6,8 @@ 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);
}