From 206636f854ddfdbb8fade37fbeba32a5120519d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EA=B0=95=EC=84=9D?= Date: Wed, 12 Jul 2023 18:24:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=84=A0=EC=9B=90=ED=98=84=ED=99=A9=20?= =?UTF-8?q?=EC=9E=91=EC=97=85=EC=A4=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UnlawfulFishingController.java | 22 ++++++-- .../mapper/UnlawfulFishingMapper.java | 5 ++ .../model/sailor/IllegalShipSailor.java | 25 +-------- .../IllegalShipSailorHistoryRepository.java | 4 +- .../service/UnlawfulFishingService.java | 22 ++++++++ .../mybatisMapper/UnlawfulFishingMapper.xml | 35 ++++++++++++ .../unlawfulFishing/illegalShipSailor.js | 44 ++++++++++++++- .../illegalShipSailorPage.html | 56 +++++++++++++------ .../illegalShipSailor/issAddModal.html | 2 +- .../shipProcessInfo/shipProcessInfoPage.html | 2 +- 10 files changed, 167 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/UnlawfulFishingController.java b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/UnlawfulFishingController.java index 0123d626..35289c7e 100644 --- a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/UnlawfulFishingController.java +++ b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/UnlawfulFishingController.java @@ -257,10 +257,10 @@ public class UnlawfulFishingController { AccessConfig accessConfig = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/unlawfulFishing/illegalShipSailor").get(0); mav.addObject("menuKey", accessConfig.getMenuKey()); mav.addObject("accessAuth", accessConfig.getAccessAuth()); - - List csDTOList = new ArrayList<>(); - - mav.addObject("sailorList", csDTOList); + params.setQueryInfo(); + mav.addObject("sailorList", unlawfulFishingService.selectIllegalShipSailorList(params)); + params.setContentCnt(unlawfulFishingService.selectIllegalShipSailorListCnt(params)); + params.setPaginationInfo(); mav.addObject("searchParams", params); return mav; } @@ -270,6 +270,20 @@ public class UnlawfulFishingController { return new ModelAndView("faStatistics/unlawfulFishing/illegalShipSailor/issAddModal"); } + @PostMapping("/saveIllegalShipSailorList") + @ResponseBody + public void saveIllegalShipSailorList(@AuthenticationPrincipal UserInfo loginUser, @RequestBody List sailorList){ + for(IllegalShipSailor sailor : sailorList){ + sailor.setWrtOrgan(loginUser.getOgCd()); + sailor.setWrtPart(loginUser.getOfcCd()); + sailor.setWrtUserSeq(loginUser.getUserSeq()); + sailor.setWrtUserGrd(loginUser.getTitleCd()); + sailor.setWrtUserNm(loginUser.getUserNm()); + sailor.setWrtDt(LocalDateTime.now()); + } + unlawfulFishingService.saveIllegalShipSailorList(sailorList); + } + @GetMapping("/issEditModal") public ModelAndView illegalShipSailorEditModal(@AuthenticationPrincipal UserInfo loginUser, IllegalShipSailor illegalShipSailor){ ModelAndView mav = new ModelAndView("faStatistics/unlawfulFishing/illegalShipSailor/issEditModal"); diff --git a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/mapper/UnlawfulFishingMapper.java b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/mapper/UnlawfulFishingMapper.java index b3644aeb..c1317308 100644 --- a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/mapper/UnlawfulFishingMapper.java +++ b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/mapper/UnlawfulFishingMapper.java @@ -4,6 +4,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.UnlawfulFishingPar import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.CrackdownInfo; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.IllegalShipInfo; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfo; +import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailor; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -24,4 +25,8 @@ public interface UnlawfulFishingMapper { List selectShipProcessInfoList(UnlawfulFishingParam params); Integer selectShipProcessInfoListCnt(UnlawfulFishingParam params); + + List selectIllegalShipSailorList(UnlawfulFishingParam params); + + Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params); } diff --git a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/model/sailor/IllegalShipSailor.java b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/model/sailor/IllegalShipSailor.java index 4cd31f2e..432aa510 100644 --- a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/model/sailor/IllegalShipSailor.java +++ b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/model/sailor/IllegalShipSailor.java @@ -35,30 +35,7 @@ public class IllegalShipSailor extends SailorBaseEntity { private String status; @Transient - @DateTimeFormat(pattern = "yyyy-MM-dd") - private LocalDateTime updDt; - @Transient - private Integer cdsKey; - @Transient - private CrackdownStatus crackdownStatus; - @Transient - private FishingBoat fishingBoat; - @Transient - private List fishingBoatList; - @Transient - private List violationList; - - @Transient - private String year; - @Transient - private String crackdownPolice; - @Transient - private String crackdownBoat; + private String caseNum; @Transient private String boatNameKr; - @Transient - private LocalDateTime napoDt; - - @Transient - private List fileList; } diff --git a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/repository/IllegalShipSailorHistoryRepository.java b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/repository/IllegalShipSailorHistoryRepository.java index 96d0014b..54ca2f3d 100644 --- a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/repository/IllegalShipSailorHistoryRepository.java +++ b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/repository/IllegalShipSailorHistoryRepository.java @@ -7,8 +7,8 @@ import java.util.List; import java.util.Optional; public interface IllegalShipSailorHistoryRepository extends JpaRepository { - Optional findTopBySailorKeyOrderByVersionNoDesc(Integer sailorKey); - List findBySailorKey(Integer sailorKey); + Optional findTopBySailorKeyOrderByVersionNoDesc(Integer sailorKey); + List findBySailorKey(Integer sailorKey); IllegalShipSailorHistory findByVersionNoAndSailorKey(Integer versionNo, Integer sailorKey); } diff --git a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/service/UnlawfulFishingService.java b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/service/UnlawfulFishingService.java index ca98c245..9aa157a1 100644 --- a/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/service/UnlawfulFishingService.java +++ b/src/main/java/com/dbnt/faisp/main/faStatistics/unlawfulFishing/service/UnlawfulFishingService.java @@ -8,6 +8,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.Illega import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfo; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfoHistory; 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.Sailor; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.mapper.UnlawfulFishingMapper; import com.dbnt.faisp.main.faStatistics.unlawfulFishing.repository.*; @@ -241,4 +242,25 @@ public class UnlawfulFishingService { public Integer selectShipProcessInfoListCnt(UnlawfulFishingParam params) { return unlawfulFishingMapper.selectShipProcessInfoListCnt(params); } + + @Transactional + public void saveIllegalShipSailorList(List sailorList) { + issRepository.saveAll(sailorList); + List historyList = new ArrayList<>(); + for(IllegalShipSailor info: sailorList){ + IllegalShipSailorHistory history = new IllegalShipSailorHistory(); + BeanUtils.copyProperties(info, history); + history.setVersionNo(1); + historyList.add(history); + } + isshRepository.saveAll(historyList); + } + + public List selectIllegalShipSailorList(UnlawfulFishingParam params) { + return unlawfulFishingMapper.selectIllegalShipSailorList(params); + } + + public Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params) { + return unlawfulFishingMapper.selectIllegalShipSailorListCnt(params); + } } diff --git a/src/main/resources/mybatisMapper/UnlawfulFishingMapper.xml b/src/main/resources/mybatisMapper/UnlawfulFishingMapper.xml index 9dfbaf0d..bab60f74 100644 --- a/src/main/resources/mybatisMapper/UnlawfulFishingMapper.xml +++ b/src/main/resources/mybatisMapper/UnlawfulFishingMapper.xml @@ -199,4 +199,39 @@ where a.status <> 'DST008' + + + + + + + where iss.status <> 'DST008' + \ No newline at end of file diff --git a/src/main/resources/static/js/faStatistics/unlawfulFishing/illegalShipSailor.js b/src/main/resources/static/js/faStatistics/unlawfulFishing/illegalShipSailor.js index 32196a72..28c81917 100644 --- a/src/main/resources/static/js/faStatistics/unlawfulFishing/illegalShipSailor.js +++ b/src/main/resources/static/js/faStatistics/unlawfulFishing/illegalShipSailor.js @@ -21,6 +21,7 @@ $(document).on('click', '#addSailorTab', function (){ $(liButton).attr("aria-controls", "sailor"+sailorCnt+"TabPanel"); const newTabContentHtml = $("#sailorTabEmptyDiv").children().clone(); + newTabContentHtml[0].className = newTabContentHtml[0].className+" sailorInfo"; newTabContentHtml[0].id = "sailor"+sailorCnt+"TabPanel"; $(newTabContentHtml).attr("aria-labelledby", "sailor"+sailorCnt+"Tab"); @@ -44,7 +45,48 @@ $(document).on('click', '.deleteTab', function (){ }) $(document).on('click', '.saveEditInfoBtn', function (){ - + if(confirm("저장하시겠습니까?")){ + const sailorList = []; + const fbKey = $("#fbKey").val() + const status = $(this).data("data-status") + $.each($(".sailorInfo"), function (idx, sailor){ + const sailorDiv = $(sailor); + sailorList.push({ + fbKey: fbKey, + status: status, + sailorNameKr: sailorDiv.find(".sailorNameKr").val(), + sailorNameCn: sailorDiv.find(".sailorNameCn").val(), + birthdate: sailorDiv.find(".birthdate").val(), + residence: sailorDiv.find(".residence").val(), + education: sailorDiv.find(".education").val(), + position: sailorDiv.find(".position").val(), + career: sailorDiv.find(".career").val(), + similarCriminalHistory: sailorDiv.find(".similarCriminalHistory").val(), + heterogeneousCriminalHistory: sailorDiv.find(".heterogeneousCriminalHistory").val(), + monthlyWages: sailorDiv.find(".monthlyWages").val(), + arrestHistory: sailorDiv.find(".arrestHistory").val(), + criminalHistoryDetail: sailorDiv.find(".criminalHistoryDetail").val(), + note: sailorDiv.find(".note").val() + }) + }); + $.ajax({ + type: 'POST', + url: '/unlawfulFishing/saveIllegalShipSailorList', + data: JSON.stringify(sailorList), + contentType: 'application/json', + dataType:"html", + beforeSend: function (xhr){ + xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val()); + }, + success: function(html){ + alert("저장되었습니다.") + location.reload() + }, + error:function(e){ + ajaxErrorAction(e); + } + }); + } }) function getIssAddModal(){ diff --git a/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/illegalShipSailorPage.html b/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/illegalShipSailorPage.html index c5ca7648..b99d3e82 100644 --- a/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/illegalShipSailorPage.html +++ b/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/illegalShipSailorPage.html @@ -104,30 +104,52 @@ 순번 사건번호 - MMSI.NO - 나포일시 - 나포장소 - 사건담당경찰서 - 사건담당경찰관 - 단속경찰서 - 단속함정 - 침범유형 - NLL침범여부 - 압송여부 + 어선명 + 선원명 + 생년월일 + 선박직책 + 승선경력 + 동종범죄경력 + 이종범죄경력 + 검거이력 작성자 작성일시 - - - - + + + + + + + -
-
-
+ + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/issAddModal.html b/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/issAddModal.html index b1f79be4..cbc0277c 100644 --- a/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/issAddModal.html +++ b/src/main/resources/templates/faStatistics/unlawfulFishing/illegalShipSailor/issAddModal.html @@ -150,7 +150,7 @@
-
+
diff --git a/src/main/resources/templates/faStatistics/unlawfulFishing/shipProcessInfo/shipProcessInfoPage.html b/src/main/resources/templates/faStatistics/unlawfulFishing/shipProcessInfo/shipProcessInfoPage.html index 06bb6059..e69a3c87 100644 --- a/src/main/resources/templates/faStatistics/unlawfulFishing/shipProcessInfo/shipProcessInfoPage.html +++ b/src/main/resources/templates/faStatistics/unlawfulFishing/shipProcessInfo/shipProcessInfoPage.html @@ -120,7 +120,7 @@ - +