불법조업외국어선 오류수정중.

master
강석 최 2023-01-11 18:29:33 +09:00
parent ad558fcac1
commit e71b87a754
4 changed files with 56 additions and 47 deletions

View File

@ -96,17 +96,19 @@ public class FishingBoatService extends BaseService {
List<Violation> violationList = crackdownStatus.getViolationList(); List<Violation> violationList = crackdownStatus.getViolationList();
List<ViolationVersion> violationVersionList = new ArrayList<>(); List<ViolationVersion> violationVersionList = new ArrayList<>();
int i = 1; int i = 1;
for(Violation violation: violationList){ if(violationList!=null){
violation.setViolationKey(i++); for(Violation violation: violationList){
violation.setFbKey(fbKey); violation.setViolationKey(i++);
violation.setFbKey(fbKey);
ViolationVersion violationVersion = new ViolationVersion(); ViolationVersion violationVersion = new ViolationVersion();
BeanUtils.copyProperties(violation, violationVersion); BeanUtils.copyProperties(violation, violationVersion);
violationVersion.setVersionNo(1); violationVersion.setVersionNo(1);
violationVersionList.add(violationVersion); violationVersionList.add(violationVersion);
}
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
} }
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
// 처리현황, 처리현황버전 저장. // 처리현황, 처리현황버전 저장.
ProcessResult processResult = crackdownStatus.getProcessResult(); ProcessResult processResult = crackdownStatus.getProcessResult();
ProcessResultVersion processResultVersion = new ProcessResultVersion(); ProcessResultVersion processResultVersion = new ProcessResultVersion();
@ -118,21 +120,23 @@ public class FishingBoatService extends BaseService {
processResultVersionRepository.save(processResultVersion); processResultVersionRepository.save(processResultVersion);
// 선원정보, 선원정보버전 저장. // 선원정보, 선원정보버전 저장.
List<Sailor> sailorList = crackdownStatus.getSailorList(); List<Sailor> sailorList = crackdownStatus.getSailorList();
for(Sailor sailor: sailorList){ if(sailorList != null){
sailor.setFbKey(fbKey); for(Sailor sailor: sailorList){
sailor.setFbKey(fbKey);
SailorVersion sailorVersion = new SailorVersion(); SailorVersion sailorVersion = new SailorVersion();
Integer sailorKey = sailorRepository.save(sailor).getSailorKey(); Integer sailorKey = sailorRepository.save(sailor).getSailorKey();
BeanUtils.copyProperties(sailor, sailorVersion); BeanUtils.copyProperties(sailor, sailorVersion);
sailorVersion.setVersionNo(1); sailorVersion.setVersionNo(1);
sailorVersion.setSailorKey(sailorKey); sailorVersion.setSailorKey(sailorKey);
Integer versionNo = sailorVersionRepository.save(sailorVersion).getVersionNo(); Integer versionNo = sailorVersionRepository.save(sailorVersion).getVersionNo();
if(sailor.getPosition().equals("POS001")){ if(sailor.getPosition().equals("POS001")){
//선장은 사진이 같이 업로드 됨. //선장은 사진이 같이 업로드 됨.
if(sailorFiles.size()>0) { if(sailorFiles!= null && sailorFiles.size()>0) {
saveCaptainPhoto(sailorKey, versionNo, sailorFiles); saveCaptainPhoto(sailorKey, versionNo, sailorFiles);
}
} }
} }
} }
@ -151,19 +155,21 @@ public class FishingBoatService extends BaseService {
fishingBoatVersionRepository.save(newInfo); fishingBoatVersionRepository.save(newInfo);
// 위반사항 // 위반사항
List<Violation> violationList = crackdownStatus.getViolationList(); List<Violation> violationList = crackdownStatus.getViolationList();
List<ViolationVersion> violationVersionList = new ArrayList<>(); if(violationList != null){
int i=1; List<ViolationVersion> violationVersionList = new ArrayList<>();
ViolationVersion lastViolationVersion = violationVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(fishingBoat.getFbKey()).orElse(null); int i=1;
for(Violation violation: violationList){ ViolationVersion lastViolationVersion = violationVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(fishingBoat.getFbKey()).orElse(null);
violation.setFbKey(fishingBoat.getFbKey()); for(Violation violation: violationList){
violation.setViolationKey(i++); violation.setFbKey(fishingBoat.getFbKey());
ViolationVersion violationVersion = new ViolationVersion(); violation.setViolationKey(i++);
BeanUtils.copyProperties(violation, violationVersion); ViolationVersion violationVersion = new ViolationVersion();
violationVersion.setVersionNo(lastViolationVersion.getVersionNo()+1); BeanUtils.copyProperties(violation, violationVersion);
violationVersionList.add(violationVersion); violationVersion.setVersionNo(lastViolationVersion.getVersionNo()+1);
violationVersionList.add(violationVersion);
}
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
} }
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
} }
return cdsKey; return cdsKey;
} }
@ -199,14 +205,15 @@ public class FishingBoatService extends BaseService {
crackdownStatus.getProcessResult().setWrtUserNm(fishingBoat.getWrtUserNm()); crackdownStatus.getProcessResult().setWrtUserNm(fishingBoat.getWrtUserNm());
crackdownStatus.getProcessResult().setWrtUserGrd(fishingBoat.getWrtUserGrd()); crackdownStatus.getProcessResult().setWrtUserGrd(fishingBoat.getWrtUserGrd());
crackdownStatus.getProcessResult().setWrtDt(LocalDateTime.now()); crackdownStatus.getProcessResult().setWrtDt(LocalDateTime.now());
if(crackdownStatus.getSailorList()!=null){
for(Sailor sailor: crackdownStatus.getSailorList()){ for(Sailor sailor: crackdownStatus.getSailorList()){
sailor.setWrtOrgan(fishingBoat.getWrtOrgan()); sailor.setWrtOrgan(fishingBoat.getWrtOrgan());
sailor.setWrtPart(fishingBoat.getWrtPart()); sailor.setWrtPart(fishingBoat.getWrtPart());
sailor.setWrtUserSeq(fishingBoat.getWrtUserSeq()); sailor.setWrtUserSeq(fishingBoat.getWrtUserSeq());
sailor.setWrtUserNm(fishingBoat.getWrtUserNm()); sailor.setWrtUserNm(fishingBoat.getWrtUserNm());
sailor.setWrtUserGrd(fishingBoat.getWrtUserGrd()); sailor.setWrtUserGrd(fishingBoat.getWrtUserGrd());
sailor.setWrtDt(LocalDateTime.now()); sailor.setWrtDt(LocalDateTime.now());
}
} }
return crackdownStatus; return crackdownStatus;
} }

View File

@ -142,7 +142,9 @@ $(document).on('change', '#crimeType', function (){
let smugglingAmount = ''; let smugglingAmount = '';
commonCode.SG.forEach(function (item){ commonCode.SG.forEach(function (item){
smugglingAmount += '<option value="'+ item.itemCd +'">' + item.itemValue +'</option>'; if(item.useChk === 'T'){
smugglingAmount += '<option value="'+ item.itemCd +'">' + item.itemValue +'</option>';
}
}) })
if ($(this).val() == 'CTH2') { if ($(this).val() == 'CTH2') {

View File

@ -44,9 +44,9 @@
<div class="col-sm-2"> <div class="col-sm-2">
<select class="form-select form-select-sm" name="crimeType" id="crimeType"> <select class="form-select form-select-sm" name="crimeType" id="crimeType">
<option value="">선택</option> <option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('CTH')}"> <th:block th:each="code:${session.commonCode.get('CTH')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" <option th:if="${code.useChk eq 'T'}" th:value="${code.itemCd}" th:text="${code.itemValue}"
th:selected="${commonCode.itemCd eq internationalCrimeArrest.crimeType}"></option> th:selected="${code.itemCd eq internationalCrimeArrest.crimeType}"></option>
</th:block> </th:block>
</select> </select>
</div> </div>

View File

@ -50,10 +50,10 @@
<header th:replace="fragments/header :: headerFragment"></header> <header th:replace="fragments/header :: headerFragment"></header>
<div sec:authorize="isAnonymous()" layout:fragment="content"></div> <div sec:authorize="isAnonymous()" layout:fragment="content"></div>
<div sec:authorize="isAuthenticated()" class="d-flex flex-nowrap h-100" style="max-height: 888px;"> <div sec:authorize="isAuthenticated()" class="d-flex flex-nowrap h-100" style="max-height: 888px;">
<div class="flex-shrink-0 bg-dark border-end overflow-auto" style="width: 240px;"> <div class="flex-shrink-0 bg-dark border-end overflow-auto" style="width: 260px;">
<div th:replace="fragments/leftMenu :: leftMenuFragment"></div> <div th:replace="fragments/leftMenu :: leftMenuFragment"></div>
</div> </div>
<div class="flex-shrink-0 px-3 py-2 bg-white overflow-auto" style="width: 1680px;"> <div class="flex-shrink-0 px-3 py-2 bg-white overflow-auto" style="width: 1660px;">
<div layout:fragment="content"></div> <div layout:fragment="content"></div>
</div> </div>
</div> </div>