중간저장/
parent
80156cacba
commit
d8fe4f4930
|
|
@ -101,8 +101,7 @@ public class FishingBoatController {
|
||||||
|
|
||||||
@PostMapping("/saveFishingBoat")
|
@PostMapping("/saveFishingBoat")
|
||||||
public Integer saveFishingBoat(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
|
public Integer saveFishingBoat(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
|
||||||
return 0;
|
return fishingBoatService.saveCrackdownStatus(crackdownStatus);
|
||||||
// return processResultService.saveProcessResult(processResult);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/checkCaseNum")
|
@GetMapping("/checkCaseNum")
|
||||||
|
|
|
||||||
|
|
@ -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)){
|
||||||
|
// 최초 등록시 단속현황, 처리현황, 선원정보를 같이 등록.
|
||||||
|
cdsKey = crackdownStatusRepository.save(crackdownStatus).getCdsKey();
|
||||||
|
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
|
||||||
|
fishingBoat.setCdsKey(cdsKey);
|
||||||
|
fbKey = fishingBoatRepository.save(fishingBoat).getFbKey();
|
||||||
|
List<Violation> violationList = crackdownStatus.getViolationList();
|
||||||
|
int i = 1;
|
||||||
|
for(Violation violation: violationList){
|
||||||
|
violation.setViolationKey(i++);
|
||||||
|
violation.setFbKey(fbKey);
|
||||||
}
|
}
|
||||||
if (crackdownStatus.getSailorDeleteKeyList() != null) {
|
violationRepository.saveAll(violationList);
|
||||||
sailorRepository.deleteAllByIdInQuery(crackdownStatus.getSailorDeleteKeyList());
|
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);
|
||||||
|
|
||||||
if (crackdownStatus.getCrackdownBoatEtc() != null) {
|
fbKey = fishingBoatRepository.save(crackdownStatus.getFishingBoat()).getFbKey();
|
||||||
crackdownStatus.setCrackdownBoat(crackdownStatus.getCrackdownBoatEtc());
|
|
||||||
}
|
}
|
||||||
if (crackdownStatus.getCrackdownPoliceEtc() != null) {
|
|
||||||
crackdownStatus.setCrackdownPolice(crackdownStatus.getCrackdownPoliceEtc());
|
|
||||||
}
|
|
||||||
|
|
||||||
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) {
|
|
||||||
crackdownStatus.getFishingBoat().setFisheryType(crackdownStatus.getFishingBoat().getFisheryTypeEtc());
|
|
||||||
}
|
|
||||||
|
|
||||||
crackdownStatus.getFishingBoat().setCdsKey(cdsKey);
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue