fix(工作报告、我的绩效、产品/项目、消息通知): 修复已知的一些问题。
This commit is contained in:
@@ -39,6 +39,7 @@ import java.math.BigInteger;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.IsoFields;
|
||||
import java.util.*;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
@@ -187,7 +188,8 @@ public class WorkReportContentExportService {
|
||||
replacePlaceholders(document, buildWeeklyTemplateData(report));
|
||||
renderPersonalReviewTable(document, report.getReviewItems());
|
||||
renderPersonalPlanTable(document, report.getPlanItems());
|
||||
return new DocumentContent(buildFilename("个人周报", report.getReporterName(), report.getPeriodLabel()),
|
||||
return new DocumentContent(buildWeeklyFilename("个人周报", report.getReporterName(),
|
||||
report.getPeriodStartDate(), report.getPeriodLabel()),
|
||||
toBytes(document));
|
||||
} catch (IOException | Docx4JException e) {
|
||||
throw new IllegalStateException("生成周报模板导出文件失败", e);
|
||||
@@ -214,7 +216,8 @@ public class WorkReportContentExportService {
|
||||
|
||||
addSectionTitle(document, "下周期重点工作计划");
|
||||
addPersonalPlanTable(document, report.getPlanItems(), false);
|
||||
return new DocumentContent(buildFilename("个人周报", report.getReporterName(), report.getPeriodLabel()),
|
||||
return new DocumentContent(buildWeeklyFilename("个人周报", report.getReporterName(),
|
||||
report.getPeriodStartDate(), report.getPeriodLabel()),
|
||||
toBytes(document));
|
||||
} catch (Docx4JException | IOException e) {
|
||||
throw new IllegalStateException("生成周报导出文件失败", e);
|
||||
@@ -1821,6 +1824,16 @@ public class WorkReportContentExportService {
|
||||
return sanitizeFilename(reportTypeName + "_" + text(ownerName) + "_" + text(periodLabel)) + ".docx";
|
||||
}
|
||||
|
||||
private String buildWeeklyFilename(String reportTypeName, String ownerName, LocalDate periodStartDate, String periodLabel) {
|
||||
if (periodStartDate == null) {
|
||||
return buildFilename(reportTypeName, ownerName, periodLabel);
|
||||
}
|
||||
int weekBasedYear = periodStartDate.get(IsoFields.WEEK_BASED_YEAR);
|
||||
int weekOfYear = periodStartDate.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
||||
return sanitizeFilename(reportTypeName + "_" + text(ownerName) + "_"
|
||||
+ weekBasedYear + "年第" + weekOfYear + "周") + ".docx";
|
||||
}
|
||||
|
||||
private String sanitizeFilename(String filename) {
|
||||
return filename.replaceAll("[\\\\/:*?\"<>|\\r\\n]+", "_");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user