|
@@ -198,6 +198,129 @@ public class ScoreExporter {
|
|
|
return sheet;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 绘制固定表头
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @param sheet
|
|
|
+ * @param style
|
|
|
+ * @param row
|
|
|
+ * @param workId
|
|
|
+ * @param subjectMap
|
|
|
+ */
|
|
|
+ public Sheet drawExcelFixedHeadLevel(int type, Sheet sheet, CellStyle style, Row row, Map<String, Map<String, ExportLevelResultDTO>> subjectMap, Long workId) {
|
|
|
+ //准考证号
|
|
|
+ Cell cell = row.createCell(0);
|
|
|
+ cell.setCellValue(EXAM_NUMBER);
|
|
|
+ cell.setCellStyle(style);
|
|
|
+ CellRangeAddress region1 = new CellRangeAddress(0, 1, (short) 0, (short) 0);
|
|
|
+ sheet.addMergedRegion(region1);
|
|
|
+ sheet.setColumnWidth(0, 15 * 256);
|
|
|
+ //姓名
|
|
|
+ Cell cell1 = row.createCell(1);
|
|
|
+ cell1.setCellValue(NAME);
|
|
|
+ cell1.setCellStyle(style);
|
|
|
+ CellRangeAddress region2 = new CellRangeAddress(0, 1, (short) 1, (short) 1);
|
|
|
+ sheet.addMergedRegion(region2);
|
|
|
+ //考区
|
|
|
+ Cell cell2 = row.createCell(2);
|
|
|
+ cell2.setCellValue(AREA_NAME);
|
|
|
+ cell2.setCellStyle(style);
|
|
|
+ CellRangeAddress region3 = new CellRangeAddress(0, 1, (short) 2, (short) 2);
|
|
|
+ sheet.addMergedRegion(region3);
|
|
|
+ sheet.setColumnWidth(2, 30 * 256);
|
|
|
+ //生源地
|
|
|
+ Cell cell5 = row.createCell(3);
|
|
|
+ cell5.setCellValue(SOURCE_NAME);
|
|
|
+ cell5.setCellStyle(style);
|
|
|
+ CellRangeAddress region6 = new CellRangeAddress(0, 1, (short) 3, (short) 3);
|
|
|
+ sheet.addMergedRegion(region6);
|
|
|
+ if (!imageConfig.isCustomSubject()) {
|
|
|
+ //色彩
|
|
|
+ int size = 0;
|
|
|
+ if (Objects.nonNull(subjectMap.get(Subject.SC.toString()))) {
|
|
|
+ size = subjectMap.get(Subject.SC.toString()).size();
|
|
|
+ }
|
|
|
+ int scSumCount = 0;
|
|
|
+ if (type == 2) {
|
|
|
+ scSumCount = score + size + 5;
|
|
|
+ } else {
|
|
|
+ scSumCount = score + size;
|
|
|
+ }
|
|
|
+ Cell cell6 = row.createCell(score);
|
|
|
+ cell6.setCellValue(SC_NAME);
|
|
|
+ cell6.setCellStyle(style);
|
|
|
+ if (score != scSumCount) {
|
|
|
+ CellRangeAddress region7 = new CellRangeAddress(0, 0, (short) score, scSumCount);
|
|
|
+ sheet.addMergedRegion(region7);
|
|
|
+ }
|
|
|
+ LOGGER.info("level:{},scSumCount:{}", score, scSumCount);
|
|
|
+
|
|
|
+ //素描
|
|
|
+ scSumCount = scSumCount + 1;//起始列+1
|
|
|
+ size = 0;
|
|
|
+ if (Objects.nonNull(subjectMap.get(Subject.SM.toString()))) {
|
|
|
+ size = subjectMap.get(Subject.SM.toString()).size();
|
|
|
+ }
|
|
|
+ int smSumCount = 0;
|
|
|
+ if (type == 2) {
|
|
|
+ smSumCount = scSumCount + size + 5;//最终列+1,因为从0开始
|
|
|
+ } else {
|
|
|
+ smSumCount = scSumCount + size;
|
|
|
+ }
|
|
|
+ Cell cell7 = row.createCell(scSumCount);
|
|
|
+ cell7.setCellValue(SM_NAME);
|
|
|
+ cell7.setCellStyle(style);
|
|
|
+ if (scSumCount != smSumCount) {
|
|
|
+ CellRangeAddress region8 = new CellRangeAddress(0, 0, (short) scSumCount, smSumCount);
|
|
|
+ sheet.addMergedRegion(region8);
|
|
|
+ }
|
|
|
+ LOGGER.info("scSumCount:{},smSumCount:{}", scSumCount, smSumCount);
|
|
|
+ //速写
|
|
|
+ smSumCount = smSumCount + 1;//起始列+1
|
|
|
+ size = 0;
|
|
|
+ if (Objects.nonNull(subjectMap.get(Subject.SX.toString()))) {
|
|
|
+ size = subjectMap.get(Subject.SX.toString()).size();
|
|
|
+ }
|
|
|
+ int sxSumCount = 0;
|
|
|
+ if (type == 2) {
|
|
|
+ sxSumCount = smSumCount + size + 5;//最终列+1,因为从0开始
|
|
|
+ } else {
|
|
|
+ sxSumCount = smSumCount + size;
|
|
|
+ }
|
|
|
+ Cell cell8 = row.createCell(smSumCount);
|
|
|
+ cell8.setCellValue(SX_NAME);
|
|
|
+ cell8.setCellStyle(style);
|
|
|
+ if (smSumCount != sxSumCount) {
|
|
|
+ CellRangeAddress region9 = new CellRangeAddress(0, 0, (short) smSumCount, sxSumCount);
|
|
|
+ sheet.addMergedRegion(region9);
|
|
|
+ }
|
|
|
+ LOGGER.info("smSumCount:{},sxSumCount:{}", smSumCount, sxSumCount);
|
|
|
+ } else {
|
|
|
+ //自定义
|
|
|
+ int size = 0;
|
|
|
+ if (Objects.nonNull(subjectMap.get(Subject.CUSTOM.toString()))) {
|
|
|
+ size = subjectMap.get(Subject.CUSTOM.toString()).size();
|
|
|
+ }
|
|
|
+ int customSumCount = 0;
|
|
|
+ if (type == 2) {
|
|
|
+ customSumCount = score + size + 1;
|
|
|
+ } else {
|
|
|
+ customSumCount = score + size;
|
|
|
+ }
|
|
|
+ MarkSubject markSubject = markSubjectRepo.findOne(workId + "-" + Subject.CUSTOM.name());
|
|
|
+ Cell cell6 = row.createCell(score);
|
|
|
+ cell6.setCellValue(markSubject.getName());
|
|
|
+ cell6.setCellStyle(style);
|
|
|
+ if (score != customSumCount) {
|
|
|
+ CellRangeAddress region7 = new CellRangeAddress(0, 0, (short) score, customSumCount);
|
|
|
+ sheet.addMergedRegion(region7);
|
|
|
+ }
|
|
|
+ LOGGER.info("level:{},customSumCount:{}", score, customSumCount);
|
|
|
+ }
|
|
|
+ return sheet;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 绘制固定表头
|
|
|
*
|
|
@@ -380,7 +503,7 @@ public class ScoreExporter {
|
|
|
Row row = sheet.createRow(0);
|
|
|
|
|
|
//绘制固定表头
|
|
|
- sheet = drawExcelFixedHead(levelInterval, sheet, style, row, subjectMap, workId);
|
|
|
+ sheet = drawExcelFixedHeadLevel(levelInterval, sheet, style, row, subjectMap, workId);
|
|
|
|
|
|
//绘制动态表头
|
|
|
Row dynamicHeadRow = sheet.createRow(1);
|