大型解析双收益团队长

This commit is contained in:
2026-05-15 14:18:40 +08:00
parent 0d9d77ea9e
commit bfef628ea6
4 changed files with 55 additions and 8 deletions

View File

@@ -94,12 +94,13 @@ public class LbAssessmentApplyController {
@RequestParam(required = false) String applicantPhone,
@RequestParam(required = false) String colleagueName,
@RequestParam(required = false) String teamLeaderName,
@RequestParam(required = false) String teamBigLeaderName,
@RequestParam(required = false) String assessmentTeacherName,
@RequestParam(required = false) String moderatorName,
@RequestParam(required = false) String meetingNumber) {
Map<String, Object> result = lbAssessmentApplyService.pageQuery(
current, size, tenantId, applicantName, applicantPhone, colleagueName, teamLeaderName,
assessmentTeacherName, moderatorName, meetingNumber
teamBigLeaderName, assessmentTeacherName, moderatorName, meetingNumber
);
Boolean success = (Boolean) result.get("success");
if (success != null && success) {

View File

@@ -54,6 +54,10 @@ public class LbAssessmentApply implements Serializable {
@Schema(description = "团队长姓名")
private String teamLeaderName;
@TableField("team_big_leader_name")
@Schema(description = "全收益团队长姓名")
private String teamBigLeaderName;
@TableField("assessment_teacher_name")
@Schema(description = "评估老师姓名")
private String assessmentTeacherName;

View File

@@ -21,6 +21,7 @@ public interface ILbAssessmentApplyService extends IService<LbAssessmentApply> {
String applicantPhone,
String colleagueName,
String teamLeaderName,
String teamBigLeaderName,
String assessmentTeacherName,
String moderatorName,
String meetingNumber);

View File

@@ -61,6 +61,7 @@ public class LbAssessmentApplyServiceImpl
colleagueName 同事姓名;
colleaguePhone 同事电话;
teamLeaderName 团队长姓名;
teamBigLeaderName 全收益团队长姓名;
assessmentTeacherName 评估老师姓名;
moderatorName 主持人姓名;
meetingNumber 会议号;
@@ -250,6 +251,7 @@ public class LbAssessmentApplyServiceImpl
String applicantPhone,
String colleagueName,
String teamLeaderName,
String teamBigLeaderName,
String assessmentTeacherName,
String moderatorName,
String meetingNumber) {
@@ -264,7 +266,7 @@ public class LbAssessmentApplyServiceImpl
LambdaQueryWrapper<LbAssessmentApply> queryWrapper = buildQueryWrapper(
tenantId, applicantName, applicantPhone, colleagueName, teamLeaderName,
assessmentTeacherName, moderatorName, meetingNumber
teamBigLeaderName, assessmentTeacherName, moderatorName, meetingNumber
);
Page<LbAssessmentApply> page = this.page(new Page<>(current, size), queryWrapper);
@@ -375,7 +377,7 @@ public class LbAssessmentApplyServiceImpl
createCell(row, 3, nullToEmpty(item.getColleagueName()), dataStyle);
createCell(row, 4, nullToEmpty(item.getColleaguePhone()), dataStyle);
createCell(row, 5, nullToEmpty(item.getTeamLeaderName()), dataStyle);
createCell(row, 6, "", dataStyle);
createCell(row, 6, nullToEmpty(item.getTeamBigLeaderName()), dataStyle);
createCell(row, 7, formatApplicationDatetime(item.getApplicationDatetime()), dataStyle);
createCell(row, 8, nullToEmpty(item.getAssessmentTeacherName()), dataStyle);
createCell(row, 9, nullToEmpty(item.getModeratorName()), dataStyle);
@@ -383,11 +385,7 @@ public class LbAssessmentApplyServiceImpl
rowIndex++;
}
for (int i = 0; i < headers.length; i++) {
sheet.autoSizeColumn(i);
int width = sheet.getColumnWidth(i);
sheet.setColumnWidth(i, Math.min(255 * 256, (int) (width * 1.2)));
}
adjustColumnWidths(sheet, headers);
String filename = "申请评估_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")) + ".xlsx";
String encoded = URLEncoder.encode(filename, StandardCharsets.UTF_8).replaceAll("\\+", "%20");
@@ -420,6 +418,7 @@ public class LbAssessmentApplyServiceImpl
String applicantPhone,
String colleagueName,
String teamLeaderName,
String teamBigLeaderName,
String assessmentTeacherName,
String moderatorName,
String meetingNumber) {
@@ -439,6 +438,9 @@ public class LbAssessmentApplyServiceImpl
if (teamLeaderName != null && !teamLeaderName.trim().isEmpty()) {
queryWrapper.like(LbAssessmentApply::getTeamLeaderName, teamLeaderName.trim());
}
if (teamBigLeaderName != null && !teamBigLeaderName.trim().isEmpty()) {
queryWrapper.like(LbAssessmentApply::getTeamBigLeaderName, teamBigLeaderName.trim());
}
if (assessmentTeacherName != null && !assessmentTeacherName.trim().isEmpty()) {
queryWrapper.like(LbAssessmentApply::getAssessmentTeacherName, assessmentTeacherName.trim());
}
@@ -472,4 +474,43 @@ public class LbAssessmentApplyServiceImpl
cell.setCellValue(text);
cell.setCellStyle(style);
}
/**
* 按单元格内容计算列宽。POI 的 autoSizeColumn 对中文支持差,改为按字符宽度估算。
*/
private static void adjustColumnWidths(Sheet sheet, String[] headers) {
int columnCount = headers.length;
int[] maxWidths = new int[columnCount];
for (int i = 0; i < columnCount; i++) {
maxWidths[i] = calcDisplayWidth(headers[i]);
}
for (int r = 1; r <= sheet.getLastRowNum(); r++) {
Row row = sheet.getRow(r);
if (row == null) {
continue;
}
for (int c = 0; c < columnCount; c++) {
Cell cell = row.getCell(c);
if (cell != null && cell.getCellType() == CellType.STRING) {
maxWidths[c] = Math.max(maxWidths[c], calcDisplayWidth(cell.getStringCellValue()));
}
}
}
for (int i = 0; i < columnCount; i++) {
// 表头加粗,额外留 1 个字符边距
int width = Math.min(255 * 256, (maxWidths[i] + 3) * 256);
sheet.setColumnWidth(i, width);
}
}
private static int calcDisplayWidth(String text) {
if (text == null || text.isEmpty()) {
return 0;
}
int width = 0;
for (char ch : text.toCharArray()) {
width += ch > 127 ? 2 : 1;
}
return width;
}
}