불법조업 통계 작업 준비

master
강석 최 2023-08-01 18:13:04 +09:00
parent 128478e477
commit 4862771a2c
11 changed files with 211 additions and 4 deletions

View File

@ -11,6 +11,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.Ship
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailor; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailor;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailorHistory; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailorHistory;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.service.UnlawfulFishingService; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.service.UnlawfulFishingService;
import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
import com.dbnt.faisp.main.userInfo.model.UserInfo; import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.security.core.annotation.AuthenticationPrincipal;
@ -28,6 +29,7 @@ public class UnlawfulFishingController {
private final AuthMgtService authMgtService; private final AuthMgtService authMgtService;
private final UnlawfulFishingService unlawfulFishingService; private final UnlawfulFishingService unlawfulFishingService;
private final OrganConfigService organConfigService;
@GetMapping("/crackdownInfo") @GetMapping("/crackdownInfo")
public ModelAndView crackdownInfoPage(@AuthenticationPrincipal UserInfo loginUser, UnlawfulFishingParam params){ public ModelAndView crackdownInfoPage(@AuthenticationPrincipal UserInfo loginUser, UnlawfulFishingParam params){
@ -385,4 +387,25 @@ public class UnlawfulFishingController {
return mav; return mav;
} }
@GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, UnlawfulFishingParam params){
ModelAndView mav = new ModelAndView("faStatistics/unlawfulFishing/statistics/statistics");
//메뉴권한 확인
AccessConfig accessConfig = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/unlawfulFishing/statistics?type=type1").get(0);
mav.addObject("menuKey", accessConfig.getMenuKey());
switch (params.getType()){
case "type1":
break;
case "type2":
break;
case "type3":
mav.addObject("organConfigList", organConfigService.selectOrganListToUnlawfulFishingStatistics());
break;
}
mav.addObject("searchParams", params);
return mav;
}
} }

View File

@ -46,6 +46,8 @@ public class UnlawfulFishingParam extends BaseModel {
private Integer heterogeneousCriminalHistory; private Integer heterogeneousCriminalHistory;
private Integer similarCriminalHistory; private Integer similarCriminalHistory;
/*통계*/
private String type;

View File

@ -17,7 +17,6 @@ import java.util.*;
@RequestMapping("/organMgt") @RequestMapping("/organMgt")
public class OrganConfigController { public class OrganConfigController {
private final OrganConfigService organConfigService; private final OrganConfigService organConfigService;
private final CodeMgtService codeMgtService;
@GetMapping("/organMgtPage") @GetMapping("/organMgtPage")
public ModelAndView organMgtPage(UserInfo userInfo) { public ModelAndView organMgtPage(UserInfo userInfo) {

View File

@ -7,6 +7,7 @@ import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate; import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*; import javax.persistence.*;
import java.util.List;
@Getter @Getter
@Setter @Setter
@ -23,6 +24,8 @@ public class OrganConfig {
private String organType; private String organType;
@Column(name = "parent_organ") @Column(name = "parent_organ")
private String parentOrgan; private String parentOrgan;
@Column(name = "cp_chk")
private String cpChk;
@Transient @Transient
private String organNm; private String organNm;
@ -30,5 +33,7 @@ public class OrganConfig {
private String useState; private String useState;
@Transient @Transient
private Integer orderNum; private Integer orderNum;
@Transient
private List<OrganConfig> childList;
} }

View File

@ -12,4 +12,5 @@ public interface OrganConfigRepository extends JpaRepository<OrganConfig, String
void deleteByOrganType(String organType); void deleteByOrganType(String organType);
List<OrganConfig> findByParentOrgan(String ogCd); List<OrganConfig> findByParentOrgan(String ogCd);
List<OrganConfig> findByParentOrganAndCpChk(String ogCd, String cpChk);
} }

View File

@ -79,6 +79,38 @@ public class OrganConfigService {
.collect(Collectors.toList()); .collect(Collectors.toList());
return configList; return configList;
} }
public List<OrganConfig> selectOrganListToUnlawfulFishingStatistics() {
List<CodeMgt> codeList = codeMgtService.selectCodeMgtList("OG");
List<OrganConfig> middleOrganList = organConfigRepository.findByParentOrgan("OG001");
for(OrganConfig middle: middleOrganList){
for(CodeMgt organCd: codeList){
if(middle.getOrganCd().equals(organCd.getItemCd())){
middle.setOrganNm(organCd.getItemValue());
middle.setOrderNum(organCd.getOrderNum());
}
}
List<OrganConfig> childList = organConfigRepository.findByParentOrganAndCpChk(middle.getOrganCd(), "T");
for(OrganConfig child: childList){
for(CodeMgt organCd: codeList){
if(child.getOrganCd().equals(organCd.getItemCd())){
child.setOrganNm(organCd.getItemValue());
child.setOrderNum(organCd.getOrderNum());
}
}
}
childList = childList.stream()
.sorted(Comparator.comparing(OrganConfig::getOrderNum, Comparator.nullsLast(Comparator.naturalOrder())))
.collect(Collectors.toList());
OrganConfig total = new OrganConfig();
total.setOrganNm(middle.getOrganNm()+" 계");
childList.add(total);
middle.setChildList(childList);
}
middleOrganList = middleOrganList.stream()
.sorted(Comparator.comparing(OrganConfig::getOrderNum, Comparator.nullsLast(Comparator.naturalOrder())))
.collect(Collectors.toList());
return middleOrganList;
}
public OrganConfig selectOrganConfig(String organCd) { public OrganConfig selectOrganConfig(String organCd) {
return organConfigRepository.findById(organCd).orElse(null); return organConfigRepository.findById(organCd).orElse(null);

View File

@ -167,5 +167,6 @@
select distinct EXTRACT(YEAR FROM case_sent_dt) select distinct EXTRACT(YEAR FROM case_sent_dt)
from international_crime_arrest from international_crime_arrest
where status &lt;> 'DST008' where status &lt;> 'DST008'
and case_sent_dt is not null
</select> </select>
</mapper> </mapper>

View File

@ -0,0 +1,3 @@
$(document).on('click', '#statisticsTab', function (event){
location.href = "/unlawfulFishing/statistics?type="+event.target.id.replace("Tab", "");
})

View File

@ -35,7 +35,14 @@ $(document).on('click', '.rowDeleteBtn', function (){
}) })
targetTr.remove(); targetTr.remove();
}) })
$(document).on('change', '.cpChk', function (){
const ogCd = $(this).parents("tr").find("select").val()
const cpChk = this.checked?'T':'F';
organList.forEach(function (organ) {
if(organ.organCd === ogCd)
organ.cpChk = cpChk;
});
})
$(document).on('change', '.organSelector', function () { $(document).on('change', '.organSelector', function () {
const selector = this; const selector = this;
const selectedItemCd = selector.value; const selectedItemCd = selector.value;
@ -117,6 +124,7 @@ function addTr(tbody){
'<option value="">선택해주세요</option>' + '<option value="">선택해주세요</option>' +
options+ options+
'</select></td>' + '</select></td>' +
'<td><input type="checkbox" class="cpChk"> </td>' +
'</tr>' '</tr>'
) )
} }
@ -133,6 +141,7 @@ function setUsedOrganTr(parentOrgan, organType){
'<td><select class="organSelector form-select-sm">' + '<td><select class="organSelector form-select-sm">' +
'<option value="'+organ.organCd+'">'+organ.organNm+'</option>' + '<option value="'+organ.organCd+'">'+organ.organNm+'</option>' +
'</select></td>' + '</select></td>' +
(organType!=="OGC002"?'<td><input type="checkbox" class="cpChk"' + (organ.cpChk==="T"?'checked':'') + '> </td>':'') +
'</tr>' '</tr>'
) )
} }

View File

@ -17,7 +17,7 @@
<div class="col-12 card bg-light text-center"> <div class="col-12 card bg-light text-center">
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
<div class="col-4"> <div class="col-5">
<div class="row justify-content-end my-2"> <div class="row justify-content-end my-2">
<div class="col-auto"> <div class="col-auto">
<button class="btn btn-success" id="organSaveBtn">저장</button> <button class="btn btn-success" id="organSaveBtn">저장</button>
@ -48,7 +48,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-2"> <div class="col-3">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<div class="row"> <div class="row">
@ -57,6 +57,7 @@
<tr> <tr>
<th></th> <th></th>
<th>관할서</th> <th>관할서</th>
<th>불법조업 외국어선<br>단속 여부</th>
</tr> </tr>
</thead> </thead>
<tbody id="bottomTbody"> <tbody id="bottomTbody">

View File

@ -0,0 +1,131 @@
<!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/faStatistics/unlawfulFishing/statistics.js}"></script>
</th:block>
<th:block layout:fragment="css">
<style>
.backslash {
background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg"><line x1="0" y1="0" x2="100%" y2="100%" stroke="gray" /></svg>');
}
.backslash { text-align: left; }
.backslash div { text-align: right; }
</style>
</th:block>
<div layout:fragment="content">
<main>
<input type="hidden" id="menuKey" value="${menuKey}">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row justify-content-between">
<div class="col-auto mb-2">
<div class="d-inline align-middle"><i class="bi bi-square-fill"></i></div>
<h5 class="d-inline align-middle"> 불법조업 외국어선 통계</h5>
</div>
<div class="col-auto"><p class="mb-0 mt-2">외사통계 > 불법조업 외국어선 > 불법조업 외국어선 통계</p></div>
</div>
<div class="row mx-0">
<div class="col-12 card bg-light">
<div class="card-body">
<ul class="nav nav-tabs" id="statisticsTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${searchParams.type eq 'type1'?'active':''}" id="type1Tab" data-bs-toggle="tab" type="button" role="tab">통계1</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${searchParams.type eq 'type2'?'active':''}" id="type2Tab" data-bs-toggle="tab" type="button" role="tab">통계2</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" th:classappend="${searchParams.type eq 'type3'?'active':''}" id="type3Tab" data-bs-toggle="tab" type="button" role="tab">통계3</button>
</li>
</ul>
<div class="tab-content bg-white border border-top-0 p-2">
<div class="row">
<div class="col-12">
<table class="table table-sm table-hover table-bordered ws-nowrap">
<th:block th:if="${searchParams.type eq 'type1'}">
<colgroup>
<col style="width: 10%">
<col style="width: 10%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
<col style="width: 8%">
</colgroup>
<thead class="align-middle text-center">
<tr class="table-secondary">
<th rowspan="2">연도</th>
<th rowspan="2">나포 척수<br>①+②</th>
<th colspan="4">배타적경제수역 ①</th>
<th rowspan="2">영해침범 ②</th>
<th rowspan="2">구속 / 불구속</th>
<th rowspan="2">담보금<br>(납부/부과)</th>
<th rowspan="2">몰수 / 폐선</th>
<th rowspan="2">공무집행방해<br>(건/척)</th>
<th rowspan="2">위탁관리</th>
</tr>
<tr class="table-secondary">
<th>소계</th>
<th>무허가</th>
<th>특정금지<br><span class="fs-11">(무허가, 정선명령위반)</span></th>
<th>제한조건위반 등</th>
</tr>
</thead>
</th:block>
<th:block th:if="${searchParams.type eq 'type2'}">
<colgroup>
<col style="width: 10%">
<th:block th:each="num : ${#numbers.sequence(1,12)}">
<col style="width: 7.5%">
</th:block>
</colgroup>
<thead class="align-middle text-center">
<tr class="table-secondary">
<th>연도</th>
<th:block th:each="num : ${#numbers.sequence(1,12)}">
<th th:text="${#strings.concat(num, '월')}"></th>
</th:block>
</tr>
</thead>
</th:block>
<th:block th:if="${searchParams.type eq 'type3'}">
<colgroup>
<col style="width: 6.5%">
<th:block th:each="num : ${#numbers.sequence(1,17)}">
<col style="width: 5.5%">
</th:block>
</colgroup>
<thead class="align-middle text-center">
<tr class="table-secondary">
<th class="backslash" rowspan="2"><div>경찰서</div>연도</th>
<th:block th:each="parent:${organConfigList}">
<th th:colspan="${#lists.size(parent.childList)}" th:text="${parent.organNm}"></th>
</th:block>
</tr>
<tr class="table-secondary">
<th:block th:each="parent:${organConfigList}">
<th:block th:each="child:${parent.childList}">
<th th:text="${child.organNm}"></th>
</th:block>
</th:block>
</tr>
</thead>
</th:block>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</html>