|
|
@@ -203,7 +203,8 @@ public class LivestockProductOutputExcelExporter
|
|
203
|
203
|
continue;
|
|
204
|
204
|
}
|
|
205
|
205
|
String text = formatter.formatCellValue(cell);
|
|
206
|
|
- if (StringUtils.isEmpty(text) || !text.contains("年"))
|
|
|
206
|
+ // 跳过填表人/填表时间行,避免把「XXXX年X月」先改成统计年导致填表日期无法落到当月
|
|
|
207
|
+ if (StringUtils.isEmpty(text) || !text.contains("年") || isFillerMetaText(text))
|
|
207
|
208
|
{
|
|
208
|
209
|
continue;
|
|
209
|
210
|
}
|
|
|
@@ -227,6 +228,9 @@ public class LivestockProductOutputExcelExporter
|
|
227
|
228
|
}
|
|
228
|
229
|
}
|
|
229
|
230
|
|
|
|
231
|
+ /**
|
|
|
232
|
+ * 将填表人、填表时间/日期写为当前登录用户与<strong>系统当月</strong>(非导出统计年月)。
|
|
|
233
|
+ */
|
|
230
|
234
|
static void updateFiller(Sheet sheet, String fillerName)
|
|
231
|
235
|
{
|
|
232
|
236
|
java.time.LocalDate today = java.time.LocalDate.now();
|
|
|
@@ -253,7 +257,7 @@ public class LivestockProductOutputExcelExporter
|
|
253
|
257
|
continue;
|
|
254
|
258
|
}
|
|
255
|
259
|
String text = formatter.formatCellValue(cell);
|
|
256
|
|
- if (StringUtils.isEmpty(text) || (!text.contains("填表人") && !text.contains("填表时间")))
|
|
|
260
|
+ if (StringUtils.isEmpty(text) || !isFillerMetaText(text))
|
|
257
|
261
|
{
|
|
258
|
262
|
continue;
|
|
259
|
263
|
}
|
|
|
@@ -262,9 +266,12 @@ public class LivestockProductOutputExcelExporter
|
|
262
|
266
|
{
|
|
263
|
267
|
updated = updated.replace("登录用户名称", fillerName);
|
|
264
|
268
|
}
|
|
265
|
|
- updated = updated.replaceAll("填表时间:\\s*XXXX年X月", "填表时间:" + fillTime);
|
|
266
|
|
- updated = updated.replaceAll("填表时间:\\s*\\d{4}年\\d{1,2}月", "填表时间:" + fillTime);
|
|
267
|
|
- if (updated.contains("XXXX年") && updated.contains("填表时间"))
|
|
|
269
|
+ // 兼容「填表时间」「填表日期」及占位 XXXX年X月 / 已被误替换的 yyyy年X月
|
|
|
270
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*XXXX年X月", "$1:" + fillTime);
|
|
|
271
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年X月", "$1:" + fillTime);
|
|
|
272
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年\\d{1,2}月", "$1:" + fillTime);
|
|
|
273
|
+ if (updated.contains("XXXX年")
|
|
|
274
|
+ && (updated.contains("填表时间") || updated.contains("填表日期")))
|
|
268
|
275
|
{
|
|
269
|
276
|
updated = updated.replaceFirst("XXXX年X?月?", fillTime);
|
|
270
|
277
|
}
|
|
|
@@ -273,6 +280,11 @@ public class LivestockProductOutputExcelExporter
|
|
273
|
280
|
}
|
|
274
|
281
|
}
|
|
275
|
282
|
|
|
|
283
|
+ private static boolean isFillerMetaText(String text)
|
|
|
284
|
+ {
|
|
|
285
|
+ return text.contains("填表人") || text.contains("填表时间") || text.contains("填表日期");
|
|
|
286
|
+ }
|
|
|
287
|
+
|
|
276
|
288
|
private static void mergeTotalLabelCells(Sheet sheet, int rowIndex)
|
|
277
|
289
|
{
|
|
278
|
290
|
int firstCol = COL_SEQ;
|