parent
f0c5318b67
commit
87621984e6
|
|
@ -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.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;
|
||||
|
|
@ -21,10 +22,12 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
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;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
|
@ -392,7 +395,7 @@ public class UnlawfulFishingController {
|
|||
}
|
||||
|
||||
@GetMapping("/statistics")
|
||||
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, StatisticsModel params){
|
||||
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, HttpSession session, StatisticsModel params){
|
||||
ModelAndView mav = new ModelAndView("faStatistics/unlawfulFishing/statistics/statistics");
|
||||
//메뉴권한 확인
|
||||
AccessConfig accessConfig = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/unlawfulFishing/statistics?type=type1").get(0);
|
||||
|
|
@ -405,7 +408,9 @@ public class UnlawfulFishingController {
|
|||
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType1(params));
|
||||
break;
|
||||
case "type2":
|
||||
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType2(params));
|
||||
List<CodeMgt> cpoCode = ((Map<String, List<CodeMgt>>) session.getAttribute("commonCode")).get("CPO");
|
||||
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType2(params, cpoCode));
|
||||
mav.addObject("monthStatList", unlawfulFishingService.selectMonthStatList(params));
|
||||
break;
|
||||
case "type3":
|
||||
mav.addObject("statisticsList", unlawfulFishingService.selectStatisticsListType3(params));
|
||||
|
|
|
|||
|
|
@ -33,5 +33,7 @@ public interface UnlawfulFishingMapper {
|
|||
|
||||
List<StatisticsModel> selectStatisticsListType1(StatisticsModel params);
|
||||
List<StatisticsModel> selectStatisticsListType2(StatisticsModel params);
|
||||
List<StatisticsModel> selectMonthStatList(StatisticsModel params);
|
||||
List<StatisticsModel> selectStatisticsListType3(StatisticsModel params);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,9 +15,10 @@ import java.util.List;
|
|||
@NoArgsConstructor
|
||||
public class StatisticsModel{
|
||||
private String type;
|
||||
private Integer year;
|
||||
private Integer month;
|
||||
|
||||
private String yearStr="";
|
||||
private Integer year;
|
||||
private Integer captureCnt=0;
|
||||
private Integer eezCnt=0;
|
||||
private Integer violation1=0;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
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;
|
||||
|
|
@ -21,7 +22,9 @@ 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
|
||||
|
|
@ -327,14 +330,94 @@ public class UnlawfulFishingService {
|
|||
statisticsList.addAll(temp);
|
||||
return statisticsList;
|
||||
}
|
||||
public List<StatisticsModel> selectStatisticsListType2(StatisticsModel params) {
|
||||
public List<StatisticsModel> selectStatisticsListType2(StatisticsModel params, List<CodeMgt> cpoCode) {
|
||||
List<StatisticsModel> statisticsList = unlawfulFishingMapper.selectStatisticsListType2(params);
|
||||
|
||||
for(StatisticsModel stat: statisticsList){
|
||||
|
||||
StatisticsModel total = new StatisticsModel();
|
||||
StatisticsModel subTotalC = new StatisticsModel();
|
||||
subTotalC.setFieldIvsgt("C");
|
||||
StatisticsModel subTotalF = new StatisticsModel();
|
||||
subTotalF.setFieldIvsgt("F");
|
||||
|
||||
List<StatisticsModel> organCaptureList = new ArrayList<>();
|
||||
for(CodeMgt cpo: cpoCode){
|
||||
StatisticsModel policeTotal = new StatisticsModel();
|
||||
policeTotal.setCrackdownPolice(cpo.getItemCd());
|
||||
organCaptureList.add(policeTotal);
|
||||
}
|
||||
|
||||
for(CodeMgt cpo: cpoCode){
|
||||
boolean cpoFlagC = false;
|
||||
boolean cpoFlagF = false;
|
||||
for(StatisticsModel stat: statisticsList){
|
||||
if(stat.getCrackdownPolice().equals(cpo.getItemCd())){
|
||||
if(stat.getFieldIvsgt().equals("C"))
|
||||
cpoFlagC = true;
|
||||
if(stat.getFieldIvsgt().equals("F"))
|
||||
cpoFlagF = true;
|
||||
}
|
||||
}
|
||||
if(!cpoFlagC){
|
||||
StatisticsModel temp = new StatisticsModel();
|
||||
temp.setFieldIvsgt("C");
|
||||
temp.setCrackdownPolice(cpo.getItemCd());
|
||||
statisticsList.add(temp);
|
||||
}
|
||||
if(!cpoFlagF){
|
||||
StatisticsModel temp = new StatisticsModel();
|
||||
temp.setFieldIvsgt("F");
|
||||
temp.setCrackdownPolice(cpo.getItemCd());
|
||||
statisticsList.add(temp);
|
||||
}
|
||||
}
|
||||
for(StatisticsModel 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){
|
||||
if(stat.getCrackdownPolice().equals(organ.getCrackdownPolice())){
|
||||
organ.setCaptureCnt(organ.getCaptureCnt()+stat.getCaptureCnt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
total.setCaptureCnt(subTotalC.getCaptureCnt()+subTotalF.getCaptureCnt());
|
||||
statisticsList.add(total);
|
||||
statisticsList.add(subTotalC);
|
||||
statisticsList.add(subTotalF);
|
||||
statisticsList.addAll(organCaptureList);
|
||||
|
||||
return statisticsList;
|
||||
}
|
||||
|
||||
public List<StatisticsModel> selectMonthStatList(StatisticsModel params) {
|
||||
List<StatisticsModel> monthStatList = unlawfulFishingMapper.selectMonthStatList(params);
|
||||
for(int i=1; i<=12; i++){
|
||||
boolean monthFlag = false;
|
||||
for(StatisticsModel monthStat: monthStatList){
|
||||
if(monthStat.getMonth().equals(i)){
|
||||
monthFlag = true;
|
||||
}
|
||||
}
|
||||
if(!monthFlag){
|
||||
StatisticsModel temp = new StatisticsModel();
|
||||
temp.setMonth(i);
|
||||
monthStatList.add(temp);
|
||||
}
|
||||
}
|
||||
int totalCnt = 0;
|
||||
for(StatisticsModel monthStat: monthStatList){
|
||||
totalCnt += monthStat.getCaptureCnt();
|
||||
}
|
||||
StatisticsModel total = new StatisticsModel();
|
||||
total.setCaptureCnt(totalCnt);
|
||||
monthStatList.add(total);
|
||||
return monthStatList;
|
||||
}
|
||||
|
||||
public List<StatisticsModel> selectStatisticsListType3(StatisticsModel params) {
|
||||
return unlawfulFishingMapper.selectStatisticsListType3(params);
|
||||
}
|
||||
|
|
@ -343,4 +426,5 @@ public class UnlawfulFishingService {
|
|||
public void saveStatEtc(ShipStatisticsEtc statEtc){
|
||||
sseRepository.save(statEtc);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -461,6 +461,15 @@
|
|||
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
|
||||
EXTRACT(MONTH FROM a.napo_dt) as month,
|
||||
count(b.fb_key) as captureCnt
|
||||
from crackdown_info a
|
||||
inner join illegal_ship_info b on a.cds_key = b.cds_key
|
||||
where EXTRACT(YEAR FROM a.napo_dt) = ${year}
|
||||
group by month
|
||||
</select>
|
||||
<select id="selectStatisticsListType3" parameterType="StatisticsModel" resultType="StatisticsModel">
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -109,29 +109,117 @@
|
|||
<colgroup>
|
||||
<col style="width: 10%">
|
||||
<th:block th:each="code:${session.commonCode.get('CPO')}">
|
||||
<col th:style="|width:${90/#lists.size(session.commonCode.get('CPO'))}%|">
|
||||
<col th:style="|width:${90/(#lists.size(session.commonCode.get('CPO'))+1)}%|">
|
||||
</th:block>
|
||||
</colgroup>
|
||||
<thead class="align-middle text-center">
|
||||
<tr class="table-secondary">
|
||||
<th>구분</th>
|
||||
<th>계</th>
|
||||
<th:block th:each="code:${session.commonCode.get('CPO')}">
|
||||
<th th:if="${code.useChk eq 'T'}" th:text="${code.itemValue}"></th>
|
||||
</th:block>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tbody class="text-center">
|
||||
<tr>
|
||||
<!--<th:block th:each="${}">
|
||||
|
||||
</th:block>-->
|
||||
<td>나포척수</td>
|
||||
<th:block th:each="stat:${statisticsList}">
|
||||
<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:if="${stat.fieldIvsgt eq null}">
|
||||
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
|
||||
<td th:text="${stat.captureCnt}"></td>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>현장조사</td>
|
||||
<th:block th:each="stat:${statisticsList}">
|
||||
<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:if="${stat.fieldIvsgt eq 'F'}">
|
||||
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
|
||||
<td th:text="${stat.captureCnt}"></td>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>압송(위탁)</td>
|
||||
<th:block th:each="stat:${statisticsList}">
|
||||
<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:if="${stat.fieldIvsgt eq 'C'}">
|
||||
<th:block th:if="${stat.crackdownPolice eq code.itemCd}">
|
||||
<td th:text="${stat.captureCnt}"></td>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</tr>
|
||||
</tbody>
|
||||
</th:block>
|
||||
<th:block th:if="${searchParams.type eq 'type3'}">
|
||||
<colgroup>
|
||||
|
||||
</colgroup>
|
||||
<thead>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</th:block>
|
||||
</table>
|
||||
<th:block th:if="${searchParams.type eq 'type2'}">
|
||||
<table class="table table-sm table-hover table-bordered ws-nowrap text-center">
|
||||
<colgroup>
|
||||
<col style="width: 8%">
|
||||
<col style="width: 8%">
|
||||
<th:block th:each="num : ${#numbers.sequence(1,12)}">
|
||||
<col style="width: 7%">
|
||||
</th:block>
|
||||
</colgroup>
|
||||
<thead class="table-secondary">
|
||||
<tr>
|
||||
<th>구분</th>
|
||||
<th>계</th>
|
||||
<th:block th:each="num : ${#numbers.sequence(1,12)}">
|
||||
<th th:text="|${num}월|"></th>
|
||||
</th:block>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>월별 나포 현황</td>
|
||||
<th:block th:each="monthStat:${monthStatList}">
|
||||
<th th:if="${monthStat.month eq null}" th:text="${monthStat.captureCnt}"></th>
|
||||
</th:block>
|
||||
<th:block th:each="num : ${#numbers.sequence(1,12)}">
|
||||
<th:block th:each="monthStat:${monthStatList}">
|
||||
<td th:if="${monthStat.month eq num}" th:text="${monthStat.captureCnt}"></td>
|
||||
</th:block>
|
||||
</th:block>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</th:block>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue