diff --git a/src/main/java/com/dbnt/faisp/main/counterIntelligence/CounterIntelligenceController.java b/src/main/java/com/dbnt/faisp/main/counterIntelligence/CounterIntelligenceController.java index 95995147..a40fe315 100644 --- a/src/main/java/com/dbnt/faisp/main/counterIntelligence/CounterIntelligenceController.java +++ b/src/main/java/com/dbnt/faisp/main/counterIntelligence/CounterIntelligenceController.java @@ -2,6 +2,7 @@ package com.dbnt.faisp.main.counterIntelligence; import com.dbnt.faisp.main.authMgt.service.AuthMgtService; import com.dbnt.faisp.main.codeMgt.service.CodeMgtService; +import com.dbnt.faisp.main.counterIntelligence.model.CiWorkStatistics; import com.dbnt.faisp.main.counterIntelligence.model.CounterIntelligenceWork; import com.dbnt.faisp.main.counterIntelligence.service.CounterIntelligenceService; import com.dbnt.faisp.main.userInfo.model.UserInfo; @@ -58,7 +59,9 @@ public class CounterIntelligenceController { }else{ ciWork = ciService.selectCounterIntelligenceWork(ciWork.getCiwKey()); } - + String accessAuth = authMgtService.selectAccessConfigList + (loginUser.getUserSeq(), "/counterIntelligence/ciWorkList").get(0).getAccessAuth(); + mav.addObject("accessAuth", accessAuth); mav.addObject("atCodeList", codeMgtService.selectCodeMgtList("AT")); mav.addObject("at2CodeList", ciWork.getCiwKey()!=null?codeMgtService.selectCodeMgtList(ciWork.getArrestType1()):null); mav.addObject("ciWork", ciWork); @@ -70,6 +73,9 @@ public class CounterIntelligenceController { ModelAndView mav = new ModelAndView("counterIntelligence/ciWorkViewModal"); mav.addObject("lineSeparator", '\n'); mav.addObject("viewUserSeq", loginUser.getUserSeq()); + String accessAuth = authMgtService.selectAccessConfigList + (loginUser.getUserSeq(), "/counterIntelligence/ciWorkList").get(0).getAccessAuth(); + mav.addObject("accessAuth", accessAuth); mav.addObject("ciWork", ciService.selectCounterIntelligenceWork(ciWork.getCiwKey())); return mav; } @@ -80,4 +86,25 @@ public class CounterIntelligenceController { ciWork.setMultipartFileList(request.getMultiFileMap().get("uploadFiles")); return ciService.saveCiWork(ciWork, deleteFileSeq); } + @PostMapping("/deleteCiWork") + public Integer deleteCiWork(@AuthenticationPrincipal UserInfo loginUser, CounterIntelligenceWork ciWork){ + String accessAuth = authMgtService.selectAccessConfigList + (loginUser.getUserSeq(), "/counterIntelligence/ciWorkList").get(0).getAccessAuth(); + if(accessAuth.equals("ACC003")){ + return ciService.deleteCiWork(ciWork.getCiwKey()); + }else{ + return 0; + } + } + @GetMapping("/CiWorkStatistics") + public ModelAndView ciWorkStatistics(CiWorkStatistics ciWorkStatistics){ + if(ciWorkStatistics.getYear()==null){ + ciWorkStatistics.setYear(LocalDateTime.now().getYear()); + } + ModelAndView mav = new ModelAndView("/counterIntelligence/ciWorkStatistics"); + mav.addObject("yearList", ciService.selectCiWorkYearList()); + mav.addObject("ciWorkStatisticsList", ciService.selectCiWorkStatisticsList(ciWorkStatistics)); + mav.addObject("searchParams", ciWorkStatistics); + return mav; + } } diff --git a/src/main/java/com/dbnt/faisp/main/counterIntelligence/mapper/CounterIntelligenceMapper.java b/src/main/java/com/dbnt/faisp/main/counterIntelligence/mapper/CounterIntelligenceMapper.java index 062983a5..a096e74c 100644 --- a/src/main/java/com/dbnt/faisp/main/counterIntelligence/mapper/CounterIntelligenceMapper.java +++ b/src/main/java/com/dbnt/faisp/main/counterIntelligence/mapper/CounterIntelligenceMapper.java @@ -1,5 +1,6 @@ package com.dbnt.faisp.main.counterIntelligence.mapper; +import com.dbnt.faisp.main.counterIntelligence.model.CiWorkStatistics; import com.dbnt.faisp.main.counterIntelligence.model.CounterIntelligenceWork; import com.dbnt.faisp.main.faRpt.model.FaRptBoard; import org.apache.ibatis.annotations.Mapper; @@ -15,4 +16,8 @@ public interface CounterIntelligenceMapper { Integer selectCounterIntelligenceWorkCnt(CounterIntelligenceWork ciWork); String selectHashTags(Integer ciwKey); + + List selectCiWorkStatisticsList(CiWorkStatistics ciWorkStatistics); + + List selectCiWorkYearList(); } diff --git a/src/main/java/com/dbnt/faisp/main/counterIntelligence/model/CiWorkStatistics.java b/src/main/java/com/dbnt/faisp/main/counterIntelligence/model/CiWorkStatistics.java new file mode 100644 index 00000000..ebae4efb --- /dev/null +++ b/src/main/java/com/dbnt/faisp/main/counterIntelligence/model/CiWorkStatistics.java @@ -0,0 +1,20 @@ +package com.dbnt.faisp.main.counterIntelligence.model; + +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@NoArgsConstructor +public class CiWorkStatistics { + + private String workRating; + + private Integer newWorkCnt=0; + private Integer doingWorkCnt=0; + private Integer prevYearWorkEndCnt=0; + private Integer thisYearWorkEndCnt=0; + + private Integer year; +} diff --git a/src/main/java/com/dbnt/faisp/main/counterIntelligence/service/CounterIntelligenceService.java b/src/main/java/com/dbnt/faisp/main/counterIntelligence/service/CounterIntelligenceService.java index 53350b52..fd2b71ca 100644 --- a/src/main/java/com/dbnt/faisp/main/counterIntelligence/service/CounterIntelligenceService.java +++ b/src/main/java/com/dbnt/faisp/main/counterIntelligence/service/CounterIntelligenceService.java @@ -3,6 +3,7 @@ package com.dbnt.faisp.main.counterIntelligence.service; import com.dbnt.faisp.config.BaseService; import com.dbnt.faisp.config.FileInfo; import com.dbnt.faisp.main.counterIntelligence.mapper.CounterIntelligenceMapper; +import com.dbnt.faisp.main.counterIntelligence.model.CiWorkStatistics; import com.dbnt.faisp.main.counterIntelligence.model.CiwFile; import com.dbnt.faisp.main.counterIntelligence.model.CounterIntelligenceWork; import com.dbnt.faisp.main.counterIntelligence.model.HashTagLinkCiw; @@ -104,4 +105,28 @@ public class CounterIntelligenceService extends BaseService { public FileInfo selectCiWorkFile(Integer ciwKey, Integer fileSeq) { return ciwFileRepository.findById(new CiwFile.CiwFileId(ciwKey, fileSeq)).orElse(null); } + + @Transactional + public Integer deleteCiWork(Integer ciwKey) { + CounterIntelligenceWork ciWork = ciwRepository.findById(ciwKey).orElse(null); + ciWork.setStatus("DST008"); + return ciwKey; + } + + public List selectCiWorkYearList() { + return ciMapper.selectCiWorkYearList(); + } + + public List selectCiWorkStatisticsList(CiWorkStatistics ciWorkStatistics) { + List ciWorkStatisticsList = ciMapper.selectCiWorkStatisticsList(ciWorkStatistics); + CiWorkStatistics totalStatistics = new CiWorkStatistics(); + for(CiWorkStatistics statistics: ciWorkStatisticsList){ + totalStatistics.setNewWorkCnt(totalStatistics.getNewWorkCnt()+statistics.getNewWorkCnt()); + totalStatistics.setDoingWorkCnt(totalStatistics.getDoingWorkCnt()+statistics.getDoingWorkCnt()); + totalStatistics.setPrevYearWorkEndCnt(totalStatistics.getPrevYearWorkEndCnt()+statistics.getPrevYearWorkEndCnt()); + totalStatistics.setThisYearWorkEndCnt(totalStatistics.getThisYearWorkEndCnt()+statistics.getThisYearWorkEndCnt()); + } + ciWorkStatisticsList.add(totalStatistics); + return ciWorkStatisticsList; + } } diff --git a/src/main/resources/mybatisMapper/CounterIntelligenceMapper.xml b/src/main/resources/mybatisMapper/CounterIntelligenceMapper.xml index 51f995b8..8051517c 100644 --- a/src/main/resources/mybatisMapper/CounterIntelligenceMapper.xml +++ b/src/main/resources/mybatisMapper/CounterIntelligenceMapper.xml @@ -6,6 +6,7 @@ + a.status <> 'DST008' and ((a.wrt_user_seq = #{wrtUserSeq} and a.status = 'DST002') or a.status = 'DST007') @@ -96,8 +97,8 @@ a.wrt_dt, b.fileCnt from counter_intelligence_work a - inner join (select ciw_key, count(*) as fileCnt from ciw_file group by ciw_key) b - on a.ciw_key = b.ciw_key + left outer join (select ciw_key, count(*) as fileCnt from ciw_file group by ciw_key) b + on a.ciw_key = b.ciw_key ORDER BY a.ciw_key DESC LIMIT #{rowCnt} OFFSET #{firstIndex} @@ -105,7 +106,7 @@ @@ -115,4 +116,26 @@ inner join hash_tag b on a.tag_key = b.tag_key where a.ciw_key = #{ciwKey} + + \ No newline at end of file diff --git a/src/main/resources/static/js/counterIntelligence/ciWork.js b/src/main/resources/static/js/counterIntelligence/ciWork.js index f8366f12..0f117ec6 100644 --- a/src/main/resources/static/js/counterIntelligence/ciWork.js +++ b/src/main/resources/static/js/counterIntelligence/ciWork.js @@ -1,3 +1,13 @@ +$(document).on('click', '#ciWorkTab', function (){ + location.href="/counterIntelligence/ciWorkList"; +}) +$(document).on('click', '#performanceTab', function (){ + location.href="/counterIntelligence/CiWorkStatistics"; +}) +$(document).on('change', '#statisticsYear', function (){ + location.href="/counterIntelligence/CiWorkStatistics?year="+this.value; +}) + $(document).on('click', '#addCiWorkBtn', function (){ getCiWorkEditModal(null); }) @@ -19,6 +29,10 @@ $(document).on('click', '#editCiWorkBtn', function (){ getCiWorkEditModal($(this).attr("data-ciwkey")); }) +$(document).on('click', '#deleteCiWorkBtn', function (){ + deleteCiWork($(this).attr("data-ciwkey")); +}) + function getCiWorkEditModal(ciwKey){ $.ajax({ url: '/counterIntelligence/ciWorkEditModal', @@ -65,6 +79,7 @@ function saveCiWork(status){ flag = contentCheck(); } if(flag){ + contentFade("in"); const ciWorkEditForm = $("#ciWorkEditForm"); ciWorkEditForm.find("#status").val(status); const formData = new FormData(ciWorkEditForm[0]); @@ -97,6 +112,33 @@ function saveCiWork(status){ } } +function deleteCiWork(ciwKey){ + if(confirm("삭제하시겠습니까?")){ + contentFade("in"); + const formData = new FormData(); + formData.append('ciwKey', ciwKey); + $.ajax({ + type : 'POST', + data : formData, + url : "/counterIntelligence/deleteCiWork", + processData: false, + contentType: false, + beforeSend: function (xhr){ + xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); + }, + success : function(result) { + alert("삭제되었습니다."); + contentFade("out"); + location.reload(); + }, + error : function(xhr, status) { + alert("삭제를 실패하였습니다.") + contentFade("out"); + } + }) + } +} + function contentCheck(){ if(!$("#workStartDate").val()){ alert("착수일을 입력해주세요.") diff --git a/src/main/resources/templates/counterIntelligence/ciWorkEditModal.html b/src/main/resources/templates/counterIntelligence/ciWorkEditModal.html index 9adfcf92..825a3889 100644 --- a/src/main/resources/templates/counterIntelligence/ciWorkEditModal.html +++ b/src/main/resources/templates/counterIntelligence/ciWorkEditModal.html @@ -45,7 +45,7 @@
- +
@@ -127,7 +127,10 @@ \ No newline at end of file diff --git a/src/main/resources/templates/counterIntelligence/ciWorkStatistics.html b/src/main/resources/templates/counterIntelligence/ciWorkStatistics.html new file mode 100644 index 00000000..cae31052 --- /dev/null +++ b/src/main/resources/templates/counterIntelligence/ciWorkStatistics.html @@ -0,0 +1,87 @@ + + + + + +
+
+
+
+

방첩공작

+
+
+

외사방첩관리 > 방첩공작

+
+
+
+
+
+ +
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + +
구분 + + 진행중(미종결) + +
+ + + +
+ 총계 + + + + + +
+
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/src/main/resources/templates/counterIntelligence/ciWorkViewModal.html b/src/main/resources/templates/counterIntelligence/ciWorkViewModal.html index 7748cd65..a362238c 100644 --- a/src/main/resources/templates/counterIntelligence/ciWorkViewModal.html +++ b/src/main/resources/templates/counterIntelligence/ciWorkViewModal.html @@ -29,7 +29,7 @@
- + @@ -108,6 +108,9 @@