외국어선 통계1 추가.

master
강석 최 2023-08-14 17:47:47 +09:00
parent 02b6cf7537
commit 3cae72979d
6 changed files with 245 additions and 37 deletions

View File

@ -2,6 +2,7 @@ package com.dbnt.faisp.main.faStatistics.unlawfulFishing;
import com.dbnt.faisp.main.authMgt.model.AccessConfig;
import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.StatisticsModel;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.UnlawfulFishingParam;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.*;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.IllegalShipInfo;
@ -13,11 +14,13 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShip
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.util.Utils;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -388,20 +391,24 @@ public class UnlawfulFishingController {
}
@GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, UnlawfulFishingParam params){
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, StatisticsModel 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());
if(Utils.isEmpty(params.getYear())){
params.setYear(LocalDate.now().getYear());
}
switch (params.getType()){
case "type1":
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType1(params));
break;
case "type2":
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType2(params));
mav.addObject("organConfigList", organConfigService.selectOrganListToUnlawfulFishingStatistics());
break;
case "type3":
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType3(params));
break;
}

View File

@ -1,5 +1,6 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.mapper;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.StatisticsModel;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.UnlawfulFishingParam;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.CrackdownInfo;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.IllegalShipInfo;
@ -29,4 +30,8 @@ public interface UnlawfulFishingMapper {
List<IllegalShipSailor> selectIllegalShipSailorList(UnlawfulFishingParam params);
Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params);
List<StatisticsModel> selectStatisticsListType1(StatisticsModel params);
List<StatisticsModel> selectStatisticsListType2(StatisticsModel params);
List<StatisticsModel> selectStatisticsListType3(StatisticsModel params);
}

View File

@ -0,0 +1,36 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model;
import com.dbnt.faisp.config.BaseModel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class StatisticsModel{
private String type;
private String yearStr="";
private Integer year;
private Integer captureCnt=0;
private Integer eezCnt=0;
private Integer violation1=0;
private Integer violation21=0;
private Integer violation22=0;
private Integer violation3=0;
private Integer violation4=0;
private Integer violation51=0;
private Integer violation52=0;
private Integer depositUnpaid=0;
private Integer depositPayment=0;
private Integer detentionCnt=0;
private Integer detentionNotCnt=0;
private Integer forfeitCnt=0;
private Integer disposeCnt=0;
private String etc="";
}

View File

@ -1,5 +1,6 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.service;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.StatisticsModel;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.UnlawfulFishingParam;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.*;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.FishingBoat;
@ -294,4 +295,40 @@ public class UnlawfulFishingService {
public void deleteIllegalShipSailor(Integer sailorKey) {
issRepository.bulkModifyingBySailorKeyToStatus(sailorKey, "DST008");
}
public List<StatisticsModel> selectStatisticsListType1(StatisticsModel params) {
List<StatisticsModel> statisticsList = new ArrayList<>();
List<StatisticsModel> temp = unlawfulFishingMapper.selectStatisticsListType1(params);
StatisticsModel total = new StatisticsModel();
total.setYearStr("총계");
for(StatisticsModel stat: temp){
stat.setYearStr(stat.getYear().toString().substring(2)+"년");
stat.setEezCnt(stat.getViolation1()+stat.getViolation21()+stat.getViolation22()+stat.getViolation3());
stat.setCaptureCnt(stat.getEezCnt()+stat.getViolation4());
total.setCaptureCnt(total.getCaptureCnt()+stat.getCaptureCnt());
total.setEezCnt(total.getEezCnt()+stat.getEezCnt());
total.setViolation1(total.getViolation1()+stat.getViolation1());
total.setViolation21(total.getViolation21()+stat.getViolation21());
total.setViolation22(total.getViolation22()+stat.getViolation22());
total.setViolation3(total.getViolation3()+stat.getViolation3());
total.setViolation4(total.getViolation4()+stat.getViolation4());
total.setViolation51(total.getViolation51()+stat.getViolation51());
total.setViolation52(total.getViolation52()+stat.getViolation52());
total.setDepositPayment(total.getDepositPayment()+stat.getDepositPayment());
total.setDepositUnpaid(total.getDepositUnpaid()+stat.getDepositUnpaid());
total.setDetentionCnt(total.getDetentionCnt()+stat.getDetentionCnt());
total.setDetentionNotCnt(total.getDetentionNotCnt()+stat.getDetentionNotCnt());
total.setForfeitCnt(total.getForfeitCnt()+stat.getForfeitCnt());
total.setDisposeCnt(total.getDisposeCnt()+stat.getDisposeCnt());
}
statisticsList.add(total);
statisticsList.addAll(temp);
return statisticsList;
}
public List<StatisticsModel> selectStatisticsListType2(StatisticsModel params) {
return unlawfulFishingMapper.selectStatisticsListType2(params);
}
public List<StatisticsModel> selectStatisticsListType3(StatisticsModel params) {
return unlawfulFishingMapper.selectStatisticsListType3(params);
}
}

View File

@ -110,7 +110,6 @@
</choose>
</sql>
<select id="selectIllegalShipInfoList" resultType="IllegalShipInfo" parameterType="UnlawfulFishingParam">
select fb_key,
a.cds_key ,
@ -360,4 +359,100 @@
</otherwise>
</choose>
</sql>
<select id="selectStatisticsListType1" parameterType="StatisticsModel" resultType="StatisticsModel">
select vt.year,
violation_1,
violation_2_1,
violation_2_2,
violation_3,
violation_4,
violation_5_1,
violation_5_2,
deposit_unpaid,
deposit_payment,
detention_cnt,
detention_not_cnt,
forfeit_cnt,
dispose_cnt,
etc
from (
select year,
sum(violation_1) as violation_1, --무허가조업
sum(violation_2_1) as violation_2_1, --무허가조업(특정금지)
sum(violation_2_2) as violation_2_2, -- 정선명령불응(특정금지)
sum(violation_3) as violation_3, -- 제한조건위반
sum(violation_4) as violation_4, -- 영해침범
sum(violation_5_1) as violation_5_1, -- 공무집행방해(건)
sum(violation_5_2) as violation_5_2 -- 공무집행방해(척)
from (
select a.cds_key ,
EXTRACT(YEAR FROM a.napo_dt) as year,
case when b.violation = 'VT002' then ship_cnt else 0 end as violation_1,
case when b.violation = 'VT003' then ship_cnt else 0 end as violation_2_1,
case when b.violation = 'VT004' then ship_cnt else 0 end as violation_2_2,
case when substring(b.violation, 3, 3)::int >= 7 and substring(b.violation, 3, 3)::int &lt;= 26 then ship_cnt else 0 end as violation_3,
case when b.violation = 'VT001' then ship_cnt else 0 end as violation_4,
case when b.violation = 'VT028' then 1 else 0 end as violation_5_1,
case when b.violation = 'VT028' then ship_cnt else 0 end as violation_5_2
from crackdown_info a
inner join violation_info b on a.cds_key = b.cds_key
inner join (select cds_key, count(*) as ship_cnt
from illegal_ship_info
where status &lt;> 'DST008'
group by cds_key) d on a.cds_key = d.cds_key
where a.status &lt;> 'DST008'
) vi
group by year
) vt
left outer join (
select EXTRACT(YEAR FROM a.napo_dt) as year,
sum(b.deposit_payment) as deposit_payment,
sum(b.deposit_unpaid) as deposit_unpaid
from crackdown_info a
inner join (
select cds_key, sum(deposit_payment) as deposit_payment, sum(deposit_unpaid) as deposit_unpaid
from illegal_ship_info
where status &lt;> 'DST008'
group by cds_key
) b on a.cds_key = b.cds_key
where a.status &lt;> 'DST008'
group by year
) dps on vt.year = dps.year
left outer join (
select year,
sum(detention_cnt) as detention_cnt,
sum(detention_not_cnt) as detention_not_cnt
from (
select EXTRACT(YEAR FROM a.napo_dt) as year,
case when detention_yn = 'Y' then 1 else 0 end as detention_cnt,
case when detention_yn = 'N' then 1 else 0 end as detention_not_cnt
from crackdown_info a
inner join illegal_ship_info b on a.cds_key = b.cds_key and b.status &lt;> 'DST008'
inner join illegal_ship_sailor c on b.fb_key = c.fb_key and c.status &lt;> 'DST008'
) a
group by year
) si on vt.year = si.year
left outer join (
select year,
sum(forfeit_cnt) as forfeit_cnt,
sum(dispose_cnt) as dispose_cnt
from (
select EXTRACT(YEAR FROM a.napo_dt) as year,
case when c.process_status = 'PR002' or c.process_status = 'PR003' then 1 else 0 end as forfeit_cnt,
case when c.process_status = 'PR005' or c.process_status = 'PR006' then 1 else 0 end as dispose_cnt
from crackdown_info a
inner join illegal_ship_info b on a.cds_key = b.cds_key and b.status &lt;> 'DST008'
inner join ship_process_info c on b.fb_key = c.fb_key and c.status &lt;> 'DST008'
) sp
group by year
) sp on sp.year = vt.year
left outer join ship_statistics_etc etc on vt.year = etc.year
where vt.year &lt;= ${year} and vt.year >= ${year}-5
order by year desc
</select>
<select id="selectStatisticsListType2" parameterType="StatisticsModel" resultType="StatisticsModel">
</select>
<select id="selectStatisticsListType3" parameterType="StatisticsModel" resultType="StatisticsModel">
</select>
</mapper>

View File

@ -41,39 +41,67 @@
<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>
<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>
<tbody class="align-middle text-center">
<th:block th:each="stat:${statisticsList}">
<tr>
<td th:text="${stat.yearStr}"></td>
<td th:text="${stat.captureCnt}"></td>
<td th:text="${stat.eezCnt}"></td>
<td th:text="${stat.violation1}"></td>
<td>
<th:block th:if="${stat.violation22>0}">
<th:block th:text="${#strings.concat(stat.violation21,'(정선',stat.violation22,')')}"></th:block>
</th:block>
<th:block th:if="${!(stat.violation22>0)}">
<th:block th:text="${stat.violation21}"></th:block>
</th:block>
</td>
<td th:text="${stat.violation3}"></td>
<td th:text="${stat.violation4}"></td>
<td th:text="${#strings.concat(stat.detentionCnt, '/', stat.detentionNotCnt)}"></td>
<td>
<div th:text="${#strings.concat(stat.depositPayment, '만원')}"></div>
<div th:text="${#strings.concat('(', stat.depositUnpaid, '만원)')}"></div>
</td>
<td th:text="${#strings.concat(stat.forfeitCnt, '/', stat.disposeCnt)}"></td>
<td th:text="${#strings.concat(stat.violation51, '건 ', stat.violation52, '척')}"></td>
<td th:text="${stat.etc}"></td>
</tr>
</th:block>
</tbody>
</th:block>
<th:block th:if="${searchParams.type eq 'type2'}">
<colgroup>