|
|
|
@ -39,64 +39,34 @@ public class FishingBoatService extends BaseService {
|
|
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
|
|
@Transactional
|
|
|
|
public Integer saveCrackdownStatus(CrackdownStatus crackdownStatus) {
|
|
|
|
public Integer saveCrackdownStatus(CrackdownStatus crackdownStatus) {
|
|
|
|
if (crackdownStatus.getViolationDeleteKeyList() != null) {
|
|
|
|
Integer cdsKey, fbKey;
|
|
|
|
violationRepository.deleteAllByIdInQuery(crackdownStatus.getViolationDeleteKeyList());
|
|
|
|
if (crackdownStatus.getCdsKey()==null || crackdownStatus.getCdsKey().equals(0)){
|
|
|
|
}
|
|
|
|
// 최초 등록시 단속현황, 처리현황, 선원정보를 같이 등록.
|
|
|
|
if (crackdownStatus.getSailorDeleteKeyList() != null) {
|
|
|
|
cdsKey = crackdownStatusRepository.save(crackdownStatus).getCdsKey();
|
|
|
|
sailorRepository.deleteAllByIdInQuery(crackdownStatus.getSailorDeleteKeyList());
|
|
|
|
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
|
|
|
|
}
|
|
|
|
fishingBoat.setCdsKey(cdsKey);
|
|
|
|
|
|
|
|
fbKey = fishingBoatRepository.save(fishingBoat).getFbKey();
|
|
|
|
if (crackdownStatus.getCrackdownBoatEtc() != null) {
|
|
|
|
List<Violation> violationList = crackdownStatus.getViolationList();
|
|
|
|
crackdownStatus.setCrackdownBoat(crackdownStatus.getCrackdownBoatEtc());
|
|
|
|
int i = 1;
|
|
|
|
}
|
|
|
|
for(Violation violation: violationList){
|
|
|
|
if (crackdownStatus.getCrackdownPoliceEtc() != null) {
|
|
|
|
violation.setViolationKey(i++);
|
|
|
|
crackdownStatus.setCrackdownPolice(crackdownStatus.getCrackdownPoliceEtc());
|
|
|
|
violation.setFbKey(fbKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Integer cdsKey = crackdownStatusRepository.save(crackdownStatus).getCdsKey();
|
|
|
|
|
|
|
|
if (crackdownStatus.getFishingBoat() != null) {
|
|
|
|
|
|
|
|
if (crackdownStatus.getFishingBoat().getBoatMaterialEtc() != null) {
|
|
|
|
|
|
|
|
crackdownStatus.getFishingBoat().setBoatMaterial(crackdownStatus.getFishingBoat().getBoatMaterialEtc());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (crackdownStatus.getFishingBoat().getFisheryTypeEtc() != null) {
|
|
|
|
violationRepository.saveAll(violationList);
|
|
|
|
crackdownStatus.getFishingBoat().setFisheryType(crackdownStatus.getFishingBoat().getFisheryTypeEtc());
|
|
|
|
List<Sailor> sailorList = crackdownStatus.getSailorList();
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
|
|
|
|
for(Sailor sailor: sailorList){
|
|
|
|
|
|
|
|
sailor.setSailorKey(i++);
|
|
|
|
|
|
|
|
sailor.setFbKey(fbKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
sailorRepository.saveAll(sailorList);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
// 업데이트시에는 어선정보만 수정.
|
|
|
|
|
|
|
|
cdsKey = crackdownStatus.getCdsKey();
|
|
|
|
|
|
|
|
FishingBoat oldInfo = fishingBoatRepository.findById(crackdownStatus.getFishingBoat().getFbKey()).orElse(null);
|
|
|
|
|
|
|
|
|
|
|
|
crackdownStatus.getFishingBoat().setCdsKey(cdsKey);
|
|
|
|
fbKey = fishingBoatRepository.save(crackdownStatus.getFishingBoat()).getFbKey();
|
|
|
|
Integer fbKey = fishingBoatRepository.save(crackdownStatus.getFishingBoat()).getFbKey();
|
|
|
|
|
|
|
|
crackdownStatus.getFishingBoat().setFbKey(fbKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (crackdownStatus.getProcessResult() != null) {
|
|
|
|
|
|
|
|
if (crackdownStatus.getProcessResult().getProcessStatusEtc() != null) {
|
|
|
|
|
|
|
|
crackdownStatus.getProcessResult().setProcessStatus(crackdownStatus.getProcessResult().getProcessStatusEtc());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
crackdownStatus.getProcessResult().setCdsKey(cdsKey);
|
|
|
|
|
|
|
|
Integer prKey = processResultRepository.save(crackdownStatus.getProcessResult()).getPrKey();
|
|
|
|
|
|
|
|
crackdownStatus.getProcessResult().setPrKey(prKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*if (internationalCrimeArrest.getDeleteSpiKeyList() != null) {
|
|
|
|
|
|
|
|
suspectPersonInfoRepository.deleteAllByIdInQuery(internationalCrimeArrest.getDeleteSpiKeyList());
|
|
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (crackdownStatus.getViolationList() != null) {
|
|
|
|
|
|
|
|
for(Violation violation: crackdownStatus.getViolationList()){
|
|
|
|
|
|
|
|
if (violation.getViolationEtc() != null) {
|
|
|
|
|
|
|
|
violation.setViolation(violation.getViolationEtc());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
violation.setFbKey(crackdownStatus.getFishingBoat().getFbKey());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
violationRepository.saveAll(crackdownStatus.getViolationList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (crackdownStatus.getSailorList() != null) {
|
|
|
|
|
|
|
|
for(Sailor sailor: crackdownStatus.getSailorList()){
|
|
|
|
|
|
|
|
sailor.setFbKey(crackdownStatus.getFishingBoat().getFbKey());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
sailorRepository.saveAll(crackdownStatus.getSailorList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return cdsKey;
|
|
|
|
return cdsKey;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|