Замена данных
This commit is contained in:
@@ -4,10 +4,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -108,4 +105,57 @@ public class Corrector1S {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCellRecord(ExcelRecord record, int column) {
|
||||||
|
Cell cell = sheet.getRow(6).getCell(column, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
cell.setCellType(CellType.STRING);
|
||||||
|
cell.setCellValue(record.name);
|
||||||
|
|
||||||
|
cell = sheet.getRow(7).getCell(column, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
if (record.addition == 0) {
|
||||||
|
cell.setCellType(CellType.BLANK);
|
||||||
|
} else {
|
||||||
|
cell.setCellType(CellType.NUMERIC);
|
||||||
|
cell.setCellValue(record.addition);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = sheet.getRow(8).getCell(column, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
if (record.addition == 0) {
|
||||||
|
cell.setCellType(CellType.BLANK);
|
||||||
|
} else {
|
||||||
|
cell.setCellType(CellType.NUMERIC);
|
||||||
|
cell.setCellValue(record.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
cell = sheet.getRow(9).getCell(column, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||||
|
if (record.addition == 0) {
|
||||||
|
cell.setCellType(CellType.BLANK);
|
||||||
|
} else {
|
||||||
|
cell.setCellType(CellType.NUMERIC);
|
||||||
|
cell.setCellValue(record.data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void replaceData() {
|
||||||
|
int c = 10;
|
||||||
|
setCellRecord(mapRecords.remove("Дневные"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Ночные"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Ночные_123"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("питание_124"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Выходные"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("выходные_135"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("пересчет за прошлый месяц _141"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("вредность_145"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Материальная помощь при рождении ребенка_148"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("компенсация за задержку зарплаты_169"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Оплата по среднему (донорство, посещение врача)_174"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Компенсация проезда при использовании личного транспорта_176"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Сверхурочные 1.5 ставки"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("сверхурочные 1,5_180"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Сверхурочные 2 ставки"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("сверхурочные 2_181"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Компенсация за неиспользованный отпуск (с декабря 2017)_184"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Месячная премия 2018_186"), c++);
|
||||||
|
setCellRecord(mapRecords.remove("Итого начислено"), c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class Main {
|
|||||||
corrector1S.check();
|
corrector1S.check();
|
||||||
corrector1S.createSnapshotData();
|
corrector1S.createSnapshotData();
|
||||||
corrector1S.removeMergedCells();
|
corrector1S.removeMergedCells();
|
||||||
|
corrector1S.replaceData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,6 +165,9 @@ public class MainController {
|
|||||||
progressBar.setProgress(0.30d);
|
progressBar.setProgress(0.30d);
|
||||||
corrector.removeMergedCells();
|
corrector.removeMergedCells();
|
||||||
|
|
||||||
|
progressBar.setProgress(0.40d);
|
||||||
|
corrector.replaceData();
|
||||||
|
|
||||||
progressBar.setProgress(1.0d);
|
progressBar.setProgress(1.0d);
|
||||||
buildInfoDialog("Информация", "Преобразование завершено успешно")
|
buildInfoDialog("Информация", "Преобразование завершено успешно")
|
||||||
.showAndWait();
|
.showAndWait();
|
||||||
|
|||||||
Reference in New Issue
Block a user