검거보고서 작업완료

jiHyung 2022-10-07 16:29:19 +09:00
parent ef44c1564a
commit e6b6655ac3
18 changed files with 1069 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.dbnt.faisp.config;
import com.dbnt.faisp.fpiMgt.affair.service.AffairService;
import com.dbnt.faisp.fpiMgt.affairPlan.service.PlanService;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
import com.dbnt.faisp.publicBoard.service.PublicBoardService;
import lombok.RequiredArgsConstructor;
import org.springframework.util.FileCopyUtils;
@ -20,6 +21,7 @@ public class FileController {
private final PlanService planService;
private final PublicBoardService publicBoardService;
private final AffairService affairService;
private final BoardInvestigationService boardInvestigationService;
@GetMapping("/file/fileDownload")
public void fileDownload(HttpServletRequest request,
@ -38,6 +40,9 @@ public class FileController {
case "affair":
downloadFile = affairService.selectAffairFile(parentKey, fileSeq);
break;
case "ivsgt":
downloadFile = boardInvestigationService.selectIvsgtFile(parentKey, fileSeq);
break;
}
BufferedInputStream in;

View File

@ -0,0 +1,79 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation;
import com.dbnt.faisp.authMgt.service.AuthMgtService;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.ArrestType;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
import com.dbnt.faisp.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/ivsgt")
public class IvsgtController {
private final AuthMgtService authMgtService;
private final BoardInvestigationService boardInvestigationService;
@GetMapping("/arrest")
public ModelAndView ivsgt(@AuthenticationPrincipal UserInfo loginUser, BoardInvestigation boardInvestigation) {
ModelAndView mav = new ModelAndView("ivsgt/arrest");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/ivsgt/arrest").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
mav.addObject("boardInvestigationList", boardInvestigationService.selectBoardInvestigationList(boardInvestigation));
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
boardInvestigation.setQueryInfo();
boardInvestigation.setContentCnt(boardInvestigationService.selectBoardInvestigationListCnt(boardInvestigation));
boardInvestigation.setPaginationInfo();
mav.addObject("searchParams", boardInvestigation);
return mav;
}
@GetMapping("/arrestEditModal")
public ModelAndView arrestEditModal(@AuthenticationPrincipal UserInfo loginUser, BoardInvestigation boardInvestigation){
ModelAndView mav = new ModelAndView("ivsgt/arrestEditModal");
if(boardInvestigation.getIvsgtKey()!=null){
boardInvestigation = boardInvestigationService.selectBoardInvestigation(boardInvestigation.getIvsgtKey());
System.out.println(boardInvestigation.toString());
}else{
boardInvestigation.setWrtOrgan(loginUser.getOgCd());
boardInvestigation.setWrtNm(loginUser.getUserNm());
boardInvestigation.setWrtDt(LocalDateTime.now());
}
mav.addObject("boardInvestigation", boardInvestigation);
return mav;
}
@GetMapping("/arrestViewModal")
public ModelAndView arrestViewModal(@AuthenticationPrincipal UserInfo loginUser, BoardInvestigation boardInvestigation){
ModelAndView mav = new ModelAndView("ivsgt/arrestViewModal");
boardInvestigation = boardInvestigationService.selectBoardInvestigation(boardInvestigation.getIvsgtKey());
mav.addObject("boardInvestigation", boardInvestigation);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/ivsgt/arrest").get(0).getAccessAuth());
return mav;
}
@PostMapping("/saveBoardInvestigation")
public Integer saveBoardInvestigation(@AuthenticationPrincipal UserInfo loginUser,
BoardInvestigation boardInvestigation,
ArrestType arrestType,
MultipartHttpServletRequest request,
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
boardInvestigation.setWrtUserSeq(loginUser.getUserSeq());
boardInvestigation.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
return boardInvestigationService.saveBoardInvestigation(boardInvestigation, arrestType, deleteFileSeq);
}
}

View File

@ -0,0 +1,15 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.mapper;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.ArrestType;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BoardInvestigationMapper {
List<BoardInvestigation> selectBoardInvestigationList(BoardInvestigation boardInvestigation);
Integer selectBoardInvestigationListCnt(BoardInvestigation boardInvestigation);
String selectHashTags(Integer ivsgtKey);
ArrestType selectArrestType(Integer ivsgtKey);
}

View File

@ -0,0 +1,35 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.model;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "arrest_type")
public class ArrestType extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "arrest_type_key")
private Integer arrestTypeKey;
@Column(name = "ivsgt_key")
private Integer ivsgtKey;
@Column(name = "arrest_cd")
private String arrestCd;
@Column(name = "arrest_cd2")
private String arrestCd2;
@Transient
private String arrestCdName;
@Transient
private String arrestCd2Name;
}

View File

@ -0,0 +1,68 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.model;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "board_investigation")
public class BoardInvestigation extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ivsgt_key")
private Integer ivsgtKey;
@Column(name = "ivsgt_type")
private String ivsgtType;
@Column(name = "content_title")
private String contentTitle;
@Column(name = "content_info")
private String contentInfo;
@Column(name = "content_main")
private String contentMain;
@Column(name = "content_status")
private String contentStatus;
@Column(name = "wrt_organ")
private String wrtOrgan;
@Column(name = "wrt_user_seq")
private Integer wrtUserSeq;
@Column(name = "wrt_nm")
private String wrtNm;
@Column(name = "wrt_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime wrtDt;
@Transient
private Integer fileCnt;
@Transient
private List<IvsgtFile> fileList;
@Transient
private List<MultipartFile> multipartFileList;
@Transient
private List<String> contentInfos;
@Transient
private String hashTags;
@Transient
private ArrestType arrestType;
@Transient
private String arrestCd;
@Transient
private String arrestCd2;
@Transient
private String arrestCdName;
@Transient
private String arrestCd2Name;
}

View File

@ -0,0 +1,36 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "hash_tag_link_ivsgt")
@IdClass(HashTagLinkIvsgt.HashTagLinkIvsgtId.class)
public class HashTagLinkIvsgt {
@Id
@Column(name = "ivsgt_key")
private Integer ivsgtKey;
@Id
@Column(name = "tag_key")
private Integer tagKey;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class HashTagLinkIvsgtId implements Serializable {
private Integer ivsgtKey;
private Integer tagKey;
}
}

View File

@ -0,0 +1,47 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.model;
import com.dbnt.faisp.config.FileInfo;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "ivsgt_file")
@IdClass(IvsgtFile.IvsgtFileId.class)
public class IvsgtFile extends FileInfo {
@Id
@Column(name = "ivsgt_key")
private Integer ivsgtKey;
@Id
@Column(name = "file_seq")
private Integer fileSeq;
@Column(name = "orig_nm")
private String origNm;
@Column(name = "conv_nm")
private String convNm;
@Column(name = "file_extn")
private String fileExtn;
@Column(name = "file_size")
private String fileSize;
@Column(name = "save_path")
private String savePath;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class IvsgtFileId implements Serializable {
private Integer ivsgtKey;
private Integer fileSeq;
}
}

View File

@ -0,0 +1,26 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.model;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "parent_ivsgt")
public class parentIvsgt extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "parent_ivsgt")
private Integer parentIvsgt;
@Column(name = "ivsgt_key")
private String ivsgtKey;
}

View File

@ -0,0 +1,8 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.ArrestType;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ArrestTypeRepository extends JpaRepository<ArrestType, Integer> {
}

View File

@ -0,0 +1,8 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
import org.springframework.data.jpa.repository.JpaRepository;
public interface BoardInvestigationRepository extends JpaRepository<BoardInvestigation, Integer> {
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.HashTagLinkIvsgt;
import org.springframework.data.jpa.repository.JpaRepository;
public interface HashTagLinkIvsgtRepository extends JpaRepository<HashTagLinkIvsgt, HashTagLinkIvsgt.HashTagLinkIvsgtId> {
void deleteByIvsgtKey(Integer ivsgtKey);
}

View File

@ -0,0 +1,13 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.IvsgtFile;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface IvsgtFileRepository extends JpaRepository<IvsgtFile, IvsgtFile.IvsgtFileId> {
List<IvsgtFile> findByIvsgtKey(Integer ivsgtKey);
Optional<IvsgtFile> findTopByIvsgtKeyOrderByFileSeqDesc(Integer ivsgtKey);
}

View File

@ -0,0 +1,126 @@
package com.dbnt.faisp.ivsgtMgt.boardInvestigation.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.fpiMgt.affair.model.HashTag;
import com.dbnt.faisp.fpiMgt.affair.repository.HashTagRepository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.mapper.BoardInvestigationMapper;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.ArrestType;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.BoardInvestigation;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.HashTagLinkIvsgt;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.model.IvsgtFile;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository.ArrestTypeRepository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository.BoardInvestigationRepository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository.HashTagLinkIvsgtRepository;
import com.dbnt.faisp.ivsgtMgt.boardInvestigation.repository.IvsgtFileRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.List;
import java.util.UUID;
@Service
@RequiredArgsConstructor
public class BoardInvestigationService extends BaseService {
private final BoardInvestigationRepository boardInvestigationRepository;
private final IvsgtFileRepository ivsgtFileRepository;
private final ArrestTypeRepository arrestTypeRepository;
private final HashTagRepository hashTagRepository;
private final HashTagLinkIvsgtRepository hashTagLinkIvsgtRepository;
private final BoardInvestigationMapper boardInvestigationMapper;
public List<BoardInvestigation> selectBoardInvestigationList(BoardInvestigation boardInvestigation) {
return boardInvestigationMapper.selectBoardInvestigationList(boardInvestigation);
}
public Integer selectBoardInvestigationListCnt(BoardInvestigation boardInvestigation) {
return boardInvestigationMapper.selectBoardInvestigationListCnt(boardInvestigation);
}
public BoardInvestigation selectBoardInvestigation(Integer ivsgtKey) {
BoardInvestigation savedBoardInvestigation = boardInvestigationRepository.findById(ivsgtKey).orElse(null);
if (savedBoardInvestigation != null) {
savedBoardInvestigation.setFileList(ivsgtFileRepository.findByIvsgtKey(ivsgtKey));
savedBoardInvestigation.setHashTags(boardInvestigationMapper.selectHashTags(ivsgtKey));
savedBoardInvestigation.setArrestType(boardInvestigationMapper.selectArrestType(ivsgtKey));
}
return savedBoardInvestigation;
}
@Transactional
public Integer saveBoardInvestigation(BoardInvestigation boardInvestigation, ArrestType arrestType, List<Integer> deleteFileSeq) {
Integer ivsgtKey = boardInvestigationRepository.save(boardInvestigation).getIvsgtKey();
String[] hashTagAry = boardInvestigation.getHashTags().split(" ");
if(hashTagAry.length>0){
saveHashTagLink(ivsgtKey, hashTagAry);
}
arrestType.setIvsgtKey(ivsgtKey);
arrestTypeRepository.save(arrestType);
if(deleteFileSeq != null && deleteFileSeq.size()>0){
deletePlanFile(ivsgtKey, deleteFileSeq);
}
if(boardInvestigation.getMultipartFileList()!=null){
saveUploadFiles(ivsgtKey, boardInvestigation.getMultipartFileList());
}
return ivsgtKey;
}
private void saveUploadFiles(Integer ivsgtKey, List<MultipartFile> multipartFileList){
IvsgtFile lastFileInfo = ivsgtFileRepository.findTopByIvsgtKeyOrderByFileSeqDesc(ivsgtKey).orElse(null);
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
for(MultipartFile file : multipartFileList){
String saveName = UUID.randomUUID().toString();
String path = locationPath+ File.separator+"monthPlan"+File.separator;
saveFile(file, new File(path+File.separator+saveName));
String originalFilename = file.getOriginalFilename();
int extnIdx = originalFilename.lastIndexOf(".");
IvsgtFile fileInfo = new IvsgtFile();
fileInfo.setIvsgtKey(ivsgtKey);
fileInfo.setFileSeq(fileSeq++);
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
fileInfo.setConvNm(saveName);
fileInfo.setFileSize(calculationSize(file.getSize()));
fileInfo.setSavePath(path);
ivsgtFileRepository.save(fileInfo);
}
}
private void deletePlanFile(Integer ivsgtKey, List<Integer> deleteFileSeq) {
List<IvsgtFile> ivsgtFileList = ivsgtFileRepository.findByIvsgtKey(ivsgtKey);
for(IvsgtFile file: ivsgtFileList){
if(deleteFileSeq.contains(file.getFileSeq())){
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
ivsgtFileRepository.delete(file);
}
}
}
private void saveHashTagLink(Integer ivsgtKey, String[] hashTagAry){
hashTagLinkIvsgtRepository.deleteByIvsgtKey(ivsgtKey);
for(String tagNm : hashTagAry){
HashTag savedTag = hashTagRepository.findByTagNm(tagNm).orElse(null);
Integer tagKey;
if(savedTag==null){
HashTag tag = new HashTag();
tag.setTagNm(tagNm);
tagKey = hashTagRepository.save(tag).getTagKey();
}else{
tagKey = savedTag.getTagKey();
}
HashTagLinkIvsgt hashTagLinkIvsgt = new HashTagLinkIvsgt();
hashTagLinkIvsgt.setIvsgtKey(ivsgtKey);
hashTagLinkIvsgt.setTagKey(tagKey);
hashTagLinkIvsgtRepository.save(hashTagLinkIvsgt);
}
}
public FileInfo selectIvsgtFile(Integer parentKey, Integer fileSeq) {
return ivsgtFileRepository.findById(new IvsgtFile.IvsgtFileId(parentKey, fileSeq)).orElse(null);
}
}

View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.ivsgtMgt.boardInvestigation.mapper.BoardInvestigationMapper">
<sql id="selectBoardInvestigationListWhere">
<where>
<if test='wrtNm != null and wrtNm != ""'>
AND a.wrt_nm LIKE '%'||#{wrtNm}||'%'
</if>
<if test='wrtOrgan != null and wrtOrgan != ""'>
AND a.wrt_organ = #{wrtOrgan}
</if>
<if test='contentTitle != null and contentTitle != ""'>
AND a.content_title LIKE '%'||#{contentTitle}||'%'
</if>
<if test='dateSelector == "wrtDt"'>
<if test='startDate != null and startDate != ""'>
And a.wrt_dt >= #{startDate}::DATE
</if>
<if test='endDate != null and endDate != ""'>
AND a.wrt_dt &lt;= #{endDate}::DATE+1
</if>
</if>
</where>
</sql>
<select id="selectBoardInvestigationList" resultType="BoardInvestigation" parameterType="BoardInvestigation">
SELECT a.ivsgt_key,
a.ivsgt_type,
a.content_title,
a.content_info,
a.content_main,
a.content_status,
a.wrt_organ,
a.wrt_user_seq,
a.wrt_nm,
a.wrt_dt,
b.fileCnt,
t.arrest_cd,
t.arrest_cd2,
cm.item_value AS arrestCdName,
cm2.item_value AS arrestCd2Name
FROM board_investigation a
LEFT OUTER JOIN (
SELECT
ivsgt_key,
count(file_seq) AS fileCnt
FROM ivsgt_file
GROUP BY ivsgt_key
) b
ON a.ivsgt_key = b.ivsgt_key
INNER JOIN arrest_type t
ON a.ivsgt_key = t.ivsgt_key
INNER JOIN code_mgt cm
ON t.arrest_cd = cm.item_cd
INNER JOIN code_mgt cm2
ON t.arrest_cd2 = cm2.item_cd
<include refid="selectBoardInvestigationListWhere"></include>
ORDER BY ivsgt_key DESC
LIMIT #{rowCnt} OFFSET #{firstIndex}
</select>
<select id="selectBoardInvestigationListCnt" resultType="int" parameterType="BoardInvestigation">
SELECT count(*)
FROM board_investigation a
<include refid="selectBoardInvestigationListWhere"></include>
</select>
<select id="selectHashTags" resultType="string" parameterType="int">
SELECT aa.hashTags
FROM (
SELECT
array_to_string(array_agg(b.tag_nm), ' ') AS hashTags
FROM hash_tag_link_ivsgt a
INNER JOIN hash_tag b ON a.tag_key = b.tag_key
WHERE a.ivsgt_key = #{ivsgtKey}
GROUP BY a.ivsgt_key) aa
</select>
<select id="selectArrestType" resultType="ArrestType" parameterType="int">
SELECT
a.arrest_type_key,
a.ivsgt_key,
a.arrest_cd,
a.arrest_cd2,
cm.item_value AS arrestCdName,
cm2.item_value AS arrestCd2Name
FROM arrest_type a
INNER JOIN board_investigation i
ON i.ivsgt_key = a.ivsgt_key
INNER JOIN code_mgt cm
ON a.arrest_cd = cm.item_cd
INNER JOIN code_mgt cm2
ON a.arrest_cd2 = cm2.item_cd
WHERE a.ivsgt_key = #{ivsgtKey}
</select>
</mapper>

View File

@ -0,0 +1,143 @@
$(document).on('click', '#arrestAddBtn', function () {
getArrestEditModal(null);
});
$(document).on('click', '#arrestEditBtn', function () {
$("#arrestViewModal").modal('hide');
getArrestEditModal(Number($("#arrestViewBody").find("[name='ivsgtKey']").val()));
});
$(document).on('click', '#contentInfoAddBtn', function (){
$("#contentInfoDiv").append("<input type='text' class='form-control' name='contentInfos'>")
});
$(document).on('click', '#saveArrestBtn', function (){
saveBoardInvestigation('N')
});
$(document).on('click', '#saveTempBtn', function (){
saveBoardInvestigation('Y')
});
$(document).on('click', '.tr', function (){
getArrestViewModal($(this).data('key'));
});
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
});
function getArrestViewModal(ivsgtKey){
$.ajax({
url: '/ivsgt/arrestViewModal',
data: {ivsgtKey: ivsgtKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#arrestViewBody").empty().append(html)
$("#arrestViewModal").modal('show');
},
error:function(){
}
});
}
function getArrestEditModal(ivsgtKey){
$.ajax({
url: '/ivsgt/arrestEditModal',
data: {ivsgtKey: ivsgtKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#arrestEditModalContent").empty().append(html)
$("#arrestEditModal").modal('show');
$("[name='contentInfo']").summernote({
lang:'ko-KR',
height: 120,
disableDragAndDrop: true,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']]
]
});
$("[name='contentMain']").summernote({
lang:'ko-KR',
height: 120,
disableDragAndDrop: true,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']]
]
});
setUploadDiv();
},
error:function(){
}
});
}
function saveBoardInvestigation(contentState){
if(contentCheck()){
if(confirm("저장하시겠습니까?")){
$("#contentStatus").val(contentState);
contentFade("in");
const formData = new FormData($("#arrestEditForm")[0]);
for(const file of files) {
if(!file.isDelete)
formData.append('uploadFiles', file, file.name);
}
$(".text-decoration-line-through").each(function (idx, el){
formData.append('fileSeq', $(el).attr("data-fileseq"));
})
$.ajax({
type : 'POST',
data : formData,
url : "/ivsgt/saveBoardInvestigation",
processData: false,
contentType: false,
success : function(result) {
alert("저장되었습니다.");
contentFade("out");
$("#arrestEditModal").modal('hide');
getArrestViewModal(result);
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
}
}
function contentCheck(){
let flag = true;
if(!$("#contentTitle").val()){
alert("제목을 입력해주세요.")
flag = false;
}
else if(!$("#arrestCd").val()){
alert("검거유형1을 선택해주세요.")
flag = false;
}
else if(!$("#arrestCd2").val()){
alert("검거유형2를 선택해주세요.")
flag = false;
}
flag = fileCheck(flag, files);
return flag;
}

View File

@ -0,0 +1,160 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="~{layout/layout}">
<th:block layout:fragment="script">
<script type="text/javascript" th:src="@{/js/ivsgt/arrest.js}"></script>
</th:block>
<div layout:fragment="content">
<main class="pt-3">
<h4>사건 보고</h4>
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row mx-0">
<div class="col-12 card">
<div class="card-body">
<form method="get" th:action="@{/ivsgt/arrest}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<input type="hidden" name="dateSelector" value="wrtDt">
<div class="row justify-content-between pe-3 py-1">
<div class="col-auto">
<select class="form-select" name="rowCnt" id="rowCnt">
<th:block th:each="num : ${#numbers.sequence(1,5)}">
<option th:value="${num*10}" th:text="${num*10}" th:selected="${searchParams.rowCnt eq num*10}"></option>
</th:block>
</select>
</div>
<div class="col-auto">
<div class="row justify-content-end">
<div class="col-auto" sec:authorize="hasRole('ROLE_SUB_ADMIN')">
<select class="form-select form-select-sm" name="wrtOrgan">
<option value="">관서 선택</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.wrtOrgan}"></option>
</th:block>
</th:block>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" placeholder="제목" name="contentTitle" th:value="${searchParams.contentTitle}">
</div>
<div class="col-4">
<div class="input-group w-auto input-daterange" id="dateSelectorDiv">
<input type="text" class="form-control form-control-sm" id="startDate" name="startDate" placeholder="시작일" autocomplete="off" readonly th:value="${searchParams.startDate}">
<input type="text" class="form-control form-control-sm" id="endDate" name="endDate" placeholder="종료일" autocomplete="off" readonly th:value="${searchParams.endDate}">
</div>
</div>
<input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
</div>
</div>
</div>
</form>
<div class="row justify-content-start">
<!-- 탭 메뉴 -->
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="arrest-tab" data-bs-toggle="tab"
data-bs-target="#arrest" type="button" role="tab" aria-controls="arrest"
aria-selected="true">검거보고서</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="proceeding-tab" data-bs-toggle="tab"
data-bs-target="#proceeding" type="button" role="tab"
aria-controls="proceeding" aria-selected="false">진행보고서</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="result-tab" data-bs-toggle="tab"
data-bs-target="#result" type="button" role="tab"
aria-controls="result" aria-selected="false">결과보고서</button>
</li>
</ul>
<!-- 내용 -->
<div class="tab-content">
<div class="tab-pane fade show active" id="arrest" role="tabpanel"
aria-labelledby="arrest-tab">
<table class="table table-striped">
<thead>
<tr>
<th>문서번호</th>
<th>관서</th>
<th>검거유형1</th>
<th>검거유형2</th>
<th>제목</th>
<th>작성자</th>
<th>작성일</th>
</tr>
</thead>
<tbody>
<tr class="tr" th:each="boardInvestigation:${boardInvestigationList}" th:data-key="${boardInvestigation.ivsgtKey}">
<td th:text="${boardInvestigation.ivsgtKey}"></td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${boardInvestigation.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<td th:text="${boardInvestigation.arrestCdName}"></td>
<td th:text="${boardInvestigation.arrestCd2Name}"></td>
<td th:text="${boardInvestigation.contentStatus == 'Y' ? '[임시저장]' : ''} + ${boardInvestigation.contentTitle}"></td>
<td th:text="${boardInvestigation.wrtNm}"></td>
<td th:text="${#temporals.format(boardInvestigation.wrtDt, 'yyyy-MM-dd')}"></td>
</tr>
</tbody>
</table>
<button id="arrestAddBtn">등록</button>
</div>
<div class="tab-pane fade" id="proceeding" role="tabpanel"
aria-labelledby="proceeding-tab">진행보고서</div>
<div class="tab-pane fade" id="result" role="tabpanel"
aria-labelledby="result-tab">결과보고서</div>
</div>
</div>
<!-- 페이징 -->
<div class="row justify-content-center">
<div class="col-auto">
<nav aria-label="Page navigation">
<ul class="pagination">
<th:block th:if="${searchParams.pageIndex>3}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)-3}">
<a class="page-link" href="#" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
</th:block>
<th:block th:each="num : ${#numbers.sequence(searchParams.startNum, searchParams.endNum)}">
<li class="page-item" th:data-pageindex="${num}" th:classappend="${searchParams.pageIndex eq num?'active':''}">
<a class="page-link" href="#" th:text="${num}"></a>
</li>
</th:block>
<th:block th:if="${searchParams.maxNum>searchParams.endNum+2}">
<li class="page-item" th:data-pageindex="${(searchParams.pageIndex)+3}">
<a class="page-link" href="#" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</th:block>
</ul>
</nav>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="arrestEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="arrestEditModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="arrestEditModalContent">
</div>
</div>
</div>
<div class="modal fade" id="arrestViewModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="arrestViewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="arrestViewBody">
</div>
</div>
</div>
</main>
</div>
</html>

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title" id="planEditModalLabel" th:text="${boardInvestigation.ivsgtKey eq null?'검거보고서 작성':'검거보고서 수정'}"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="arrestEditBody">
<form action="#" method="post" id="arrestEditForm">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<input type="hidden" name="ivsgtKey" th:value="${boardInvestigation.ivsgtKey}">
<input type="hidden" name="ivsgtKey" th:value="${boardInvestigation.wrtNm}">
<input type="hidden" name="ivsgtKey" th:value="${boardInvestigation.wrtDt}">
<input type="hidden" name="wrtOrgan" th:value="${boardInvestigation.wrtOrgan}">
<input type="hidden" id="contentStatus" name="contentStatus">
<input type="hidden" name="ivsgtType" value="arrest">
<div class="mb-3 row">
<label for="wrtNm" class="col-sm-2 col-form-label text-center">작성자</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="wrtNm" name="wrtNm" th:value="${boardInvestigation.wrtNm}" readonly>
</div>
<label for="wrtDt" class="col-sm-2 col-form-label text-center">작성일시</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="wrtDt" name="wrtDt" th:value="${#temporals.format(boardInvestigation.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
</div>
</div>
<div class="mb-3 row">
<label for="contentTitle" class="col-sm-2 col-form-label text-center">제목</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="contentTitle" name="contentTitle" th:value="${boardInvestigation.contentTitle}">
</div>
</div>
<div class="mb-3 row" id="arrestTypeDiv">
<label class="col-sm-2 col-form-label text-center">검거유형1</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" name="arrestCd" id="arrestCd">
<option value="">검거유형1 선택-</option>
<th:block th:each="commonCode:${session.commonCode.get('AT1')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
th:selected="${boardInvestigation.arrestType != null and commonCode.itemCd eq boardInvestigation.arrestType.arrestCd}"></option>
</th:block>
</select>
</div>
<label class="col-sm-2 col-form-label text-center">검거유형2</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" name="arrestCd2" id="arrestCd2">
<option value="">검거유형2 선택-</option>
<th:block th:each="commonCode:${session.commonCode.get('AT2')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
th:selected="${boardInvestigation.arrestType != null and commonCode.itemCd eq boardInvestigation.arrestType.arrestCd2}"></option>
</th:block>
</select>
</div>
</div>
<div class="mb-3 row">
<label for="hashTags" class="col-sm-2 col-form-label col-form-label-sm text-center">해시태그</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm" id="hashTags" name="hashTags" th:value="${boardInvestigation.hashTags}"
placeholder="띄어쓰기로 각 태그를 구분합니다. 한 태그 내에서는 띄어쓰기 없이 입력해주세요. ex)태그1 태그2">
</div>
</div>
<div class="mb-3 row justify-content-center">
<label for="contentInfoDiv" class="col-sm-2 col-form-label text-center">사건개요</label>
<div class="col-sm-10" id="contentInfoDiv">
<textarea type='text' name='contentInfo' th:utext="${boardInvestigation.contentInfo}"></textarea>
</div>
<div class="mb-3 row justify-content-center">
<label for="contentMainDiv" class="col-sm-2 col-form-label text-center">주요내용</label>
<div class="col-sm-10" id="contentMainDiv">
<textarea type='text' name='contentMain' th:utext="${boardInvestigation.contentMain}"></textarea>
</div>
</div>
<div class="row mb-3">
<label for="fileInputer" class="col-sm-2 col-form-label text-center">업로드 자료</label>
<div class="col-sm-10" style="min-height: 70px;">
<div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
<th:block th:if="${#arrays.isEmpty(boardInvestigation.fileList)}">
<br>파일을 업로드 해주세요.
</th:block>
<th:block th:unless="${#arrays.isEmpty(boardInvestigation.fileList)}">
<div class='row-col-6' th:each="ivsgtFile:${boardInvestigation.fileList}">
<span th:data-fileseq="${ivsgtFile.fileSeq}" th:text="|${ivsgtFile.origNm}.${ivsgtFile.fileExtn} ${ivsgtFile.fileSize}|"></span>
<a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>
</div>
</th:block>
</div>
</div>
<input type="file" class="d-none" id="fileInputer" multiple>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-warning" id="saveTempBtn">임시저장</button>
<button type="button" class="btn btn-primary" id="saveArrestBtn">저장</button>
</div>
</html>

View File

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title" id="arrestViewModalLabel">검거보고서</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="arrestViewBody">
<form action="#" method="post" id="arrestEditForm">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<input type="hidden" name="ivsgtKey" th:value="${boardInvestigation.ivsgtKey}">
<input type="hidden" name="wrtOrgan" th:value="${boardInvestigation.wrtOrgan}">
<input type="hidden" name="contentState">
<input type="hidden" name="ivsgtType" value="arrest">
<div class="mb-3 row">
<label for="wrtUserNm" class="col-sm-2 col-form-label text-center">작성자</label>
<div class="col-sm-2">
<input type="text" class="form-control border-0" id="wrtUserNm" name="wrtUserNm" th:value="${boardInvestigation.wrtNm}" readonly>
</div>
<label for="wrtDt" class="col-sm-2 col-form-label text-center">작성일시</label>
<div class="col-sm-2">
<input type="text" class="form-control border-0" id="wrtDt" name="wrtDt" th:value="${#temporals.format(boardInvestigation.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
</div>
</div>
<div class="mb-3 row">
<label for="contentTitle" class="col-sm-2 col-form-label text-center">제목</label>
<div class="col-sm-10">
<input type="text" class="form-control border-0" id="contentTitle" name="contentTitle" th:value="${boardInvestigation.contentTitle}" readonly>
</div>
</div>
<div class="mb-3 row" id="arrestTypeDiv">
<label class="col-sm-2 col-form-label text-center">검거유형1</label>
<div class="col-sm-2">
<div th:utext="${boardInvestigation.arrestType.arrestCdName}"></div>
</div>
<label class="col-sm-2 col-form-label text-center">검거유형2</label>
<div class="col-sm-2">
<div th:utext="${boardInvestigation.arrestType.arrestCd2Name}"></div>
</div>
</div>
<div class="mb-3 row">
<label for="hashTags" class="col-sm-2 col-form-label col-form-label-sm text-center">해시태그</label>
<div class="col-sm-10">
<input type="text" class="form-control form-control-sm border-0" id="hashTags" name="hashTags" th:value="${boardInvestigation.hashTags}"
placeholder="없음" readonly>
</div>
</div>
<div class="mb-3 row justify-content-center">
<div class="col-8">
<div class="mb-3 row">
<label for="contentInfoDiv" class="col-sm-2 col-form-label text-center">사건개요</label>
<div class="col-sm-10" id="contentInfoDiv">
<textarea type='text' class="col-sm-10" name='contentInfos'th:utext="${boardInvestigation.contentInfo}" readonly></textarea>
</div>
</div>
<div class="mb-3 row">
<label for="contentMainDiv" class="col-sm-2 col-form-label text-center">주요내용</label>
<div class="col-sm-10" id="contentMainDiv">
<textarea type='text' class="col-sm-10" name='contentMain' th:utext="${boardInvestigation.contentMain}" readonly></textarea>
</div>
</div>
</div>
<div class="col-4">
<table class="table">
<thead>
<tr>
<th>파일명</th>
<th>사이즈</th>
</tr>
</thead>
<tbody>
<th:block th:if="${#lists.isEmpty(boardInvestigation.fileList)}">
<tr>
<td colspan="2">파일이 없습니다.</td>
</tr>
</th:block>
<th:block th:unless="${#lists.isEmpty(boardInvestigation.fileList)}">
<th:block th:each="file:${boardInvestigation.fileList}">
<tr class="fileInfoTr">
<td><a href="#" class="fileDownLink" data-board="ivsgt"
th:data-parentkey="${file.ivsgtKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a></td>
<td th:text="${file.fileSize}"></td>
</tr>
</th:block>
</th:block>
</tbody>
</table>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<th:block th:if="${userSeq eq boardInvestigation.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="arrestEditBtn">수정</button>
</th:block>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>
</html>