package com.qianwen.smartman.modules.mdc.strategy;
|
|
import com.alibaba.excel.metadata.Head;
|
import com.alibaba.excel.write.merge.AbstractMergeStrategy;
|
import java.util.List;
|
import java.util.Map;
|
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
import com.qianwen.smartman.modules.mdc.dto.RowRangeDTO;
|
|
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/mdc/strategy/BizMergeStrategy.class */
|
public class BizMergeStrategy extends AbstractMergeStrategy {
|
private final Map<String, List<RowRangeDTO>> strategyMap;
|
private Sheet sheet;
|
|
public BizMergeStrategy(Map<String, List<RowRangeDTO>> strategyMap) {
|
this.strategyMap = strategyMap;
|
}
|
|
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) {
|
this.sheet = sheet;
|
if (cell.getRowIndex() == 1 && cell.getColumnIndex() == 0) {
|
for (Map.Entry<String, List<RowRangeDTO>> entry : this.strategyMap.entrySet()) {
|
int columnIndex = Integer.parseInt(entry.getKey());
|
entry.getValue().forEach(rowRange -> {
|
sheet.addMergedRegionUnsafe(new CellRangeAddress(rowRange.getStart().intValue(), rowRange.getEnd().intValue(), columnIndex, columnIndex));
|
});
|
}
|
}
|
}
|
}
|