🗃️ AIS Target 변경으로 인한 데이터 및 컬럼추가
This commit is contained in:
부모
3fb133e367
커밋
6e70e921af
@ -22,6 +22,6 @@ import java.util.List;
|
||||
@AllArgsConstructor
|
||||
public class AisTargetApiResponse {
|
||||
|
||||
@JsonProperty("targetArr")
|
||||
@JsonProperty("targetEnhancedArr")
|
||||
private List<AisTargetDto> targetArr;
|
||||
}
|
||||
|
||||
@ -132,4 +132,36 @@ public class AisTargetDto {
|
||||
|
||||
@JsonProperty("WidthStarboard")
|
||||
private Integer widthStarboard;
|
||||
|
||||
// TargetEnhanced 컬럼 추가
|
||||
@JsonProperty("TonnesCargo")
|
||||
private Integer tonnesCargo;
|
||||
@JsonProperty("InSTS")
|
||||
private Integer inSTS;
|
||||
@JsonProperty("OnBerth")
|
||||
private Boolean onBerth;
|
||||
@JsonProperty("DWT")
|
||||
private Integer dwt;
|
||||
@JsonProperty("Anomalous")
|
||||
private String anomalous;
|
||||
@JsonProperty("DestinationPortID")
|
||||
private Integer destinationPortID;
|
||||
@JsonProperty("DestinationTidied")
|
||||
private String destinationTidied;
|
||||
@JsonProperty("DestinationUNLOCODE")
|
||||
private String destinationUNLOCODE;
|
||||
@JsonProperty("ImoVerified")
|
||||
private String imoVerified;
|
||||
@JsonProperty("LastStaticUpdateReceived")
|
||||
private String lastStaticUpdateReceived;
|
||||
@JsonProperty("LPCCode")
|
||||
private Integer lpcCode;
|
||||
@JsonProperty("MessageType")
|
||||
private Integer messageType;
|
||||
@JsonProperty("Source")
|
||||
private String source;
|
||||
@JsonProperty("StationId")
|
||||
private String stationId;
|
||||
@JsonProperty("ZoneId")
|
||||
private Double zoneId;
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.snp.batch.jobs.aistarget.batch.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.snp.batch.common.batch.entity.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
@ -99,4 +100,22 @@ public class AisTargetEntity extends BaseEntity {
|
||||
* - Class B인 경우 항상 null
|
||||
*/
|
||||
private String core20Mmsi;
|
||||
|
||||
// TargetEnhanced 컬럼 추가
|
||||
private Integer tonnesCargo;
|
||||
private Integer inSTS;
|
||||
private Boolean onBerth;
|
||||
private Integer dwt;
|
||||
private String anomalous;
|
||||
private Integer destinationPortID;
|
||||
private String destinationTidied;
|
||||
private String destinationUNLOCODE;
|
||||
private String imoVerified;
|
||||
private OffsetDateTime lastStaticUpdateReceived;
|
||||
private Integer lpcCode;
|
||||
private Integer messageType;
|
||||
private String source;
|
||||
private String stationId;
|
||||
private Double zoneId;
|
||||
|
||||
}
|
||||
|
||||
@ -95,6 +95,22 @@ public class AisTargetDataProcessor extends BaseProcessor<AisTargetDto, AisTarge
|
||||
// 타임스탬프
|
||||
.receivedDate(parseTimestamp(dto.getReceivedDate()))
|
||||
.collectedAt(collectedAt != null ? collectedAt : OffsetDateTime.now())
|
||||
// TargetEnhanced 컬럼 추가
|
||||
.tonnesCargo(dto.getTonnesCargo())
|
||||
.inSTS(dto.getInSTS())
|
||||
.onBerth(dto.getOnBerth())
|
||||
.dwt(dto.getDwt())
|
||||
.anomalous(dto.getAnomalous())
|
||||
.destinationPortID(dto.getDestinationPortID())
|
||||
.destinationTidied(dto.getDestinationTidied())
|
||||
.destinationUNLOCODE(dto.getDestinationUNLOCODE())
|
||||
.imoVerified(dto.getImoVerified())
|
||||
.lastStaticUpdateReceived(parseTimestamp(dto.getLastStaticUpdateReceived()))
|
||||
.lpcCode(dto.getLpcCode())
|
||||
.messageType(dto.getMessageType())
|
||||
.source(dto.getSource())
|
||||
.stationId(dto.getStationId())
|
||||
.zoneId(dto.getZoneId())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ public class AisTargetDataReader extends BaseApiReader<AisTargetDto> {
|
||||
|
||||
@Override
|
||||
protected String getApiPath() {
|
||||
return "/AisSvc.svc/AIS/GetTargets";
|
||||
return "/AisSvc.svc/AIS/GetTargetsEnhanced";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -43,7 +43,10 @@ public class AisTargetRepositoryImpl implements AisTargetRepository {
|
||||
age_minutes, position_accuracy, timestamp_utc, repeat_indicator, raim_flag,
|
||||
radio_status, regional, regional2, spare, spare2,
|
||||
ais_version, position_fix_type, dte, band_flag,
|
||||
received_date, collected_at, created_at, updated_at
|
||||
received_date, collected_at, created_at, updated_at,
|
||||
tonnes_cargo, in_sts, on_berth, dwt, anomalous,
|
||||
destination_port_id, destination_tidied, destination_unlocode, imo_verified, last_static_update_received,
|
||||
lpc_code, message_type, "source", station_id, zone_id
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, ?, ?,
|
||||
?, ?, ST_SetSRID(ST_MakePoint(?, ?), 4326),
|
||||
@ -53,7 +56,10 @@ public class AisTargetRepositoryImpl implements AisTargetRepository {
|
||||
?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?,
|
||||
?, ?, NOW(), NOW()
|
||||
?, ?, NOW(), NOW(),
|
||||
?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?
|
||||
)
|
||||
ON CONFLICT (mmsi, message_timestamp) DO UPDATE SET
|
||||
imo = EXCLUDED.imo,
|
||||
@ -94,7 +100,22 @@ public class AisTargetRepositoryImpl implements AisTargetRepository {
|
||||
band_flag = EXCLUDED.band_flag,
|
||||
received_date = EXCLUDED.received_date,
|
||||
collected_at = EXCLUDED.collected_at,
|
||||
updated_at = NOW()
|
||||
updated_at = NOW(),
|
||||
tonnes_cargo = EXCLUDED.tonnes_cargo,
|
||||
in_sts = EXCLUDED.in_sts,
|
||||
on_berth = EXCLUDED.on_berth,
|
||||
dwt = EXCLUDED.dwt,
|
||||
anomalous = EXCLUDED.anomalous,
|
||||
destination_port_id = EXCLUDED.destination_port_id,
|
||||
destination_tidied = EXCLUDED.destination_tidied,
|
||||
destination_unlocode = EXCLUDED.destination_unlocode,
|
||||
imo_verified = EXCLUDED.imo_verified,
|
||||
last_static_update_received = EXCLUDED.last_static_update_received,
|
||||
lpc_code = EXCLUDED.lpc_code,
|
||||
message_type = EXCLUDED.message_type,
|
||||
"source" = EXCLUDED."source",
|
||||
station_id = EXCLUDED.station_id,
|
||||
zone_id = EXCLUDED.zone_id
|
||||
""";
|
||||
|
||||
// ==================== RowMapper ====================
|
||||
@ -139,6 +160,21 @@ public class AisTargetRepositoryImpl implements AisTargetRepository {
|
||||
.bandFlag(rs.getObject("band_flag", Integer.class))
|
||||
.receivedDate(toOffsetDateTime(rs.getTimestamp("received_date")))
|
||||
.collectedAt(toOffsetDateTime(rs.getTimestamp("collected_at")))
|
||||
.tonnesCargo(rs.getObject("tonnes_cargo", Integer.class))
|
||||
.inSTS(rs.getObject("in_sts", Integer.class))
|
||||
.onBerth(rs.getObject("on_berth", Boolean.class))
|
||||
.dwt(rs.getObject("dwt", Integer.class))
|
||||
.anomalous(rs.getString("anomalous"))
|
||||
.destinationPortID(rs.getObject("destination_port_id", Integer.class))
|
||||
.destinationTidied(rs.getString("destination_tidied"))
|
||||
.destinationUNLOCODE(rs.getString("destination_unlocode"))
|
||||
.imoVerified(rs.getString("imo_verified"))
|
||||
.lastStaticUpdateReceived(toOffsetDateTime(rs.getTimestamp("last_static_update_received")))
|
||||
.lpcCode(rs.getObject("lpc_code", Integer.class))
|
||||
.messageType(rs.getObject("message_type", Integer.class))
|
||||
.source(rs.getString("source"))
|
||||
.stationId(rs.getString("station_id"))
|
||||
.zoneId(rs.getObject("zone_id", Double.class))
|
||||
.build();
|
||||
|
||||
// ==================== Repository Methods ====================
|
||||
@ -277,6 +313,22 @@ public class AisTargetRepositoryImpl implements AisTargetRepository {
|
||||
// 타임스탬프
|
||||
ps.setTimestamp(idx++, toTimestamp(entity.getReceivedDate()));
|
||||
ps.setTimestamp(idx++, toTimestamp(entity.getCollectedAt()));
|
||||
// TargetEnhanced 컬럼 추가
|
||||
ps.setObject(idx++, entity.getTonnesCargo());
|
||||
ps.setObject(idx++, entity.getInSTS());
|
||||
ps.setObject(idx++, entity.getOnBerth());
|
||||
ps.setObject(idx++, entity.getDwt());
|
||||
ps.setObject(idx++, entity.getAnomalous());
|
||||
ps.setObject(idx++, entity.getDestinationPortID());
|
||||
ps.setObject(idx++, entity.getDestinationTidied());
|
||||
ps.setObject(idx++, entity.getDestinationUNLOCODE());
|
||||
ps.setObject(idx++, entity.getImoVerified());
|
||||
ps.setTimestamp(idx++, toTimestamp(entity.getLastStaticUpdateReceived()));
|
||||
ps.setObject(idx++, entity.getLpcCode());
|
||||
ps.setObject(idx++, entity.getMessageType());
|
||||
ps.setObject(idx++, entity.getSource());
|
||||
ps.setObject(idx++, entity.getStationId());
|
||||
ps.setObject(idx++, entity.getZoneId());
|
||||
});
|
||||
|
||||
log.info("AIS Target 배치 UPSERT 완료: {} 건", entities.size());
|
||||
|
||||
불러오는 중...
Reference in New Issue
Block a user