diff --git a/src/main/java/com/dbnt/faisp/config/FileController.java b/src/main/java/com/dbnt/faisp/config/FileController.java index de8773c9..6b49c312 100644 --- a/src/main/java/com/dbnt/faisp/config/FileController.java +++ b/src/main/java/com/dbnt/faisp/config/FileController.java @@ -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; diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/IvsgtController.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/IvsgtController.java new file mode 100644 index 00000000..ecb158f8 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/IvsgtController.java @@ -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 deleteFileSeq){ + boardInvestigation.setWrtUserSeq(loginUser.getUserSeq()); + boardInvestigation.setMultipartFileList(request.getMultiFileMap().get("uploadFiles")); + return boardInvestigationService.saveBoardInvestigation(boardInvestigation, arrestType, deleteFileSeq); + } +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/mapper/BoardInvestigationMapper.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/mapper/BoardInvestigationMapper.java new file mode 100644 index 00000000..2da33b82 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/mapper/BoardInvestigationMapper.java @@ -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 selectBoardInvestigationList(BoardInvestigation boardInvestigation); + Integer selectBoardInvestigationListCnt(BoardInvestigation boardInvestigation); + String selectHashTags(Integer ivsgtKey); + ArrestType selectArrestType(Integer ivsgtKey); +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/ArrestType.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/ArrestType.java new file mode 100644 index 00000000..3ac3fdea --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/ArrestType.java @@ -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; +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/BoardInvestigation.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/BoardInvestigation.java new file mode 100644 index 00000000..698694b3 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/BoardInvestigation.java @@ -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 fileList; + @Transient + private List multipartFileList; + @Transient + private List 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; +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/HashTagLinkIvsgt.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/HashTagLinkIvsgt.java new file mode 100644 index 00000000..de1aee93 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/HashTagLinkIvsgt.java @@ -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; + } + +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/IvsgtFile.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/IvsgtFile.java new file mode 100644 index 00000000..86b7beed --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/IvsgtFile.java @@ -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; + } + +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/parentIvsgt.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/parentIvsgt.java new file mode 100644 index 00000000..1554ca5c --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/model/parentIvsgt.java @@ -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; +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/ArrestTypeRepository.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/ArrestTypeRepository.java new file mode 100644 index 00000000..cd59d916 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/ArrestTypeRepository.java @@ -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 { + +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/BoardInvestigationRepository.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/BoardInvestigationRepository.java new file mode 100644 index 00000000..5c2304c1 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/BoardInvestigationRepository.java @@ -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 { +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/HashTagLinkIvsgtRepository.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/HashTagLinkIvsgtRepository.java new file mode 100644 index 00000000..d6e406b7 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/HashTagLinkIvsgtRepository.java @@ -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 { + void deleteByIvsgtKey(Integer ivsgtKey); +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/IvsgtFileRepository.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/IvsgtFileRepository.java new file mode 100644 index 00000000..f2c767f7 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/repository/IvsgtFileRepository.java @@ -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 { + List findByIvsgtKey(Integer ivsgtKey); + Optional findTopByIvsgtKeyOrderByFileSeqDesc(Integer ivsgtKey); +} diff --git a/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/service/BoardInvestigationService.java b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/service/BoardInvestigationService.java new file mode 100644 index 00000000..ee767bd6 --- /dev/null +++ b/src/main/java/com/dbnt/faisp/ivsgtMgt/boardInvestigation/service/BoardInvestigationService.java @@ -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 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 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 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 deleteFileSeq) { + List 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); + } +} diff --git a/src/main/resources/mybatisMapper/BoardInvestigationMapper.xml b/src/main/resources/mybatisMapper/BoardInvestigationMapper.xml new file mode 100644 index 00000000..f572db08 --- /dev/null +++ b/src/main/resources/mybatisMapper/BoardInvestigationMapper.xml @@ -0,0 +1,95 @@ + + + + + + + + + AND a.wrt_nm LIKE '%'||#{wrtNm}||'%' + + + AND a.wrt_organ = #{wrtOrgan} + + + AND a.content_title LIKE '%'||#{contentTitle}||'%' + + + + And a.wrt_dt >= #{startDate}::DATE + + + AND a.wrt_dt <= #{endDate}::DATE+1 + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/static/js/ivsgt/arrest.js b/src/main/resources/static/js/ivsgt/arrest.js new file mode 100644 index 00000000..c281f441 --- /dev/null +++ b/src/main/resources/static/js/ivsgt/arrest.js @@ -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("") +}); + +$(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; +} \ No newline at end of file diff --git a/src/main/resources/templates/ivsgt/arrest.html b/src/main/resources/templates/ivsgt/arrest.html new file mode 100644 index 00000000..45134b03 --- /dev/null +++ b/src/main/resources/templates/ivsgt/arrest.html @@ -0,0 +1,160 @@ + + + + + +
+
+

사건 보고

+ + +
+
+
+
+ + +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+
+
+ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
문서번호관서검거유형1검거유형2제목작성자작성일
+ +
+
진행보고서
+
결과보고서
+
+
+ +
+
+ +
+
+
+
+
+ + + +
+
+ \ No newline at end of file diff --git a/src/main/resources/templates/ivsgt/arrestEditModal.html b/src/main/resources/templates/ivsgt/arrestEditModal.html new file mode 100644 index 00000000..874af6b8 --- /dev/null +++ b/src/main/resources/templates/ivsgt/arrestEditModal.html @@ -0,0 +1,98 @@ + + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/ivsgt/arrestViewModal.html b/src/main/resources/templates/ivsgt/arrestViewModal.html new file mode 100644 index 00000000..d91b3b0d --- /dev/null +++ b/src/main/resources/templates/ivsgt/arrestViewModal.html @@ -0,0 +1,98 @@ + + + + + + \ No newline at end of file