|
|
@@ -191,7 +191,8 @@ public class YakOutboundReportExcelExporter
|
|
191
|
191
|
continue;
|
|
192
|
192
|
}
|
|
193
|
193
|
String text = formatter.formatCellValue(cell);
|
|
194
|
|
- if (StringUtils.isEmpty(text) || !text.contains("年"))
|
|
|
194
|
+ // 跳过填表人/填表时间行,避免把「XXXX年X月」先改成统计年导致填表日期无法落到当月
|
|
|
195
|
+ if (StringUtils.isEmpty(text) || !text.contains("年") || isFillerMetaText(text))
|
|
195
|
196
|
{
|
|
196
|
197
|
continue;
|
|
197
|
198
|
}
|
|
|
@@ -215,6 +216,9 @@ public class YakOutboundReportExcelExporter
|
|
215
|
216
|
}
|
|
216
|
217
|
}
|
|
217
|
218
|
|
|
|
219
|
+ /**
|
|
|
220
|
+ * 将填表人、填表时间/日期写为当前登录用户与<strong>系统当月</strong>(非导出统计年月)。
|
|
|
221
|
+ */
|
|
218
|
222
|
static void updateFiller(Sheet sheet, String fillerName)
|
|
219
|
223
|
{
|
|
220
|
224
|
java.time.LocalDate today = java.time.LocalDate.now();
|
|
|
@@ -241,7 +245,7 @@ public class YakOutboundReportExcelExporter
|
|
241
|
245
|
continue;
|
|
242
|
246
|
}
|
|
243
|
247
|
String text = formatter.formatCellValue(cell);
|
|
244
|
|
- if (StringUtils.isEmpty(text) || (!text.contains("填表人") && !text.contains("填表时间")))
|
|
|
248
|
+ if (StringUtils.isEmpty(text) || !isFillerMetaText(text))
|
|
245
|
249
|
{
|
|
246
|
250
|
continue;
|
|
247
|
251
|
}
|
|
|
@@ -250,9 +254,12 @@ public class YakOutboundReportExcelExporter
|
|
250
|
254
|
{
|
|
251
|
255
|
updated = updated.replace("登录用户名称", fillerName);
|
|
252
|
256
|
}
|
|
253
|
|
- updated = updated.replaceAll("填表时间:\\s*XXXX年X月", "填表时间:" + fillTime);
|
|
254
|
|
- updated = updated.replaceAll("填表时间:\\s*\\d{4}年\\d{1,2}月", "填表时间:" + fillTime);
|
|
255
|
|
- if (updated.contains("XXXX年") && updated.contains("填表时间"))
|
|
|
257
|
+ // 兼容「填表时间」「填表日期」及占位 XXXX年X月 / 已被误替换的 yyyy年X月
|
|
|
258
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*XXXX年X月", "$1:" + fillTime);
|
|
|
259
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年X月", "$1:" + fillTime);
|
|
|
260
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年\\d{1,2}月", "$1:" + fillTime);
|
|
|
261
|
+ if (updated.contains("XXXX年")
|
|
|
262
|
+ && (updated.contains("填表时间") || updated.contains("填表日期")))
|
|
256
|
263
|
{
|
|
257
|
264
|
updated = updated.replaceFirst("XXXX年X?月?", fillTime);
|
|
258
|
265
|
}
|
|
|
@@ -261,6 +268,11 @@ public class YakOutboundReportExcelExporter
|
|
261
|
268
|
}
|
|
262
|
269
|
}
|
|
263
|
270
|
|
|
|
271
|
+ private static boolean isFillerMetaText(String text)
|
|
|
272
|
+ {
|
|
|
273
|
+ return text.contains("填表人") || text.contains("填表时间") || text.contains("填表日期");
|
|
|
274
|
+ }
|
|
|
275
|
+
|
|
264
|
276
|
private static void mergeTotalLabelCells(Sheet sheet, int rowIndex)
|
|
265
|
277
|
{
|
|
266
|
278
|
int firstCol = COL_SEQ;
|