diff --git a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java
index 268d332f..f108455e 100644
--- a/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java
+++ b/bms-back/bms-system/src/main/java/com/bms/ar/service/impl/ArBillServiceImpl.java
@@ -28,6 +28,7 @@ import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import jakarta.servlet.http.HttpServletResponse;
+import org.apache.poi.ss.usermodel.BuiltinFormats;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.model.StylesTable;
@@ -1281,11 +1282,19 @@ public class ArBillServiceImpl implements IArBillService {
private void writeOoxmlWorkbook(ArBill bill, ArExportTemplate template, Path target) throws IOException {
// 样式表单独读取;不加载整张工作簿,且不依赖 styles.xml 和 sheet1.xml 在 ZIP 中的先后顺序。
StylesTable styles = readExportStyles(template);
+ XSSFCellStyle detailNoStyle = styles.createCellStyle();
+ detailNoStyle.cloneStyleFrom(styles.getStyleAt(TEMPLATE_DETAIL_STYLE_INDEX));
+ detailNoStyle.setDataFormat(BuiltinFormats.getBuiltinFormat("0"));
+ int detailNoStyleIndex = Short.toUnsignedInt(detailNoStyle.getIndex());
XSSFCellStyle failedDetailStyle = styles.createCellStyle();
failedDetailStyle.cloneStyleFrom(styles.getStyleAt(TEMPLATE_DETAIL_STYLE_INDEX));
failedDetailStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
failedDetailStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
int failedDetailStyleIndex = Short.toUnsignedInt(failedDetailStyle.getIndex());
+ XSSFCellStyle failedDetailNoStyle = styles.createCellStyle();
+ failedDetailNoStyle.cloneStyleFrom(failedDetailStyle);
+ failedDetailNoStyle.setDataFormat(BuiltinFormats.getBuiltinFormat("0"));
+ int failedDetailNoStyleIndex = Short.toUnsignedInt(failedDetailNoStyle.getIndex());
try (InputStream input = openTemplateStream(template); ZipInputStream templateZip = new ZipInputStream(input);
OutputStream fileOutput = Files.newOutputStream(target); ZipOutputStream output = new ZipOutputStream(fileOutput)) {
boolean replaced = false;
@@ -1293,7 +1302,8 @@ public class ArBillServiceImpl implements IArBillService {
ZipEntry outputEntry = new ZipEntry(entry.getName());
output.putNextEntry(outputEntry);
if (TEMPLATE_SHEET_XML.equals(entry.getName())) {
- writeOoxmlSheet(readUtf8(templateZip), bill, output, failedDetailStyleIndex);
+ writeOoxmlSheet(readUtf8(templateZip), bill, output, failedDetailStyleIndex,
+ detailNoStyleIndex, failedDetailNoStyleIndex);
replaced = true;
} else if (TEMPLATE_STYLES_XML.equals(entry.getName())) {
styles.writeTo(output);
@@ -1352,8 +1362,8 @@ public class ArBillServiceImpl implements IArBillService {
/**
* 以 XML 流方式写入表头、分页明细和银行信息,避免 POI 在大数据量下移动行。
*/
- private void writeOoxmlSheet(String templateXml, ArBill bill, OutputStream output, int failedDetailStyleIndex)
- throws IOException {
+ private void writeOoxmlSheet(String templateXml, ArBill bill, OutputStream output, int failedDetailStyleIndex,
+ int detailNoStyleIndex, int failedDetailNoStyleIndex) throws IOException {
int sheetDataStart = templateXml.indexOf("', sheetDataStart);
int sheetDataEnd = templateXml.indexOf("", sheetDataOpenEnd);
@@ -1386,7 +1396,8 @@ public class ArBillServiceImpl implements IArBillService {
}
attachFees(details);
for (ArBillDetail detail : details) {
- writeOoxmlDetailRow(output, rowIndex++, detail, failedDetailStyleIndex);
+ writeOoxmlDetailRow(output, rowIndex++, detail, failedDetailStyleIndex,
+ detailNoStyleIndex, failedDetailNoStyleIndex);
}
lastDetailNo = details.get(details.size() - 1).getDetailNo();
}
@@ -1530,10 +1541,12 @@ public class ArBillServiceImpl implements IArBillService {
}
}
- private void writeOoxmlDetailRow(OutputStream output, int rowNumber, ArBillDetail detail, int failedDetailStyleIndex)
- throws IOException {
+ private void writeOoxmlDetailRow(OutputStream output, int rowNumber, ArBillDetail detail, int failedDetailStyleIndex,
+ int detailNoStyleIndex, int failedDetailNoStyleIndex) throws IOException {
String failureDescription = exportBillingFailDescription(detail.getBillingFailStatus());
- int styleIndex = failureDescription.isEmpty() ? TEMPLATE_DETAIL_STYLE_INDEX : failedDetailStyleIndex;
+ boolean failedDetail = !failureDescription.isEmpty();
+ int styleIndex = failedDetail ? failedDetailStyleIndex : TEMPLATE_DETAIL_STYLE_INDEX;
+ int sequenceStyleIndex = failedDetail ? failedDetailNoStyleIndex : detailNoStyleIndex;
Object[] values = {
detail.getDetailNo(),
detail.getReceiveTime() == null ? "" : new SimpleDateFormat("yyyy-MM-dd").format(detail.getReceiveTime()),
@@ -1549,7 +1562,8 @@ public class ArBillServiceImpl implements IArBillService {
StringBuilder row = new StringBuilder(2048);
row.append("");
for (int index = 0; index < TEMPLATE_COLUMN_COUNT; index++) {
- appendOoxmlCell(row, (char) ('A' + index) + String.valueOf(rowNumber), values[index], styleIndex);
+ int cellStyleIndex = index == 0 ? sequenceStyleIndex : styleIndex;
+ appendOoxmlCell(row, (char) ('A' + index) + String.valueOf(rowNumber), values[index], cellStyleIndex);
}
row.append("
");
writeUtf8(output, row.toString());
diff --git a/bms-front/src/views/login.vue b/bms-front/src/views/login.vue
index f4b6398d..5ad1e8db 100644
--- a/bms-front/src/views/login.vue
+++ b/bms-front/src/views/login.vue
@@ -79,8 +79,8 @@ const router = useRouter()
const { proxy } = getCurrentInstance()
const loginForm = ref({
- username: "admin",
- password: "admin123",
+ username: "",
+ password: "",
rememberMe: false,
code: "",
uuid: ""