💩 임시커밋
This commit is contained in:
부모
270b2a0b55
커밋
4700ec862b
@ -23,7 +23,7 @@ public class JsonChangeDetector {
|
|||||||
// TreeMap을 사용하여 키를 알파벳 순으로 정렬할 수도 있지만, 여기서는 HashMap을 사용하고 final로 만듭니다.
|
// TreeMap을 사용하여 키를 알파벳 순으로 정렬할 수도 있지만, 여기서는 HashMap을 사용하고 final로 만듭니다.
|
||||||
Map<String, String> map = new HashMap<>();
|
Map<String, String> map = new HashMap<>();
|
||||||
// List 필드명 // 정렬 기준 복합 키 (JSON 필드명, 쉼표로 구분)
|
// List 필드명 // 정렬 기준 복합 키 (JSON 필드명, 쉼표로 구분)
|
||||||
map.put("OwnerHistory", "OwnerCode,EffectiveDate");
|
map.put("OwnerHistory", "OwnerCode,EffectiveDate,Sequence");
|
||||||
map.put("CrewList", "ID");
|
map.put("CrewList", "ID");
|
||||||
map.put("StowageCommodity", "Sequence,CommodityCode,StowageCode");
|
map.put("StowageCommodity", "Sequence,CommodityCode,StowageCode");
|
||||||
map.put("GroupBeneficialOwnerHistory", "EffectiveDate,GroupBeneficialOwnerCode,Sequence");
|
map.put("GroupBeneficialOwnerHistory", "EffectiveDate,GroupBeneficialOwnerCode,Sequence");
|
||||||
@ -44,6 +44,9 @@ public class JsonChangeDetector {
|
|||||||
map.put("StatusHistory", "Sequence,StatusCode,StatusDate");
|
map.put("StatusHistory", "Sequence,StatusCode,StatusDate");
|
||||||
map.put("SpecialFeature", "Sequence,SpecialFeatureCode");
|
map.put("SpecialFeature", "Sequence,SpecialFeatureCode");
|
||||||
map.put("Thrusters", "Sequence");
|
map.put("Thrusters", "Sequence");
|
||||||
|
map.put("DarkActivityConfirmed", "Lrno,Mmsi,Dark_Time,Dark_Status");
|
||||||
|
map.put("CompanyComplianceDetails", "OwCode");
|
||||||
|
map.put("CompanyVesselRelationships", "LRNO");
|
||||||
|
|
||||||
LIST_SORT_KEYS = Collections.unmodifiableMap(map);
|
LIST_SORT_KEYS = Collections.unmodifiableMap(map);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ public class ShipDetailUpdateJobConfig extends BaseJobConfig<ShipDetailCompariso
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getChunkSize() {
|
protected int getChunkSize() {
|
||||||
return 30; // API에서 100개씩 가져오므로 chunk도 100으로 설정
|
return 1; // API에서 100개씩 가져오므로 chunk도 100으로 설정
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "ShipDetailUpdateJob")
|
@Bean(name = "ShipDetailUpdateJob")
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CompanyComplianceDto {
|
||||||
|
@Getter @Setter @ToString @NoArgsConstructor
|
||||||
|
public static class DataSetVersionDto {
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private String dataSetVersion;
|
||||||
|
}
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private DataSetVersionDto dataSetVersion;
|
||||||
|
|
||||||
|
@JsonProperty("OwCode") private String owCode;
|
||||||
|
@JsonProperty("ShortCompanyName") private String shortCompanyName;
|
||||||
|
@JsonProperty("CompanyOnOFACSanctionList") private String companyOnOFACSanctionList;
|
||||||
|
@JsonProperty("CompanyOnUNSanctionList") private String companyOnUNSanctionList;
|
||||||
|
@JsonProperty("CompanyOnEUSanctionList") private String companyOnEUSanctionList;
|
||||||
|
@JsonProperty("CompanyOnBESSanctionList") private String companyOnBESSanctionList;
|
||||||
|
@JsonProperty("CompanyInOFACSanctionedCountry") private String companyInOFACSanctionedCountry;
|
||||||
|
@JsonProperty("CompanyInFATFJurisdiction") private String companyInFATFJurisdiction;
|
||||||
|
@JsonProperty("ParentCompanyComplianceRisk") private String parentCompanyComplianceRisk;
|
||||||
|
@JsonProperty("CompanyOverallComplianceStatus") private String companyOverallComplianceStatus;
|
||||||
|
@JsonProperty("CompanyOnAustralianSanctionList") private String companyOnAustralianSanctionList;
|
||||||
|
@JsonProperty("CompanyOnCanadianSanctionList") private String companyOnCanadianSanctionList;
|
||||||
|
@JsonProperty("CompanyOnSwissSanctionList") private String companyOnSwissSanctionList;
|
||||||
|
@JsonProperty("CompanyOnOFACSSIList") private String companyOnOFACSSIList;
|
||||||
|
@JsonProperty("CompanyOnOFACNonSDNSanctionList") private String companyOnOFACNonSDNSanctionList;
|
||||||
|
@JsonProperty("CompanyOnUAESanctionList") private String companyOnUAESanctionList;
|
||||||
|
}
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class CompanyVesselRelationshipDto {
|
||||||
|
@Getter @Setter @ToString @NoArgsConstructor
|
||||||
|
public static class DataSetVersionDto {
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private String dataSetVersion;
|
||||||
|
}
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private DataSetVersionDto dataSetVersion;
|
||||||
|
|
||||||
|
@JsonProperty("DOCCode")
|
||||||
|
private String docCode;
|
||||||
|
@JsonProperty("DOCCompany")
|
||||||
|
private String docCompany;
|
||||||
|
@JsonProperty("DOCGroup")
|
||||||
|
private String docGroup;
|
||||||
|
@JsonProperty("DOCGroupCode")
|
||||||
|
private String docGroupCode;
|
||||||
|
@JsonProperty("GroupBeneficialOwner")
|
||||||
|
private String groupBeneficialOwner;
|
||||||
|
@JsonProperty("GroupBeneficialOwnerCode")
|
||||||
|
private String groupBeneficialOwnerCode;
|
||||||
|
@JsonProperty("LRNO")
|
||||||
|
private String lrno;
|
||||||
|
@JsonProperty("Operator")
|
||||||
|
private String operator;
|
||||||
|
@JsonProperty("OperatorCode")
|
||||||
|
private String operatorCode;
|
||||||
|
@JsonProperty("OperatorGroup")
|
||||||
|
private String operatorGroup;
|
||||||
|
@JsonProperty("OperatorGroupCode")
|
||||||
|
private String operatorGroupCode;
|
||||||
|
@JsonProperty("RegisteredOwner")
|
||||||
|
private String registeredOwner;
|
||||||
|
@JsonProperty("RegisteredOwnerCode")
|
||||||
|
private String registeredOwnerCode;
|
||||||
|
@JsonProperty("ShipManager")
|
||||||
|
private String shipManager;
|
||||||
|
@JsonProperty("ShipManagerCode")
|
||||||
|
private String shipManagerCode;
|
||||||
|
@JsonProperty("ShipManagerGroup")
|
||||||
|
private String shipManagerGroup;
|
||||||
|
@JsonProperty("ShipManagerGroupCode")
|
||||||
|
private String shipManagerGroupCode;
|
||||||
|
@JsonProperty("TechnicalManager")
|
||||||
|
private String technicalManager;
|
||||||
|
@JsonProperty("TechnicalManagerCode")
|
||||||
|
private String technicalManagerCode;
|
||||||
|
@JsonProperty("TechnicalManagerGroup")
|
||||||
|
private String technicalManagerGroup;
|
||||||
|
@JsonProperty("TechnicalManagerGroupCode")
|
||||||
|
private String technicalManagerGroupCode;
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ToString
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class DarkActivityConfirmedDto {
|
||||||
|
@Getter @Setter @ToString @NoArgsConstructor
|
||||||
|
public static class DataSetVersionDto {
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private String dataSetVersion;
|
||||||
|
}
|
||||||
|
@JsonProperty("DataSetVersion")
|
||||||
|
private DataSetVersionDto dataSetVersion;
|
||||||
|
|
||||||
|
@JsonProperty("Lrno") private String lrno;
|
||||||
|
@JsonProperty("Mmsi") private String mmsi;
|
||||||
|
@JsonProperty("Vessel_Name") private String vesselName;
|
||||||
|
@JsonProperty("Dark_Hours") private String darkHours;
|
||||||
|
@JsonProperty("Dark_Activity") private String darkActivity;
|
||||||
|
@JsonProperty("Dark_Status") private String darkStatus;
|
||||||
|
@JsonProperty("Area_Id") private String areaId;
|
||||||
|
@JsonProperty("Area_Name") private String areaName;
|
||||||
|
@JsonProperty("Dark_Time") private String darkTime;
|
||||||
|
@JsonProperty("Dark_Latitude") private String darkLatitude;
|
||||||
|
@JsonProperty("Dark_Longitude") private String darkLongitude;
|
||||||
|
@JsonProperty("Dark_Speed") private String darkSpeed;
|
||||||
|
@JsonProperty("Dark_Heading") private String darkHeading;
|
||||||
|
@JsonProperty("Dark_Draught") private String darkDraught;
|
||||||
|
@JsonProperty("NextSeen") private String nextSeen;
|
||||||
|
@JsonProperty("NextSeen_Latitude") private String nextSeenLatitude;
|
||||||
|
@JsonProperty("NextSeen_Longitude") private String nextSeenLongitude;
|
||||||
|
@JsonProperty("NextSeen_Speed") private String nextSeenSpeed;
|
||||||
|
@JsonProperty("NextSeen_Draught") private String nextSeenDraught;
|
||||||
|
@JsonProperty("NextSeen_Heading") private String nextSeenHeading;
|
||||||
|
@JsonProperty("Dark_Reported_Destination") private String darkReportedDestination;
|
||||||
|
@JsonProperty("NextSeen_Reported_Destination") private String nextSeenReportedDestination;
|
||||||
|
@JsonProperty("Last_Port_of_Call") private String lastPortOfCall;
|
||||||
|
@JsonProperty("Last_Port_Country_Code") private String lastPortCountryCode;
|
||||||
|
@JsonProperty("Last_Port_Country") private String lastPortCountry;
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.snp.batch.jobs.shipdetail.batch.dto;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.snp.batch.jobs.shipdetail.batch.entity.CompanyComplianceEntity;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -448,4 +449,26 @@ public class ShipDetailDto {
|
|||||||
*/
|
*/
|
||||||
@JsonProperty("Thrusters")
|
@JsonProperty("Thrusters")
|
||||||
private List<ThrustersDto> thrusters;
|
private List<ThrustersDto> thrusters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 선박과 연관된 회사 정보 List
|
||||||
|
* API: CompanyVesselRelationships
|
||||||
|
*/
|
||||||
|
@JsonProperty("CompanyVesselRelationships")
|
||||||
|
private List<CompanyVesselRelationshipDto> CompanyVesselRelationships;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 회사 컴플라이언스 정보 List
|
||||||
|
* API: CompanyComplianceDetails
|
||||||
|
*/
|
||||||
|
@JsonProperty("CompanyComplianceDetails")
|
||||||
|
private List<CompanyComplianceDto> CompanyComplianceDetails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 다크활동이력 정보 List
|
||||||
|
* API: DarkActivityConfirmed
|
||||||
|
*/
|
||||||
|
@JsonProperty("DarkActivityConfirmed")
|
||||||
|
private List<DarkActivityConfirmedDto> darkActivityConfirmed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,4 +43,7 @@ public class ShipDetailUpdate {
|
|||||||
private final List<StatusHistoryEntity> statusHistoryEntityList;
|
private final List<StatusHistoryEntity> statusHistoryEntityList;
|
||||||
private final List<SpecialFeatureEntity> specialFeatureEntityList;
|
private final List<SpecialFeatureEntity> specialFeatureEntityList;
|
||||||
private final List<ThrustersEntity> thrustersEntityList;
|
private final List<ThrustersEntity> thrustersEntityList;
|
||||||
|
private final List<DarkActivityConfirmedEntity> darkActivityConfirmedEntityList;
|
||||||
|
private final List<CompanyComplianceEntity> companyComplianceEntityList;
|
||||||
|
private final List<CompanyVesselRelationshipEntity> companyVesselRelationshipEntityList;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.entity;
|
||||||
|
|
||||||
|
import com.snp.batch.common.batch.entity.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class CompanyComplianceEntity extends BaseEntity {
|
||||||
|
private String datasetversion;
|
||||||
|
private String owcode;
|
||||||
|
private String shortcompanyname;
|
||||||
|
private String companyonofacsanctionlist;
|
||||||
|
private String companyonunsanctionlist;
|
||||||
|
private String companyoneusanctionlist;
|
||||||
|
private String companyonbessanctionlist;
|
||||||
|
private String companyinofacsanctionedcountry;
|
||||||
|
private String companyinfatfjurisdiction;
|
||||||
|
private String companyoverallcompliancestatus;
|
||||||
|
private String companyonaustraliansanctionlist;
|
||||||
|
private String companyoncanadiansanctionlist;
|
||||||
|
private String companyonswisssanctionlist;
|
||||||
|
private String companyonofacssilist;
|
||||||
|
private String companyonofacnonsdnsanctionlist;
|
||||||
|
private String companyonuaesanctionlist;
|
||||||
|
private String parentcompanycompliancerisk;
|
||||||
|
}
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.entity;
|
||||||
|
|
||||||
|
import com.snp.batch.common.batch.entity.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class CompanyVesselRelationshipEntity extends BaseEntity {
|
||||||
|
private String datasetversion;
|
||||||
|
private String doccode;
|
||||||
|
private String doccompany;
|
||||||
|
private String groupbeneficialowner;
|
||||||
|
private String groupbeneficialownercode;
|
||||||
|
private String lrno;
|
||||||
|
private String operator;
|
||||||
|
private String operatorcode;
|
||||||
|
private String registeredowner;
|
||||||
|
private String registeredownercode;
|
||||||
|
private String shipmanager;
|
||||||
|
private String shipmanagercode;
|
||||||
|
private String technicalmanager;
|
||||||
|
private String technicalmanagercode;
|
||||||
|
private String docgroup;
|
||||||
|
private String docgroupcode;
|
||||||
|
private String operatorgroup;
|
||||||
|
private String operatorgroupcode;
|
||||||
|
private String shipmanagergroup;
|
||||||
|
private String shipmanagergroupcode;
|
||||||
|
private String technicalmanagergroup;
|
||||||
|
private String technicalmanagergroupcode;
|
||||||
|
private String vesselid;
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
package com.snp.batch.jobs.shipdetail.batch.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.snp.batch.common.batch.entity.BaseEntity;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@SuperBuilder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class DarkActivityConfirmedEntity extends BaseEntity {
|
||||||
|
private String datasetversion;
|
||||||
|
private String lrno;
|
||||||
|
private String mmsi;
|
||||||
|
private String vessel_name;
|
||||||
|
private String dark_hours;
|
||||||
|
private String dark_activity;
|
||||||
|
private String dark_status;
|
||||||
|
private String area_id;
|
||||||
|
private String area_name;
|
||||||
|
private String dark_time;
|
||||||
|
private String dark_latitude;
|
||||||
|
private String dark_longitude;
|
||||||
|
private String dark_speed;
|
||||||
|
private String dark_heading;
|
||||||
|
private String dark_draught;
|
||||||
|
private String nextseen;
|
||||||
|
private String nextseen_speed;
|
||||||
|
private String nextseen_draught;
|
||||||
|
private String nextseen_heading;
|
||||||
|
private String dark_reported_destination;
|
||||||
|
private String last_port_of_call;
|
||||||
|
private String last_port_country_code;
|
||||||
|
private String last_port_country;
|
||||||
|
private String nextseen_latitude;
|
||||||
|
private String nextseen_longitude;
|
||||||
|
private String nextseen_reported_destination;
|
||||||
|
private String vesselid;
|
||||||
|
}
|
||||||
@ -59,6 +59,9 @@ public class ShipDetailDataProcessor extends BaseProcessor<ShipDetailComparisonD
|
|||||||
List<StatusHistoryEntity> statusHistoryEntityList = makeStatusHistoryEntityList(comparisonData.getStructuredDto().getStatusHistory());
|
List<StatusHistoryEntity> statusHistoryEntityList = makeStatusHistoryEntityList(comparisonData.getStructuredDto().getStatusHistory());
|
||||||
List<SpecialFeatureEntity> specialFeatureEntityList = makeSpecialFeatureEntityList(comparisonData.getStructuredDto().getSpecialFeature());
|
List<SpecialFeatureEntity> specialFeatureEntityList = makeSpecialFeatureEntityList(comparisonData.getStructuredDto().getSpecialFeature());
|
||||||
List<ThrustersEntity> thrustersEntityList = makeThrustersEntityList(comparisonData.getStructuredDto().getThrusters());
|
List<ThrustersEntity> thrustersEntityList = makeThrustersEntityList(comparisonData.getStructuredDto().getThrusters());
|
||||||
|
List<DarkActivityConfirmedEntity> darkActivityConfirmedEntityList = makeDarkActivityConfirmedEntityList(comparisonData.getStructuredDto().getDarkActivityConfirmed());
|
||||||
|
List<CompanyComplianceEntity> companyComplianceEntityList = makeCompanyComplianceEntityList(comparisonData.getStructuredDto().getCompanyComplianceDetails());
|
||||||
|
List<CompanyVesselRelationshipEntity> companyVesselRelationshipEntityList = makeCompanyVesselRelationshipEntityList(comparisonData.getStructuredDto().getCompanyVesselRelationships());
|
||||||
|
|
||||||
// 3. 최종 업데이트 DTO 생성 (Writer에 전달)
|
// 3. 최종 업데이트 DTO 생성 (Writer에 전달)
|
||||||
return ShipDetailUpdate.builder()
|
return ShipDetailUpdate.builder()
|
||||||
@ -88,6 +91,9 @@ public class ShipDetailDataProcessor extends BaseProcessor<ShipDetailComparisonD
|
|||||||
.statusHistoryEntityList(statusHistoryEntityList)
|
.statusHistoryEntityList(statusHistoryEntityList)
|
||||||
.specialFeatureEntityList(specialFeatureEntityList)
|
.specialFeatureEntityList(specialFeatureEntityList)
|
||||||
.thrustersEntityList(thrustersEntityList)
|
.thrustersEntityList(thrustersEntityList)
|
||||||
|
.darkActivityConfirmedEntityList(darkActivityConfirmedEntityList)
|
||||||
|
.companyComplianceEntityList(companyComplianceEntityList)
|
||||||
|
.companyVesselRelationshipEntityList(companyVesselRelationshipEntityList)
|
||||||
.shipHashEntity(makeShipHashEntity(imo, currentHash))
|
.shipHashEntity(makeShipHashEntity(imo, currentHash))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
@ -719,6 +725,115 @@ public class ShipDetailDataProcessor extends BaseProcessor<ShipDetailComparisonD
|
|||||||
return entityList;
|
return entityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<CompanyVesselRelationshipEntity> makeCompanyVesselRelationshipEntityList(List<CompanyVesselRelationshipDto> dtoList){
|
||||||
|
List<CompanyVesselRelationshipEntity> entityList = new ArrayList<>();
|
||||||
|
if (dtoList == null || dtoList.isEmpty()) {
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
for (CompanyVesselRelationshipDto dto : dtoList) {
|
||||||
|
String datasetVersion = (dto.getDataSetVersion() != null) ? dto.getDataSetVersion().getDataSetVersion() : null;
|
||||||
|
CompanyVesselRelationshipEntity entity = CompanyVesselRelationshipEntity.builder()
|
||||||
|
.datasetversion(datasetVersion)
|
||||||
|
.doccode(dto.getDocCode())
|
||||||
|
.doccompany(dto.getDocCompany())
|
||||||
|
.groupbeneficialowner(dto.getGroupBeneficialOwner())
|
||||||
|
.groupbeneficialownercode(dto.getGroupBeneficialOwnerCode())
|
||||||
|
.lrno(dto.getLrno())
|
||||||
|
.operator(dto.getOperator())
|
||||||
|
.operatorcode(dto.getOperatorCode())
|
||||||
|
.registeredowner(dto.getRegisteredOwner())
|
||||||
|
.registeredownercode(dto.getRegisteredOwnerCode())
|
||||||
|
.shipmanager(dto.getShipManager())
|
||||||
|
.shipmanagercode(dto.getShipManagerCode())
|
||||||
|
.technicalmanager(dto.getTechnicalManager())
|
||||||
|
.technicalmanagercode(dto.getTechnicalManagerCode())
|
||||||
|
.docgroup(dto.getDocGroup())
|
||||||
|
.docgroupcode(dto.getDocGroupCode())
|
||||||
|
.operatorgroup(dto.getOperatorGroup())
|
||||||
|
.operatorgroupcode(dto.getOperatorGroupCode())
|
||||||
|
.shipmanagergroup(dto.getShipManagerGroup())
|
||||||
|
.shipmanagergroupcode(dto.getShipManagerGroupCode())
|
||||||
|
.technicalmanagergroup(dto.getTechnicalManagerGroup())
|
||||||
|
.technicalmanagergroupcode(dto.getTechnicalManagerGroupCode())
|
||||||
|
.vesselid(dto.getLrno()) // LRNO를 VesselID로 매핑
|
||||||
|
.build();
|
||||||
|
entityList.add(entity);
|
||||||
|
}
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<DarkActivityConfirmedEntity> makeDarkActivityConfirmedEntityList(List<DarkActivityConfirmedDto> dtoList){
|
||||||
|
List<DarkActivityConfirmedEntity> entityList = new ArrayList<>();
|
||||||
|
if (dtoList == null || dtoList.isEmpty()) {
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
for (DarkActivityConfirmedDto dto : dtoList) {
|
||||||
|
String datasetVersion = (dto.getDataSetVersion() != null) ? dto.getDataSetVersion().getDataSetVersion() : null;
|
||||||
|
DarkActivityConfirmedEntity entity = DarkActivityConfirmedEntity.builder()
|
||||||
|
.datasetversion(datasetVersion)
|
||||||
|
.lrno(dto.getLrno())
|
||||||
|
.mmsi(dto.getMmsi())
|
||||||
|
.vessel_name(dto.getVesselName())
|
||||||
|
.dark_hours(dto.getDarkHours())
|
||||||
|
.dark_activity(dto.getDarkActivity())
|
||||||
|
.dark_status(dto.getDarkStatus())
|
||||||
|
.area_id(dto.getAreaId())
|
||||||
|
.area_name(dto.getAreaName())
|
||||||
|
.dark_time(dto.getDarkTime())
|
||||||
|
.dark_latitude(dto.getDarkLatitude())
|
||||||
|
.dark_longitude(dto.getDarkLongitude())
|
||||||
|
.dark_speed(dto.getDarkSpeed())
|
||||||
|
.dark_heading(dto.getDarkHeading())
|
||||||
|
.dark_draught(dto.getDarkDraught())
|
||||||
|
.nextseen(dto.getNextSeen())
|
||||||
|
.nextseen_speed(dto.getNextSeenSpeed())
|
||||||
|
.nextseen_draught(dto.getNextSeenDraught())
|
||||||
|
.nextseen_heading(dto.getNextSeenHeading())
|
||||||
|
.dark_reported_destination(dto.getDarkReportedDestination())
|
||||||
|
.last_port_of_call(dto.getLastPortOfCall())
|
||||||
|
.last_port_country_code(dto.getLastPortCountryCode())
|
||||||
|
.last_port_country(dto.getLastPortCountry())
|
||||||
|
.nextseen_latitude(dto.getNextSeenLatitude())
|
||||||
|
.nextseen_longitude(dto.getNextSeenLongitude())
|
||||||
|
.nextseen_reported_destination(dto.getNextSeenReportedDestination())
|
||||||
|
.vesselid(dto.getLrno())
|
||||||
|
.build();
|
||||||
|
entityList.add(entity);
|
||||||
|
}
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<CompanyComplianceEntity> makeCompanyComplianceEntityList(List<CompanyComplianceDto> dtoList){
|
||||||
|
List<CompanyComplianceEntity> entityList = new ArrayList<>();
|
||||||
|
if (dtoList == null || dtoList.isEmpty()) {
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
for (CompanyComplianceDto dto : dtoList) {
|
||||||
|
String datasetVersion = (dto.getDataSetVersion() != null) ? dto.getDataSetVersion().getDataSetVersion() : null;
|
||||||
|
CompanyComplianceEntity entity = CompanyComplianceEntity.builder()
|
||||||
|
.datasetversion(datasetVersion)
|
||||||
|
.owcode(dto.getOwCode())
|
||||||
|
.shortcompanyname(dto.getShortCompanyName())
|
||||||
|
.companyonofacsanctionlist(dto.getCompanyOnOFACSanctionList())
|
||||||
|
.companyonunsanctionlist(dto.getCompanyOnUNSanctionList())
|
||||||
|
.companyoneusanctionlist(dto.getCompanyOnEUSanctionList())
|
||||||
|
.companyonbessanctionlist(dto.getCompanyOnBESSanctionList())
|
||||||
|
.companyinofacsanctionedcountry(dto.getCompanyInOFACSanctionedCountry())
|
||||||
|
.companyinfatfjurisdiction(dto.getCompanyInFATFJurisdiction())
|
||||||
|
.companyoverallcompliancestatus(dto.getCompanyOverallComplianceStatus())
|
||||||
|
.companyonaustraliansanctionlist(dto.getCompanyOnAustralianSanctionList())
|
||||||
|
.companyoncanadiansanctionlist(dto.getCompanyOnCanadianSanctionList())
|
||||||
|
.companyonswisssanctionlist(dto.getCompanyOnSwissSanctionList())
|
||||||
|
.companyonofacssilist(dto.getCompanyOnOFACSSIList())
|
||||||
|
.companyonofacnonsdnsanctionlist(dto.getCompanyOnOFACNonSDNSanctionList())
|
||||||
|
.companyonuaesanctionlist(dto.getCompanyOnUAESanctionList())
|
||||||
|
.parentcompanycompliancerisk(dto.getParentCompanyComplianceRisk())
|
||||||
|
.build();
|
||||||
|
entityList.add(entity);
|
||||||
|
}
|
||||||
|
return entityList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 해시값을 비교하여 변경 여부를 판단합니다.
|
* 해시값을 비교하여 변경 여부를 판단합니다.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class ShipDetailUpdateDataReader extends BaseApiReader<ShipDetailComparis
|
|||||||
// DB 해시값을 저장할 맵
|
// DB 해시값을 저장할 맵
|
||||||
private Map<String, String> dbMasterHashes;
|
private Map<String, String> dbMasterHashes;
|
||||||
private int currentBatchIndex = 0;
|
private int currentBatchIndex = 0;
|
||||||
private final int batchSize = 30;
|
private final int batchSize = 1;
|
||||||
|
|
||||||
public ShipDetailUpdateDataReader(WebClient webClient, JdbcTemplate jdbcTemplate, ObjectMapper objectMapper,BatchDateService batchDateService) {
|
public ShipDetailUpdateDataReader(WebClient webClient, JdbcTemplate jdbcTemplate, ObjectMapper objectMapper,BatchDateService batchDateService) {
|
||||||
super(webClient);
|
super(webClient);
|
||||||
@ -261,12 +261,18 @@ public class ShipDetailUpdateDataReader extends BaseApiReader<ShipDetailComparis
|
|||||||
.uri(url, uriBuilder -> uriBuilder
|
.uri(url, uriBuilder -> uriBuilder
|
||||||
// 맵에서 파라미터 값을 동적으로 가져와 세팅
|
// 맵에서 파라미터 값을 동적으로 가져와 세팅
|
||||||
.queryParam("shipsCategory", params.get("shipsCategory"))
|
.queryParam("shipsCategory", params.get("shipsCategory"))
|
||||||
.queryParam("fromYear", params.get("fromYear"))
|
// .queryParam("fromYear", params.get("fromYear"))
|
||||||
.queryParam("fromMonth", params.get("fromMonth"))
|
// .queryParam("fromMonth", params.get("fromMonth"))
|
||||||
.queryParam("fromDay", params.get("fromDay"))
|
// .queryParam("fromDay", params.get("fromDay"))
|
||||||
.queryParam("toYear", params.get("toYear"))
|
// .queryParam("toYear", params.get("toYear"))
|
||||||
.queryParam("toMonth", params.get("toMonth"))
|
// .queryParam("toMonth", params.get("toMonth"))
|
||||||
.queryParam("toDay", params.get("toDay"))
|
// .queryParam("toDay", params.get("toDay"))
|
||||||
|
.queryParam("fromYear", "2025")
|
||||||
|
.queryParam("fromMonth", "10")
|
||||||
|
.queryParam("fromDay", "15")
|
||||||
|
.queryParam("toYear", "2025")
|
||||||
|
.queryParam("toMonth", "12")
|
||||||
|
.queryParam("toDay", "17")
|
||||||
.build())
|
.build())
|
||||||
.retrieve()
|
.retrieve()
|
||||||
.bodyToMono(ShipUpdateApiResponse.class)
|
.bodyToMono(ShipUpdateApiResponse.class)
|
||||||
|
|||||||
@ -15,69 +15,54 @@ public interface ShipDetailRepository {
|
|||||||
|
|
||||||
void saveAllOwnerHistoryData(List<OwnerHistoryEntity> entities);
|
void saveAllOwnerHistoryData(List<OwnerHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : CrewList 저장 함수 선언
|
|
||||||
void saveAllCrewListData(List<CrewListEntity> entities);
|
void saveAllCrewListData(List<CrewListEntity> entities);
|
||||||
|
|
||||||
//TODO : StowageCommodity 저장 함수 선언
|
|
||||||
void saveAllStowageCommodityData(List<StowageCommodityEntity> entities);
|
void saveAllStowageCommodityData(List<StowageCommodityEntity> entities);
|
||||||
|
|
||||||
//TODO : GroupBeneficialOwnerHistory 저장 함수 선언
|
|
||||||
void saveAllGroupBeneficialOwnerHistoryData(List<GroupBeneficialOwnerHistoryEntity> entities);
|
void saveAllGroupBeneficialOwnerHistoryData(List<GroupBeneficialOwnerHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : ShipManagerHistory 저장 함수 선언
|
|
||||||
void saveAllShipManagerHistoryData(List<ShipManagerHistoryEntity> entities);
|
void saveAllShipManagerHistoryData(List<ShipManagerHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : OperatorHistory 저장 함수 선언
|
|
||||||
void saveAllOperatorHistoryData(List<OperatorHistoryEntity> entities);
|
void saveAllOperatorHistoryData(List<OperatorHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : TechnicalManagerHistory 저장 함수 선언
|
|
||||||
void saveAllTechnicalManagerHistoryData(List<TechnicalManagerHistoryEntity> entities);
|
void saveAllTechnicalManagerHistoryData(List<TechnicalManagerHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : BareBoatCharterHistory 저장 함수 선언
|
|
||||||
void saveAllBareBoatCharterHistoryData(List<BareBoatCharterHistoryEntity> entities);
|
void saveAllBareBoatCharterHistoryData(List<BareBoatCharterHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : NameHistory 저장 함수 선언
|
|
||||||
void saveAllNameHistoryData(List<NameHistoryEntity> entities);
|
void saveAllNameHistoryData(List<NameHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : FlagHistory 저장 함수 선언
|
|
||||||
void saveAllFlagHistoryData(List<FlagHistoryEntity> entities);
|
void saveAllFlagHistoryData(List<FlagHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : AdditionalInformation 저장 함수 선언
|
|
||||||
void saveAllAdditionalInformationData(List<AdditionalInformationEntity> entities);
|
void saveAllAdditionalInformationData(List<AdditionalInformationEntity> entities);
|
||||||
|
|
||||||
//TODO : PandIHistory 저장 함수 선언
|
|
||||||
void saveAllPandIHistoryData(List<PandIHistoryEntity> entities);
|
void saveAllPandIHistoryData(List<PandIHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : CallSignAndMmsiHistory 저장 함수 선언
|
|
||||||
void saveAllCallSignAndMmsiHistoryData(List<CallSignAndMmsiHistoryEntity> entities);
|
void saveAllCallSignAndMmsiHistoryData(List<CallSignAndMmsiHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : IceClass 저장 함수 선언
|
|
||||||
void saveAllIceClassData(List<IceClassEntity> entities);
|
void saveAllIceClassData(List<IceClassEntity> entities);
|
||||||
|
|
||||||
//TODO : SafetyManagementCertificateHistory 저장 함수 선언
|
|
||||||
void saveAllSafetyManagementCertificateHistoryData(List<SafetyManagementCertificateHistoryEntity> entities);
|
void saveAllSafetyManagementCertificateHistoryData(List<SafetyManagementCertificateHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : ClassHistory 저장 함수 선언
|
|
||||||
void saveAllClassHistoryData(List<ClassHistoryEntity> entities);
|
void saveAllClassHistoryData(List<ClassHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : SurveyDatesHistory 저장 함수 선언
|
|
||||||
void saveAllSurveyDatesHistoryData(List<SurveyDatesHistoryEntity> entities);
|
void saveAllSurveyDatesHistoryData(List<SurveyDatesHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : SurveyDatesHistoryUnique 저장 함수 선언
|
|
||||||
void saveAllSurveyDatesHistoryUniqueData(List<SurveyDatesHistoryUniqueEntity> entities);
|
void saveAllSurveyDatesHistoryUniqueData(List<SurveyDatesHistoryUniqueEntity> entities);
|
||||||
|
|
||||||
//TODO : SisterShipLinks 저장 함수 선언
|
|
||||||
void saveAllSisterShipLinksData(List<SisterShipLinksEntity> entities);
|
void saveAllSisterShipLinksData(List<SisterShipLinksEntity> entities);
|
||||||
|
|
||||||
//TODO : StatusHistory 저장 함수 선언
|
|
||||||
void saveAllStatusHistoryData(List<StatusHistoryEntity> entities);
|
void saveAllStatusHistoryData(List<StatusHistoryEntity> entities);
|
||||||
|
|
||||||
//TODO : SpecialFeature 저장 함수 선언
|
|
||||||
void saveAllSpecialFeatureData(List<SpecialFeatureEntity> entities);
|
void saveAllSpecialFeatureData(List<SpecialFeatureEntity> entities);
|
||||||
|
|
||||||
//TODO : Thrusters 저장 함수 선언
|
|
||||||
void saveAllThrustersData(List<ThrustersEntity> entities);
|
void saveAllThrustersData(List<ThrustersEntity> entities);
|
||||||
|
|
||||||
|
void saveAllDarkActivityConfirmedData(List<DarkActivityConfirmedEntity> entities);
|
||||||
|
|
||||||
|
void saveAllCompanyComplianceData(List<CompanyComplianceEntity> entities);
|
||||||
|
|
||||||
|
void saveAllCompanyVesselRelationshipData(List<CompanyVesselRelationshipEntity> entities);
|
||||||
|
|
||||||
void delete(String id);
|
void delete(String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import org.springframework.jdbc.core.RowMapper;
|
|||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,7 +27,7 @@ public class ShipDetailRepositoryImpl extends BaseJdbcRepository<ShipDetailEntit
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableName() {
|
protected String getTableName() {
|
||||||
return "snp_data.core20";
|
return "snp_data.ship_detail_data";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -389,6 +391,22 @@ public class ShipDetailRepositoryImpl extends BaseJdbcRepository<ShipDetailEntit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setTimestampOrNull(PreparedStatement ps, int idx, String value) throws SQLException {
|
||||||
|
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss");
|
||||||
|
if (value == null || value.trim().isEmpty() || "null".equalsIgnoreCase(value)) {
|
||||||
|
ps.setNull(idx, Types.TIMESTAMP);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
// 날짜 문자열을 LocalDateTime으로 변환 후 Timestamp로 변환
|
||||||
|
LocalDateTime dateTime = LocalDateTime.parse(value.trim(), DATE_TIME_FORMATTER);
|
||||||
|
ps.setTimestamp(idx, Timestamp.valueOf(dateTime));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 로그 기록 (필요 시) 및 NULL 처리
|
||||||
|
ps.setNull(idx, Types.TIMESTAMP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setUpdateParameters(PreparedStatement ps, ShipDetailEntity entity) throws Exception {
|
protected void setUpdateParameters(PreparedStatement ps, ShipDetailEntity entity) throws Exception {
|
||||||
int idx = 1;
|
int idx = 1;
|
||||||
@ -1048,6 +1066,79 @@ public class ShipDetailRepositoryImpl extends BaseJdbcRepository<ShipDetailEntit
|
|||||||
log.info("{} 배치 삽입 완료: {} 건", entityName, entities.size());
|
log.info("{} 배치 삽입 완료: {} 건", entityName, entities.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAllDarkActivityConfirmedData(List<DarkActivityConfirmedEntity> entities) {
|
||||||
|
String entityName = "DarkActivityConfirmedEntity";
|
||||||
|
String sql = ShipDetailSql.getDarkActivityConfirmedSql();
|
||||||
|
|
||||||
|
if (entities == null || entities.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 시작: {} 건", entityName, entities.size());
|
||||||
|
|
||||||
|
jdbcTemplate.batchUpdate(sql, entities, entities.size(),
|
||||||
|
(ps, entity) -> {
|
||||||
|
try {
|
||||||
|
setDarkActivityConfirmedInsertParameters(ps, (DarkActivityConfirmedEntity) entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("배치 삽입 파라미터 설정 실패 - " + entityName, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 완료: {} 건", entityName, entities.size());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAllCompanyComplianceData(List<CompanyComplianceEntity> entities) {
|
||||||
|
String entityName = "CompanyComplianceEntity";
|
||||||
|
String sql = ShipDetailSql.getCompanyComplianceSql();
|
||||||
|
|
||||||
|
if (entities == null || entities.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 시작: {} 건", entityName, entities.size());
|
||||||
|
|
||||||
|
jdbcTemplate.batchUpdate(sql, entities, entities.size(),
|
||||||
|
(ps, entity) -> {
|
||||||
|
try {
|
||||||
|
setCompanyComplianceInsertParameters(ps, (CompanyComplianceEntity) entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("배치 삽입 파라미터 설정 실패 - " + entityName, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 완료: {} 건", entityName, entities.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveAllCompanyVesselRelationshipData(List<CompanyVesselRelationshipEntity> entities) {
|
||||||
|
String entityName = "CompanyVesselRelationshipEntity";
|
||||||
|
String sql = ShipDetailSql.getCompanyVesselRelationshipSql();
|
||||||
|
|
||||||
|
if (entities == null || entities.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 시작: {} 건", entityName, entities.size());
|
||||||
|
|
||||||
|
jdbcTemplate.batchUpdate(sql, entities, entities.size(),
|
||||||
|
(ps, entity) -> {
|
||||||
|
try {
|
||||||
|
setCompanyVesselRelationshipInsertParameters(ps, (CompanyVesselRelationshipEntity) entity);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("배치 삽입 파라미터 설정 실패 - " + entityName, e);
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
log.info("{} 배치 삽입 완료: {} 건", entityName, entities.size());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean existsByImo(String imo) {
|
public boolean existsByImo(String imo) {
|
||||||
String sql = String.format("SELECT COUNT(*) FROM %s WHERE %s = ?", getTableName(), getIdColumnName("ihslrorimoshipno"));
|
String sql = String.format("SELECT COUNT(*) FROM %s WHERE %s = ?", getTableName(), getIdColumnName("ihslrorimoshipno"));
|
||||||
Long count = jdbcTemplate.queryForObject(sql, Long.class, imo);
|
Long count = jdbcTemplate.queryForObject(sql, Long.class, imo);
|
||||||
@ -1370,6 +1461,92 @@ public class ShipDetailRepositoryImpl extends BaseJdbcRepository<ShipDetailEntit
|
|||||||
ps.setString(idx++, entity.getLrno()); // 11. vesselid (LRNO 값 사용)
|
ps.setString(idx++, entity.getLrno()); // 11. vesselid (LRNO 값 사용)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCompanyVesselRelationshipInsertParameters(PreparedStatement ps, CompanyVesselRelationshipEntity entity) throws Exception {
|
||||||
|
int idx = 1;
|
||||||
|
ps.setString(idx++, entity.getDatasetversion());
|
||||||
|
ps.setString(idx++, entity.getDoccode());
|
||||||
|
ps.setString(idx++, entity.getDoccompany());
|
||||||
|
ps.setString(idx++, entity.getGroupbeneficialowner());
|
||||||
|
ps.setString(idx++, entity.getGroupbeneficialownercode());
|
||||||
|
ps.setString(idx++, entity.getLrno());
|
||||||
|
ps.setString(idx++, entity.getOperator());
|
||||||
|
ps.setString(idx++, entity.getOperatorcode());
|
||||||
|
ps.setString(idx++, entity.getRegisteredowner());
|
||||||
|
ps.setString(idx++, entity.getRegisteredownercode());
|
||||||
|
ps.setString(idx++, entity.getShipmanager());
|
||||||
|
ps.setString(idx++, entity.getShipmanagercode());
|
||||||
|
ps.setString(idx++, entity.getTechnicalmanager());
|
||||||
|
ps.setString(idx++, entity.getTechnicalmanagercode());
|
||||||
|
ps.setString(idx++, entity.getDocgroup());
|
||||||
|
ps.setString(idx++, entity.getDocgroupcode());
|
||||||
|
ps.setString(idx++, entity.getOperatorgroup());
|
||||||
|
ps.setString(idx++, entity.getOperatorgroupcode());
|
||||||
|
ps.setString(idx++, entity.getShipmanagergroup());
|
||||||
|
ps.setString(idx++, entity.getShipmanagergroupcode());
|
||||||
|
ps.setString(idx++, entity.getTechnicalmanagergroup());
|
||||||
|
ps.setString(idx++, entity.getTechnicalmanagergroupcode());
|
||||||
|
ps.setString(idx++, entity.getVesselid());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCompanyComplianceInsertParameters(PreparedStatement ps, CompanyComplianceEntity entity) throws Exception {
|
||||||
|
int idx = 1;
|
||||||
|
ps.setString(idx++, entity.getDatasetversion());
|
||||||
|
ps.setString(idx++, entity.getOwcode());
|
||||||
|
ps.setString(idx++, entity.getShortcompanyname());
|
||||||
|
|
||||||
|
// 숫자형 컬럼에 대해 SqlUtils 사용 (DDL이 int8임)
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonofacsanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonunsanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyoneusanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonbessanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyinofacsanctionedcountry());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyinfatfjurisdiction());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyoverallcompliancestatus());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonaustraliansanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyoncanadiansanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonswisssanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonofacssilist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonofacnonsdnsanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getCompanyonuaesanctionlist());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getParentcompanycompliancerisk());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDarkActivityConfirmedInsertParameters(PreparedStatement ps, DarkActivityConfirmedEntity entity) throws Exception {
|
||||||
|
int idx = 1;
|
||||||
|
ps.setString(idx++, entity.getDatasetversion());
|
||||||
|
ps.setString(idx++, entity.getLrno());
|
||||||
|
ps.setString(idx++, entity.getMmsi());
|
||||||
|
ps.setString(idx++, entity.getVessel_name());
|
||||||
|
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getDark_hours());
|
||||||
|
ps.setString(idx++, entity.getDark_activity());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getDark_status());
|
||||||
|
setIntegerOrNull(ps, idx++, entity.getArea_id());
|
||||||
|
ps.setString(idx++, entity.getArea_name());
|
||||||
|
|
||||||
|
// 타임스탬프 및 실수형 처리
|
||||||
|
setTimestampOrNull(ps, idx++, entity.getDark_time()); // 별도의 파싱 로직 포함된 SqlUtils 함수 필요
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getDark_latitude());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getDark_longitude());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getDark_speed());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getDark_heading());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getDark_draught());
|
||||||
|
|
||||||
|
setTimestampOrNull(ps, idx++, entity.getNextseen());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getNextseen_speed());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getNextseen_draught());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getNextseen_heading());
|
||||||
|
|
||||||
|
ps.setString(idx++, entity.getDark_reported_destination());
|
||||||
|
ps.setString(idx++, entity.getLast_port_of_call());
|
||||||
|
ps.setString(idx++, entity.getLast_port_country_code());
|
||||||
|
ps.setString(idx++, entity.getLast_port_country());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getNextseen_latitude());
|
||||||
|
setDoubleOrNull(ps, idx++, entity.getNextseen_longitude());
|
||||||
|
ps.setString(idx++, entity.getNextseen_reported_destination());
|
||||||
|
ps.setString(idx++, entity.getVesselid());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShipDetailEntity RowMapper
|
* ShipDetailEntity RowMapper
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -8,14 +8,11 @@ public class ShipDetailSql {
|
|||||||
datasetversion, companystatus, effectivedate, lrno, "owner",
|
datasetversion, companystatus, effectivedate, lrno, "owner",
|
||||||
ownercode, "sequence", shipresultindex, vesselid, rowindex, batch_flag
|
ownercode, "sequence", shipresultindex, vesselid, rowindex, batch_flag
|
||||||
)VALUES(?, ?, ?, ?, ?, ?, ?, nextval('snp_data.ownerhistory_index_seq'::regclass), ?, nextval('snp_data.ownerhistory_row_index_seq'::regclass), 'N')
|
)VALUES(?, ?, ?, ?, ?, ?, ?, nextval('snp_data.ownerhistory_index_seq'::regclass), ?, nextval('snp_data.ownerhistory_row_index_seq'::regclass), 'N')
|
||||||
ON CONFLICT (lrno,ownercode, effectivedate)
|
ON CONFLICT (lrno, ownercode, effectivedate, sequence)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
companystatus = EXCLUDED.companystatus,
|
companystatus = EXCLUDED.companystatus,
|
||||||
effectivedate = EXCLUDED.effectivedate,
|
|
||||||
"owner" = EXCLUDED.owner,
|
"owner" = EXCLUDED.owner,
|
||||||
ownercode = EXCLUDED.ownercode,
|
|
||||||
"sequence" = EXCLUDED.sequence,
|
|
||||||
batch_flag = 'N'
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
@ -53,7 +50,7 @@ public class ShipDetailSql {
|
|||||||
// DDL에 정의된 모든 컬럼 포함
|
// DDL에 정의된 모든 컬럼 포함
|
||||||
return """
|
return """
|
||||||
INSERT INTO snp_data.stowagecommodity(
|
INSERT INTO snp_data.stowagecommodity(
|
||||||
datasetversion, commoditycode, commoditydecode, lrno, "sequence",
|
datasetversion, commoditycode, commoditydecode, lrno, "sequence",
|
||||||
stowagecode, stowagedecode, shipresultindex, vesselid, rowindex
|
stowagecode, stowagedecode, shipresultindex, vesselid, rowindex
|
||||||
)VALUES(
|
)VALUES(
|
||||||
?, ?, ?, ?, ?, ?, ?,
|
?, ?, ?, ?, ?, ?, ?,
|
||||||
@ -65,10 +62,8 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
commoditydecode = EXCLUDED.commoditydecode,
|
commoditydecode = EXCLUDED.commoditydecode,
|
||||||
"sequence" = EXCLUDED."sequence",
|
|
||||||
stowagecode = EXCLUDED.stowagecode,
|
|
||||||
stowagedecode = EXCLUDED.stowagedecode,
|
stowagedecode = EXCLUDED.stowagedecode,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,7 +85,7 @@ public class ShipDetailSql {
|
|||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
companystatus = EXCLUDED.companystatus,
|
companystatus = EXCLUDED.companystatus,
|
||||||
groupbeneficialowner = EXCLUDED.groupbeneficialowner,
|
groupbeneficialowner = EXCLUDED.groupbeneficialowner,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +106,7 @@ public class ShipDetailSql {
|
|||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
companystatus = EXCLUDED.companystatus,
|
companystatus = EXCLUDED.companystatus,
|
||||||
shipmanager = EXCLUDED.shipmanager,
|
shipmanager = EXCLUDED.shipmanager,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +127,7 @@ public class ShipDetailSql {
|
|||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
companystatus = EXCLUDED.companystatus,
|
companystatus = EXCLUDED.companystatus,
|
||||||
"operator" = EXCLUDED."operator",
|
"operator" = EXCLUDED."operator",
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +148,7 @@ public class ShipDetailSql {
|
|||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
companystatus = EXCLUDED.companystatus,
|
companystatus = EXCLUDED.companystatus,
|
||||||
technicalmanager = EXCLUDED.technicalmanager,
|
technicalmanager = EXCLUDED.technicalmanager,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,7 +168,7 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
bbcharterer = EXCLUDED.bbcharterer,
|
bbcharterer = EXCLUDED.bbcharterer,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +188,7 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
vesselname = EXCLUDED.vesselname,
|
vesselname = EXCLUDED.vesselname,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,10 +207,8 @@ public class ShipDetailSql {
|
|||||||
ON CONFLICT (lrno, flagcode, effectivedate, sequence)
|
ON CONFLICT (lrno, flagcode, effectivedate, sequence)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
effectivedate = EXCLUDED.effectivedate,
|
|
||||||
flag = EXCLUDED.flag,
|
flag = EXCLUDED.flag,
|
||||||
"sequence" = EXCLUDED."sequence",
|
batch_flag = 'N'
|
||||||
vesselid = EXCLUDED.vesselid
|
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +258,7 @@ public class ShipDetailSql {
|
|||||||
"sequence" = EXCLUDED."sequence",
|
"sequence" = EXCLUDED."sequence",
|
||||||
pandiclubdecode = EXCLUDED.pandiclubdecode,
|
pandiclubdecode = EXCLUDED.pandiclubdecode,
|
||||||
"source" = EXCLUDED."source",
|
"source" = EXCLUDED."source",
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +279,7 @@ public class ShipDetailSql {
|
|||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
callsign = EXCLUDED.callsign,
|
callsign = EXCLUDED.callsign,
|
||||||
mmsi = EXCLUDED.mmsi,
|
mmsi = EXCLUDED.mmsi,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +299,7 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
iceclass = EXCLUDED.iceclass,
|
iceclass = EXCLUDED.iceclass,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +336,7 @@ public class ShipDetailSql {
|
|||||||
safetymanagementcertificateshipname = EXCLUDED.safetymanagementcertificateshipname,
|
safetymanagementcertificateshipname = EXCLUDED.safetymanagementcertificateshipname,
|
||||||
safetymanagementcertificateshiptype = EXCLUDED.safetymanagementcertificateshiptype,
|
safetymanagementcertificateshiptype = EXCLUDED.safetymanagementcertificateshiptype,
|
||||||
safetymanagementcertificatesource = EXCLUDED.safetymanagementcertificatesource,
|
safetymanagementcertificatesource = EXCLUDED.safetymanagementcertificatesource,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,7 +360,7 @@ public class ShipDetailSql {
|
|||||||
classindicator = EXCLUDED.classindicator,
|
classindicator = EXCLUDED.classindicator,
|
||||||
currentindicator = EXCLUDED.currentindicator,
|
currentindicator = EXCLUDED.currentindicator,
|
||||||
classid = EXCLUDED.classid,
|
classid = EXCLUDED.classid,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,7 +387,7 @@ public class ShipDetailSql {
|
|||||||
annualsurvey = EXCLUDED.annualsurvey,
|
annualsurvey = EXCLUDED.annualsurvey,
|
||||||
continuousmachinerysurvey = EXCLUDED.continuousmachinerysurvey,
|
continuousmachinerysurvey = EXCLUDED.continuousmachinerysurvey,
|
||||||
tailshaftsurvey = EXCLUDED.tailshaftsurvey,
|
tailshaftsurvey = EXCLUDED.tailshaftsurvey,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,7 +408,7 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
classsociety = EXCLUDED.classsociety,
|
classsociety = EXCLUDED.classsociety,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +428,7 @@ public class ShipDetailSql {
|
|||||||
ON CONFLICT (lrno, linkedlrno)
|
ON CONFLICT (lrno, linkedlrno)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,7 +449,7 @@ public class ShipDetailSql {
|
|||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
status = EXCLUDED.status,
|
status = EXCLUDED.status,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,9 +469,8 @@ public class ShipDetailSql {
|
|||||||
ON CONFLICT (lrno, sequence, specialfeaturecode)
|
ON CONFLICT (lrno, sequence, specialfeaturecode)
|
||||||
DO UPDATE SET
|
DO UPDATE SET
|
||||||
datasetversion = EXCLUDED.datasetversion,
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
"sequence" = EXCLUDED."sequence",
|
|
||||||
specialfeature = EXCLUDED.specialfeature,
|
specialfeature = EXCLUDED.specialfeature,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,9 +497,123 @@ public class ShipDetailSql {
|
|||||||
thrusterbhp = EXCLUDED.thrusterbhp,
|
thrusterbhp = EXCLUDED.thrusterbhp,
|
||||||
thrusterkw = EXCLUDED.thrusterkw,
|
thrusterkw = EXCLUDED.thrusterkw,
|
||||||
typeofinstallation = EXCLUDED.typeofinstallation,
|
typeofinstallation = EXCLUDED.typeofinstallation,
|
||||||
vesselid = EXCLUDED.vesselid
|
batch_flag = 'N'
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getCompanyVesselRelationshipSql(){
|
||||||
|
return """
|
||||||
|
INSERT INTO snp_data.companyvesselrelationships (
|
||||||
|
datasetversion, doccode, doccompany, groupbeneficialowner, groupbeneficialownercode,
|
||||||
|
lrno, "operator", operatorcode, registeredowner, registeredownercode,
|
||||||
|
shipmanager, shipmanagercode, technicalmanager, technicalmanagercode,
|
||||||
|
docgroup, docgroupcode, operatorgroup, operatorgroupcode,
|
||||||
|
shipmanagergroup, shipmanagergroupcode, technicalmanagergroup,
|
||||||
|
technicalmanagergroupcode, vesselid
|
||||||
|
) VALUES (
|
||||||
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||||
|
)
|
||||||
|
ON CONFLICT (lrno)
|
||||||
|
DO UPDATE SET
|
||||||
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
|
doccode = EXCLUDED.doccode,
|
||||||
|
doccompany = EXCLUDED.doccompany,
|
||||||
|
groupbeneficialowner = EXCLUDED.groupbeneficialowner,
|
||||||
|
groupbeneficialownercode = EXCLUDED.groupbeneficialownercode,
|
||||||
|
"operator" = EXCLUDED."operator",
|
||||||
|
operatorcode = EXCLUDED.operatorcode,
|
||||||
|
registeredowner = EXCLUDED.registeredowner,
|
||||||
|
registeredownercode = EXCLUDED.registeredownercode,
|
||||||
|
shipmanager = EXCLUDED.shipmanager,
|
||||||
|
shipmanagercode = EXCLUDED.shipmanagercode,
|
||||||
|
technicalmanager = EXCLUDED.technicalmanager,
|
||||||
|
technicalmanagercode = EXCLUDED.technicalmanagercode,
|
||||||
|
docgroup = EXCLUDED.docgroup,
|
||||||
|
docgroupcode = EXCLUDED.docgroupcode,
|
||||||
|
operatorgroup = EXCLUDED.operatorgroup,
|
||||||
|
operatorgroupcode = EXCLUDED.operatorgroupcode,
|
||||||
|
shipmanagergroup = EXCLUDED.shipmanagergroup,
|
||||||
|
shipmanagergroupcode = EXCLUDED.shipmanagergroupcode,
|
||||||
|
technicalmanagergroup = EXCLUDED.technicalmanagergroup,
|
||||||
|
technicalmanagergroupcode = EXCLUDED.technicalmanagergroupcode,
|
||||||
|
vesselid = EXCLUDED.vesselid,
|
||||||
|
batch_flag = 'N'
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getCompanyComplianceSql(){
|
||||||
|
return """
|
||||||
|
INSERT INTO snp_data.companycompliancedetails (
|
||||||
|
datasetversion, owcode, shortcompanyname, companyonofacsanctionlist,
|
||||||
|
companyonunsanctionlist, companyoneusanctionlist, companyonbessanctionlist,
|
||||||
|
companyinofacsanctionedcountry, companyinfatfjurisdiction, companyoverallcompliancestatus,
|
||||||
|
companyonaustraliansanctionlist, companyoncanadiansanctionlist, companyonswisssanctionlist,
|
||||||
|
companyonofacssilist, companyonofacnonsdnsanctionlist, companyonuaesanctionlist,
|
||||||
|
parentcompanycompliancerisk
|
||||||
|
) VALUES (
|
||||||
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
||||||
|
)
|
||||||
|
ON CONFLICT (owcode)
|
||||||
|
DO UPDATE SET
|
||||||
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
|
shortcompanyname = EXCLUDED.shortcompanyname,
|
||||||
|
companyonofacsanctionlist = EXCLUDED.companyonofacsanctionlist,
|
||||||
|
companyonunsanctionlist = EXCLUDED.companyonunsanctionlist,
|
||||||
|
companyoneusanctionlist = EXCLUDED.companyoneusanctionlist,
|
||||||
|
companyonbessanctionlist = EXCLUDED.companyonbessanctionlist,
|
||||||
|
companyinofacsanctionedcountry = EXCLUDED.companyinofacsanctionedcountry,
|
||||||
|
companyinfatfjurisdiction = EXCLUDED.companyinfatfjurisdiction,
|
||||||
|
companyoverallcompliancestatus = EXCLUDED.companyoverallcompliancestatus,
|
||||||
|
companyonaustraliansanctionlist = EXCLUDED.companyonaustraliansanctionlist,
|
||||||
|
companyoncanadiansanctionlist = EXCLUDED.companyoncanadiansanctionlist,
|
||||||
|
companyonswisssanctionlist = EXCLUDED.companyonswisssanctionlist,
|
||||||
|
companyonofacssilist = EXCLUDED.companyonofacssilist,
|
||||||
|
companyonofacnonsdnsanctionlist = EXCLUDED.companyonofacnonsdnsanctionlist,
|
||||||
|
companyonuaesanctionlist = EXCLUDED.companyonuaesanctionlist,
|
||||||
|
parentcompanycompliancerisk = EXCLUDED.parentcompanycompliancerisk,
|
||||||
|
batch_flag = 'N'
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDarkActivityConfirmedSql(){
|
||||||
|
return """
|
||||||
|
INSERT INTO snp_data.darkactivityconfirmed (
|
||||||
|
datasetversion, lrno, mmsi, vessel_name, dark_hours, dark_activity, dark_status,
|
||||||
|
area_id, area_name, dark_time, dark_latitude, dark_longitude, dark_speed,
|
||||||
|
dark_heading, dark_draught, nextseen, nextseen_speed, nextseen_draught,
|
||||||
|
nextseen_heading, dark_reported_destination, last_port_of_call,
|
||||||
|
last_port_country_code,last_port_country, nextseen_latitude, nextseen_longitude,
|
||||||
|
nextseen_reported_destination, vesselid
|
||||||
|
) VALUES (
|
||||||
|
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?
|
||||||
|
)
|
||||||
|
ON CONFLICT (lrno, mmsi, dark_time, dark_status)
|
||||||
|
DO UPDATE SET
|
||||||
|
datasetversion = EXCLUDED.datasetversion,
|
||||||
|
vessel_name = EXCLUDED.vessel_name,
|
||||||
|
dark_hours = EXCLUDED.dark_hours,
|
||||||
|
dark_activity = EXCLUDED.dark_activity,
|
||||||
|
area_id = EXCLUDED.area_id,
|
||||||
|
area_name = EXCLUDED.area_name,
|
||||||
|
dark_latitude = EXCLUDED.dark_latitude,
|
||||||
|
dark_longitude = EXCLUDED.dark_longitude,
|
||||||
|
dark_speed = EXCLUDED.dark_speed,
|
||||||
|
dark_heading = EXCLUDED.dark_heading,
|
||||||
|
dark_draught = EXCLUDED.dark_draught,
|
||||||
|
nextseen = EXCLUDED.nextseen,
|
||||||
|
nextseen_speed = EXCLUDED.nextseen_speed,
|
||||||
|
nextseen_draught = EXCLUDED.nextseen_draught,
|
||||||
|
nextseen_heading = EXCLUDED.nextseen_heading,
|
||||||
|
dark_reported_destination = EXCLUDED.dark_reported_destination,
|
||||||
|
last_port_of_call = EXCLUDED.last_port_of_call,
|
||||||
|
last_port_country_code = EXCLUDED.last_port_country_code,
|
||||||
|
last_port_country = EXCLUDED.last_port_country,
|
||||||
|
nextseen_latitude = EXCLUDED.nextseen_latitude,
|
||||||
|
nextseen_longitude = EXCLUDED.nextseen_longitude,
|
||||||
|
nextseen_reported_destination = EXCLUDED.nextseen_reported_destination,
|
||||||
|
vesselid = EXCLUDED.vesselid,
|
||||||
|
batch_flag = 'N'
|
||||||
|
""";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -65,6 +65,9 @@ public class ShipDetailDataWriter extends BaseWriter<ShipDetailUpdate> {
|
|||||||
List<StatusHistoryEntity> statusHistoryListEntities = flattenEntities(items, ShipDetailUpdate::getStatusHistoryEntityList);
|
List<StatusHistoryEntity> statusHistoryListEntities = flattenEntities(items, ShipDetailUpdate::getStatusHistoryEntityList);
|
||||||
List<SpecialFeatureEntity> specialFeatureListEntities = flattenEntities(items, ShipDetailUpdate::getSpecialFeatureEntityList);
|
List<SpecialFeatureEntity> specialFeatureListEntities = flattenEntities(items, ShipDetailUpdate::getSpecialFeatureEntityList);
|
||||||
List<ThrustersEntity> thrustersListEntities = flattenEntities(items, ShipDetailUpdate::getThrustersEntityList);
|
List<ThrustersEntity> thrustersListEntities = flattenEntities(items, ShipDetailUpdate::getThrustersEntityList);
|
||||||
|
List<DarkActivityConfirmedEntity> darkActivityConfirmedEntities = flattenEntities(items, ShipDetailUpdate::getDarkActivityConfirmedEntityList);
|
||||||
|
List<CompanyComplianceEntity> companyComplianceEntities = flattenEntities(items, ShipDetailUpdate::getCompanyComplianceEntityList);
|
||||||
|
List<CompanyVesselRelationshipEntity> companyVesselRelationshipEntities = flattenEntities(items, ShipDetailUpdate::getCompanyVesselRelationshipEntityList);
|
||||||
|
|
||||||
// 1-3. List<ShipHashEntity> (Hash값 데이터 처리용)
|
// 1-3. List<ShipHashEntity> (Hash값 데이터 처리용)
|
||||||
List<ShipHashEntity> hashEntities = items.stream()
|
List<ShipHashEntity> hashEntities = items.stream()
|
||||||
@ -73,97 +76,109 @@ public class ShipDetailDataWriter extends BaseWriter<ShipDetailUpdate> {
|
|||||||
|
|
||||||
// 2. 각 Repository에 전달
|
// 2. 각 Repository에 전달
|
||||||
// ✅ 2-1. ShipDetailRepository (Core20 데이터)
|
// ✅ 2-1. ShipDetailRepository (Core20 데이터)
|
||||||
log.debug("Core20 데이터 저장 시작: {} 건", coreEntities.size());
|
// log.debug("Core20 데이터 저장 시작: {} 건", coreEntities.size());
|
||||||
shipDetailRepository.saveAllCoreData(coreEntities);
|
// shipDetailRepository.saveAllCoreData(coreEntities);
|
||||||
|
//
|
||||||
|
// // ✅ 2-2. 추가적인 Array/List 데이터
|
||||||
|
// // OwnerHistory 저장
|
||||||
|
// log.debug("OwnerHistory 데이터 저장 시작: {} 건", ownerHistoriyListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllOwnerHistoryData(ownerHistoriyListEntities);
|
||||||
|
//
|
||||||
|
// // CrewList 저장
|
||||||
|
// log.debug("CrewList 데이터 저장 시작: {} 건", crewListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllCrewListData(crewListEntities);
|
||||||
|
//
|
||||||
|
// // StowageCommodity 저장
|
||||||
|
// log.debug("StowageCommodity 저장 시작: {} 건", stowageCommodityListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllStowageCommodityData(stowageCommodityListEntities);
|
||||||
|
//
|
||||||
|
// // GroupBeneficialOwnerHistory 저장
|
||||||
|
// log.debug("GroupBeneficialOwnerHistory 저장 시작: {} 건", groupBeneficialOwnerHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllGroupBeneficialOwnerHistoryData(groupBeneficialOwnerHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // ShipManagerHistory 저장
|
||||||
|
// log.debug("ShipManagerHistory 저장 시작: {} 건", shipManagerHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllShipManagerHistoryData(shipManagerHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // OperatorHistory 저장
|
||||||
|
// log.debug("OperatorHistory 저장 시작: {} 건", operatorHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllOperatorHistoryData(operatorHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // TechnicalManagerHistory 저장
|
||||||
|
// log.debug("TechnicalManagerHistory 저장 시작: {} 건", technicalManagerHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllTechnicalManagerHistoryData(technicalManagerHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // BareBoatCharterHistory 저장
|
||||||
|
// log.debug("BareBoatCharterHistory 저장 시작: {} 건", bareBoatCharterHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllBareBoatCharterHistoryData(bareBoatCharterHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // NameHistory 저장
|
||||||
|
// log.debug("NameHistory 저장 시작: {} 건", nameHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllNameHistoryData(nameHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // FlagHistory 저장
|
||||||
|
// log.debug("FlagHistory 저장 시작: {} 건", flagHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllFlagHistoryData(flagHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // AdditionalInformation 저장
|
||||||
|
// log.debug("AdditionalInformation 저장 시작: {} 건", additionalInformationListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllAdditionalInformationData(additionalInformationListEntities);
|
||||||
|
//
|
||||||
|
// // PandIHistory 저장
|
||||||
|
// log.debug("PandIHistory 저장 시작: {} 건", pandIHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllPandIHistoryData(pandIHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // CallSignAndMmsiHistory 저장
|
||||||
|
// log.debug("CallSignAndMmsiHistory 저장 시작: {} 건", callSignAndMmsiHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllCallSignAndMmsiHistoryData(callSignAndMmsiHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // IceClass 저장
|
||||||
|
// log.debug("IceClass 저장 시작: {} 건", iceClassListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllIceClassData(iceClassListEntities);
|
||||||
|
//
|
||||||
|
// // SafetyManagementCertificateHistory 저장
|
||||||
|
// log.debug("SafetyManagementCertificateHistory 저장 시작: {} 건", safetyManagementCertificateHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllSafetyManagementCertificateHistoryData(safetyManagementCertificateHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // ClassHistory 저장
|
||||||
|
// log.debug("ClassHistory 저장 시작: {} 건", classHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllClassHistoryData(classHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // SurveyDatesHistory 저장
|
||||||
|
// log.debug("SurveyDatesHistory 저장 시작: {} 건", surveyDatesHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllSurveyDatesHistoryData(surveyDatesHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // SurveyDatesHistoryUnique 저장
|
||||||
|
// log.debug("SurveyDatesHistoryUnique 저장 시작: {} 건", surveyDatesHistoryUniqueListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllSurveyDatesHistoryUniqueData(surveyDatesHistoryUniqueListEntities);
|
||||||
|
//
|
||||||
|
// // SisterShipLinks 저장
|
||||||
|
// log.debug("SisterShipLinks 저장 시작: {} 건", sisterShipLinksListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllSisterShipLinksData(sisterShipLinksListEntities);
|
||||||
|
//
|
||||||
|
// // StatusHistory 저장
|
||||||
|
// log.debug("StatusHistory 저장 시작: {} 건", statusHistoryListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllStatusHistoryData(statusHistoryListEntities);
|
||||||
|
//
|
||||||
|
// // SpecialFeature 저장
|
||||||
|
// log.debug("SpecialFeature 저장 시작: {} 건", specialFeatureListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllSpecialFeatureData(specialFeatureListEntities);
|
||||||
|
//
|
||||||
|
// // Thrusters 저장
|
||||||
|
// log.debug("Thrusters 저장 시작: {} 건", thrustersListEntities.size());
|
||||||
|
// shipDetailRepository.saveAllThrustersData(thrustersListEntities);
|
||||||
|
|
||||||
// ✅ 2-2. 추가적인 Array/List 데이터
|
// DarkActivityConfirmed 저장
|
||||||
// OwnerHistory 저장
|
log.debug("DarkActivityConfirmed 저장 시작: {} 건", darkActivityConfirmedEntities.size());
|
||||||
log.debug("OwnerHistory 데이터 저장 시작: {} 건", ownerHistoriyListEntities.size());
|
shipDetailRepository.saveAllDarkActivityConfirmedData(darkActivityConfirmedEntities);
|
||||||
shipDetailRepository.saveAllOwnerHistoryData(ownerHistoriyListEntities);
|
|
||||||
|
|
||||||
// CrewList 저장
|
// CompanyCompliance 저장
|
||||||
log.debug("CrewList 데이터 저장 시작: {} 건", crewListEntities.size());
|
log.debug("CompanyCompliance 저장 시작: {} 건", companyComplianceEntities.size());
|
||||||
shipDetailRepository.saveAllCrewListData(crewListEntities);
|
shipDetailRepository.saveAllCompanyComplianceData(companyComplianceEntities);
|
||||||
|
|
||||||
// StowageCommodity 저장
|
// CompanyVesselRelationship 저장
|
||||||
log.debug("StowageCommodity 저장 시작: {} 건", stowageCommodityListEntities.size());
|
log.debug("CompanyVesselRelationship 저장 시작: {} 건", companyVesselRelationshipEntities.size());
|
||||||
shipDetailRepository.saveAllStowageCommodityData(stowageCommodityListEntities);
|
shipDetailRepository.saveAllCompanyVesselRelationshipData(companyVesselRelationshipEntities);
|
||||||
|
|
||||||
// GroupBeneficialOwnerHistory 저장
|
|
||||||
log.debug("GroupBeneficialOwnerHistory 저장 시작: {} 건", groupBeneficialOwnerHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllGroupBeneficialOwnerHistoryData(groupBeneficialOwnerHistoryListEntities);
|
|
||||||
|
|
||||||
// ShipManagerHistory 저장
|
|
||||||
log.debug("ShipManagerHistory 저장 시작: {} 건", shipManagerHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllShipManagerHistoryData(shipManagerHistoryListEntities);
|
|
||||||
|
|
||||||
// OperatorHistory 저장
|
|
||||||
log.debug("OperatorHistory 저장 시작: {} 건", operatorHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllOperatorHistoryData(operatorHistoryListEntities);
|
|
||||||
|
|
||||||
// TechnicalManagerHistory 저장
|
|
||||||
log.debug("TechnicalManagerHistory 저장 시작: {} 건", technicalManagerHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllTechnicalManagerHistoryData(technicalManagerHistoryListEntities);
|
|
||||||
|
|
||||||
// BareBoatCharterHistory 저장
|
|
||||||
log.debug("BareBoatCharterHistory 저장 시작: {} 건", bareBoatCharterHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllBareBoatCharterHistoryData(bareBoatCharterHistoryListEntities);
|
|
||||||
|
|
||||||
// NameHistory 저장
|
|
||||||
log.debug("NameHistory 저장 시작: {} 건", nameHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllNameHistoryData(nameHistoryListEntities);
|
|
||||||
|
|
||||||
// FlagHistory 저장
|
|
||||||
log.debug("FlagHistory 저장 시작: {} 건", flagHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllFlagHistoryData(flagHistoryListEntities);
|
|
||||||
|
|
||||||
// AdditionalInformation 저장
|
|
||||||
log.debug("AdditionalInformation 저장 시작: {} 건", additionalInformationListEntities.size());
|
|
||||||
shipDetailRepository.saveAllAdditionalInformationData(additionalInformationListEntities);
|
|
||||||
|
|
||||||
// PandIHistory 저장
|
|
||||||
log.debug("PandIHistory 저장 시작: {} 건", pandIHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllPandIHistoryData(pandIHistoryListEntities);
|
|
||||||
|
|
||||||
// CallSignAndMmsiHistory 저장
|
|
||||||
log.debug("CallSignAndMmsiHistory 저장 시작: {} 건", callSignAndMmsiHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllCallSignAndMmsiHistoryData(callSignAndMmsiHistoryListEntities);
|
|
||||||
|
|
||||||
// IceClass 저장
|
|
||||||
log.debug("IceClass 저장 시작: {} 건", iceClassListEntities.size());
|
|
||||||
shipDetailRepository.saveAllIceClassData(iceClassListEntities);
|
|
||||||
|
|
||||||
// SafetyManagementCertificateHistory 저장
|
|
||||||
log.debug("SafetyManagementCertificateHistory 저장 시작: {} 건", safetyManagementCertificateHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllSafetyManagementCertificateHistoryData(safetyManagementCertificateHistoryListEntities);
|
|
||||||
|
|
||||||
// ClassHistory 저장
|
|
||||||
log.debug("ClassHistory 저장 시작: {} 건", classHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllClassHistoryData(classHistoryListEntities);
|
|
||||||
|
|
||||||
// SurveyDatesHistory 저장
|
|
||||||
log.debug("SurveyDatesHistory 저장 시작: {} 건", surveyDatesHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllSurveyDatesHistoryData(surveyDatesHistoryListEntities);
|
|
||||||
|
|
||||||
// SurveyDatesHistoryUnique 저장
|
|
||||||
log.debug("SurveyDatesHistoryUnique 저장 시작: {} 건", surveyDatesHistoryUniqueListEntities.size());
|
|
||||||
shipDetailRepository.saveAllSurveyDatesHistoryUniqueData(surveyDatesHistoryUniqueListEntities);
|
|
||||||
|
|
||||||
// SisterShipLinks 저장
|
|
||||||
log.debug("SisterShipLinks 저장 시작: {} 건", sisterShipLinksListEntities.size());
|
|
||||||
shipDetailRepository.saveAllSisterShipLinksData(sisterShipLinksListEntities);
|
|
||||||
|
|
||||||
// StatusHistory 저장
|
|
||||||
log.debug("StatusHistory 저장 시작: {} 건", statusHistoryListEntities.size());
|
|
||||||
shipDetailRepository.saveAllStatusHistoryData(statusHistoryListEntities);
|
|
||||||
|
|
||||||
// SpecialFeature 저장
|
|
||||||
log.debug("SpecialFeature 저장 시작: {} 건", specialFeatureListEntities.size());
|
|
||||||
shipDetailRepository.saveAllSpecialFeatureData(specialFeatureListEntities);
|
|
||||||
|
|
||||||
// Thrusters 저장
|
|
||||||
log.debug("Thrusters 저장 시작: {} 건", thrustersListEntities.size());
|
|
||||||
shipDetailRepository.saveAllThrustersData(thrustersListEntities);
|
|
||||||
|
|
||||||
// ✅ 2-3. ShipHashRepository (Hash값 데이터)
|
// ✅ 2-3. ShipHashRepository (Hash값 데이터)
|
||||||
log.debug("Ship Hash 데이터 저장 시작: {} 건", hashEntities.size());
|
log.debug("Ship Hash 데이터 저장 시작: {} 건", hashEntities.size());
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user