|
@@ -0,0 +1,781 @@
|
|
|
|
+package cn.hmsoft.mr.control.imp;
|
|
|
|
+
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.OutputStream;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.net.URLEncoder;
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
|
+
|
|
|
|
+import org.apache.poi.hssf.util.HSSFColor.HSSFColorPredefined;
|
|
|
|
+import org.apache.poi.ss.usermodel.BorderStyle;
|
|
|
|
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
|
|
|
+import org.apache.poi.ss.usermodel.VerticalAlignment;
|
|
|
|
+import org.apache.poi.ss.util.CellRangeAddress;
|
|
|
|
+import org.apache.poi.ss.util.RegionUtil;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCell;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFFont;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+import cn.hmsoft.application.web.Ajax;
|
|
|
|
+import cn.hmsoft.frame.constants.FrameThreadCallbackType;
|
|
|
|
+import cn.hmsoft.frame.constants.FrameThreadStatus;
|
|
|
|
+import cn.hmsoft.frame.control.FrameControl;
|
|
|
|
+import cn.hmsoft.frame.data.model.FrameDept;
|
|
|
|
+import cn.hmsoft.frame.data.model.FrameOptr;
|
|
|
|
+import cn.hmsoft.frame.data.model.FrameThread;
|
|
|
|
+import cn.hmsoft.frame.exception.BusinessException;
|
|
|
|
+import cn.hmsoft.frame.thread.FrameThreadHelper;
|
|
|
|
+import cn.hmsoft.helper.JsonHelper;
|
|
|
|
+import cn.hmsoft.helper.StringHelper;
|
|
|
|
+import cn.hmsoft.helper.excel.ExcelReaderHelper;
|
|
|
|
+import cn.hmsoft.log.LogHelper;
|
|
|
|
+import cn.hmsoft.mr.constants.MRConst;
|
|
|
|
+import cn.hmsoft.mr.data.dao.imp.FinalScoreDao;
|
|
|
|
+import cn.hmsoft.mr.data.model.cf.CfSchool;
|
|
|
|
+import cn.hmsoft.mr.data.model.imp.FinalScore;
|
|
|
|
+import cn.hmsoft.mr.data.model.imp.FinalScoreVo;
|
|
|
|
+import cn.hmsoft.mr.service.imp.FinalScoreService;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 登分、最终成绩
|
|
|
|
+ * @author zq
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+@RestController
|
|
|
|
+public class FinalScoreControl extends FrameControl {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private FinalScoreService service;
|
|
|
|
+ @Autowired
|
|
|
|
+ private FinalScoreDao dao;
|
|
|
|
+
|
|
|
|
+ @RequestMapping("std/final/score/classroomlist.htm")
|
|
|
|
+ public Ajax listClassroom(Integer school_id, Integer batch_id, boolean is_admin) {
|
|
|
|
+ if (is_admin) {
|
|
|
|
+ return new Ajax(this.dao.listMapBySql("select distinct class_room from final_score where school_id=? and batch_id=?",
|
|
|
|
+ school_id, batch_id));
|
|
|
|
+ } else {
|
|
|
|
+ return new Ajax(this.dao.listMapBySql("select distinct class_room from final_score where school_id=? and batch_id=? and login_name=?",
|
|
|
|
+ school_id, batch_id, this.getFrameOptr().getLogin_name()));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //分组登分界面-按考场分组 默认排序
|
|
|
|
+ @RequestMapping("std/final/score/classroom/default/list.htm")
|
|
|
|
+ public Ajax list(Integer school_id, Integer batch_id, String class_room, boolean is_admin) {
|
|
|
|
+ return new Ajax(this.service.listByClassroom(false, school_id, batch_id, class_room, this.getFrameOptr(), is_admin));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //分组登分界面-按考场分组、分组、排名
|
|
|
|
+ @RequestMapping("std/final/score/classroom/level/list.htm")
|
|
|
|
+ public Ajax listByLevel(Integer school_id, Integer batch_id, String class_room, boolean is_admin) {
|
|
|
|
+ return new Ajax(this.service.listByClassroom(true, school_id, batch_id, class_room, this.getFrameOptr(), is_admin));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @CrossOrigin
|
|
|
|
+ @RequestMapping("std/final/score/upload.htm")
|
|
|
|
+ public Ajax upload(MultipartFile file, Integer school_id, Integer batch_id, String error_flag, String thread_flag) throws IOException {
|
|
|
|
+ final FrameOptr optr = this.getFrameOptr();
|
|
|
|
+ FrameDept org = this.dao.find(FrameDept.class, optr.getOptr_dept());
|
|
|
|
+ CfSchool school = this.dao.findBySql(CfSchool.class, "select * from cf_school where school_id=?", school_id);
|
|
|
|
+ if (!org.getDept_type().equals(MRConst.OrgType.School.toString()) ||
|
|
|
|
+ !org.getDept_code().equals(school.getSchool_code())) {
|
|
|
|
+ throw new BusinessException("只有当前学校招办老师才能上传!");
|
|
|
|
+ }
|
|
|
|
+ LogHelper.info("optr_dept-->" + this.getFrameOptr().getOptr_dept() + ",school_code--->" + org.getDept_code());
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
+ Map<String, List<List<String>>> dataMap = ExcelReaderHelper.readExcel(file.getOriginalFilename(), file.getInputStream(), 1, 20);
|
|
|
|
+ List<List<String>> scoreRegiList = dataMap.get("Sheet1");
|
|
|
|
+
|
|
|
|
+ FrameThread thread = FrameThreadHelper.createThread("登分导入线程", "数据需要进行处理", FrameThreadCallbackType.Swal,
|
|
|
|
+ "数据处理完成", optr);
|
|
|
|
+ try {
|
|
|
|
+ new Thread(() -> {
|
|
|
|
+ this.service.uploadProcess(thread, school_id, batch_id, error_flag, scoreRegiList, file, optr, school);
|
|
|
|
+ FrameThreadHelper.completeThread(thread, "导入完成!");
|
|
|
|
+ }).start();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ FrameThreadHelper.completeThread(thread, "出现错误:" + e.getMessage(), FrameThreadStatus.Error);
|
|
|
|
+ }
|
|
|
|
+ return new Ajax(thread);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //保存分数
|
|
|
|
+ @RequestMapping("std/final/score/save.htm")
|
|
|
|
+ public Ajax save(Integer school_id, Integer batch_id, String data_json) {
|
|
|
|
+ LogHelper.info("save final score ---->" + school_id + "," + batch_id);
|
|
|
|
+ FrameDept org = this.dao.find(FrameDept.class, this.getFrameOptr().getOptr_dept());
|
|
|
|
+ CfSchool school = this.dao.findBySql(CfSchool.class, "select * from cf_school where school_id=?", school_id);
|
|
|
|
+ if (!org.getDept_type().equals(MRConst.OrgType.School.toString()) ||
|
|
|
|
+ !org.getDept_code().equals(school.getSchool_code())) {
|
|
|
|
+ throw new BusinessException("只有当前学校招办老师才能保存!");
|
|
|
|
+ }
|
|
|
|
+ FinalScoreVo vo = JsonHelper.toObject(data_json, FinalScoreVo.class);
|
|
|
|
+ this.service.save(school_id, batch_id, vo, this.getFrameOptr());
|
|
|
|
+ //查询返回
|
|
|
|
+ //List<FinalScoreVo> retList = this.service.listByClassroom(school_id, batch_id, "");
|
|
|
|
+ return new Ajax();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //保存录取意见
|
|
|
|
+ @RequestMapping("std/final/score/remark/save.htm")
|
|
|
|
+ public Ajax saveRemark(Integer school_id, Integer batch_id, String data_json) {
|
|
|
|
+ LogHelper.info("save remark ---->" + school_id + "," + batch_id);
|
|
|
|
+ FrameDept org = this.dao.find(FrameDept.class, this.getFrameOptr().getOptr_dept());
|
|
|
|
+ CfSchool school = this.dao.findBySql(CfSchool.class, "select * from cf_school where school_id=?", school_id);
|
|
|
|
+ if (!org.getDept_type().equals(MRConst.OrgType.School.toString()) ||
|
|
|
|
+ !org.getDept_code().equals(school.getSchool_code())) {
|
|
|
|
+ throw new BusinessException("只有当前学校招办老师才能保存!");
|
|
|
|
+ }
|
|
|
|
+ FinalScoreVo vo = JsonHelper.toObject(data_json, FinalScoreVo.class);
|
|
|
|
+ this.service.saveRemark(school_id, batch_id, vo, this.getFrameOptr());
|
|
|
|
+ //查询返回
|
|
|
|
+ //List<FinalScoreVo> retList = this.service.listByClassroom(school_id, batch_id, "");
|
|
|
|
+ return new Ajax();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //删除上传
|
|
|
|
+ @RequestMapping("std/final/score/upload/delete.htm")
|
|
|
|
+ public Ajax deleteImp(Integer school_id, Integer batch_id) {
|
|
|
|
+ LogHelper.info("delete imp ---->" + school_id + "," + batch_id);
|
|
|
|
+ FrameDept org = this.dao.find(FrameDept.class, this.getFrameOptr().getOptr_dept());
|
|
|
|
+ CfSchool school = this.dao.findBySql(CfSchool.class, "select * from cf_school where school_id=?", school_id);
|
|
|
|
+ if (!org.getDept_type().equals(MRConst.OrgType.School.toString()) ||
|
|
|
|
+ !org.getDept_code().equals(school.getSchool_code())) {
|
|
|
|
+ throw new BusinessException("只有当前学校招办老师才能删除!");
|
|
|
|
+ }
|
|
|
|
+ this.service.delete(school_id, batch_id, this.getFrameOptr());
|
|
|
|
+ return new Ajax();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //导出复试成绩单
|
|
|
|
+ @RequestMapping("std/final/score/export.htm")
|
|
|
|
+ public void export(Integer school_id, Integer batch_id, String class_room) {
|
|
|
|
+ XSSFWorkbook wb = new XSSFWorkbook();
|
|
|
|
+ XSSFSheet sheet = wb.createSheet("2024年博士研究生复试成绩单");
|
|
|
|
+ // 1.生成字体对象-总标题
|
|
|
|
+ XSSFFont fontTitle1 = wb.createFont();
|
|
|
|
+ fontTitle1.setFontHeightInPoints((short) 20);
|
|
|
|
+ fontTitle1.setFontName("新宋体");
|
|
|
|
+ fontTitle1.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ fontTitle1.setBold(true);
|
|
|
|
+ XSSFCellStyle styleTitle1 = wb.createCellStyle();
|
|
|
|
+ styleTitle1.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle1.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle1.setFont(fontTitle1); // 调用字体样式对象
|
|
|
|
+ styleTitle1.setWrapText(false);
|
|
|
|
+ // 2.生成字体对象-表头
|
|
|
|
+ XSSFFont fontTitle2 = wb.createFont();
|
|
|
|
+ fontTitle2.setFontHeightInPoints((short) 11);
|
|
|
|
+ fontTitle2.setFontName("新宋体");
|
|
|
|
+ fontTitle2.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ fontTitle2.setBold(true);
|
|
|
|
+ XSSFCellStyle styleTitle2 = wb.createCellStyle();
|
|
|
|
+ styleTitle2.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle2.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle2.setFont(fontTitle2); // 调用字体样式对象
|
|
|
|
+ styleTitle2.setWrapText(false);
|
|
|
|
+ // 3.内容样式
|
|
|
|
+ XSSFFont fontTitle3 = wb.createFont();
|
|
|
|
+ fontTitle3.setFontHeightInPoints((short) 10);
|
|
|
|
+ fontTitle3.setFontName("新宋体");
|
|
|
|
+ fontTitle3.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ XSSFCellStyle styleTitle3 = wb.createCellStyle();
|
|
|
|
+ styleTitle3.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle3.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle3.setFont(fontTitle3); // 调用字体样式对象
|
|
|
|
+ styleTitle3.setWrapText(false);
|
|
|
|
+ // 4.签名
|
|
|
|
+ XSSFFont fontTitle4 = wb.createFont();
|
|
|
|
+ fontTitle4.setFontHeightInPoints((short) 12);
|
|
|
|
+ fontTitle4.setFontName("新宋体");
|
|
|
|
+ fontTitle4.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ XSSFCellStyle styleTitle4 = wb.createCellStyle();
|
|
|
|
+ styleTitle4.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ styleTitle4.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle4.setFont(fontTitle4); // 调用字体样式对象
|
|
|
|
+ styleTitle4.setWrapText(false);
|
|
|
|
+
|
|
|
|
+ // 增加表格边框的样式 例子
|
|
|
|
+ styleTitle1.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ styleTitle2.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ styleTitle3.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ int index = 0;
|
|
|
|
+ XSSFRow row1 = sheet.createRow(index);
|
|
|
|
+ row1.setHeight((short) 600);
|
|
|
|
+ XSSFCell cellTitle = row1.createCell(0);
|
|
|
|
+ cellTitle.setCellStyle(styleTitle1);
|
|
|
|
+ cellTitle.setCellValue("2024年博士研究生复试成绩单");
|
|
|
|
+ CellRangeAddress range1 = new CellRangeAddress(index, index, 0, 13);
|
|
|
|
+ sheet.addMergedRegion(range1);
|
|
|
|
+ RegionUtil.setBorderBottom(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderRight(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderLeft(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderTop(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ index++;
|
|
|
|
+
|
|
|
|
+ sheet.setColumnWidth(0, 3 * 256);//序
|
|
|
|
+ sheet.setColumnWidth(1, 8 * 256);//姓名
|
|
|
|
+ sheet.setColumnWidth(2, 14 * 256);//准考证编号
|
|
|
|
+ sheet.setColumnWidth(3, 14 * 256);//专业
|
|
|
|
+ sheet.setColumnWidth(4, 10 * 256);//专业综合面试
|
|
|
|
+ sheet.setColumnWidth(5, 10 * 256);//专业综合面试90%
|
|
|
|
+ sheet.setColumnWidth(6, 10 * 256);//外语面试10%
|
|
|
|
+ sheet.setColumnWidth(7, 10 * 256);//复试面试成绩
|
|
|
|
+ sheet.setColumnWidth(8, 10 * 256);//初试总成绩
|
|
|
|
+ sheet.setColumnWidth(9, 12 * 256);//初试成绩权重比
|
|
|
|
+ sheet.setColumnWidth(10, 8 * 256);//总成绩
|
|
|
|
+ sheet.setColumnWidth(11, 6 * 256);//成绩排名
|
|
|
|
+ sheet.setColumnWidth(12, 8 * 256);//导师
|
|
|
|
+ sheet.setColumnWidth(13, 10 * 256);//拟录取意见
|
|
|
|
+
|
|
|
|
+ XSSFRow rowTitle = sheet.createRow(index);
|
|
|
|
+ XSSFCell cell0 = rowTitle.createCell(0);
|
|
|
|
+ cell0.setCellStyle(styleTitle2);
|
|
|
|
+ cell0.setCellValue("序");
|
|
|
|
+ XSSFCell cell1 = rowTitle.createCell(1);
|
|
|
|
+ cell1.setCellStyle(styleTitle2);
|
|
|
|
+ cell1.setCellValue("姓名");
|
|
|
|
+ XSSFCell cell2 = rowTitle.createCell(2);
|
|
|
|
+ cell2.setCellStyle(styleTitle2);
|
|
|
|
+ cell2.setCellValue("准考证编号");
|
|
|
|
+ XSSFCell cell3 = rowTitle.createCell(3);
|
|
|
|
+ cell3.setCellStyle(styleTitle2);
|
|
|
|
+ cell3.setCellValue("专业");
|
|
|
|
+ XSSFCell cell4 = rowTitle.createCell(4);
|
|
|
|
+ cell4.setCellStyle(styleTitle2);
|
|
|
|
+ cell4.setCellValue("专业\r\n综合面试");
|
|
|
|
+ cell4.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell5 = rowTitle.createCell(5);
|
|
|
|
+ cell5.setCellStyle(styleTitle2);
|
|
|
|
+ cell5.setCellValue("专业\r\n综合面试\n90%");
|
|
|
|
+ cell5.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell6 = rowTitle.createCell(6);
|
|
|
|
+ cell6.setCellStyle(styleTitle2);
|
|
|
|
+ cell6.setCellValue("外语\r\n面试10%");
|
|
|
|
+ cell6.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell7 = rowTitle.createCell(7);
|
|
|
|
+ cell7.setCellStyle(styleTitle2);
|
|
|
|
+ cell7.setCellValue("复试\r\n总成绩");
|
|
|
|
+ cell7.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell8 = rowTitle.createCell(8);
|
|
|
|
+ cell8.setCellStyle(styleTitle2);
|
|
|
|
+ cell8.setCellValue("初试\r\n总分");
|
|
|
|
+ cell8.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell9 = rowTitle.createCell(9);
|
|
|
|
+ cell9.setCellStyle(styleTitle2);
|
|
|
|
+ cell9.setCellValue("初试总成绩\r\n(权重)");
|
|
|
|
+ cell9.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell10 = rowTitle.createCell(10);
|
|
|
|
+ cell10.setCellStyle(styleTitle2);
|
|
|
|
+ cell10.setCellValue("总成绩");
|
|
|
|
+ XSSFCell cell11 = rowTitle.createCell(11);
|
|
|
|
+ cell11.setCellStyle(styleTitle2);
|
|
|
|
+ cell11.setCellValue("成绩\r\n排名");
|
|
|
|
+ cell11.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell12 = rowTitle.createCell(12);
|
|
|
|
+ cell12.setCellStyle(styleTitle2);
|
|
|
|
+ cell12.setCellValue("导师");
|
|
|
|
+ XSSFCell cell13 = rowTitle.createCell(13);
|
|
|
|
+ cell13.setCellStyle(styleTitle2);
|
|
|
|
+ cell13.setCellValue("拟录取\r\n意见");
|
|
|
|
+ cell13.getCellStyle().setWrapText(true);
|
|
|
|
+ index++;
|
|
|
|
+
|
|
|
|
+ String groupNameStr = "";
|
|
|
|
+ List<FinalScoreVo> classRoomList = this.service.listByClassroom(true, school_id, batch_id, class_room, this.getFrameOptr(), true);
|
|
|
|
+ for (FinalScoreVo room : classRoomList) {
|
|
|
|
+ for (List<FinalScore> gList : room.getGroup_list()) {
|
|
|
|
+ //显示每个考场的分组名
|
|
|
|
+ XSSFRow groupNameRow = sheet.createRow(index);
|
|
|
|
+ XSSFCell gCell = groupNameRow.createCell(0);//序
|
|
|
|
+ gCell.setCellStyle(styleTitle3);
|
|
|
|
+ gCell.setCellValue(gList.get(0).getGroup_name());
|
|
|
|
+ groupNameStr = groupNameStr + gList.get(0).getGroup_name() + "、";
|
|
|
|
+ //显示分组最终成绩明显
|
|
|
|
+ for (int i=0; i<gList.size(); i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ XSSFRow rows = sheet.createRow(index);
|
|
|
|
+ rows.setHeight((short) 500);
|
|
|
|
+ XSSFCell tCell0 = rows.createCell(0);//分组名
|
|
|
|
+ tCell0.setCellStyle(styleTitle2);
|
|
|
|
+ tCell0.setCellValue(gList.get(i).getGroup_name());
|
|
|
|
+ CellRangeAddress rangeGn = new CellRangeAddress(index, index, 0, 13);
|
|
|
|
+ sheet.addMergedRegion(rangeGn);
|
|
|
|
+ RegionUtil.setBorderBottom(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderRight(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderLeft(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderTop(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ index ++;
|
|
|
|
+ }
|
|
|
|
+ FinalScore score = gList.get(i);
|
|
|
|
+ XSSFRow rows = sheet.createRow(index);
|
|
|
|
+ rows.setHeight((short) 350);
|
|
|
|
+ XSSFCell tCell0 = rows.createCell(0);//序
|
|
|
|
+ tCell0.setCellStyle(styleTitle3);
|
|
|
|
+ tCell0.setCellValue(score.getScore_seq() != null ? score.getScore_seq().toString() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell1 = rows.createCell(1);//姓名
|
|
|
|
+ tCell1.setCellStyle(styleTitle3);
|
|
|
|
+ tCell1.setCellValue(score.getStd_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell2 = rows.createCell(2);//准考证编号
|
|
|
|
+ tCell2.setCellStyle(styleTitle3);
|
|
|
|
+ tCell2.setCellValue(score.getTicket_no());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell3 = rows.createCell(3);//专业
|
|
|
|
+ tCell3.setCellStyle(styleTitle3);
|
|
|
|
+ tCell3.setCellValue(score.getGroup_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell4 = rows.createCell(4);//专业\n综合面试
|
|
|
|
+ tCell4.setCellStyle(styleTitle3);
|
|
|
|
+ tCell4.setCellValue(score.getFinal_score());
|
|
|
|
+
|
|
|
|
+ String final_score_weight = StringHelper.isNotEmpty(score.getFinal_score_weight()) ? score.getFinal_score_weight() : "0";
|
|
|
|
+ XSSFCell tCell5 = rows.createCell(5);//专业\n综合面试\n90%
|
|
|
|
+ tCell5.setCellStyle(styleTitle3);
|
|
|
|
+ tCell5.setCellValue(final_score_weight);
|
|
|
|
+
|
|
|
|
+ String foreign_score = StringHelper.isNotEmpty(score.getForeign_score()) ? score.getForeign_score() : "0";
|
|
|
|
+ XSSFCell tCell6 = rows.createCell(6);//外语\n面试10%
|
|
|
|
+ tCell6.setCellStyle(styleTitle3);
|
|
|
|
+ tCell6.setCellValue(foreign_score);
|
|
|
|
+
|
|
|
|
+ BigDecimal faceTotalScore = new BigDecimal(final_score_weight).add(new BigDecimal(foreign_score));
|
|
|
|
+ XSSFCell tCell7 = rows.createCell(7);//复试\n面试成绩
|
|
|
|
+ tCell7.setCellStyle(styleTitle3);
|
|
|
|
+ tCell7.setCellValue(faceTotalScore.toPlainString());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell8 = rows.createCell(8);//初试总成绩
|
|
|
|
+ tCell8.setCellStyle(styleTitle3);
|
|
|
|
+ tCell8.setCellValue(StringHelper.isNotEmpty(score.getFirst_score()) ? score.getFirst_score() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell9 = rows.createCell(9);//初试成绩\n权重比
|
|
|
|
+ tCell9.setCellStyle(styleTitle3);
|
|
|
|
+ tCell9.setCellValue(StringHelper.isNotEmpty(score.getFirst_score_weight()) ? score.getFirst_score_weight() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell10 = rows.createCell(10);//总成绩
|
|
|
|
+ tCell10.setCellStyle(styleTitle3);
|
|
|
|
+ tCell10.setCellValue(StringHelper.isNotEmpty(score.getTotal_score()) ? score.getTotal_score() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell11 = rows.createCell(11);//成绩\n排名
|
|
|
|
+ tCell11.setCellStyle(styleTitle3);
|
|
|
|
+ tCell11.setCellValue(score.getScore_level() != null ? score.getScore_level().toString() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell12 = rows.createCell(12);//导师
|
|
|
|
+ tCell12.setCellStyle(styleTitle3);
|
|
|
|
+ tCell12.setCellValue(score.getDoct_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell13 = rows.createCell(13);//拟录取意见
|
|
|
|
+ tCell13.setCellStyle(styleTitle3);
|
|
|
|
+ tCell13.setCellValue(score.getAdmiss_remark());
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //签字栏
|
|
|
|
+ index += 2;
|
|
|
|
+ XSSFRow signRow = sheet.createRow(index);
|
|
|
|
+ XSSFCell sginCell = signRow.createCell(0);
|
|
|
|
+ sginCell.setCellStyle(styleTitle4);
|
|
|
|
+ sginCell.setCellValue("复试导师组签字: ");
|
|
|
|
+ CellRangeAddress rangeSign = new CellRangeAddress(index, index, 0, 3);
|
|
|
|
+ sheet.addMergedRegion(rangeSign);
|
|
|
|
+ //输出
|
|
|
|
+ ServletOutputStream outStream = null;
|
|
|
|
+ if (groupNameStr.length() > 0) {
|
|
|
|
+ groupNameStr = groupNameStr.substring(0, groupNameStr.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ String fileName = groupNameStr + ".xlsx";
|
|
|
|
+ fileName = URLEncoder.encode(fileName, "UTF-8");
|
|
|
|
+ fileName = new String(fileName.getBytes(), "ISO-8859-1");
|
|
|
|
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
|
+ wb.write(os);
|
|
|
|
+ this.getResponse().reset();
|
|
|
|
+ this.getResponse().setContentType("application/x-msdownload");
|
|
|
|
+ this.getResponse().setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
|
|
|
+ outStream = this.getResponse().getOutputStream();
|
|
|
|
+ outStream.write(os.toByteArray());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ if (outStream != null) {
|
|
|
|
+ try {
|
|
|
|
+ outStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (wb != null) {
|
|
|
|
+ try {
|
|
|
|
+ wb.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void main(String[] args) {
|
|
|
|
+ XSSFWorkbook wb = new XSSFWorkbook();
|
|
|
|
+ XSSFSheet sheet = wb.createSheet("2024年博士研究生复试成绩单");
|
|
|
|
+ // 1.生成字体对象-总标题
|
|
|
|
+ XSSFFont fontTitle1 = wb.createFont();
|
|
|
|
+ fontTitle1.setFontHeightInPoints((short) 20);
|
|
|
|
+ fontTitle1.setFontName("新宋体");
|
|
|
|
+ fontTitle1.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ fontTitle1.setBold(true);
|
|
|
|
+ XSSFCellStyle styleTitle1 = wb.createCellStyle();
|
|
|
|
+ styleTitle1.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle1.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle1.setFont(fontTitle1); // 调用字体样式对象
|
|
|
|
+ styleTitle1.setWrapText(false);
|
|
|
|
+ // 2.生成字体对象-表头
|
|
|
|
+ XSSFFont fontTitle2 = wb.createFont();
|
|
|
|
+ fontTitle2.setFontHeightInPoints((short) 11);
|
|
|
|
+ fontTitle2.setFontName("新宋体");
|
|
|
|
+ fontTitle2.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ fontTitle2.setBold(true);
|
|
|
|
+ XSSFCellStyle styleTitle2 = wb.createCellStyle();
|
|
|
|
+ styleTitle2.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle2.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle2.setFont(fontTitle2); // 调用字体样式对象
|
|
|
|
+ styleTitle2.setWrapText(false);
|
|
|
|
+ // 3.内容样式
|
|
|
|
+ XSSFFont fontTitle3 = wb.createFont();
|
|
|
|
+ fontTitle3.setFontHeightInPoints((short) 10);
|
|
|
|
+ fontTitle3.setFontName("新宋体");
|
|
|
|
+ fontTitle3.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ XSSFCellStyle styleTitle3 = wb.createCellStyle();
|
|
|
|
+ styleTitle3.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ styleTitle3.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle3.setFont(fontTitle3); // 调用字体样式对象
|
|
|
|
+ styleTitle3.setWrapText(false);
|
|
|
|
+ // 4.签名
|
|
|
|
+ XSSFFont fontTitle4 = wb.createFont();
|
|
|
|
+ fontTitle4.setFontHeightInPoints((short) 12);
|
|
|
|
+ fontTitle4.setFontName("新宋体");
|
|
|
|
+ fontTitle4.setColor(HSSFColorPredefined.BLACK.getIndex());
|
|
|
|
+ XSSFCellStyle styleTitle4 = wb.createCellStyle();
|
|
|
|
+ styleTitle4.setAlignment(HorizontalAlignment.LEFT);
|
|
|
|
+ styleTitle4.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
|
|
+ styleTitle4.setFont(fontTitle4); // 调用字体样式对象
|
|
|
|
+ styleTitle4.setWrapText(false);
|
|
|
|
+
|
|
|
|
+ // 增加表格边框的样式 例子
|
|
|
|
+ styleTitle1.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle1.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ styleTitle2.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle2.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ styleTitle3.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderLeft(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderTop(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderBottom(BorderStyle.THIN);
|
|
|
|
+ styleTitle3.setBorderRight(BorderStyle.THIN);
|
|
|
|
+
|
|
|
|
+ int index = 0;
|
|
|
|
+ XSSFRow row1 = sheet.createRow(index);
|
|
|
|
+ row1.setHeight((short) 600);
|
|
|
|
+ XSSFCell cellTitle = row1.createCell(0);
|
|
|
|
+ cellTitle.setCellStyle(styleTitle1);
|
|
|
|
+ cellTitle.setCellValue("2024年博士研究生复试成绩单");
|
|
|
|
+ CellRangeAddress range1 = new CellRangeAddress(index, index, 0, 13);
|
|
|
|
+ sheet.addMergedRegion(range1);
|
|
|
|
+ RegionUtil.setBorderBottom(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderRight(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderLeft(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ RegionUtil.setBorderTop(BorderStyle.THIN, range1, sheet);
|
|
|
|
+ index++;
|
|
|
|
+
|
|
|
|
+ sheet.setColumnWidth(0, 3 * 256);//序
|
|
|
|
+ sheet.setColumnWidth(1, 8 * 256);//姓名
|
|
|
|
+ sheet.setColumnWidth(2, 14 * 256);//准考证编号
|
|
|
|
+ sheet.setColumnWidth(3, 14 * 256);//专业
|
|
|
|
+ sheet.setColumnWidth(4, 10 * 256);//专业综合面试
|
|
|
|
+ sheet.setColumnWidth(5, 10 * 256);//专业综合面试90%
|
|
|
|
+ sheet.setColumnWidth(6, 10 * 256);//外语面试10%
|
|
|
|
+ sheet.setColumnWidth(7, 10 * 256);//复试面试成绩
|
|
|
|
+ sheet.setColumnWidth(8, 10 * 256);//初试总成绩
|
|
|
|
+ sheet.setColumnWidth(9, 12 * 256);//初试成绩权重比
|
|
|
|
+ sheet.setColumnWidth(10, 8 * 256);//总成绩
|
|
|
|
+ sheet.setColumnWidth(11, 6 * 256);//成绩排名
|
|
|
|
+ sheet.setColumnWidth(12, 8 * 256);//导师
|
|
|
|
+ sheet.setColumnWidth(13, 10 * 256);//拟录取意见
|
|
|
|
+
|
|
|
|
+ XSSFRow rowTitle = sheet.createRow(index);
|
|
|
|
+ XSSFCell cell0 = rowTitle.createCell(0);
|
|
|
|
+ cell0.setCellStyle(styleTitle2);
|
|
|
|
+ cell0.setCellValue("序");
|
|
|
|
+ XSSFCell cell1 = rowTitle.createCell(1);
|
|
|
|
+ cell1.setCellStyle(styleTitle2);
|
|
|
|
+ cell1.setCellValue("姓名");
|
|
|
|
+ XSSFCell cell2 = rowTitle.createCell(2);
|
|
|
|
+ cell2.setCellStyle(styleTitle2);
|
|
|
|
+ cell2.setCellValue("准考证编号");
|
|
|
|
+ XSSFCell cell3 = rowTitle.createCell(3);
|
|
|
|
+ cell3.setCellStyle(styleTitle2);
|
|
|
|
+ cell3.setCellValue("专业");
|
|
|
|
+ XSSFCell cell4 = rowTitle.createCell(4);
|
|
|
|
+ cell4.setCellStyle(styleTitle2);
|
|
|
|
+ cell4.setCellValue("专业\r\n综合面试");
|
|
|
|
+ cell4.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell5 = rowTitle.createCell(5);
|
|
|
|
+ cell5.setCellStyle(styleTitle2);
|
|
|
|
+ cell5.setCellValue("专业\r\n综合面试\n90%");
|
|
|
|
+ cell5.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell6 = rowTitle.createCell(6);
|
|
|
|
+ cell6.setCellStyle(styleTitle2);
|
|
|
|
+ cell6.setCellValue("外语\r\n面试10%");
|
|
|
|
+ cell6.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell7 = rowTitle.createCell(7);
|
|
|
|
+ cell7.setCellStyle(styleTitle2);
|
|
|
|
+ cell7.setCellValue("复试\r\n总成绩");
|
|
|
|
+ cell7.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell8 = rowTitle.createCell(8);
|
|
|
|
+ cell8.setCellStyle(styleTitle2);
|
|
|
|
+ cell8.setCellValue("初试\r\n总分");
|
|
|
|
+ cell8.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell9 = rowTitle.createCell(9);
|
|
|
|
+ cell9.setCellStyle(styleTitle2);
|
|
|
|
+ cell9.setCellValue("初试总成绩\r\n(权重)");
|
|
|
|
+ cell9.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell10 = rowTitle.createCell(10);
|
|
|
|
+ cell10.setCellStyle(styleTitle2);
|
|
|
|
+ cell10.setCellValue("总成绩");
|
|
|
|
+ XSSFCell cell11 = rowTitle.createCell(11);
|
|
|
|
+ cell11.setCellStyle(styleTitle2);
|
|
|
|
+ cell11.setCellValue("成绩\r\n排名");
|
|
|
|
+ cell11.getCellStyle().setWrapText(true);
|
|
|
|
+ XSSFCell cell12 = rowTitle.createCell(12);
|
|
|
|
+ cell12.setCellStyle(styleTitle2);
|
|
|
|
+ cell12.setCellValue("导师");
|
|
|
|
+ XSSFCell cell13 = rowTitle.createCell(13);
|
|
|
|
+ cell13.setCellStyle(styleTitle2);
|
|
|
|
+ cell13.setCellValue("拟录取\r\n意见");
|
|
|
|
+ cell13.getCellStyle().setWrapText(true);
|
|
|
|
+ index++;
|
|
|
|
+
|
|
|
|
+ String groupNameStr = "";
|
|
|
|
+ List<FinalScoreVo> classRoomList = new ArrayList<FinalScoreVo>();
|
|
|
|
+ FinalScoreVo vo1 = new FinalScoreVo();
|
|
|
|
+ List<List<FinalScore>> group_list1 = new ArrayList<List<FinalScore>>();
|
|
|
|
+ vo1.setClass_room("考场1111");
|
|
|
|
+ vo1.setGroup_list(group_list1);
|
|
|
|
+ List<FinalScore> dyList = new ArrayList<FinalScore>();//电影
|
|
|
|
+ FinalScore dyScore1 = new FinalScore();
|
|
|
|
+ dyScore1.setClass_room("考场1111");dyScore1.setScore_seq(1);dyScore1.setStd_name("张超杰");dyScore1.setFirst_score("240");dyScore1.setFinal_score_weight("80.00");
|
|
|
|
+ dyScore1.setTicket_no("842013130300251");dyScore1.setGroup_name("电影学");dyScore1.setScore_level(1);dyScore1.setDoct_name("丁亚平");
|
|
|
|
+ FinalScore dyScore2 = new FinalScore();
|
|
|
|
+ dyScore2.setClass_room("考场1111");dyScore2.setScore_seq(2);dyScore2.setStd_name("贾艺华");dyScore2.setFirst_score("234");dyScore2.setFinal_score_weight("78.00");
|
|
|
|
+ dyScore2.setTicket_no("842013130300254");dyScore2.setGroup_name("电影学");dyScore2.setScore_level(1);dyScore2.setDoct_name("丁亚平");
|
|
|
|
+ FinalScore dyScore3 = new FinalScore();
|
|
|
|
+ dyScore3.setClass_room("考场1111");dyScore3.setScore_seq(3);dyScore3.setStd_name("崔明明");dyScore3.setFirst_score("232");dyScore3.setFinal_score_weight("77.00");
|
|
|
|
+ dyScore3.setTicket_no("842013130300259");dyScore3.setGroup_name("电影学");dyScore3.setScore_level(1);dyScore3.setDoct_name("高小健");
|
|
|
|
+ dyList.add(dyScore1);dyList.add(dyScore2);dyList.add(dyScore3);
|
|
|
|
+
|
|
|
|
+ List<FinalScore> syList = new ArrayList<FinalScore>();//摄影
|
|
|
|
+ FinalScore syScore1 = new FinalScore();
|
|
|
|
+ syScore1.setClass_room("考场1111");syScore1.setScore_seq(1);syScore1.setStd_name("沈孝怡");syScore1.setFirst_score("229");syScore1.setFinal_score_weight("76.00");
|
|
|
|
+ syScore1.setTicket_no("842013130300251");syScore1.setGroup_name("摄影学");syScore1.setScore_level(1);syScore1.setDoct_name("李树峰");
|
|
|
|
+ FinalScore syScore2 = new FinalScore();
|
|
|
|
+ syScore2.setClass_room("考场1111");syScore2.setScore_seq(2);syScore2.setStd_name("李静怡");syScore2.setFirst_score("226");syScore2.setFinal_score_weight("75.00");
|
|
|
|
+ syScore2.setTicket_no("842013130300254");syScore2.setGroup_name("摄影学");syScore2.setScore_level(1);syScore2.setDoct_name("李树峰");
|
|
|
|
+ FinalScore syScore3 = new FinalScore();
|
|
|
|
+ syScore3.setClass_room("考场1111");syScore3.setScore_seq(3);syScore3.setStd_name("田相洁");syScore3.setFirst_score("234");syScore3.setFinal_score_weight("78.00");
|
|
|
|
+ syScore3.setTicket_no("842013130300259");syScore3.setGroup_name("摄影学");syScore3.setScore_level(1);syScore3.setDoct_name("李树峰");
|
|
|
|
+ syList.add(syScore1);syList.add(syScore2);syList.add(syScore3);
|
|
|
|
+
|
|
|
|
+ group_list1.add(dyList);
|
|
|
|
+ group_list1.add(syList);
|
|
|
|
+
|
|
|
|
+ FinalScoreVo vo2 = new FinalScoreVo();
|
|
|
|
+ List<List<FinalScore>> group_list2 = new ArrayList<List<FinalScore>>();
|
|
|
|
+ vo2.setClass_room("考场2222");
|
|
|
|
+ vo2.setGroup_list(group_list2);
|
|
|
|
+
|
|
|
|
+ List<FinalScore> gbdsList = new ArrayList<FinalScore>();//广播电视艺术学
|
|
|
|
+ FinalScore gbdsScore1 = new FinalScore();
|
|
|
|
+ gbdsScore1.setClass_room("考场1111");gbdsScore1.setScore_seq(1);gbdsScore1.setStd_name("张超杰");gbdsScore1.setFirst_score("240");gbdsScore1.setFinal_score_weight("80.00");
|
|
|
|
+ gbdsScore1.setTicket_no("842013130300251");gbdsScore1.setGroup_name("广播电视艺术学");gbdsScore1.setScore_level(1);gbdsScore1.setDoct_name("丁亚平");
|
|
|
|
+ FinalScore gbdsScore2 = new FinalScore();
|
|
|
|
+ gbdsScore2.setClass_room("考场1111");gbdsScore2.setScore_seq(2);gbdsScore2.setStd_name("贾艺华");gbdsScore2.setFirst_score("234");gbdsScore2.setFinal_score_weight("78.00");
|
|
|
|
+ gbdsScore2.setTicket_no("842013130300254");gbdsScore2.setGroup_name("广播电视艺术学");gbdsScore2.setScore_level(1);gbdsScore2.setDoct_name("丁亚平");
|
|
|
|
+ FinalScore gbdsScore3 = new FinalScore();
|
|
|
|
+ gbdsScore3.setClass_room("考场1111");gbdsScore3.setScore_seq(3);gbdsScore3.setStd_name("崔明明");gbdsScore3.setFirst_score("232");gbdsScore3.setFinal_score_weight("77.00");
|
|
|
|
+ gbdsScore3.setTicket_no("842013130300259");gbdsScore3.setGroup_name("广播电视艺术学");gbdsScore3.setScore_level(1);gbdsScore3.setDoct_name("高小健");
|
|
|
|
+ gbdsList.add(gbdsScore1);gbdsList.add(gbdsScore2);gbdsList.add(gbdsScore3);
|
|
|
|
+
|
|
|
|
+ group_list2.add(gbdsList);
|
|
|
|
+
|
|
|
|
+ classRoomList.add(vo1);
|
|
|
|
+ classRoomList.add(vo2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (FinalScoreVo room : classRoomList) {
|
|
|
|
+ for (List<FinalScore> gList : room.getGroup_list()) {
|
|
|
|
+ //显示每个考场的分组名
|
|
|
|
+ XSSFRow groupNameRow = sheet.createRow(index);
|
|
|
|
+ XSSFCell gCell = groupNameRow.createCell(0);//序
|
|
|
|
+ gCell.setCellStyle(styleTitle3);
|
|
|
|
+ gCell.setCellValue(gList.get(0).getGroup_name());
|
|
|
|
+ groupNameStr = groupNameStr + gList.get(0).getGroup_name() + "、";
|
|
|
|
+ //显示分组最终成绩明显
|
|
|
|
+ for (int i=0; i<gList.size(); i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ XSSFRow rows = sheet.createRow(index);
|
|
|
|
+ rows.setHeight((short) 500);
|
|
|
|
+ XSSFCell tCell0 = rows.createCell(0);//分组名
|
|
|
|
+ tCell0.setCellStyle(styleTitle2);
|
|
|
|
+ tCell0.setCellValue(gList.get(i).getGroup_name());
|
|
|
|
+ CellRangeAddress rangeGn = new CellRangeAddress(index, index, 0, 13);
|
|
|
|
+ sheet.addMergedRegion(rangeGn);
|
|
|
|
+ RegionUtil.setBorderBottom(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderRight(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderLeft(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ RegionUtil.setBorderTop(BorderStyle.THIN, rangeGn, sheet);
|
|
|
|
+ index ++;
|
|
|
|
+ }
|
|
|
|
+ FinalScore score = gList.get(i);
|
|
|
|
+ XSSFRow rows = sheet.createRow(index);
|
|
|
|
+ rows.setHeight((short) 350);
|
|
|
|
+ XSSFCell tCell0 = rows.createCell(0);//序
|
|
|
|
+ tCell0.setCellStyle(styleTitle3);
|
|
|
|
+ tCell0.setCellValue(score.getScore_seq() != null ? score.getScore_seq().toString() : "");
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell1 = rows.createCell(1);//姓名
|
|
|
|
+ tCell1.setCellStyle(styleTitle3);
|
|
|
|
+ tCell1.setCellValue(score.getStd_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell2 = rows.createCell(2);//准考证编号
|
|
|
|
+ tCell2.setCellStyle(styleTitle3);
|
|
|
|
+ tCell2.setCellValue(score.getTicket_no());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell3 = rows.createCell(3);//专业
|
|
|
|
+ tCell3.setCellStyle(styleTitle3);
|
|
|
|
+ tCell3.setCellValue(score.getGroup_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell4 = rows.createCell(4);//专业\n综合面试
|
|
|
|
+ tCell4.setCellStyle(styleTitle3);
|
|
|
|
+ tCell4.setCellValue(score.getFinal_score());
|
|
|
|
+
|
|
|
|
+ String final_score_weight = StringHelper.isNotEmpty(score.getFinal_score_weight()) ? score.getFinal_score_weight() : "0";
|
|
|
|
+ XSSFCell tCell5 = rows.createCell(5);//专业\n综合面试\n90%
|
|
|
|
+ tCell5.setCellStyle(styleTitle3);
|
|
|
|
+ tCell5.setCellValue(final_score_weight);
|
|
|
|
+
|
|
|
|
+ String foreign_score = StringHelper.isNotEmpty(score.getForeign_score()) ? score.getForeign_score() : "0";
|
|
|
|
+ XSSFCell tCell6 = rows.createCell(6);//外语\n面试10%
|
|
|
|
+ tCell6.setCellStyle(styleTitle3);
|
|
|
|
+ tCell6.setCellValue(foreign_score);
|
|
|
|
+
|
|
|
|
+ BigDecimal faceTotalScore = new BigDecimal(final_score_weight).add(new BigDecimal(foreign_score));
|
|
|
|
+ XSSFCell tCell7 = rows.createCell(7);//复试\n面试成绩
|
|
|
|
+ tCell7.setCellStyle(styleTitle3);
|
|
|
|
+ tCell7.setCellValue(faceTotalScore.toPlainString());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell8 = rows.createCell(8);//初试总成绩
|
|
|
|
+ tCell8.setCellStyle(styleTitle3);
|
|
|
|
+ tCell8.setCellValue(score.getFinal_score());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell9 = rows.createCell(9);//初试成绩\n权重比
|
|
|
|
+ tCell9.setCellStyle(styleTitle3);
|
|
|
|
+ tCell9.setCellValue(score.getFinal_score_weight());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell10 = rows.createCell(10);//总成绩
|
|
|
|
+ tCell10.setCellStyle(styleTitle3);
|
|
|
|
+ tCell10.setCellValue(score.getTotal_score());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell11 = rows.createCell(11);//成绩\n排名
|
|
|
|
+ tCell11.setCellStyle(styleTitle3);
|
|
|
|
+ tCell11.setCellValue(score.getScore_level());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell12 = rows.createCell(12);//导师
|
|
|
|
+ tCell12.setCellStyle(styleTitle3);
|
|
|
|
+ tCell12.setCellValue(score.getDoct_name());
|
|
|
|
+
|
|
|
|
+ XSSFCell tCell13 = rows.createCell(13);//拟录取意见
|
|
|
|
+ tCell13.setCellStyle(styleTitle3);
|
|
|
|
+ tCell13.setCellValue(score.getAdmiss_remark());
|
|
|
|
+ index++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //签字栏
|
|
|
|
+ index += 2;
|
|
|
|
+ XSSFRow signRow = sheet.createRow(index);
|
|
|
|
+ XSSFCell sginCell = signRow.createCell(0);
|
|
|
|
+ sginCell.setCellStyle(styleTitle4);
|
|
|
|
+ sginCell.setCellValue("复试导师组签字: ");
|
|
|
|
+ CellRangeAddress rangeSign = new CellRangeAddress(index, index, 0, 3);
|
|
|
|
+ sheet.addMergedRegion(rangeSign);
|
|
|
|
+ //输出
|
|
|
|
+ if (groupNameStr.length() > 0) {
|
|
|
|
+ groupNameStr = groupNameStr.substring(0, groupNameStr.length() - 1);
|
|
|
|
+ }
|
|
|
|
+ OutputStream outStream = null;
|
|
|
|
+ try {
|
|
|
|
+ String fileName = groupNameStr + ".xlsx";
|
|
|
|
+ fileName = URLEncoder.encode(fileName, "UTF-8");
|
|
|
|
+ fileName = new String(fileName.getBytes(), "ISO-8859-1");
|
|
|
|
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
|
|
|
|
+ wb.write(os);
|
|
|
|
+ outStream = new FileOutputStream("C:\\Users\\admin\\Desktop\\t.xlsx");
|
|
|
|
+ outStream.write(os.toByteArray());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ if (outStream != null) {
|
|
|
|
+ try {
|
|
|
|
+ outStream.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (wb != null) {
|
|
|
|
+ try {
|
|
|
|
+ wb.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|