|
|
@@ -186,7 +186,8 @@ public class CooperativeDevelopmentExcelExporter
|
|
186
|
186
|
continue;
|
|
187
|
187
|
}
|
|
188
|
188
|
String text = formatter.formatCellValue(cell);
|
|
189
|
|
- if (StringUtils.isEmpty(text) || !text.contains("年"))
|
|
|
189
|
+ // 跳过填表人/填表时间行,避免把「XXXX年X月」先改成统计年导致填表日期无法落到当月
|
|
|
190
|
+ if (StringUtils.isEmpty(text) || !text.contains("年") || isFillerMetaText(text))
|
|
190
|
191
|
{
|
|
191
|
192
|
continue;
|
|
192
|
193
|
}
|
|
|
@@ -210,6 +211,9 @@ public class CooperativeDevelopmentExcelExporter
|
|
210
|
211
|
}
|
|
211
|
212
|
}
|
|
212
|
213
|
|
|
|
214
|
+ /**
|
|
|
215
|
+ * 将填表人、填表时间/日期写为当前登录用户与<strong>系统当月</strong>(非导出统计年月)。
|
|
|
216
|
+ */
|
|
213
|
217
|
static void updateFiller(Sheet sheet, String fillerName)
|
|
214
|
218
|
{
|
|
215
|
219
|
java.time.LocalDate today = java.time.LocalDate.now();
|
|
|
@@ -236,7 +240,7 @@ public class CooperativeDevelopmentExcelExporter
|
|
236
|
240
|
continue;
|
|
237
|
241
|
}
|
|
238
|
242
|
String text = formatter.formatCellValue(cell);
|
|
239
|
|
- if (StringUtils.isEmpty(text) || (!text.contains("填表人") && !text.contains("填表时间")))
|
|
|
243
|
+ if (StringUtils.isEmpty(text) || !isFillerMetaText(text))
|
|
240
|
244
|
{
|
|
241
|
245
|
continue;
|
|
242
|
246
|
}
|
|
|
@@ -245,9 +249,12 @@ public class CooperativeDevelopmentExcelExporter
|
|
245
|
249
|
{
|
|
246
|
250
|
updated = updated.replace("登录用户名称", fillerName);
|
|
247
|
251
|
}
|
|
248
|
|
- updated = updated.replaceAll("填表时间:\\s*XXXX年X月", "填表时间:" + fillTime);
|
|
249
|
|
- updated = updated.replaceAll("填表时间:\\s*\\d{4}年\\d{1,2}月", "填表时间:" + fillTime);
|
|
250
|
|
- if (updated.contains("XXXX年") && updated.contains("填表时间"))
|
|
|
252
|
+ // 兼容「填表时间」「填表日期」及占位 XXXX年X月 / 已被误替换的 yyyy年X月
|
|
|
253
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*XXXX年X月", "$1:" + fillTime);
|
|
|
254
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年X月", "$1:" + fillTime);
|
|
|
255
|
+ updated = updated.replaceAll("(填表时间|填表日期):\\s*\\d{4}年\\d{1,2}月", "$1:" + fillTime);
|
|
|
256
|
+ if (updated.contains("XXXX年")
|
|
|
257
|
+ && (updated.contains("填表时间") || updated.contains("填表日期")))
|
|
251
|
258
|
{
|
|
252
|
259
|
updated = updated.replaceFirst("XXXX年X?月?", fillTime);
|
|
253
|
260
|
}
|
|
|
@@ -256,6 +263,11 @@ public class CooperativeDevelopmentExcelExporter
|
|
256
|
263
|
}
|
|
257
|
264
|
}
|
|
258
|
265
|
|
|
|
266
|
+ private static boolean isFillerMetaText(String text)
|
|
|
267
|
+ {
|
|
|
268
|
+ return text.contains("填表人") || text.contains("填表时间") || text.contains("填表日期");
|
|
|
269
|
+ }
|
|
|
270
|
+
|
|
259
|
271
|
private static void clearDataCells(Row row)
|
|
260
|
272
|
{
|
|
261
|
273
|
short lastCell = row.getLastCellNum();
|