[bomList배치] Reader 단 statCd='D' 우선 전역 정렬 — 청크 경계 A+D 분리 시 A 가 이김 보장 #503

Merged
ysCha merged 1 commits from dev into dev-deploy 2026-05-20 13:26:11 +09:00

View File

@ -6,6 +6,7 @@ import com.interplug.qcast.biz.displayItem.dto.BomSyncResponse;
import com.interplug.qcast.util.InterfaceQsp; import com.interplug.qcast.util.InterfaceQsp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator;
import java.util.List; import java.util.List;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecutionListener; import org.springframework.batch.core.JobExecutionListener;
@ -62,9 +63,16 @@ public class BomConfiguration implements JobExecutionListener {
this.bomSyncList = this.bomSyncList =
interfaceQsp.callApiData( interfaceQsp.callApiData(
HttpMethod.GET, qspInterfaceUrl, null, new TypeReference<List<BomSyncResponse>>() {}); HttpMethod.GET, qspInterfaceUrl, null, new TypeReference<List<BomSyncResponse>>() {});
return (bomSyncList != null) if (bomSyncList == null) {
? new ListItemReader<>(bomSyncList) return new ListItemReader<>(Collections.emptyList());
: new ListItemReader<>(Collections.emptyList()); }
// 2026-05-20 청크 경계에서 같은 A/D 분리되어 A 먼저 MERGE
// 다음 청크의 D 그것을 삭제해버리는 리스크를 차단하기 위해,
// 전체 리스트를 statCd='D' 우선으로 정렬한다. (Spring Batch 청크를 순차 처리하므로
// 모든 D 청크가 끝난 뒤에 A/U 청크가 시작되어 전역적으로 'A 이김' 보장됨)
bomSyncList.sort(
Comparator.comparingInt((BomSyncResponse b) -> "D".equals(b.getStatCd()) ? 0 : 1));
return new ListItemReader<>(bomSyncList);
} }
@Bean @Bean