添加产值汇总表专业所排序
This commit is contained in:
@@ -15,12 +15,14 @@ public class EmployeeOutputSummaryExcelRespVO {
|
|||||||
@ExcelProperty("序号")
|
@ExcelProperty("序号")
|
||||||
private Integer serialNo;
|
private Integer serialNo;
|
||||||
|
|
||||||
|
@ExcelProperty("专业所")
|
||||||
|
private String officeName;
|
||||||
|
|
||||||
|
private Integer officeSortNo;
|
||||||
|
|
||||||
@ExcelProperty("姓名")
|
@ExcelProperty("姓名")
|
||||||
private String employeeName;
|
private String employeeName;
|
||||||
|
|
||||||
@ExcelProperty("所属专业所")
|
|
||||||
private String officeName;
|
|
||||||
|
|
||||||
@ExcelProperty("第一季度")
|
@ExcelProperty("第一季度")
|
||||||
private BigDecimal quarterOneAmount;
|
private BigDecimal quarterOneAmount;
|
||||||
|
|
||||||
|
|||||||
@@ -716,6 +716,7 @@ public class ProjectOutputReportServiceImpl implements ProjectOutputReportServic
|
|||||||
.selectEnabledListByOutputYear(reqVO.getYear(), employeeIds)
|
.selectEnabledListByOutputYear(reqVO.getYear(), employeeIds)
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(EmployeeYearLeaderOutputDO::getEmployeeId, item -> item, (a, b) -> a));
|
.collect(Collectors.toMap(EmployeeYearLeaderOutputDO::getEmployeeId, item -> item, (a, b) -> a));
|
||||||
|
Map<Long, OfficeDO> officeMap = getOfficeMap(employeeList);
|
||||||
|
|
||||||
List<EmployeeOutputSummaryExcelRespVO> rows = new ArrayList<>();
|
List<EmployeeOutputSummaryExcelRespVO> rows = new ArrayList<>();
|
||||||
for (EmployeeDO employee : employeeList) {
|
for (EmployeeDO employee : employeeList) {
|
||||||
@@ -737,8 +738,11 @@ public class ProjectOutputReportServiceImpl implements ProjectOutputReportServic
|
|||||||
.setScale(2, RoundingMode.HALF_UP);
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
BigDecimal estimatedYearEndPerformanceAmount = remainingOutputAmount.multiply(kValue)
|
BigDecimal estimatedYearEndPerformanceAmount = remainingOutputAmount.multiply(kValue)
|
||||||
.setScale(2, RoundingMode.HALF_UP);
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
OfficeDO office = officeMap.get(employee.getOfficeId());
|
||||||
|
|
||||||
EmployeeOutputSummaryExcelRespVO row = new EmployeeOutputSummaryExcelRespVO();
|
EmployeeOutputSummaryExcelRespVO row = new EmployeeOutputSummaryExcelRespVO();
|
||||||
|
row.setOfficeName(office == null ? "" : defaultString(office.getOfficeName()));
|
||||||
|
row.setOfficeSortNo(office == null ? null : office.getSortNo());
|
||||||
row.setEmployeeName(employee.getEmployeeName());
|
row.setEmployeeName(employee.getEmployeeName());
|
||||||
row.setQuarterOneAmount(amountToWan(accumulator.getQuarterOneAmount()));
|
row.setQuarterOneAmount(amountToWan(accumulator.getQuarterOneAmount()));
|
||||||
row.setQuarterTwoAmount(amountToWan(accumulator.getQuarterTwoAmount()));
|
row.setQuarterTwoAmount(amountToWan(accumulator.getQuarterTwoAmount()));
|
||||||
@@ -2420,19 +2424,30 @@ public class ProjectOutputReportServiceImpl implements ProjectOutputReportServic
|
|||||||
private void sortEmployeeRows(List<EmployeeOutputSummaryExcelRespVO> rows, String sortType) {
|
private void sortEmployeeRows(List<EmployeeOutputSummaryExcelRespVO> rows, String sortType) {
|
||||||
Comparator<EmployeeOutputSummaryExcelRespVO> comparator;
|
Comparator<EmployeeOutputSummaryExcelRespVO> comparator;
|
||||||
if (Objects.equals(sortType, SORT_NAME_ASC)) {
|
if (Objects.equals(sortType, SORT_NAME_ASC)) {
|
||||||
comparator = Comparator.comparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName,
|
comparator = employeeOfficeComparator()
|
||||||
String.CASE_INSENSITIVE_ORDER);
|
.thenComparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName, String.CASE_INSENSITIVE_ORDER);
|
||||||
} else if (Objects.equals(sortType, SORT_ANNUAL_TOTAL_ASC)) {
|
} else if (Objects.equals(sortType, SORT_ANNUAL_TOTAL_ASC)) {
|
||||||
comparator = Comparator.comparing(EmployeeOutputSummaryExcelRespVO::getAnnualTotalAmount, this::compareAmount)
|
comparator = employeeOfficeComparator()
|
||||||
|
.thenComparing(EmployeeOutputSummaryExcelRespVO::getAnnualTotalAmount, this::compareAmount)
|
||||||
.thenComparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName, String.CASE_INSENSITIVE_ORDER);
|
.thenComparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName, String.CASE_INSENSITIVE_ORDER);
|
||||||
} else {
|
} else {
|
||||||
comparator = Comparator.comparing(EmployeeOutputSummaryExcelRespVO::getAnnualTotalAmount, this::compareAmount)
|
Comparator<EmployeeOutputSummaryExcelRespVO> annualTotalDescComparator = Comparator
|
||||||
.reversed()
|
.comparing(EmployeeOutputSummaryExcelRespVO::getAnnualTotalAmount, this::compareAmount)
|
||||||
|
.reversed();
|
||||||
|
comparator = employeeOfficeComparator()
|
||||||
|
.thenComparing(annualTotalDescComparator)
|
||||||
.thenComparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName, String.CASE_INSENSITIVE_ORDER);
|
.thenComparing(EmployeeOutputSummaryExcelRespVO::getEmployeeName, String.CASE_INSENSITIVE_ORDER);
|
||||||
}
|
}
|
||||||
rows.sort(comparator);
|
rows.sort(comparator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Comparator<EmployeeOutputSummaryExcelRespVO> employeeOfficeComparator() {
|
||||||
|
return Comparator
|
||||||
|
.comparing((EmployeeOutputSummaryExcelRespVO row) -> row.getOfficeSortNo() == null
|
||||||
|
? Integer.MAX_VALUE : row.getOfficeSortNo())
|
||||||
|
.thenComparing(EmployeeOutputSummaryExcelRespVO::getOfficeName, String.CASE_INSENSITIVE_ORDER);
|
||||||
|
}
|
||||||
|
|
||||||
private int compareAmount(BigDecimal left, BigDecimal right) {
|
private int compareAmount(BigDecimal left, BigDecimal right) {
|
||||||
return amount(left).compareTo(amount(right));
|
return amount(left).compareTo(amount(right));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
private static final String TITLE_PREFIX = "7.1.6 ";
|
private static final String TITLE_PREFIX = "7.1.6 ";
|
||||||
private static final String TITLE_SUFFIX = " 年设计中心员工个人考核产值汇总,全公司产值人员汇总表";
|
private static final String TITLE_SUFFIX = " 年设计中心员工个人考核产值汇总,全公司产值人员汇总表";
|
||||||
private static final String SUBTITLE_SUFFIX = " 年设计中心员工个人考核产值汇总(单位:万元)";
|
private static final String SUBTITLE_SUFFIX = " 年设计中心员工个人考核产值汇总(单位:万元)";
|
||||||
private static final int LAST_COL = 12;
|
private static final int LAST_COL = 13;
|
||||||
private static final int DETAIL_START_ROW_NUM = 4;
|
private static final int DETAIL_START_ROW_NUM = 4;
|
||||||
|
|
||||||
public Workbook build(ExportData data) {
|
public Workbook build(ExportData data) {
|
||||||
@@ -36,7 +36,7 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
|
|
||||||
private void buildSheet(Workbook workbook, ExportData data) {
|
private void buildSheet(Workbook workbook, ExportData data) {
|
||||||
Sheet sheet = createSheet(workbook, SHEET_NAME, SHEET_NAME);
|
Sheet sheet = createSheet(workbook, SHEET_NAME, SHEET_NAME);
|
||||||
setColumnWidths(sheet, 8, 14, 12, 12, 12, 12, 12, 14, 14, 18, 14, 14, 14);
|
setColumnWidths(sheet, 8, 16, 14, 12, 12, 12, 12, 12, 14, 14, 18, 14, 14, 14);
|
||||||
|
|
||||||
CellStyle subtitleStyle = createDerivedStyle(workbook, createInfoStyle(workbook),
|
CellStyle subtitleStyle = createDerivedStyle(workbook, createInfoStyle(workbook),
|
||||||
null, HorizontalAlignment.CENTER, true, (short) 11);
|
null, HorizontalAlignment.CENTER, true, (short) 11);
|
||||||
@@ -80,7 +80,7 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
|
|
||||||
private int writeHeaderRow(Sheet sheet, int rowIndex, CellStyle style) {
|
private int writeHeaderRow(Sheet sheet, int rowIndex, CellStyle style) {
|
||||||
writeRow(sheet, rowIndex, style,
|
writeRow(sheet, rowIndex, style,
|
||||||
"序号", "姓名", "第一季度", "第二季度", "第三季度", "第四季度", "年度合计",
|
"序号", "专业所", "姓名", "第一季度", "第二季度", "第三季度", "第四季度", "年度合计",
|
||||||
"所长 / BIM 考核产值", "年度考核产值合计", "1~12 月份预计发生成本(含预计精神文明奖)",
|
"所长 / BIM 考核产值", "年度考核产值合计", "1~12 月份预计发生成本(含预计精神文明奖)",
|
||||||
"基本考核产值", "剩余产值", "预估年底绩效");
|
"基本考核产值", "剩余产值", "预估年底绩效");
|
||||||
return rowIndex + 1;
|
return rowIndex + 1;
|
||||||
@@ -92,19 +92,20 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
Row row = sheet.createRow(rowIndex);
|
Row row = sheet.createRow(rowIndex);
|
||||||
int excelRowNum = rowIndex + 1;
|
int excelRowNum = rowIndex + 1;
|
||||||
setText(row, 0, rowData == null || rowData.getSerialNo() == null ? "" : rowData.getSerialNo(), cellStyle);
|
setText(row, 0, rowData == null || rowData.getSerialNo() == null ? "" : rowData.getSerialNo(), cellStyle);
|
||||||
setText(row, 1, rowData == null ? "" : safeText(rowData.getEmployeeName()), leftCellStyle);
|
setText(row, 1, rowData == null ? "" : safeText(rowData.getOfficeName()), leftCellStyle);
|
||||||
setNumericCell(row, 2, rowData == null ? null : rowData.getQuarterOneAmount(), amountStyle);
|
setText(row, 2, rowData == null ? "" : safeText(rowData.getEmployeeName()), leftCellStyle);
|
||||||
setNumericCell(row, 3, rowData == null ? null : rowData.getQuarterTwoAmount(), amountStyle);
|
setNumericCell(row, 3, rowData == null ? null : rowData.getQuarterOneAmount(), amountStyle);
|
||||||
setNumericCell(row, 4, rowData == null ? null : rowData.getQuarterThreeAmount(), amountStyle);
|
setNumericCell(row, 4, rowData == null ? null : rowData.getQuarterTwoAmount(), amountStyle);
|
||||||
setNumericCell(row, 5, rowData == null ? null : rowData.getQuarterFourAmount(), amountStyle);
|
setNumericCell(row, 5, rowData == null ? null : rowData.getQuarterThreeAmount(), amountStyle);
|
||||||
setNumericCell(row, 6, rowData == null ? null : rowData.getAnnualTotalAmount(), amountStyle);
|
setNumericCell(row, 6, rowData == null ? null : rowData.getQuarterFourAmount(), amountStyle);
|
||||||
setNumericCell(row, 7, rowData == null ? null : rowData.getOfficeLeaderOrBimAmount(), amountStyle);
|
setNumericCell(row, 7, rowData == null ? null : rowData.getAnnualTotalAmount(), amountStyle);
|
||||||
setNumericCell(row, 8, rowData == null ? null : rowData.getTotalAssessmentOutputAmount(), amountStyle);
|
setNumericCell(row, 8, rowData == null ? null : rowData.getOfficeLeaderOrBimAmount(), amountStyle);
|
||||||
setNumericCell(row, 9, rowData == null ? null : rowData.getExpectedCostAmount(), amountStyle);
|
setNumericCell(row, 9, rowData == null ? null : rowData.getTotalAssessmentOutputAmount(), amountStyle);
|
||||||
|
setNumericCell(row, 10, rowData == null ? null : rowData.getExpectedCostAmount(), amountStyle);
|
||||||
|
|
||||||
setFormulaCell(row, 10, buildBasicAssessmentFormula(excelRowNum, data), formulaStyle);
|
setFormulaCell(row, 11, buildBasicAssessmentFormula(excelRowNum, data), formulaStyle);
|
||||||
setFormulaCell(row, 11, buildRemainingOutputFormula(excelRowNum), formulaStyle);
|
setFormulaCell(row, 12, buildRemainingOutputFormula(excelRowNum), formulaStyle);
|
||||||
setFormulaCell(row, 12, buildPerformanceFormula(excelRowNum, data), formulaStyle);
|
setFormulaCell(row, 13, buildPerformanceFormula(excelRowNum, data), formulaStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void writeTotalRow(Sheet sheet, int rowIndex, List<EmployeeOutputSummaryExcelRespVO> rows, ExportData data,
|
private void writeTotalRow(Sheet sheet, int rowIndex, List<EmployeeOutputSummaryExcelRespVO> rows, ExportData data,
|
||||||
@@ -115,8 +116,9 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
int detailEndRowNum = DETAIL_START_ROW_NUM + rows.size() - 1;
|
int detailEndRowNum = DETAIL_START_ROW_NUM + rows.size() - 1;
|
||||||
|
|
||||||
setText(row, 0, "", totalCellStyle);
|
setText(row, 0, "", totalCellStyle);
|
||||||
setText(row, 1, "合计", totalLeftCellStyle);
|
setText(row, 1, "", totalLeftCellStyle);
|
||||||
for (int col = 2; col <= LAST_COL; col++) {
|
setText(row, 2, "合计", totalLeftCellStyle);
|
||||||
|
for (int col = 3; col <= LAST_COL; col++) {
|
||||||
if (rows.isEmpty()) {
|
if (rows.isEmpty()) {
|
||||||
setNumericCell(row, col, BigDecimal.ZERO, totalStyle);
|
setNumericCell(row, col, BigDecimal.ZERO, totalStyle);
|
||||||
continue;
|
continue;
|
||||||
@@ -126,9 +128,9 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
}
|
}
|
||||||
// Ensure total-row formulas survive even if Excel recalculation is disabled.
|
// Ensure total-row formulas survive even if Excel recalculation is disabled.
|
||||||
if (!rows.isEmpty()) {
|
if (!rows.isEmpty()) {
|
||||||
row.getCell(10).setCellFormula(buildTotalBasicAssessmentFormula(totalExcelRowNum));
|
row.getCell(11).setCellFormula(buildTotalBasicAssessmentFormula(totalExcelRowNum));
|
||||||
row.getCell(11).setCellFormula(buildTotalRemainingOutputFormula(totalExcelRowNum));
|
row.getCell(12).setCellFormula(buildTotalRemainingOutputFormula(totalExcelRowNum));
|
||||||
row.getCell(12).setCellFormula(buildTotalPerformanceFormula(totalExcelRowNum, data));
|
row.getCell(13).setCellFormula(buildTotalPerformanceFormula(totalExcelRowNum, data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,11 +139,11 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
if (kValue.compareTo(BigDecimal.ZERO) <= 0) {
|
if (kValue.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
return "ROUND(J" + excelRowNum + "/" + kValue.stripTrailingZeros().toPlainString() + ",2)";
|
return "ROUND(K" + excelRowNum + "/" + kValue.stripTrailingZeros().toPlainString() + ",2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildRemainingOutputFormula(int excelRowNum) {
|
private String buildRemainingOutputFormula(int excelRowNum) {
|
||||||
return "ROUND(I" + excelRowNum + "-K" + excelRowNum + ",2)";
|
return "ROUND(J" + excelRowNum + "-L" + excelRowNum + ",2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildPerformanceFormula(int excelRowNum, ExportData data) {
|
private String buildPerformanceFormula(int excelRowNum, ExportData data) {
|
||||||
@@ -149,21 +151,21 @@ public class EmployeeOutputSummaryExcelBuilder extends AbstractProjectOutputExce
|
|||||||
if (kValue.compareTo(BigDecimal.ZERO) <= 0) {
|
if (kValue.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
return "0";
|
return "0";
|
||||||
}
|
}
|
||||||
return "ROUND(L" + excelRowNum + "*" + kValue.stripTrailingZeros().toPlainString() + ",2)";
|
return "ROUND(M" + excelRowNum + "*" + kValue.stripTrailingZeros().toPlainString() + ",2)";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildTotalBasicAssessmentFormula(int excelRowNum) {
|
private String buildTotalBasicAssessmentFormula(int excelRowNum) {
|
||||||
return "SUM(K" + DETAIL_START_ROW_NUM + ":K" + (excelRowNum - 1) + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildTotalRemainingOutputFormula(int excelRowNum) {
|
|
||||||
return "SUM(L" + DETAIL_START_ROW_NUM + ":L" + (excelRowNum - 1) + ")";
|
return "SUM(L" + DETAIL_START_ROW_NUM + ":L" + (excelRowNum - 1) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildTotalPerformanceFormula(int excelRowNum, ExportData data) {
|
private String buildTotalRemainingOutputFormula(int excelRowNum) {
|
||||||
return "SUM(M" + DETAIL_START_ROW_NUM + ":M" + (excelRowNum - 1) + ")";
|
return "SUM(M" + DETAIL_START_ROW_NUM + ":M" + (excelRowNum - 1) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildTotalPerformanceFormula(int excelRowNum, ExportData data) {
|
||||||
|
return "SUM(N" + DETAIL_START_ROW_NUM + ":N" + (excelRowNum - 1) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
private String safeYear(ExportData data) {
|
private String safeYear(ExportData data) {
|
||||||
return data == null || data.getYear() == null ? "" : String.valueOf(data.getYear());
|
return data == null || data.getYear() == null ? "" : String.valueOf(data.getYear());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user