외사통계 > 국제범죄검거현황 삭제기능 오류 수정.

외사통계 > 불법조업 외국어선 > 외국어선 정보 삭제기능 추가.
master
강석 최 2023-05-09 18:26:19 +09:00
parent 6ae270e042
commit 5cc91ade85
8 changed files with 91 additions and 38 deletions

View File

@ -111,6 +111,7 @@ public class FishingBoatController {
if(crackdownStatus.getCdsKey()!=null){
crackdownStatus = fishingBoatService.selectCrackdownStatus(crackdownStatus.getCdsKey());
}else{
crackdownStatus.setNapoDt(LocalDateTime.now());
crackdownStatus.setFishingBoat(new FishingBoat());
crackdownStatus.setProcessResult(new ProcessResult());
crackdownStatus.getFishingBoat().setWrtOrgan(loginUser.getOgCd());
@ -153,4 +154,10 @@ public class FishingBoatController {
mav.addObject("bmList", codeMgtService.selectCodeMgtList("BM"));
return mav;
}
@PostMapping("/deleteFishingBoat")
@ResponseBody
public void deleteFishingBoat (@RequestBody FishingBoat boatInfo){
fishingBoatService.deleteFishingBoat(boatInfo.getFbKey());
}
}

View File

@ -2,12 +2,17 @@ package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.util.Optional;
public interface FishingBoatRepository extends JpaRepository<FishingBoat, Integer> {
Optional<FishingBoat> findByCdsKey(Integer cdsKey);
Optional<FishingBoat> findByFbKey(Integer fbKey);
Optional<FishingBoat> findByCdsKey(Integer cdsKey);
Optional<FishingBoat> findByFbKey(Integer fbKey);
@Modifying(clearAutomatically = true)
@Query("update FishingBoat set status = :status where fbKey = :fbKey")
void bulkModifyingByFbKeyToStatus(Integer fbKey, String status);
}

View File

@ -18,6 +18,7 @@ import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@ -214,11 +215,13 @@ public class FishingBoatService extends BaseService {
int fbKey = fishingBoatRepository.save(fishingBoat).getFbKey();
violationRepository.deleteByFbKey(fbKey);
int i=1;
for(Violation violation: violationList){
violation.setFbKey(fbKey);
violation.setViolationKey(i++);
if(violationList != null){
for(Violation violation: violationList){
violation.setFbKey(fbKey);
violation.setViolationKey(i++);
}
violationRepository.saveAll(violationList);
}
violationRepository.saveAll(violationList);
if(!fishingBoat.getStatus().equals("DST001")){
FishingBoatVersion lastVersion = fishingBoatVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(fbKey).orElse(null);
FishingBoatVersion fishingBoatVersion = new FishingBoatVersion();
@ -241,17 +244,19 @@ public class FishingBoatService extends BaseService {
public CSStatistics calculationCSStatistics(List<CrackdownStatusDTO> csDTOList) {
CSStatistics statistics = new CSStatistics();
for(CrackdownStatusDTO dto: csDTOList){
if (dto.getViolationCode().contains("VT002")){
statistics.setVt002Cnt(statistics.getVt002Cnt()+1);
}
if (dto.getViolationCode().contains("VT003") || dto.getViolationCode().contains("VT004")){
statistics.setVt003vt004Cnt(statistics.getVt003vt004Cnt()+1);
}
if (dto.getViolationCode().contains("VT029")){
statistics.setVt029Cnt(statistics.getVt029Cnt()+1);
}
if (dto.getViolationCode().contains("VT030")){
statistics.setVt030Cnt(statistics.getVt030Cnt()+1);
if(!Utils.isEmpty(dto.getViolationCode())){
if (dto.getViolationCode().contains("VT002")){
statistics.setVt002Cnt(statistics.getVt002Cnt()+1);
}
if (dto.getViolationCode().contains("VT003") || dto.getViolationCode().contains("VT004")){
statistics.setVt003vt004Cnt(statistics.getVt003vt004Cnt()+1);
}
if (dto.getViolationCode().contains("VT029")){
statistics.setVt029Cnt(statistics.getVt029Cnt()+1);
}
if (dto.getViolationCode().contains("VT030")){
statistics.setVt030Cnt(statistics.getVt030Cnt()+1);
}
}
if (dto.getNll().equals("Y")){
statistics.setNllCnt(statistics.getNllCnt()+1);
@ -359,7 +364,7 @@ public class FishingBoatService extends BaseService {
if (dto.getConfiscationDt() == null){
statistics.setConfiscationNotCnt(statistics.getConfiscationNotCnt()+1);
}
if(dto.getFieldIvsgt().equals("F")){
if(!Utils.isEmpty(dto.getFieldIvsgt()) && dto.getFieldIvsgt().equals("F")){
statistics.setFieldIvsgtCnt(statistics.getFieldIvsgtCnt()+1);
}
if(!Utils.isEmpty(dto.getConfiscationFrame())){
@ -380,4 +385,9 @@ public class FishingBoatService extends BaseService {
}
return statistics;
}
@Transactional
public void deleteFishingBoat(Integer fbKey) {
fishingBoatRepository.bulkModifyingByFbKeyToStatus(fbKey, "DST008");
}
}

View File

@ -82,7 +82,7 @@ public class InternationalCrimeArrestService extends BaseService {
@Transactional
public void deleteInternationalCrimeArrest(InternationalCrimeArrest internationalCrimeArrest) {
internationalCrimeArrestRepository.bulkModifyingByIcaKeyToStatus(internationalCrimeArrest.getIcaKey(), "D");
internationalCrimeArrestRepository.bulkModifyingByIcaKeyToStatus(internationalCrimeArrest.getIcaKey(), "DST008");
}
}

View File

@ -439,6 +439,7 @@
<sql id="selectFishingBoatListWhere">
<where>
b.status &lt;> 'DST008'
<if test="year != null and year != 0">
and extract(year from a.napo_dt) = ${year}
</if>

View File

@ -58,6 +58,35 @@ $(document).on('click', '#editFishingBoatBtn', function (){
getFishingBoatEditModal($("#fishingBoatViewModalContent").find(".cdsKey").val());
$("#fishingBoatViewModal").modal('hide');
})
$(document).on('click', '#deleteFishingBoatBtn', function (){
if(confirm("삭제하시겠습니까?" +
"\n되돌릴 수 없습니다." +
"\n연관된 단속현황, 처리현황, 선원정보가 같이 지워집니다.")){
contentFade("in");
$.ajax({
type : 'POST',
data : JSON.stringify({fbKey: $("#fishingBoatViewModalContent").find(".fbKey").val()}),
url : "/faStatistics/deleteFishingBoat",
contentType: 'application/json',
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(result) {
alert("삭제되었습니다.");
let searchParam = location.search;
if(searchParam.includes("refDocKey")){
searchParam = searchParam.substring(0, searchParam.indexOf("&"))
}
location.href = location.pathname+searchParam;
},
error : function(xhr, status) {
alert("삭제를 실패하였습니다.")
contentFade("out");
}
})
}
})
$(document).on('change', '#caseNum', function (){
$.ajax({
url: '/faStatistics/checkCaseNum',
@ -433,12 +462,11 @@ function saveFishingBoatInfo(status){
}
function valueCheck(status){
if(!$("#napoDt").val()){
alert("나포일시를 입력해주세요")
return false;
}
if(status === "DST007"){
if(!$("#napoDt").val()){
alert("나포일시를 입력해주세요")
return false;
}
}
return true;
}

View File

@ -147,7 +147,7 @@
<div class="col-sm-2">
<div class="input-group">
<input type="text" class="form-control form-control-sm dateSelector" id="napoDate" placeholder="yyyy-mm-dd" th:value="${#temporals.format(crackdownStatus.napoDt, 'yyyy-MM-dd')}" autocomplete="off">
<input type="text" class="form-control form-control-sm timeInputer" id="napoTime" placeholder="hh:mm" th:value="${#temporals.format(crackdownStatus.napoDt, 'hh:mm')}" autocomplete="off">
<input type="text" class="form-control form-control-sm timeInputer" id="napoTime" placeholder="hh:mm" th:value="${#temporals.format(crackdownStatus.napoDt, 'HH:mm')}" autocomplete="off">
</div>
</div>
<label for="napoSeaPointLon" class="col-sm-1 col-form-label col-form-label-sm text-center">나포장소</label>
@ -159,7 +159,6 @@
</div>
</div>
</div>
<hr class="m-0">
<div class="row">
<label class="col-sm-1 col-form-label col-form-label-sm text-center bg-lightB2">특수공무집행방해</label>
<div class="col-sm-11 border" id="damageDiv"
@ -239,7 +238,7 @@
<th:block th:if="${#lists.isEmpty(crackdownStatus.sailorList)}">
<div class="col-6" id="captainDiv">
<div class="row mb-1">
<label for="captainDiv" class="col-sm-2 col-form-label col-form-label-sm text-center">&nbsp;</label>
<label for="captainDiv" class="col-sm-2 col-form-label col-form-label-sm">&nbsp;</label>
</div>
<div class="row mb-1">
<label for="sailorNameKr" class="col-sm-2 col-form-label col-form-label-sm text-center">선장명</label>
@ -553,7 +552,7 @@
</div>
</div>
</div>
<hr class="m-0">
<div class="row mb-1">
<label for="offenseType" class="col-sm-1 col-form-label col-form-label-sm text-center">범칙물</label>
<div class="col-sm-2">
@ -593,7 +592,7 @@
<input type="hidden" id="paymentPaymentDt" name="fishingBoat.paymentPaymentDt" th:value="${#temporals.format(crackdownStatus.fishingBoat.paymentPaymentDt, 'yyyy-MM-dd hh:mm')}">
<div class="input-group">
<input type="text" class="form-control form-control-sm dateSelector" id="paymentPaymentDate" placeholder="yyyy-mm-dd" th:value="${#temporals.format(crackdownStatus.fishingBoat.paymentPaymentDt, 'yyyy-MM-dd')}" autocomplete="off">
<input type="text" class="form-control form-control-sm timeInputer" id="paymentPaymentTime" placeholder="hh:mm" th:value="${#temporals.format(crackdownStatus.fishingBoat.paymentPaymentDt, 'hh:mm')}" autocomplete="off">
<input type="text" class="form-control form-control-sm timeInputer" id="paymentPaymentTime" placeholder="hh:mm" th:value="${#temporals.format(crackdownStatus.fishingBoat.paymentPaymentDt, 'HH:mm')}" autocomplete="off">
</div>
</div>
</div>
@ -685,7 +684,7 @@
<div class="input-group">
<input type="hidden" id="releaseDt" name="processResult.releaseDt" th:value="${#temporals.format(crackdownStatus.processResult.releaseDt, 'yyyy-MM-dd hh:mm')}">
<input type="text" class="form-control form-control-sm dateSelector" id="releaseDate" th:value="${#temporals.format(crackdownStatus.processResult.releaseDt, 'yyyy-MM-dd')}" placeholder="yyyy-mm-dd" readonly>
<input type="text" class="form-control form-control-sm timeInputer" id="releaseTime" th:value="${#temporals.format(crackdownStatus.processResult.releaseDt, 'hh:mm')}" placeholder="hh:mm">
<input type="text" class="form-control form-control-sm timeInputer" id="releaseTime" th:value="${#temporals.format(crackdownStatus.processResult.releaseDt, 'HH:mm')}" placeholder="hh:mm">
</div>
</div>
<label for="napoDt" class="col-sm-1 col-form-label col-form-label-sm text-center">소요시간</label>
@ -693,7 +692,6 @@
<input type="text" class="form-control form-control-sm" id="releaseToNapo" placeholder="석방일시-나포일시" readonly>
</div>
</div>
<hr class="m-0">
<div class="row mb-1">
<label for="consignmentStartDt" class="col-sm-1 col-form-label col-form-label-sm text-center">위탁여부</label>
<div class="col-sm-2">
@ -803,7 +801,6 @@
</div>
</div>
</div>
<hr class="m-0">
<div class="row mb-1">
<th:block th:if="${#lists.isEmpty(crackdownStatus.sailorList)}">
<label for="captainRestriction" class="col-sm-1 col-form-label col-form-label-sm text-center">선장구속</label>

View File

@ -16,6 +16,7 @@
<div class="tab-content bg-white border border-top-0">
<div class="tab-pane fade p-2 mx-2 show active" id="fishingBoatViewTabPanel" role="tabpanel" aria-labelledby="fishingBoatViewTab" tabindex="0">
<input type="hidden" class="cdsKey" th:value="${crackdownStatus.cdsKey}">
<input type="hidden" class="fbKey" th:value="${crackdownStatus.fishingBoat.fbKey}">
<div class="row py-2">
<div class="col-12">
<div class="row justify-content-end">
@ -589,11 +590,15 @@
</div>
</div>
</div>
<div class="modal-footer bg-light">
<th:block th:if="${userSeq eq crackdownStatus.fishingBoat.wrtUserSeq
<th:block th:if="${userSeq eq crackdownStatus.fishingBoat.wrtUserSeq
or (accessAuth eq 'ACC003' and #lists.contains(mgtOrganList, crackdownStatus.fishingBoat.wrtOrgan))}">
<!--작성자, 관리자일 경우 수정 허용-->
<!--작성자, 관리자일 경우 수정, 삭제 허용-->
<div class="modal-footer justify-content-between bg-light">
<div class="col-auto">
<button type="button" class="btn btn-danger" id="deleteFishingBoatBtn">삭제</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-warning" id="editFishingBoatBtn">수정</button>
</th:block>
<!-- <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>-->
</div>
</div>
</th:block>