Compare commits

..

2 Commits

9 changed files with 90 additions and 31 deletions

View File

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
@RestController
@RequiredArgsConstructor
@ -27,28 +28,20 @@ public class FishingBoatController {
private final CodeMgtService codeMgtService;
@RequestMapping("/fishingBoat")
public ModelAndView fishingBoat(@AuthenticationPrincipal UserInfo loginUser, FishingBoat fishingBoat) {
public ModelAndView fishingBoat(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus) {
ModelAndView mav = new ModelAndView("faStatistics/fishingBoat/fishingBoatMgt");
//메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/faStatistics/fishingBoat").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth);
fishingBoat.setQueryInfo();
/*List<ProcessResult> processResultList = processResultService.selectProcessResultList(fishingBoat);
crackdownStatus.setQueryInfo();
List<CrackdownStatus> crackdownStatusList = fishingBoatService.selectCrackdownStatusList(crackdownStatus);
for (ProcessResult pr:processResultList) {
pr.setCrackdownStatus(crackdownStatusRepository.findByCdsKey(pr.getCdsKey()));
pr.setFishingBoat(fishingBoatRepository.findByCdsKey(pr.getCdsKey()));
pr.setViolationList(violationRepository.findByFbKey(pr.getFishingBoat().getFbKey()));
}
mav.addObject("processResultList", processResultList);
fishingBoat.setContentCnt(processResultService.selectProcessResultListCnt(fishingBoat));
*/
fishingBoat.setPaginationInfo();
mav.addObject("searchParams", fishingBoat);
mav.addObject("crackdownStatusList", crackdownStatusList);
crackdownStatus.setContentCnt(fishingBoatService.selectCrackdownStatusListCnt(crackdownStatus));
crackdownStatus.setPaginationInfo();
mav.addObject("searchParams", crackdownStatus);
return mav;
}

View File

@ -3,6 +3,8 @@ package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.ViolationVersion;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ViolationVersionRepository extends JpaRepository<ViolationVersion, ViolationVersion.ViolationVersionId> {
import java.util.Optional;
public interface ViolationVersionRepository extends JpaRepository<ViolationVersion, ViolationVersion.ViolationVersionId> {
Optional<ViolationVersion> findTop1ByFbKeyOrderByVersionNoDesc(Integer fbKey);
}

View File

@ -8,15 +8,18 @@ import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.C
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoatVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.ViolationVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResult;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.processResult.ProcessResultVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.Sailor;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.SailorVersion;
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
import com.fasterxml.jackson.databind.util.BeanUtil;
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;
@Service
@ -31,8 +34,16 @@ public class FishingBoatService extends BaseService {
private final ViolationRepository violationRepository;
private final ViolationVersionRepository violationVersionRepository;
private final ProcessResultRepository processResultRepository;
private final ProcessResultVersionRepository processResultVersionRepository;
private final SailorRepository sailorRepository;
private final SailorVersionRepository sailorVersionRepository;
public List<CrackdownStatus> selectCrackdownStatusList(CrackdownStatus crackdownStatus){
return crackdownStatusMapper.selectCrackdownStatusList(crackdownStatus);
}
public Integer selectCrackdownStatusListCnt(CrackdownStatus crackdownStatus){
return crackdownStatusMapper.selectCrackdownStatusListCnt(crackdownStatus);
}
public CrackdownStatus selectCrackdownStatus(Integer cdsKey) {
CrackdownStatus crackdownStatus = crackdownStatusRepository.findById(cdsKey).orElse(null);
crackdownStatus.setFishingBoat(fishingBoatRepository.findByCdsKey(cdsKey).orElse(new FishingBoat()));
@ -52,10 +63,13 @@ public class FishingBoatService extends BaseService {
Integer cdsKey, fbKey;
if (crackdownStatus.getCdsKey()==null || crackdownStatus.getCdsKey().equals(0)){
// 최초 등록시 단속현황, 처리현황, 선원정보를 같이 등록.
// 단속현황, 단속현황버전 저장.
cdsKey = crackdownStatusRepository.save(crackdownStatus).getCdsKey();
CrackdownStatusVersion crackdownStatusVersion = new CrackdownStatusVersion();
BeanUtils.copyProperties(crackdownStatus, crackdownStatusVersion);
crackdownStatusVersion.setVersionNo(1);
crackdownStatusVersionRepository.save(crackdownStatusVersion);
// 어선정보, 어선정보버전 저장.
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
fishingBoat.setCdsKey(cdsKey);
fbKey = fishingBoatRepository.save(fishingBoat).getFbKey();
@ -63,28 +77,69 @@ public class FishingBoatService extends BaseService {
BeanUtils.copyProperties(fishingBoat, fishingBoatVersion);
fishingBoatVersion.setVersionNo(1);
fishingBoatVersionRepository.save(fishingBoatVersion);
// 위반사항, 위반사항버전 저장.
List<Violation> violationList = crackdownStatus.getViolationList();
List<ViolationVersion> violationVersionList = new ArrayList<>();
int i = 1;
for(Violation violation: violationList){
violation.setViolationKey(i++);
violation.setFbKey(fbKey);
ViolationVersion violationVersion = new ViolationVersion();
BeanUtils.copyProperties(violation, violationVersion);
violationVersion.setVersionNo(1);
violationVersionList.add(violationVersion);
}
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
// 처리현황, 처리현황버전 저장.
ProcessResult processResult = crackdownStatus.getProcessResult();
ProcessResultVersion processResultVersion = new ProcessResultVersion();
processResult.setCdsKey(cdsKey);
BeanUtils.copyProperties(processResult, processResultVersion);
processResultVersion.setVersionNo(1);
Integer prKey = processResultRepository.save(processResult).getPrKey();
processResultVersion.setPrKey(prKey);
processResultVersionRepository.save(processResultVersion);
// 선원정보, 선원정보버전 저장.
List<Sailor> sailorList = crackdownStatus.getSailorList();
List<SailorVersion> sailorVersionList = new ArrayList<>();
i = 1;
for(Sailor sailor: sailorList){
sailor.setSailorKey(i++);
sailor.setFbKey(fbKey);
SailorVersion sailorVersion = new SailorVersion();
BeanUtils.copyProperties(sailor, sailorVersion);
sailorVersion.setVersionNo(1);
sailorVersionList.add(sailorVersion);
}
sailorRepository.saveAll(sailorList);
sailorVersionRepository.saveAll(sailorVersionList);
}else{
// 업데이트시에는 어선정보만 수정.
cdsKey = crackdownStatus.getCdsKey();
FishingBoatVersion lastVersion = fishingBoatVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(crackdownStatus.getFishingBoat().getFbKey()).orElse(null);
int versionNo = lastVersion.getVersionNo();
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
FishingBoatVersion newInfo = new FishingBoatVersion();
fbKey = fishingBoatRepository.save(crackdownStatus.getFishingBoat()).getFbKey();
BeanUtils.copyProperties(fishingBoat, newInfo);
FishingBoatVersion lastFishingBoatVersion = fishingBoatVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(crackdownStatus.getFishingBoat().getFbKey()).orElse(null);
newInfo.setVersionNo(lastFishingBoatVersion.getVersionNo()+1);
fishingBoatRepository.save(fishingBoat);
fishingBoatVersionRepository.save(newInfo);
// 위반사항
List<Violation> violationList = crackdownStatus.getViolationList();
List<ViolationVersion> violationVersionList = new ArrayList<>();
int i=1;
ViolationVersion lastViolationVersion = violationVersionRepository.findTop1ByFbKeyOrderByVersionNoDesc(fishingBoat.getFbKey()).orElse(null);
for(Violation violation: violationList){
violation.setViolationKey(i);
ViolationVersion violationVersion = new ViolationVersion();
BeanUtils.copyProperties(violation, violationVersion);
violationVersion.setVersionNo(lastViolationVersion.getVersionNo()+1);
violationVersionList.add(violationVersion);
}
violationRepository.saveAll(violationList);
violationVersionRepository.saveAll(violationVersionList);
}
return cdsKey;
}

View File

@ -125,11 +125,12 @@ function getFishingBoatEditModal(cdsKey){
});
$(".dateTimeSelector").datetimepicker({
format:'Y-m-d H:i',
lang:'kr'
lang:'kr',
step:20
});
$(".timeSelector").datetimepicker({
datepicker:false,
format:'H:i',
format:'H시간i분',
lang:'kr',
step:20
});
@ -231,7 +232,7 @@ function saveFishingBoatInfo(saveYn){
success : function() {
alert("저장되었습니다.");
contentFade("out");
// location.reload();
location.reload();
},
error : function(xhr, status) {
alert("저장에 실패하였습니다.");

View File

@ -81,7 +81,7 @@ function getEditModal(publicKey, publicType){
dataType:"html",
success: function(html){
$("#editContent").empty().append(html)
$("#content").summernote({
/*$("#content").summernote({
lang:'ko-KR',
height: 350,
disableDragAndDrop: true,
@ -92,7 +92,7 @@ function getEditModal(publicKey, publicType){
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']]
]
});
});*/
setUploadDiv();
$("#editModal").modal('show');
},

View File

@ -351,6 +351,8 @@
</div>
<input type="hidden" class="processResultInfo" name="processResult.warrantReqTakeTime" id="warrantReqTake">
</div>
</div>
<div class="mb-3 row">
<label for="isIvsgtStop" class="col-sm-1 col-form-label col-form-label-sm text-center">수사중지 여부</label>
<div class="col-sm-2">
<select class="form-select form-select-sm processResultInfo" id="isIvsgtStop" name="processResult.isIvsgtStop">
@ -359,12 +361,12 @@
<option value="N">X</option>
</select>
</div>
</div>
<div class="mb-3 row">
<label for="evictionDt" class="col-sm-1 col-form-label col-form-label-sm text-center">퇴거일</label>
<div class="col-sm-2">
<input type="text" class="form-control form-control-sm processResultInfo dateSelector" id="evictionDt" name="processResult.evictionDt" placeholder="0000-00-00" th:value="${crackdownStatus.processResult.evictionDt}">
</div>
</div>
<div class="mb-3 row">
<label for="directHandoverDt" class="col-sm-1 col-form-label col-form-label-sm text-center">직접인계일</label>
<div class="col-sm-2">
<input type="text" class="form-control form-control-sm processResultInfo dateSelector" id="directHandoverDt" name="processResult.directHandoverDt" placeholder="0000-00-00" th:value="${crackdownStatus.processResult.directHandoverDt}">
@ -376,8 +378,6 @@
<input type="text" class="form-control form-control-sm processResultInfo" id="handoverSeaPointLat" name="processResult.handoverSeaPointLat" placeholder="000-00.00E" th:value="${crackdownStatus.processResult.handoverSeaPointLat}">
</div>
</div>
</div>
<div class="mb-3 row">
<label for="handoverBoat" class="col-sm-1 col-form-label col-form-label-sm text-center">인계 함정</label>
<div class="col-sm-2">
<input type="text" class="form-control form-control-sm processResultInfo" id="handoverBoat" name="processResult.handoverBoat" th:value="${crackdownStatus.processResult.handoverBoat}">

View File

@ -125,7 +125,7 @@
<th></th>
<th>나포일시</th>
<th>나포해점</th>
<th>사건담당<br>경찰서</th>
<th>사건담당기관</th>
<th>단속경찰서</th>
<th>단속함정</th>
<th>선명</th>

View File

@ -5,6 +5,7 @@
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>해양경찰청 외사종합포털</title>
<!--bootstrap-->
@ -34,6 +35,9 @@
<!--summernote-->
<script type="text/javascript" th:src="@{/vendor/summernote-0.8.18-dist/summernote-lite.min.js}"></script>
<script type="text/javascript" th:src="@{/vendor/summernote-0.8.18-dist/lang/summernote-ko-KR.min.js}"></script>
<!--namo cross editor-->
<script type="text/javascript" th:src="@{http://118.219.150.34:50571/Crosseditor/js/namo_scripteditor.js}"></script>
<!--sheetJs(excel)-->
<script type="text/javascript" th:src="@{/vendor/excel/FileSaver.min.js}"></script>
<script type="text/javascript" th:src="@{/vendor/excel/xlsx.full.min.js}"></script>

View File

@ -43,6 +43,10 @@
<label for="content" class="col-sm-2 col-form-label text-center">내용</label>
<div class="col-sm-10">
<textarea type='text' id="content" name='content' th:utext="${info.content}"></textarea>
<script type="text/javascript">
var CrossEditor = new NamoSE('content');
CrossEditor.EditorStart();
</script>
</div>
</div>
<div class="row mb-3">