260305_01_ENH: 쿼리 배치 count 상수명 통일
This commit is contained in:
@@ -2,7 +2,7 @@ package com.kri.lge.penetration.common.consts;
|
|||||||
|
|
||||||
public final class LgePenetrationConst {
|
public final class LgePenetrationConst {
|
||||||
|
|
||||||
public static final int BATCH_SIZE = 1000;
|
public static final int INSERT_CHUNK_SIZE = 1000;
|
||||||
public static final int ADMIN_ROLE = 9999;
|
public static final int ADMIN_ROLE = 9999;
|
||||||
|
|
||||||
public static final String EXCEL_ID = "ID";
|
public static final String EXCEL_ID = "ID";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.kri.lge.penetration.service;
|
package com.kri.lge.penetration.service;
|
||||||
|
|
||||||
import static com.kri.lge.penetration.common.consts.LgePenetrationConst.BATCH_SIZE;
|
import static com.kri.lge.penetration.common.consts.LgePenetrationConst.INSERT_CHUNK_SIZE;
|
||||||
import static com.kri.lge.penetration.common.consts.LgePenetrationConst.EXCEL_ID;
|
import static com.kri.lge.penetration.common.consts.LgePenetrationConst.EXCEL_ID;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
@@ -42,7 +42,7 @@ public class UploadService {
|
|||||||
|
|
||||||
public ExcelUploadResultDto uploadData(MultipartFile file){
|
public ExcelUploadResultDto uploadData(MultipartFile file){
|
||||||
try (InputStream in = file.getInputStream()) {
|
try (InputStream in = file.getInputStream()) {
|
||||||
List<RowContext> buffer = new ArrayList<>(BATCH_SIZE);
|
List<RowContext> buffer = new ArrayList<>(INSERT_CHUNK_SIZE);
|
||||||
List<Map<String, String>> failRows = new ArrayList<>();
|
List<Map<String, String>> failRows = new ArrayList<>();
|
||||||
|
|
||||||
AtomicInteger total = new AtomicInteger();
|
AtomicInteger total = new AtomicInteger();
|
||||||
@@ -64,7 +64,7 @@ public class UploadService {
|
|||||||
|
|
||||||
buffer.add(new RowContext(rowIndex, row, parsed.entity));
|
buffer.add(new RowContext(rowIndex, row, parsed.entity));
|
||||||
|
|
||||||
if (buffer.size() >= BATCH_SIZE) {
|
if (buffer.size() >= INSERT_CHUNK_SIZE) {
|
||||||
flushBuffer(buffer, success, fail, failRows);
|
flushBuffer(buffer, success, fail, failRows);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user