불법조업 외국어선 통계 관련 클레스 분리.

master
강석 최 2023-09-05 18:03:05 +09:00
parent 87621984e6
commit 267f1c7b93
11 changed files with 92 additions and 64 deletions

View File

@ -3,8 +3,8 @@ 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.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.ShipStatisticsEtc;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.StatisticsModel;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.ShipStatisticsEtc;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.StatisticsParam;
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;
@ -25,7 +25,6 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpSession;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -395,7 +394,7 @@ public class UnlawfulFishingController {
}
@GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, HttpSession session, StatisticsModel params){
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, HttpSession session, StatisticsParam params){
ModelAndView mav = new ModelAndView("faStatistics/unlawfulFishing/statistics/statistics");
//메뉴권한 확인
AccessConfig accessConfig = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/unlawfulFishing/statistics?type=type1").get(0);
@ -405,15 +404,15 @@ public class UnlawfulFishingController {
}
switch (params.getType()){
case "type1":
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType1(params));
mav.addObject("captureStatList", unlawfulFishingService.selectStatisticsListType1(params));
break;
case "type2":
List<CodeMgt> cpoCode = ((Map<String, List<CodeMgt>>) session.getAttribute("commonCode")).get("CPO");
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType2(params, cpoCode));
mav.addObject("organStatList", unlawfulFishingService.selectStatisticsListType2(params, cpoCode));
mav.addObject("monthStatList", unlawfulFishingService.selectMonthStatList(params));
break;
case "type3":
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType3(params));
mav.addObject("processStatList", unlawfulFishingService.selectStatisticsListType3(params));
break;
}

View File

@ -1,6 +1,9 @@
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.statistics.OrganStatistics;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.CaptureStatistics;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.ProcessStatistics;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.StatisticsParam;
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;
@ -31,9 +34,9 @@ public interface UnlawfulFishingMapper {
Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params);
List<StatisticsModel> selectStatisticsListType1(StatisticsModel params);
List<StatisticsModel> selectStatisticsListType2(StatisticsModel params);
List<StatisticsModel> selectMonthStatList(StatisticsModel params);
List<StatisticsModel> selectStatisticsListType3(StatisticsModel params);
List<CaptureStatistics> selectStatisticsListType1(StatisticsParam params);
List<OrganStatistics> selectStatisticsListType2(StatisticsParam params);
List<OrganStatistics> selectMonthStatList(StatisticsParam params);
List<ProcessStatistics> selectStatisticsListType3(StatisticsParam params);
}

View File

@ -1,4 +1,4 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model;
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics;
import com.dbnt.faisp.config.BaseModel;
@ -13,10 +13,9 @@ import java.util.List;
@Getter
@Setter
@NoArgsConstructor
public class StatisticsModel{
public class CaptureStatistics {
private String type;
private Integer year;
private Integer month;
private String yearStr="";
private Integer captureCnt=0;
@ -36,7 +35,4 @@ public class StatisticsModel{
private Integer disposeCnt=0;
private String etc="";
private String fieldIvsgt;
private String crackdownPolice;
}

View File

@ -0,0 +1,17 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class OrganStatistics {
private String fieldIvsgt;
private String crackdownPolice;
private Integer month;
private Integer captureCnt=0;
}

View File

@ -0,0 +1,4 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics;
public class ProcessStatistics {
}

View File

@ -1,4 +1,4 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model;
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics;
import com.dbnt.faisp.config.BaseModel;
import lombok.*;

View File

@ -0,0 +1,15 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
public class StatisticsParam {
private String type;
private Integer year;
}

View File

@ -1,11 +1,8 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.repository;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.ShipStatisticsEtc;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.asfCov.AsfCov;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.ShipStatisticsEtc;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Optional;
public interface ShipStatisticsEtcRepository extends JpaRepository<ShipStatisticsEtc, Integer> {
}

View File

@ -1,9 +1,7 @@
package com.dbnt.faisp.main.faStatistics.unlawfulFishing.service;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.ShipStatisticsEtc;
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.*;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.*;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.IllegalShipInfo;
@ -14,6 +12,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShip
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailorHistory;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.Sailor;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.mapper.UnlawfulFishingMapper;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.statistics.*;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.repository.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
@ -22,9 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service
@RequiredArgsConstructor
@ -301,12 +298,12 @@ public class UnlawfulFishingService {
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();
public List<CaptureStatistics> selectStatisticsListType1(StatisticsParam params) {
List<CaptureStatistics> statisticsList = new ArrayList<>();
List<CaptureStatistics> temp = unlawfulFishingMapper.selectStatisticsListType1(params);
CaptureStatistics total = new CaptureStatistics();
total.setYearStr("총계");
for(StatisticsModel stat: temp){
for(CaptureStatistics 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());
@ -330,18 +327,18 @@ public class UnlawfulFishingService {
statisticsList.addAll(temp);
return statisticsList;
}
public List<StatisticsModel> selectStatisticsListType2(StatisticsModel params, List<CodeMgt> cpoCode) {
List<StatisticsModel> statisticsList = unlawfulFishingMapper.selectStatisticsListType2(params);
public List<OrganStatistics> selectStatisticsListType2(StatisticsParam params, List<CodeMgt> cpoCode) {
List<OrganStatistics> statisticsList = unlawfulFishingMapper.selectStatisticsListType2(params);
StatisticsModel total = new StatisticsModel();
StatisticsModel subTotalC = new StatisticsModel();
OrganStatistics total = new OrganStatistics();
OrganStatistics subTotalC = new OrganStatistics();
subTotalC.setFieldIvsgt("C");
StatisticsModel subTotalF = new StatisticsModel();
OrganStatistics subTotalF = new OrganStatistics();
subTotalF.setFieldIvsgt("F");
List<StatisticsModel> organCaptureList = new ArrayList<>();
List<OrganStatistics> organCaptureList = new ArrayList<>();
for(CodeMgt cpo: cpoCode){
StatisticsModel policeTotal = new StatisticsModel();
OrganStatistics policeTotal = new OrganStatistics();
policeTotal.setCrackdownPolice(cpo.getItemCd());
organCaptureList.add(policeTotal);
}
@ -349,7 +346,7 @@ public class UnlawfulFishingService {
for(CodeMgt cpo: cpoCode){
boolean cpoFlagC = false;
boolean cpoFlagF = false;
for(StatisticsModel stat: statisticsList){
for(OrganStatistics stat: statisticsList){
if(stat.getCrackdownPolice().equals(cpo.getItemCd())){
if(stat.getFieldIvsgt().equals("C"))
cpoFlagC = true;
@ -358,26 +355,26 @@ public class UnlawfulFishingService {
}
}
if(!cpoFlagC){
StatisticsModel temp = new StatisticsModel();
OrganStatistics temp = new OrganStatistics();
temp.setFieldIvsgt("C");
temp.setCrackdownPolice(cpo.getItemCd());
statisticsList.add(temp);
}
if(!cpoFlagF){
StatisticsModel temp = new StatisticsModel();
OrganStatistics temp = new OrganStatistics();
temp.setFieldIvsgt("F");
temp.setCrackdownPolice(cpo.getItemCd());
statisticsList.add(temp);
}
}
for(StatisticsModel stat: statisticsList){
for(OrganStatistics stat: statisticsList){
if(stat.getFieldIvsgt().equals("C")){
subTotalC.setCaptureCnt(subTotalC.getCaptureCnt()+stat.getCaptureCnt());
}else if(stat.getFieldIvsgt().equals("F")){
subTotalF.setCaptureCnt(subTotalF.getCaptureCnt()+stat.getCaptureCnt());
}
for(StatisticsModel organ: organCaptureList){
for(OrganStatistics organ: organCaptureList){
if(stat.getCrackdownPolice().equals(organ.getCrackdownPolice())){
organ.setCaptureCnt(organ.getCaptureCnt()+stat.getCaptureCnt());
}
@ -393,32 +390,32 @@ public class UnlawfulFishingService {
return statisticsList;
}
public List<StatisticsModel> selectMonthStatList(StatisticsModel params) {
List<StatisticsModel> monthStatList = unlawfulFishingMapper.selectMonthStatList(params);
public List<OrganStatistics> selectMonthStatList(StatisticsParam params) {
List<OrganStatistics> monthStatList = unlawfulFishingMapper.selectMonthStatList(params);
for(int i=1; i<=12; i++){
boolean monthFlag = false;
for(StatisticsModel monthStat: monthStatList){
for(OrganStatistics monthStat: monthStatList){
if(monthStat.getMonth().equals(i)){
monthFlag = true;
}
}
if(!monthFlag){
StatisticsModel temp = new StatisticsModel();
OrganStatistics temp = new OrganStatistics();
temp.setMonth(i);
monthStatList.add(temp);
}
}
int totalCnt = 0;
for(StatisticsModel monthStat: monthStatList){
for(OrganStatistics monthStat: monthStatList){
totalCnt += monthStat.getCaptureCnt();
}
StatisticsModel total = new StatisticsModel();
OrganStatistics total = new OrganStatistics();
total.setCaptureCnt(totalCnt);
monthStatList.add(total);
return monthStatList;
}
public List<StatisticsModel> selectStatisticsListType3(StatisticsModel params) {
public List<ProcessStatistics> selectStatisticsListType3(StatisticsParam params) {
return unlawfulFishingMapper.selectStatisticsListType3(params);
}

View File

@ -360,7 +360,7 @@
</choose>
</sql>
<select id="selectStatisticsListType1" parameterType="StatisticsModel" resultType="StatisticsModel">
<select id="selectStatisticsListType1" parameterType="StatisticsParam" resultType="CaptureStatistics">
select vt.year,
violation_1,
violation_2_1,
@ -451,7 +451,7 @@
where vt.year &lt;= ${year} and vt.year >= ${year}-5
order by year desc
</select>
<select id="selectStatisticsListType2" parameterType="StatisticsModel" resultType="StatisticsModel">
<select id="selectStatisticsListType2" parameterType="StatisticsParam" resultType="OrganStatistics">
select
a.field_ivsgt,
a.crackdown_police,
@ -461,7 +461,7 @@
where EXTRACT(YEAR FROM a.napo_dt) = ${year}
group by a.field_ivsgt, a.crackdown_police
</select>
<select id="selectMonthStatList" parameterType="StatisticsModel" resultType="StatisticsModel">
<select id="selectMonthStatList" parameterType="StatisticsParam" resultType="OrganStatistics">
select
EXTRACT(MONTH FROM a.napo_dt) as month,
count(b.fb_key) as captureCnt
@ -470,6 +470,6 @@
where EXTRACT(YEAR FROM a.napo_dt) = ${year}
group by month
</select>
<select id="selectStatisticsListType3" parameterType="StatisticsModel" resultType="StatisticsModel">
<select id="selectStatisticsListType3" parameterType="StatisticsParam" resultType="ProcessStatistics">
</select>
</mapper>

View File

@ -77,7 +77,7 @@
</tr>
</thead>
<tbody class="align-middle text-center">
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${captureStatList}">
<tr th:class="${stat.year ne null?'type1Row':''}" th:data-year="${stat.year}">
<td th:text="${stat.yearStr}"></td>
<td th:text="${stat.captureCnt}"></td>
@ -124,13 +124,13 @@
<tbody class="text-center">
<tr>
<td>나포척수</td>
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.crackdownPolice eq null and stat.fieldIvsgt eq null}">
<td th:text="${stat.captureCnt}"></td>
</th:block>
</th:block>
<th:block th:each="code:${session.commonCode.get('CPO')}">
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.fieldIvsgt eq null}">
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
<td th:text="${stat.captureCnt}"></td>
@ -141,13 +141,13 @@
</tr>
<tr>
<td>현장조사</td>
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.crackdownPolice eq null and stat.fieldIvsgt eq 'F'}">
<td th:text="${stat.captureCnt}"></td>
</th:block>
</th:block>
<th:block th:each="code:${session.commonCode.get('CPO')}">
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.fieldIvsgt eq 'F'}">
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
<td th:text="${stat.captureCnt}"></td>
@ -158,13 +158,13 @@
</tr>
<tr>
<td>압송(위탁)</td>
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.crackdownPolice eq null and stat.fieldIvsgt eq 'C'}">
<td th:text="${stat.captureCnt}"></td>
</th:block>
</th:block>
<th:block th:each="code:${session.commonCode.get('CPO')}">
<th:block th:each="stat:${statisticsList}">
<th:block th:each="stat:${organStatList}">
<th:block th:if="${stat.fieldIvsgt eq 'C'}">
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
<td th:text="${stat.captureCnt}"></td>
@ -183,7 +183,7 @@
</thead>
<tbody>
</tbody>
</th:block>
</table>