🗃️ Ship Data 스키마 변경
This commit is contained in:
부모
4700ec862b
커밋
7b1fe1d52c
@ -103,7 +103,7 @@ public class ShipDetailUpdateJobConfig extends BaseJobConfig<ShipDetailCompariso
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getChunkSize() {
|
protected int getChunkSize() {
|
||||||
return 1; // API에서 100개씩 가져오므로 chunk도 100으로 설정
|
return 20; // API에서 100개씩 가져오므로 chunk도 100으로 설정
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "ShipDetailUpdateJob")
|
@Bean(name = "ShipDetailUpdateJob")
|
||||||
|
|||||||
@ -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 = 1;
|
private final int batchSize = 20;
|
||||||
|
|
||||||
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,18 +261,12 @@ 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)
|
||||||
|
|||||||
@ -76,8 +76,8 @@ 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 데이터
|
// // ✅ 2-2. 추가적인 Array/List 데이터
|
||||||
// // OwnerHistory 저장
|
// // OwnerHistory 저장
|
||||||
|
|||||||
@ -26,7 +26,7 @@ public class ShipRepositoryImpl extends BaseJdbcRepository<ShipEntity, Long> imp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getTableName() {
|
protected String getTableName() {
|
||||||
return "ship_data";
|
return "snp_data.ship_data";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,7 +47,7 @@ public class ShipRepositoryImpl extends BaseJdbcRepository<ShipEntity, Long> imp
|
|||||||
@Override
|
@Override
|
||||||
protected String getInsertSql() {
|
protected String getInsertSql() {
|
||||||
return """
|
return """
|
||||||
INSERT INTO ship_data (imo_number, core_ship_ind, dataset_version, import_date, created_at, updated_at, created_by, updated_by)
|
INSERT INTO snp_data.ship_data (imo_number, core_ship_ind, dataset_version, import_date, created_at, updated_at, created_by, updated_by)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||||
""";
|
""";
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ public class ShipRepositoryImpl extends BaseJdbcRepository<ShipEntity, Long> imp
|
|||||||
@Override
|
@Override
|
||||||
protected String getUpdateSql() {
|
protected String getUpdateSql() {
|
||||||
return """
|
return """
|
||||||
UPDATE ship_data
|
UPDATE snp_data.ship_data
|
||||||
SET core_ship_ind = ?,
|
SET core_ship_ind = ?,
|
||||||
dataset_version = ?,
|
dataset_version = ?,
|
||||||
import_date = ?,
|
import_date = ?,
|
||||||
@ -100,7 +100,7 @@ public class ShipRepositoryImpl extends BaseJdbcRepository<ShipEntity, Long> imp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Optional<ShipEntity> findByImoNumber(String imoNumber) {
|
public Optional<ShipEntity> findByImoNumber(String imoNumber) {
|
||||||
String sql = "SELECT * FROM ship_data WHERE imo_number = ?";
|
String sql = "SELECT * FROM snp_data.ship_data WHERE imo_number = ?";
|
||||||
return executeQueryForObject(sql, imoNumber);
|
return executeQueryForObject(sql, imoNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ public class ShipRepositoryImpl extends BaseJdbcRepository<ShipEntity, Long> imp
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean existsByImoNumber(String imoNumber) {
|
public boolean existsByImoNumber(String imoNumber) {
|
||||||
String sql = "SELECT COUNT(*) FROM ship_data WHERE imo_number = ?";
|
String sql = "SELECT COUNT(*) FROM snp_data.ship_data WHERE imo_number = ?";
|
||||||
Long count = jdbcTemplate.queryForObject(sql, Long.class, imoNumber);
|
Long count = jdbcTemplate.queryForObject(sql, Long.class, imoNumber);
|
||||||
return count != null && count > 0;
|
return count != null && count > 0;
|
||||||
}
|
}
|
||||||
|
|||||||
불러오는 중...
Reference in New Issue
Block a user