|
@@ -481,8 +481,7 @@ public class TRBasicInfoController {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到学生信息");
|
|
|
}
|
|
|
|
|
|
- Map<Long, BigDecimal> examStudentMatrixDegree = new LinkedHashMap<>(),
|
|
|
- examStudentSumMatrixDegree = new LinkedHashMap<>();
|
|
|
+ Map<Long, BigDecimal> examStudentMatrixDegree = new LinkedHashMap<>(), examStudentSumMatrixDegree = new LinkedHashMap<>();
|
|
|
BigDecimal examStudentSumTargetWeight = new BigDecimal(0);
|
|
|
LinkedMultiValueMap<String, String> courseTargetMap = new LinkedMultiValueMap<>();
|
|
|
LinkedMultiValueMap<Long, BigDecimal> examStudentMatrixDegreeMap = new LinkedMultiValueMap<>();
|
|
@@ -523,7 +522,7 @@ public class TRBasicInfoController {
|
|
|
examStudentMatrixDegree.put(t.getId(), matrixDegree);
|
|
|
|
|
|
examStudentSumTargetWeight = examStudentSumTargetWeight.setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- BigDecimal sumMatrixDegree = SystemConstant.PERCENT.multiply(matrixDegree).divide(examStudentSumTargetWeight, 2, BigDecimal.ROUND_HALF_UP).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+ BigDecimal sumMatrixDegree = SystemConstant.PERCENT.multiply(matrixDegree).divide(examStudentSumTargetWeight, 2, BigDecimal.ROUND_HALF_UP);
|
|
|
examStudentSumMatrixDegree.put(t.getId(), sumMatrixDegree);
|
|
|
}
|
|
|
}
|
|
@@ -534,25 +533,7 @@ public class TRBasicInfoController {
|
|
|
|
|
|
SXSSFWorkbook wb = new SXSSFWorkbook();
|
|
|
Sheet sheet = wb.createSheet("过程考核");
|
|
|
- CellStyle headerStyle = wb.createCellStyle();
|
|
|
- headerStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中格式
|
|
|
- headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
|
|
|
- headerStyle.setBorderRight(BorderStyle.THIN);
|
|
|
- headerStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
- headerStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
- headerStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
- headerStyle.setBorderTop(BorderStyle.THIN);
|
|
|
- headerStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
- headerStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
- headerStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
- // 背景颜色
|
|
|
- headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
- headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
|
|
-
|
|
|
- Font defaultFont = wb.createFont();
|
|
|
- defaultFont.setFontHeightInPoints((short) 12);
|
|
|
- defaultFont.setBold(true);
|
|
|
- headerStyle.setFont(defaultFont);
|
|
|
+ CellStyle headerStyle = this.createHeadStyle(wb);
|
|
|
|
|
|
Row rowHeadOne = sheet.createRow(0);
|
|
|
Row rowHeadTwo = sheet.createRow(1);
|
|
@@ -601,9 +582,7 @@ public class TRBasicInfoController {
|
|
|
//第二行
|
|
|
this.drawExcelFixedHead(rowHeadTwo, headerStyle, sheet, "课程:" + trBasicInfo.getCourseName() + " 班级:" + (Objects.nonNull(trBasicInfo.getTeachingObject()) ? trBasicInfo.getTeachingObject() : "无") + " 任课教师:" + (Objects.nonNull(trBasicInfo.getTeacher()) ? trBasicInfo.getTeacher() : "无") + " 学期:" + trBasicInfo.getOpenTime(), 0, 1, 1, 0, cellTwoIndex.get() - 1, sheet.getColumnWidth(cellTwoIndex.get()) * 17);
|
|
|
|
|
|
- CellStyle styleExamStudent = wb.createCellStyle();
|
|
|
- styleExamStudent.setAlignment(HorizontalAlignment.LEFT);
|
|
|
- styleExamStudent.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ CellStyle styleExamStudent = this.createRowStyle(wb);
|
|
|
AtomicInteger rowStudentIndex = new AtomicInteger(4);
|
|
|
for (TRExamStudent t : trExamStudentList) {
|
|
|
Row rowStudent = sheet.createRow(rowStudentIndex.get());
|
|
@@ -622,6 +601,48 @@ public class TRBasicInfoController {
|
|
|
ExcelUtil.exportEXCEL(fileName, wb, ServletUtil.getResponse());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建行样式
|
|
|
+ *
|
|
|
+ * @param wb
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected CellStyle createRowStyle(SXSSFWorkbook wb) {
|
|
|
+ CellStyle styleExamStudent = wb.createCellStyle();
|
|
|
+ styleExamStudent.setAlignment(HorizontalAlignment.LEFT);
|
|
|
+ styleExamStudent.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
+ return styleExamStudent;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建头样式
|
|
|
+ *
|
|
|
+ * @param wb
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ protected CellStyle createHeadStyle(SXSSFWorkbook wb) {
|
|
|
+ CellStyle headerStyle = wb.createCellStyle();
|
|
|
+ headerStyle.setAlignment(HorizontalAlignment.CENTER); // 水平居中格式
|
|
|
+ headerStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直居中
|
|
|
+ headerStyle.setBorderRight(BorderStyle.THIN);
|
|
|
+ headerStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
+ headerStyle.setBorderLeft(BorderStyle.THIN);
|
|
|
+ headerStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
+ headerStyle.setBorderTop(BorderStyle.THIN);
|
|
|
+ headerStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
+ headerStyle.setBorderBottom(BorderStyle.THIN);
|
|
|
+ headerStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
|
|
|
+ // 背景颜色
|
|
|
+ headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
|
+ headerStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
|
|
|
+
|
|
|
+ Font defaultFont = wb.createFont();
|
|
|
+ defaultFont.setFontHeightInPoints((short) 12);
|
|
|
+ defaultFont.setBold(true);
|
|
|
+ headerStyle.setFont(defaultFont);
|
|
|
+ return headerStyle;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 创建固定行表头
|
|
|
*
|