국제범죄검거현황 통계모달 추가.

master
강석 최 2023-05-19 18:40:04 +09:00
parent c4ea7e3640
commit 44d9418961
10 changed files with 274 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest; package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService; import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaStatistics;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSubInfo; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSubInfo;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.repository.IcaSuspectInfoRepository; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.repository.IcaSuspectInfoRepository;
@ -18,6 +19,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -84,6 +86,31 @@ public class InternationalCrimeArrestController {
return mav; return mav;
} }
@GetMapping("/icaStatisticsModal")
public ModelAndView icaStatisticsModal(@AuthenticationPrincipal UserInfo loginUser, IcaStatistics icaStatistics){
ModelAndView mav = new ModelAndView("faStatistics/internationalCrimeArrest/icaStatisticsModal");
if(Utils.isEmpty(icaStatistics.getOrgan())){
icaStatistics.setOrgan(loginUser.getOgCd());
}
if(Utils.isEmpty(icaStatistics.getYear())){
icaStatistics.setYear(LocalDate.now().getYear());
}
if(Utils.isEmpty(icaStatistics.getMonth())){
icaStatistics.setMonth(LocalDate.now().getMonthValue());
}
List<IcaStatistics> icaStatisticsList = internationalCrimeArrestService.selectIcaStatistics(icaStatistics);
mav.addObject("total", internationalCrimeArrestService.getIcaStatisticsTotal(icaStatisticsList));
mav.addObject("icaStatisticsList", icaStatisticsList);
List<Integer> yearList = internationalCrimeArrestService.selectYearOptionList(icaStatistics.getOrgan());
if(yearList.size()==0){
yearList.add(icaStatistics.getYear());
}
mav.addObject("yearOptionList", yearList);
mav.addObject("searchParams", icaStatistics);
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
return mav;
}
@PostMapping("/saveInternationalCrimeArrest") @PostMapping("/saveInternationalCrimeArrest")
public Integer saveInternationalCrimeArrest(@AuthenticationPrincipal UserInfo loginUser, public Integer saveInternationalCrimeArrest(@AuthenticationPrincipal UserInfo loginUser,
InternationalCrimeArrest internationalCrimeArrest){ InternationalCrimeArrest internationalCrimeArrest){

View File

@ -1,6 +1,7 @@
package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper; package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaStatistics;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
import com.dbnt.faisp.util.ParamMap; import com.dbnt.faisp.util.ParamMap;
@ -12,4 +13,6 @@ import java.util.List;
public interface InternationalCrimeArrestMapper{ public interface InternationalCrimeArrestMapper{
List<InternationalCrimeArrest> selectInternationalCrimeArrestList(InternationalCrimeArrest internationalCrimeArrest); List<InternationalCrimeArrest> selectInternationalCrimeArrestList(InternationalCrimeArrest internationalCrimeArrest);
Integer selectInternationalCrimeArrestListCnt(InternationalCrimeArrest internationalCrimeArrest); Integer selectInternationalCrimeArrestListCnt(InternationalCrimeArrest internationalCrimeArrest);
List<IcaStatistics> selectIcaStatistics(IcaStatistics icaStatistics);
List<Integer> selectYearOptionList(String organ);
} }

View File

@ -0,0 +1,27 @@
package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class IcaStatistics {
private String crimeType;
private String violationType;
private Integer caseCnt = 0;
private Integer suspectCnt = 0;
private Integer arrestCnt = 0;
private Integer arrestSuspectCnt = 0;
private Integer pcr001Cnt = 0;
private Integer pcr002Cnt = 0;
private Integer pcr003Cnt = 0;
private Integer pcr004Cnt = 0;
private Integer pcr005Cnt = 0;
private String organ;
private Integer year;
private Integer month;
}

View File

@ -3,6 +3,7 @@ package com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.service;
import com.dbnt.faisp.config.BaseService; import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper.InternationalCrimeArrestMapper; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.mapper.InternationalCrimeArrestMapper;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaStatistics;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSubInfo; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSubInfo;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.InternationalCrimeArrest;
import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSuspectInfo; import com.dbnt.faisp.main.faStatistics.internationalCrimeArrest.model.IcaSuspectInfo;
@ -85,4 +86,28 @@ public class InternationalCrimeArrestService extends BaseService {
internationalCrimeArrestRepository.bulkModifyingByIcaKeyToStatus(internationalCrimeArrest.getIcaKey(), "DST008"); internationalCrimeArrestRepository.bulkModifyingByIcaKeyToStatus(internationalCrimeArrest.getIcaKey(), "DST008");
} }
public List<IcaStatistics> selectIcaStatistics(IcaStatistics icaStatistics) {
return internationalCrimeArrestMapper.selectIcaStatistics(icaStatistics);
}
public List<Integer> selectYearOptionList(String organ) {
return internationalCrimeArrestMapper.selectYearOptionList(organ);
}
public IcaStatistics getIcaStatisticsTotal(List<IcaStatistics> icaStatisticsList) {
IcaStatistics total = new IcaStatistics();
for(IcaStatistics statistics : icaStatisticsList){
total.setCaseCnt(total.getCaseCnt()+statistics.getCaseCnt());
total.setSuspectCnt(total.getSuspectCnt()+statistics.getSuspectCnt());
total.setArrestCnt(total.getArrestCnt()+statistics.getArrestCnt());
total.setArrestSuspectCnt(total.getArrestSuspectCnt()+statistics.getArrestSuspectCnt());
total.setPcr001Cnt(total.getPcr001Cnt()+statistics.getPcr001Cnt());
total.setPcr002Cnt(total.getPcr002Cnt()+statistics.getPcr002Cnt());
total.setPcr003Cnt(total.getPcr003Cnt()+statistics.getPcr003Cnt());
total.setPcr004Cnt(total.getPcr004Cnt()+statistics.getPcr004Cnt());
total.setPcr005Cnt(total.getPcr005Cnt()+statistics.getPcr005Cnt());
}
return total;
}
} }

View File

@ -105,4 +105,45 @@
WHERE s.ica_key = #{icaKey} WHERE s.ica_key = #{icaKey}
</select> </select>
<select id="selectIcaStatistics" resultType="IcaStatistics" parameterType="IcaStatistics">
select a.item_value as crime_type ,
b.item_value as violation_type,
coalesce(c.caseCnt, 0) as caseCnt,
coalesce(c.suspectCnt, 0) as suspectCnt,
coalesce(c.arrestCnt, 0) as arrestCnt,
coalesce(c.arrestSuspectCnt, 0) as arrestSuspectCnt,
coalesce(c.pcr001Cnt, 0) as pcr001Cnt,
coalesce(c.pcr002Cnt, 0) as pcr002Cnt,
coalesce(c.pcr003Cnt, 0) as pcr003Cnt,
coalesce(c.pcr004Cnt, 0) as pcr004Cnt,
coalesce(c.pcr005Cnt, 0) as pcr005Cnt
from code_mgt a
inner join code_mgt b on a.category_cd = 'CTH' and a.item_cd = b.category_cd
left outer join (
select aa.crime_type,
aa.violation_type,
count(distinct aa.ica_key) as caseCnt,
count(*) as suspectCnt,
0 as arrestCnt,
0 as arrestSuspectCnt,
sum(case when ab.process_result = 'PCR001' then 1 else 0 end) as pcr001Cnt,
sum(case when ab.process_result = 'PCR002' then 1 else 0 end) as pcr002Cnt,
sum(case when ab.process_result = 'PCR003' then 1 else 0 end) as pcr003Cnt,
sum(case when ab.process_result = 'PCR004' then 1 else 0 end) as pcr004Cnt,
sum(case when ab.process_result = 'PCR005' then 1 else 0 end) as pcr005Cnt
from international_crime_arrest aa
inner join ica_suspect_info ab on aa.ica_key = ab.ica_key
where department = #{organ}
and EXTRACT(YEAR FROM wrt_dt) = ${year}
and EXTRACT(MONTH FROM wrt_dt) = ${month}
group by crime_type, violation_type
) c on a.item_cd = c.crime_type and b.item_cd = c.violation_type
order by a.item_cd, b.item_cd
</select>
<select id="selectYearOptionList" resultType="int" parameterType="string">
select distinct EXTRACT(YEAR FROM wrt_dt)
from international_crime_arrest
where department = #{organ}
</select>
</mapper> </mapper>

View File

@ -9,8 +9,16 @@ $(function(){
language: "ko", language: "ko",
autoclose: true autoclose: true
}); });
getStatisticsModal();
}); });
$(document).on('click', '#statisticsModalBtn', function (){
getStatisticsModal();
})
$(document).on('click', '#statisticsSearchBtn', function (){
getStatisticsModal($('#organ').val(), $('#year').val(), $('#month').val())
})
$(document).on('click', '#icaAddBtn', function () { $(document).on('click', '#icaAddBtn', function () {
getIcaEditModal(null); getIcaEditModal(null);
@ -189,7 +197,6 @@ function saveInternationalCrimeArrest(status){
formData.append("suspectInfoList["+idx+"].processResult", spi.find('.processResult').val()); formData.append("suspectInfoList["+idx+"].processResult", spi.find('.processResult').val());
}); });
formData.append("caseOverview", CrossEditor.GetBodyValue()); formData.append("caseOverview", CrossEditor.GetBodyValue());
debugger
$.ajax({ $.ajax({
type : 'POST', type : 'POST',
data : formData, data : formData,
@ -219,6 +226,26 @@ function contentCheck(status){
return flag; return flag;
} }
function getStatisticsModal(organ, year, month){
$.ajax({
url: '/faStatistics/icaStatisticsModal',
data: {
organ: organ,
year: year,
month: month,
},
type: 'GET',
dataType:"html",
success: function(html){
$("#icaStatisticsBody").empty().append(html)
$("#icaStatisticsModal").modal('show');
},
error:function(e){
ajaxErrorAction(e);
}
});
}
$(document).on('click', '#icaExcelDownBtn', function (){ $(document).on('click', '#icaExcelDownBtn', function (){
debugger debugger
exportExcel('국제범죄검거현황', 'icaTable') exportExcel('국제범죄검거현황', 'icaTable')

View File

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header bg-dark">
<h5 class="modal-title text-white" id="icaStatisticsModalLabel">국제범죄검거 통계</h5>
<button type="button" class="btn-close f-invert" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<div class="row justify-content-end mb-1">
<div class="col-2">
<select class="form-select form-select-sm" id="organ">
<th:block th:each="code:${session.commonCode.get('OG')}">
<th:block th:if="${code.useChk eq 'T' and #lists.contains(mgtOrganList, code.itemCd)}">
<option th:value="${code.itemCd}" th:text="${code.itemValue}" th:selected="${code.itemCd eq searchParams.organ}"></option>
</th:block>
</th:block>
</select>
</div>
<div class="col-2">
<select class="form-select form-select-sm" id="year">
<th:block th:each="year:${yearOptionList}">
<option th:value="${year}" th:text="${year}" th:selected="${year eq searchParams.year}"></option>
</th:block>
</select>
</div>
<div class="col-2">
<select class="form-select form-select-sm" id="month">
<th:block th:each="num : ${#numbers.sequence(1,12)}">
<option th:value="${num}" th:text="${num}" th:selected="${num eq searchParams.month}"></option>
</th:block>
</select>
</div>
<div class="col-1 d-grid gap-2">
<input type="button" class="btn btn-sm btn-primary" id="statisticsSearchBtn" value="검색">
</div>
</div>
<div class="row">
<div class="col-12">
<table class="table table-sm table-hover table-bordered ws-nowrap">
<colgroup>
<col style="width: 12%">
<col style="width: 12%">
<col style="width: 4%">
<col style="width: 4%">
<col style="width: 4%">
<col style="width: 4%">
<th:block th:each="code:${session.commonCode.get('PCR')}">
<col style="width: 8%">
</th:block>
</colgroup>
<thead class="align-middle text-center">
<tr class="table-secondary">
<th rowspan="2">분야</th>
<th rowspan="2">위반유형</th>
<th colspan="2">발생</th>
<th colspan="2">검거</th>
<th colspan="5">피의자 신병 처리 결과</th>
</tr>
<tr class="table-secondary">
<th></th>
<th></th>
<th></th>
<th></th>
<th:block th:each="code:${session.commonCode.get('PCR')}">
<th th:text="${code.itemValue}"></th>
</th:block>
</tr>
<tr class="bg-warning">
<th colspan="2"></th>
<th th:text="${total.caseCnt}"></th>
<th th:text="${total.suspectCnt}"></th>
<th th:text="${total.arrestCnt}"></th>
<th th:text="${total.arrestSuspectCnt}"></th>
<th th:text="${total.pcr001Cnt}"></th>
<th th:text="${total.pcr002Cnt}"></th>
<th th:text="${total.pcr003Cnt}"></th>
<th th:text="${total.pcr004Cnt}"></th>
<th th:text="${total.pcr005Cnt}"></th>
</tr>
<th:block th:each="statistics:${icaStatisticsList}">
<tr>
<td th:text="${statistics.crimeType}"></td>
<td th:text="${statistics.violationType}"></td>
<th th:text="${statistics.caseCnt}"></th>
<th th:text="${statistics.suspectCnt}"></th>
<th th:text="${statistics.arrestCnt}"></th>
<th th:text="${statistics.arrestSuspectCnt}"></th>
<th th:text="${statistics.pcr001Cnt}"></th>
<th th:text="${statistics.pcr002Cnt}"></th>
<th th:text="${statistics.pcr003Cnt}"></th>
<th th:text="${statistics.pcr004Cnt}"></th>
<th th:text="${statistics.pcr005Cnt}"></th>
</tr>
</th:block>
</thead>
</table>
</div>
</div>
</div>
</html>

View File

@ -31,6 +31,8 @@
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}"> <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<input type="hidden" name="dateSelector" value="wrtDt"> <input type="hidden" name="dateSelector" value="wrtDt">
<div class="row justify-content-between py-1"> <div class="row justify-content-between py-1">
<div class="col-auto">
<div class="row">
<div class="col-auto"> <div class="col-auto">
<select class="form-select form-select-sm" name="rowCnt" id="rowCnt"> <select class="form-select form-select-sm" name="rowCnt" id="rowCnt">
<th:block th:each="num : ${#numbers.sequence(1,5)}"> <th:block th:each="num : ${#numbers.sequence(1,5)}">
@ -38,6 +40,13 @@
</th:block> </th:block>
</select> </select>
</div> </div>
</div>
<div class="row mt-4">
<div class="col-12">
<input type="button" class="btn btn-sm btn-info w-100" id="statisticsModalBtn" value="통계">
</div>
</div>
</div>
<div class="col-8"> <div class="col-8">
<div class="row"> <div class="row">
<div class="col-11"> <div class="col-11">
@ -285,6 +294,13 @@
<div class="modal-dialog modal-xl modal-dialog-scrollable"> <div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="icaViewBody"> <div class="modal-content" id="icaViewBody">
</div>
</div>
</div>
<div class="modal fade" id="icaStatisticsModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="icaStatisticsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content" id="icaStatisticsBody">
</div> </div>
</div> </div>
</div> </div>

View File

@ -421,7 +421,6 @@
<th:block th:each="code:${session.commonCode.get('PCR')}"> <th:block th:each="code:${session.commonCode.get('PCR')}">
<option th:value="${code.itemCd}" th:text="${code.itemValue}"></option> <option th:value="${code.itemCd}" th:text="${code.itemValue}"></option>
</th:block> </th:block>
<option value="etc">기타(신병인계)</option>
</select> </select>
</div> </div>
<button type="button" class="btn btn-sm col-sm-auto btn-danger mb-1 spiRemoveBtn" style="display: none"> <button type="button" class="btn btn-sm col-sm-auto btn-danger mb-1 spiRemoveBtn" style="display: none">

View File

@ -267,7 +267,7 @@
</label> </label>
<label class="col-sm-1 col-form-label col-form-label-sm text-center">신병처리</label> <label class="col-sm-1 col-form-label col-form-label-sm text-center">신병처리</label>
<label class="col-sm-2 col-form-label col-form-label-sm text-start"> <label class="col-sm-2 col-form-label col-form-label-sm text-start">
<th:block th:each="code:${session.commonCode.get('PCR')}"> <th:block th:each="code:${session.commonCode.get('')}">
<th:block th:if="${code.itemCd eq suspect.processResult}" th:text="${code.itemValue}"></th:block> <th:block th:if="${code.itemCd eq suspect.processResult}" th:text="${code.itemValue}"></th:block>
</th:block> </th:block>
</label> </label>