Compare commits

...

2 Commits

14 changed files with 1206 additions and 0 deletions

View File

@ -0,0 +1,196 @@
package com.dbnt.faisp.fpiMgt.affairResult;
import com.dbnt.faisp.authMgt.service.AuthMgtService;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultApprv;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultBoard;
import com.dbnt.faisp.fpiMgt.affairResult.service.ResultService;
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("/affairResult")
public class ResultController { // 첩보수집활동 > 외사경찰 견문관리 > 계획수립
private final ResultService resultService;
private final AuthMgtService authMgtService;
@GetMapping("/resultMgt")
public ModelAndView resultMgtPage(@AuthenticationPrincipal UserInfo loginUser, ResultBoard resultBoard){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairResult/resultMgt");
mav.addObject("page", "main");
mav.addObject("searchUrl", "/affairResult/resultMgt");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getAccessAuth();
switch (accessAuth){
case "ACC001": // 조회
case "ACC002": // 작성 // 자신이 작성한 문서만 열람가능
resultBoard.setWrtUserSeq(loginUser.getUserSeq());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
resultBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getApprovalAuth();
mav.addObject("accessAuth", accessAuth);
mav.addObject("apprvAuth", apprvAuth);
resultBoard.setQueryInfo();
mav.addObject("resultList", resultService.selectResultBoardList(resultBoard));
resultBoard.setContentCnt(resultService.selectResultBoardListCnt(resultBoard));
resultBoard.setPaginationInfo();
mav.addObject("searchParams", resultBoard);
return mav;
}
@GetMapping("/stayPage")
public ModelAndView apprvStayPage(@AuthenticationPrincipal UserInfo loginUser, ResultBoard resultBoard){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairResult/resultMgt");
mav.addObject("page", "stay");
mav.addObject("searchUrl", "/affairResult/stayPage");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getAccessAuth();
switch (accessAuth){
case "ACC001": // 조회
case "ACC002": // 작성 // 자신의 관서 내에서 작성한 문서만 열람가능
resultBoard.setWrtOrgan(loginUser.getOgCd());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
resultBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getApprovalAuth();
if(apprvAuth==null) {
if(!accessAuth.equals("ACC003")){
resultBoard.setWrtUserSeq(loginUser.getUserSeq());
resultBoard.setUserType("normalStayList");
}else{
resultBoard.setUserType("managerStayList");
}
}else{
mav.addObject("userNm", loginUser.getUserNm());
switch (apprvAuth){
case "APC004": // 계장대행
case "APC003": // 계장 // 결재대기 문서 조회
resultBoard.setResultState("DST002");
break;
case "APC002": // 부장대행
case "APC001": // 부장 // 계장승인 문서 조회
resultBoard.setResultState("DST004");
break;
}
}
mav.addObject("accessAuth", accessAuth);
mav.addObject("apprvAuth", apprvAuth);
resultBoard.setQueryInfo();
mav.addObject("resultList", resultService.selectResultBoardList(resultBoard));
resultBoard.setContentCnt(resultService.selectResultBoardListCnt(resultBoard));
resultBoard.setPaginationInfo();
mav.addObject("searchParams", resultBoard);
return mav;
}
@GetMapping("/commitPage")
public ModelAndView apprvCommitPage(@AuthenticationPrincipal UserInfo loginUser, ResultBoard resultBoard){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairResult/resultMgt");
mav.addObject("page", "commit");
mav.addObject("searchUrl", "/affairResult/commitPage");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getAccessAuth();
switch (accessAuth){
case "ACC001": // 조회
case "ACC002": // 작성 // 자신의 관서 내에서 작성한 문서만 열람가능
resultBoard.setWrtOrgan(loginUser.getOgCd());
break;
case "ACC003": // 관리 // 자신 외 하위 기관에서 작성한 문서 열람가능
resultBoard.setDownOrganCdList(loginUser.getDownOrganCdList());
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
break;
}
//결재권한 확인
String apprvAuth = authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getApprovalAuth();
if(apprvAuth==null) {
if(!accessAuth.equals("ACC003")){
resultBoard.setWrtUserSeq(loginUser.getUserSeq());
resultBoard.setUserType("normalCommitList");
}else{
resultBoard.setUserType("managerCommitList");
}
}else{
switch (apprvAuth) {
case "APC004": // 계장대행
case "APC003": // 계장 // 계장반려, 계장승인 문서 조회
resultBoard.setUserType("sectionCommitList");
break;
case "APC002": // 부장대행
case "APC001": // 부장 // 부장반려, 부장승인 문서 조회
resultBoard.setUserType("headCommitList");
break;
}
}
mav.addObject("accessAuth", accessAuth);
mav.addObject("apprvAuth", apprvAuth);
resultBoard.setQueryInfo();
mav.addObject("resultList", resultService.selectResultBoardList(resultBoard));
resultBoard.setContentCnt(resultService.selectResultBoardListCnt(resultBoard));
resultBoard.setPaginationInfo();
mav.addObject("searchParams", resultBoard);
return mav;
}
@GetMapping("/resultEditModal")
public ModelAndView resultEditModal(@AuthenticationPrincipal UserInfo loginUser, ResultBoard resultBoard){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairResult/resultEditModal");
if(resultBoard.getResultKey()!=null){
resultBoard = resultService.selectResultBoard(resultBoard.getResultKey());
}else{
resultBoard.setWrtOrgan(loginUser.getOgCd());
resultBoard.setWrtPart(loginUser.getOfcCd());
resultBoard.setWrtUserSeq(loginUser.getUserSeq());
resultBoard.setWrtUserNm(loginUser.getUserNm());
resultBoard.setWrtDt(LocalDateTime.now());
}
mav.addObject("result", resultBoard);
return mav;
}
@GetMapping("/resultViewModal")
public ModelAndView resultViewModal(@AuthenticationPrincipal UserInfo loginUser, ResultBoard resultBoard){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/affairResult/resultViewModal");
resultBoard = resultService.selectResultBoard(resultBoard.getResultKey());
mav.addObject("result", resultBoard);
mav.addObject("userSeq",loginUser.getUserSeq());
//메뉴권한 확인
mav.addObject("accessAuth", authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getAccessAuth());
mav.addObject("apprvAuth", authMgtService.selectApprovalConfigList(loginUser.getUserSeq(), "/affairResult/resultMgt").get(0).getApprovalAuth());
return mav;
}
@PostMapping("/saveResult")
public Integer saveResult(ResultBoard resultBoard,
@RequestParam(value = "resultInfos", required = false) List<String> resultInfos,
@RequestParam(value = "detailResultInfos", required = false)List<String> detailResultInfos,
MultipartHttpServletRequest request,
@RequestParam(value = "fileSeq", required = false) List<Integer> deleteFileSeq){
resultBoard.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
return resultService.saveResultBoard(resultBoard, resultInfos, detailResultInfos, deleteFileSeq);
}
@PostMapping("/resultStateChange")
public Integer resultStateChange(@AuthenticationPrincipal UserInfo loginUser, ResultApprv apprv){
apprv.setUserSeq(loginUser.getUserSeq());
apprv.setUserNm(loginUser.getUserNm());
apprv.setSaveDt(LocalDateTime.now());
return resultService.resultStateChange(apprv);
}
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.fpiMgt.affairResult.mapper;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultBoard;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ResultMapper {
List<ResultBoard> selectResultBoardList(ResultBoard resultBoard);
Integer selectResultBoardListCnt(ResultBoard resultBoard);
}

View File

@ -0,0 +1,45 @@
package com.dbnt.faisp.fpiMgt.affairResult.model;
import lombok.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "result_apprv")
@IdClass(ResultApprv.ResultApprvId.class)
public class ResultApprv {
@Id
@Column(name = "result_key")
private Integer resultKey;
@Id
@Column(name = "apprv_seq")
private Integer apprvSeq;
@Column(name = "state")
private String state;
@Column(name = "user_seq")
private Integer userSeq;
@Column(name = "user_nm")
private String userNm;
@Column(name = "etc")
private String etc;
@Column(name = "save_dt")
private LocalDateTime saveDt;
@Embeddable
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class ResultApprvId implements Serializable {
private Integer resultKey;
private Integer apprvSeq;
}
}

View File

@ -0,0 +1,70 @@
package com.dbnt.faisp.fpiMgt.affairResult.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.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Getter
@Setter
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "result_board")
public class ResultBoard extends BaseModel {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "result_key")
private Integer resultKey;
@Column(name = "result_state")
private String resultState;
@Column(name = "clear_title")
private String clearTitle;
@Column(name = "result_title")
private String resultTitle;
@Column(name = "start_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDt;
@Column(name = "end_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDt;
@Column(name = "plan_price")
private Double planPrice;
@Column(name = "use_price")
private Double usePrice;
@Column(name = "wrt_organ")
private String wrtOrgan;
@Column(name = "wrt_part")
private String wrtPart;
@Column(name = "wrt_user_seq")
private Integer wrtUserSeq;
@Column(name = "wrt_user_grd")
private String wrtUserGrd;
@Column(name = "wrt_user_nm")
private String wrtUserNm;
@Column(name = "wrt_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime wrtDt;
@Transient
private String userType;
@Transient
private Integer fileCnt;
@Transient
private List<ResultApprv> apprvList;
@Transient
private List<ResultFile> fileList;
@Transient
private List<MultipartFile> multipartFileList;
}

View File

@ -0,0 +1,49 @@
package com.dbnt.faisp.fpiMgt.affairResult.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 = "result_file")
@IdClass(ResultFile.ResultFileId.class)
public class ResultFile extends FileInfo {
@Id
@Column(name = "result_key")
private Integer resultKey;
@Id
@Column(name = "file_seq")
private Integer fileSeq;
@Column(name = "file_type")
private String fileType;
@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 ResultFileId implements Serializable {
private Integer resultKey;
private Integer fileSeq;
}
}

View File

@ -0,0 +1,14 @@
package com.dbnt.faisp.fpiMgt.affairResult.repository;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultApprv;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface ResultApprvRepository extends JpaRepository<ResultApprv, ResultApprv.ResultApprvId> {
Optional<ResultApprv> findTopByResultKeyOrderByApprvSeqDesc(Integer resultKey);
List<ResultApprv> findByResultKey(Integer resultKey);
}

View File

@ -0,0 +1,9 @@
package com.dbnt.faisp.fpiMgt.affairResult.repository;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultBoard;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ResultBoardRepository extends JpaRepository<ResultBoard, Integer> {
}

View File

@ -0,0 +1,13 @@
package com.dbnt.faisp.fpiMgt.affairResult.repository;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultFile;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
import java.util.Optional;
public interface ResultFileRepository extends JpaRepository<ResultFile, ResultFile.ResultFileId> {
List<ResultFile> findByResultKey(Integer resultKey);
Optional<ResultFile> findTopByResultKeyOrderByFileSeqDesc(Integer resultKey);
}

View File

@ -0,0 +1,104 @@
package com.dbnt.faisp.fpiMgt.affairResult.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.config.FileInfo;
import com.dbnt.faisp.fpiMgt.affairResult.mapper.ResultMapper;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultApprv;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultBoard;
import com.dbnt.faisp.fpiMgt.affairResult.model.ResultFile;
import com.dbnt.faisp.fpiMgt.affairResult.repository.ResultApprvRepository;
import com.dbnt.faisp.fpiMgt.affairResult.repository.ResultBoardRepository;
import com.dbnt.faisp.fpiMgt.affairResult.repository.ResultFileRepository;
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 ResultService extends BaseService { // 월간계획
private final ResultBoardRepository resultBoardRepository;
private final ResultFileRepository resultFileRepository;
private final ResultApprvRepository resultApprvRepository;
private final ResultMapper resultMapper;
public List<ResultBoard> selectResultBoardList(ResultBoard resultBoard) {
return resultMapper.selectResultBoardList(resultBoard);
}
public Integer selectResultBoardListCnt(ResultBoard resultBoard) {
return resultMapper.selectResultBoardListCnt(resultBoard);
}
public ResultBoard selectResultBoard(Integer resultKey) {
ResultBoard savedResult = resultBoardRepository.findById(resultKey).orElse(null);
if (savedResult != null) {
savedResult.setFileList(resultFileRepository.findByResultKey(resultKey));
savedResult.setApprvList(resultApprvRepository.findByResultKey(resultKey));
}
return savedResult;
}
@Transactional
public Integer saveResultBoard(ResultBoard resultBoard, List<String> resultInfos, List<String> detailResultInfos, List<Integer> deleteFileSeq) {
Integer resultKey = resultBoardRepository.save(resultBoard).getResultKey();
if(deleteFileSeq != null && deleteFileSeq.size()>0){
deleteResultFile(resultKey, deleteFileSeq);
}
if(resultBoard.getMultipartFileList()!=null){
saveUploadFiles(resultKey, resultBoard.getMultipartFileList());
}
return resultKey;
}
private void saveUploadFiles(Integer resultKey, List<MultipartFile> multipartFileList){
ResultFile lastFileInfo = resultFileRepository.findTopByResultKeyOrderByFileSeqDesc(resultKey).orElse(null);
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
for(MultipartFile file : multipartFileList){
String saveName = UUID.randomUUID().toString();
String path = locationPath+File.separator+"affairResult"+File.separator;
saveFile(file, new File(path+File.separator+saveName));
String originalFilename = file.getOriginalFilename();
int extnIdx = originalFilename.lastIndexOf(".");
ResultFile fileInfo = new ResultFile();
fileInfo.setResultKey(resultKey);
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);
resultFileRepository.save(fileInfo);
}
}
private void deleteResultFile(Integer resultKey, List<Integer> deleteFileSeq) {
List<ResultFile> resultFileList = resultFileRepository.findByResultKey(resultKey);
for(ResultFile file: resultFileList){
if(deleteFileSeq.contains(file.getFileSeq())){
deleteStoredFile(new File(file.getSavePath(), file.getConvNm()));
resultFileRepository.delete(file);
}
}
}
public FileInfo selectResultFile(Integer resultKey, Integer fileSeq) {
return resultFileRepository.findById(new ResultFile.ResultFileId(resultKey, fileSeq)).orElse(null);
}
@Transactional
public Integer resultStateChange(ResultApprv apprv) {
ResultBoard savedResult = resultBoardRepository.findById(apprv.getResultKey()).orElse(null);
savedResult.setResultState(apprv.getState());
ResultApprv lastApprv = resultApprvRepository.findTopByResultKeyOrderByApprvSeqDesc(apprv.getResultKey()).orElse(null);
apprv.setApprvSeq(lastApprv==null?1:lastApprv.getApprvSeq()+1);
resultApprvRepository.save(apprv);
return apprv.getApprvSeq();
}
}

View File

@ -0,0 +1,94 @@
<?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.fpiMgt.affairResult.mapper.ResultMapper">
<sql id="selectResultBoardListWhere">
<where>
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
and a.wrt_user_seq = #{wrtUserSeq}
</if>
<if test='wrtUserNm != null and wrtUserNm != ""'>
and a.wrt_user_nm like '%'||#{wrtUserNm}||'%'
</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='resultState != null and resultState != ""'>
and a.result_state = #{resultState}
</if>
<if test='dateSelector == "resultDt"'>
<if test='startDate != null and startDate != ""'>
and a.result_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and a.result_dt &lt;= #{endDate}::date+1
</if>
</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>
<if test="downOrganCdList != null">
and a.wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</if>
<if test='userType != null and userType != ""'>
<if test='userType == "normalStayList"'>
and a.result_state in ('DST002', 'DST004')
</if>
<if test='userType == "normalCommitList"'>
and a.result_state in ('DST003', 'DST005', 'DST006')
</if>
<if test='userType == "sectionCommitList"'>
and a.result_state in ('DST003', 'DST004', 'DST005', 'DST006')
</if>
<if test='userType == "headCommitList"'>
and a.result_state in ('DST003', 'DST005', 'DST006')
</if>
<if test='userType == "managerStayList"'>
and a.result_state in ('DST002', 'DST004')
</if>
<if test='userType == "managerCommitList"'>
and a.result_state in ('DST003', 'DST005', 'DST006')
</if>
</if>
</where>
</sql>
<select id="selectResultBoardList" resultType="ResultBoard" parameterType="ResultBoard">
select a.result_key,
a.content_title,
a.result_state,
a.result_dt,
a.wrt_organ,
a.wrt_part,
a.wrt_user_nm,
a.wrt_user_seq,
a.wrt_dt,
b.fileCnt
from result_board a
left outer join (select result_key,
count(file_seq) as fileCnt
from result_file
group by result_key) b
on a.result_key = b.result_key
<include refid="selectResultBoardListWhere"></include>
order by result_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectResultBoardListCnt" resultType="int" parameterType="ResultBoard">
select count(*)
from result_board a
<include refid="selectResultBoardListWhere"></include>
</select>
</mapper>

View File

@ -0,0 +1,187 @@
let files = [];
$(function(){
$("#dateSelectorDiv").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
})
$(document).on('click', '#planTab', function (){
location.href = "/affairPlan/planMgt";
})
$(document).on('click', '#stayTab', function (){
location.href = "/affairPlan/stayPage";
})
$(document).on('click', '#commitTab', function (){
location.href = "/affairPlan/commitPage";
})
$(document).on('click', '#addPlanBtn', function (){
getPlanEditModal(null)
})
$(document).on('click', '#editPlanBtn', function (){
$("#planViewModal").modal('hide');
getPlanEditModal(Number($("#planViewBody").find("[name='planKey']").val()));
})
$(document).on('click', '#planAddBtn', function (){
$("#planDiv").append("<input type='text' class='form-control' name='planInfos'>")
})
$(document).on('click', '#detailPlanAddBtn', function (){
const detailPlanDiv = $("#detailPlanDiv");
detailPlanDiv.append("<textarea type='text' name='detailPlanInfos'></textarea>");
const lastAppendTextarea = detailPlanDiv.children()[detailPlanDiv.children().length-1];
$(lastAppendTextarea).summernote({
lang:'ko-KR',
height: 120,
disableDragAndDrop: true,
toolbar: [
['style', ['style']],
['font', ['bold', 'underline', 'clear']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']]
]
});
})
$(document).on('click', '#savePlanBtn', function (){
savePlan('DST002')
})
$(document).on('click', '#saveTempBtn', function (){
savePlan('DST001')
})
$(document).on('click', '.planTr', function (){
$(".trChkBox").prop("checked", false);
$(this).find(".trChkBox").prop("checked", true);
getPlanViewModal(Number($(this).find(".planKey").val()));
})
$(document).on('click', '.apprvBtn', function (){
$("#apprvFormPlanKey").val($("#viewModalPlanKey").val());
$("#viewModalApprvValue").val($(this).attr("data-planstate"));
if(confirm($(this).val()+"하시겠습니까?")){
const formData = new FormData($("#apprvForm")[0]);
contentFade("in")
$.ajax({
type : 'POST',
data : formData,
url : "/affairPlan/planStateChange",
processData: false,
contentType: false,
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(result) {
alert("저장되었습니다")
getPlanViewModal(result);
contentFade("out");
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.");
contentFade("out");
}
})
}
})
function getPlanViewModal(planKey){
$.ajax({
url: '/affairPlan/planViewModal',
data: {planKey: planKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#planViewBody").empty().append(html)
$("#planViewModal").modal('show');
},
error:function(){
}
});
}
function getPlanEditModal(planKey){
$.ajax({
url: '/affairPlan/planEditModal',
data: {planKey: planKey},
type: 'GET',
dataType:"html",
success: function(html){
$("#planEditModalContent").empty().append(html)
$("#planEditModal").modal('show');
$("#planDt").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
$("[name='detailPlanInfos']").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 savePlan(planState){
if(contentCheck()){
if(confirm("저장하시겠습니까?")){
$("#planState").val(planState);
contentFade("in");
const formData = new FormData($("#planEditForm")[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 : "/affairPlan/savePlan",
processData: false,
contentType: false,
success : function(result) {
alert("저장되었습니다.");
contentFade("out");
$("#planEditModal").modal('hide');
getPlanViewModal(result);
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.")
contentFade("out");
}
})
}
}
}
function contentCheck(){
let flag = true;
if(!$("#contentTitle").val()){
alert("제목을 입력해주세요.")
flag = false;
}
if(!$("#planDt").val()){
alert("시행일자를 입력해주세요.")
flag = false;
}
flag = fileCheck(flag, files);
return flag;
}

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title" id="planEditModalLabel" th:text="${plan.planKey eq null?'월간 계획 작성':'월간 계획 수정'}"></h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="planEditBody">
<form action="#" method="post" id="planEditForm">
<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="planKey" th:value="${plan.planKey}">
<input type="hidden" name="wrtOrgan" th:value="${plan.wrtOrgan}">
<input type="hidden" name="wrtPart" th:value="${plan.wrtPart}">
<input type="hidden" name="wrtUserSeq" th:value="${plan.wrtUserSeq}">
<input type="hidden" name="planState" id="planState" th:value="${plan.planState}">
<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" id="wrtUserNm" name="wrtUserNm" th:value="${plan.wrtUserNm}" 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(plan.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
</div>
<label for="planDt" class="col-sm-2 col-form-label text-center">시행일자</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="planDt" name="planDt" th:value="${#temporals.format(plan.planDt, 'yyyy-MM-dd')}" autocomplete="off">
</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="${plan.contentTitle}">
</div>
</div>
<div class="mb-3 row justify-content-center">
<label for="planDiv" class="col-sm-2 col-form-label text-center">주요 사업계획</label>
<div class="col-sm-10" id="planDiv">
<th:block th:if="${plan.planKey eq null}">
<input type='text' class='form-control' name='planInfos'>
</th:block>
<th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'S'}">
<input type="text" class="form-control" name="planInfos" th:value="${infoList.planInfo}">
</th:block>
</th:block>
</div>
<div class="col-sm-auto">
<button type="button" class="btn btn-sm btn-outline-primary" id="planAddBtn"><i class="bi bi-plus-lg"></i></button>
</div>
</div>
<div class="mb-3 row justify-content-center">
<label for="detailPlanDiv" class="col-sm-2 col-form-label text-center">사업개요 및 추진계획</label>
<div class="col-sm-10" id="detailPlanDiv">
<th:block th:if="${plan.planKey eq null}">
<textarea type='text' name='detailPlanInfos'></textarea>
</th:block>
<th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'D'}">
<textarea type='text' name='detailPlanInfos' th:utext="${infoList.planInfo}"></textarea>
</th:block>
</th:block>
</div>
<div class="col-sm-auto">
<button type="button" class="btn btn-sm btn-outline-primary" id="detailPlanAddBtn"><i class="bi bi-plus-lg"></i></button>
</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(plan.fileList)}">
<br>파일을 업로드 해주세요.
</th:block>
<th:block th:unless="${#arrays.isEmpty(plan.fileList)}">
<div class='row-col-6' th:each="planFile:${plan.fileList}">
<span th:data-fileseq="${planFile.fileSeq}" th:text="|${planFile.origNm}.${planFile.fileExtn} ${planFile.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>
</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="savePlanBtn">저장</button>
</div>

View File

@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
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/igActivities/fpiMgt/plan/planMgt.js}"></script>
</th:block>
<div layout:fragment="content">
<main class="pt-3">
<p>첩보수집활동 > 외사경찰 견문관리 > 계획수립</p>
<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 text-center">
<div class="card-body">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${page eq 'main'?' active':''}" id="planTab" data-bs-toggle="tab" type="button" role="tab">계획 목록</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${page eq 'stay'?' active':''}" id="stayTab" data-bs-toggle="tab" type="button" role="tab">결재대기목록</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${page eq 'commit'?' active':''}" id="commitTab" data-bs-toggle="tab" type="button" role="tab">결재처리목록</button>
</li>
</ul>
<div class="tab-content border border-top-0 p-2" id="planContent">
<form method="get" th:action="${searchUrl}">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<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" th:if="${accessAuth eq 'ACC003'}">
<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-auto" th:if="${accessAuth eq 'ACC003'}">
<input type="text" class="form-control form-control-sm" placeholder="작성자" name="wrtUserNm" th:value="${searchParams.wrtUserNm}">
</div>
<div class="col-auto">
<select class="form-select form-select-sm" name="planState">
<option value="">상태 선택</option>
<th:block th:each="commonCode:${session.commonCode.get('DST')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.planState}"></option>
</th:block>
</select>
</div>
<div class="col-4">
<div class="input-group w-auto input-daterange" id="dateSelectorDiv">
<select class="form-select form-select-sm" name="dateSelector">
<option value="">조건선택</option>
<option value="planDt" th:selected="${searchParams.dateSelector eq 'planDt'}">시행일</option>
<option value="wrtDt" th:selected="${searchParams.dateSelector eq 'wrtDt'}">작성일</option>
</select>
<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">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<table class="table table-hover">
<thead>
<tr>
<th></th>
<th>제목</th>
<th>시행일자</th>
<th>관서</th>
<th>부서</th>
<th>작성자</th>
<th>작성일시</th>
<th>첨부파일</th>
<th>상태</th>
</tr>
</thead>
<tbody>
<tr class="planTr" th:each="plan:${planList}">
<input type="hidden" class="planKey" th:value="${plan.planKey}">
<td><input type="checkbox" class="trChkBox"></td>
<td th:text="${plan.contentTitle}"></td>
<td th:text="${#temporals.format(plan.planDt, 'yyyy-MM-dd')}"></td>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<td th:if="${plan.wrtOrgan eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<th:block th:each="commonCode:${session.commonCode.get('OFC')}">
<td th:if="${plan.wrtPart eq commonCode.itemCd}" th:text="${commonCode.itemValue}"></td>
</th:block>
<td th:text="${plan.wrtUserNm}"></td>
<td th:text="${#temporals.format(plan.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
<td th:text="${plan.fileCnt eq null?'파일 없음':#strings.concat(plan.fileCnt,' 건')}"></td>
<td th:if="${plan.planState eq 'DST001'}">임시저장</td>
<td th:if="${plan.planState eq 'DST002'}">결재대기</td>
<td th:if="${plan.planState eq 'DST003'}">계장반려</td>
<td th:if="${plan.planState eq 'DST004'}">계장결재</td>
<td th:if="${plan.planState eq 'DST005'}">부장반려</td>
<td th:if="${plan.planState eq 'DST006'}">부장결재</td>
</tr>
</tbody>
</table>
</div>
<div class="row justify-content-between">
<div class="col-auto"></div>
<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 class="col-auto">
<input type="button" class="btn btn-success" value="등록" id="addPlanBtn" th:unless="${accessAuth eq 'ACC001'}">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<div class="modal fade" id="planEditModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="planEditModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="planEditModalContent">
</div>
</div>
</div>
<div class="modal fade" id="planViewModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="planViewModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="planViewBody">
</div>
</div>
</div>
</div>
</html>

View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title" id="planViewModalLabel">월간 계획 열람</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-12">
<input type="hidden" name="planKey" id="viewModalPlanKey" th:value="${plan.planKey}">
<input type="hidden" name="wrtOrgan" th:value="${plan.wrtOrgan}">
<input type="hidden" name="planState" id="planState" th:value="${plan.planState}">
<div class="mb-3 row">
<label for="wrtUserNm" class="col-sm-1 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="${plan.wrtUserNm}" readonly>
</div>
<label for="wrtDt" class="col-sm-1 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(plan.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
</div>
<label for="planDt" class="col-sm-1 col-form-label text-center">시행일자</label>
<div class="col-sm-2">
<input type="text" class="form-control border-0" id="planDt" name="planDt" th:value="${#temporals.format(plan.planDt, 'yyyy-MM-dd')}" readonly>
</div>
<label for="planState" class="col-sm-1 col-form-label text-center">상태</label>
<div class="col-sm-2">
<th:block th:each="commonCode:${session.commonCode.get('DST')}">
<input type="text" class="form-control border-0" th:if="${commonCode.itemCd eq plan.planState}" th:value="${commonCode.itemValue}" readonly>
</th:block>
</div>
</div>
<hr>
<div class="row">
<div class="col-8">
<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="${plan.contentTitle}" readonly>
</div>
</div>
<hr>
<div class="mb-3 row">
<label for="planDiv" class="col-sm-2 col-form-label text-center">주요<br>사업계획</label>
<div class="col-sm-10" id="planDiv">
<th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'S'}">
<input type="text" class="form-control border-0" name="planInfo" th:value="${infoList.planInfo}" readonly>
</th:block>
</th:block>
</div>
</div>
<hr>
<div class="mb-3 row">
<label for="detailPlanDiv" class="col-sm-2 col-form-label text-center">사업개요<br><br>추진계획</label>
<div class="col-sm-10" id="detailPlanDiv">
<th:block th:each="infoList:${plan.mainInfoList}">
<th:block th:if="${infoList.planType eq 'D'}">
<div th:utext="${infoList.planInfo}"></div>
</th:block>
</th:block>
</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(plan.fileList)}">
<tr>
<td colspan="2">파일이 없습니다.</td>
</tr>
</th:block>
<th:block th:unless="${#lists.isEmpty(plan.fileList)}">
<th:block th:each="file:${plan.fileList}">
<tr class="fileInfoTr">
<td><a href="#" class="fileDownLink" data-board="affairPlan"
th:data-parentkey="${file.planKey}" 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>
<th:block th:unless="${#lists.isEmpty(plan.apprvList)}">
<hr>
<th:block th:each="apprv,cnt:${plan.apprvList}">
<div class="row justify-content-between py-1">
<div class="col-auto">
<th:block th:each="commonCode:${session.commonCode.get('DST')}">
<span th:if="${commonCode.itemCd eq apprv.state}" th:text="|결재결과: ${commonCode.itemValue}|"></span>
</th:block>
<span th:text="|결재자: ${apprv.userNm}|"></span>
</div>
<div class="col-auto">
<span th:text="|결재일시: ${#temporals.format(apprv.saveDt, 'yyyy-MM-dd HH:mm:ss')}|"></span>
</div>
<div class="col-12">
<span th:text="|기타의견: ${apprv.etc}|"></span>
</div>
</div>
</th:block>
</th:block>
</div>
<div class="col-12" th:if="${apprvAuth ne null}">
<form action="#" method="post" id="apprvForm">
<div class="row">
<div class="col-10">
<input type="hidden" name="planKey" id="apprvFormPlanKey">
<input type="hidden" name="state" id="viewModalApprvValue">
<input type="text" class="form-control form-control-sm" name="etc" placeholder="추가의견, 반려사유 기입">
<input type="text" class="d-none" id="submitPrevention">
</div>
<div class="col-auto">
<input type="button" class="btn btn-sm btn-success apprvBtn" th:data-planstate="${apprvAuth eq 'APC004'||apprvAuth eq 'APC003'?'DST004':'DST006'}" value="승인">
</div>
<div class="col-auto">
<input type="button" class="btn btn-sm btn-danger apprvBtn" th:data-planstate="${apprvAuth eq 'APC004'||apprvAuth eq 'APC003'?'DST003':'DST005'}" value="반려">
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<th:block th:unless="${plan.planState eq 'DST004' or plan.planState eq 'DST006'}"><!--승인 상태일때는 수정 불가-->
<th:block th:if="${userSeq eq plan.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
<button type="button" class="btn btn-warning" id="editPlanBtn">수정</button>
</th:block>
</th:block>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>