1、新增常用货物

2、新增运输计划
3、新增项目管理
4、新增运单管理
5、新增常用线路
6、新增发货模板
7、新增合同管理
8、新增过程配置
9、新增临时额度管理
This commit is contained in:
2026-07-28 23:14:18 +08:00
parent 221825ebf9
commit 9419439668
81 changed files with 9214 additions and 3 deletions

View File

@@ -30,7 +30,6 @@ import cn.idev.excel.annotation.ExcelIgnore;
import cn.idev.excel.annotation.ExcelProperty;
import cn.idev.excel.metadata.data.WriteCellData;
import cn.idev.excel.write.handler.CellWriteHandler;
import cn.idev.excel.write.handler.context.CellWriteHandlerContext;
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
import cn.idev.excel.write.metadata.holder.WriteTableHolder;
import jakarta.servlet.http.HttpServletResponse;
@@ -191,6 +190,8 @@ public class ImportFailureExcelUtil {
private final List<List<Object>> rows;
private final int failureReasonColumnIndex;
private final Map<Short, CellStyle> redStyleCache = new HashMap<>();
private final Map<Short, CellStyle> noWrapStyleCache = new HashMap<>();
private final Map<Integer, Integer> columnWidthCache = new HashMap<>();
private ImportFailureCellStyleHandler(List<Field> excelFields, List<List<Object>> rows) {
this.columnKeywords = excelFields.stream()
@@ -209,7 +210,13 @@ public class ImportFailureExcelUtil {
cn.idev.excel.metadata.Head head,
Integer relativeRowIndex,
Boolean isHead) {
if (Boolean.TRUE.equals(isHead) || relativeRowIndex == null || relativeRowIndex < 0 || relativeRowIndex >= rows.size()) {
if (Boolean.TRUE.equals(isHead)) {
adjustColumnWidth(cell);
markNoWrap(cell);
return;
}
adjustColumnWidth(cell);
if (relativeRowIndex == null || relativeRowIndex < 0 || relativeRowIndex >= rows.size()) {
return;
}
if (shouldMarkRed(relativeRowIndex, cell.getColumnIndex())) {
@@ -241,6 +248,35 @@ public class ImportFailureExcelUtil {
});
cell.setCellStyle(redStyle);
}
private void markNoWrap(Cell cell) {
CellStyle currentStyle = cell.getCellStyle();
CellStyle noWrapStyle = noWrapStyleCache.computeIfAbsent(currentStyle.getIndex(), styleIndex -> {
CellStyle newStyle = cell.getSheet().getWorkbook().createCellStyle();
newStyle.cloneStyleFrom(currentStyle);
newStyle.setWrapText(false);
return newStyle;
});
cell.setCellStyle(noWrapStyle);
}
private void adjustColumnWidth(Cell cell) {
int columnIndex = cell.getColumnIndex();
int columnWidth = Math.min(Math.max(displayWidth(cell.toString()) + 4, 12), 80) * 256;
Integer currentWidth = columnWidthCache.get(columnIndex);
if (currentWidth == null || columnWidth > currentWidth) {
columnWidthCache.put(columnIndex, columnWidth);
cell.getSheet().setColumnWidth(columnIndex, columnWidth);
}
}
private int displayWidth(String value) {
int width = 0;
for (int index = 0; index < value.length(); index++) {
width += value.charAt(index) > 255 ? 2 : 1;
}
return width;
}
}
}