|
@@ -7,6 +7,7 @@ import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
+import cn.com.qmth.mps.enums.ArbitrateMethod;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
import org.apache.poi.ss.usermodel.CellStyle;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
import org.apache.poi.ss.usermodel.CellType;
|
|
@@ -96,22 +97,22 @@ public class PaperController extends BaseController {
|
|
@PostMapping("export-subjective")
|
|
@PostMapping("export-subjective")
|
|
public void exportSubjective(PaperQuery query, HttpServletResponse response) throws IOException {
|
|
public void exportSubjective(PaperQuery query, HttpServletResponse response) throws IOException {
|
|
String fileName = URLEncoder.encode("主观题", "UTF-8");
|
|
String fileName = URLEncoder.encode("主观题", "UTF-8");
|
|
- response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
|
|
- response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
|
+ response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
|
|
- List<PaperStructInfoVo> list = paperService.subjectiveList(query,getAccessUser());
|
|
|
|
- Workbook wb=null;
|
|
|
|
- OutputStream out=null;
|
|
|
|
- try {
|
|
|
|
|
|
+ List<PaperStructInfoVo> list = paperService.subjectiveList(query, getAccessUser());
|
|
|
|
+ Workbook wb = null;
|
|
|
|
+ OutputStream out = null;
|
|
|
|
+ try {
|
|
wb = new XSSFWorkbook(ResouceUtil.getStream("importtemplates/structImport.xlsx"));
|
|
wb = new XSSFWorkbook(ResouceUtil.getStream("importtemplates/structImport.xlsx"));
|
|
- if(CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
CellStyle style = wb.createCellStyle();
|
|
CellStyle style = wb.createCellStyle();
|
|
style.setAlignment(HorizontalAlignment.CENTER);
|
|
style.setAlignment(HorizontalAlignment.CENTER);
|
|
- Sheet sheet=wb.getSheetAt(0);
|
|
|
|
- int rowIndex=1;
|
|
|
|
- for(PaperStructInfoVo vo:list) {
|
|
|
|
|
|
+ Sheet sheet = wb.getSheetAt(0);
|
|
|
|
+ int rowIndex = 1;
|
|
|
|
+ for (PaperStructInfoVo vo : list) {
|
|
rowIndex++;
|
|
rowIndex++;
|
|
- Row row=sheet.createRow(rowIndex);
|
|
|
|
|
|
+ Row row = sheet.createRow(rowIndex);
|
|
row.createCell(0, CellType.STRING).setCellValue(getStringVal(vo.getCourseCode()));
|
|
row.createCell(0, CellType.STRING).setCellValue(getStringVal(vo.getCourseCode()));
|
|
row.createCell(1, CellType.STRING).setCellValue(getStringVal(vo.getCourseName()));
|
|
row.createCell(1, CellType.STRING).setCellValue(getStringVal(vo.getCourseName()));
|
|
row.createCell(2, CellType.STRING).setCellValue(getStringVal(vo.getDetailName()));
|
|
row.createCell(2, CellType.STRING).setCellValue(getStringVal(vo.getDetailName()));
|
|
@@ -121,18 +122,29 @@ public class PaperController extends BaseController {
|
|
row.createCell(6, CellType.STRING).setCellValue(getStringVal(vo.getScore()));
|
|
row.createCell(6, CellType.STRING).setCellValue(getStringVal(vo.getScore()));
|
|
row.createCell(7, CellType.STRING).setCellValue(getStringVal(vo.getScoreStep()));
|
|
row.createCell(7, CellType.STRING).setCellValue(getStringVal(vo.getScoreStep()));
|
|
row.createCell(8, CellType.STRING).setCellValue(getStringVal(vo.getGroupNumber()));
|
|
row.createCell(8, CellType.STRING).setCellValue(getStringVal(vo.getGroupNumber()));
|
|
- for(int i=0;i<9;i++) {
|
|
|
|
|
|
+ row.createCell(9, CellType.STRING).setCellValue("");
|
|
|
|
+ ArbitrateMethod arbitrateMethod = vo.getArbitrateMethod();
|
|
|
|
+ String arbitrateMethodStr = "";
|
|
|
|
+ if (arbitrateMethod != null) {
|
|
|
|
+ arbitrateMethodStr = getStringVal(arbitrateMethod.getValue());
|
|
|
|
+ }
|
|
|
|
+ row.createCell(10, CellType.STRING).setCellValue(arbitrateMethodStr);
|
|
|
|
+ row.createCell(11, CellType.STRING).setCellValue(getStringVal(vo.getDoubleRate()));
|
|
|
|
+ row.createCell(12, CellType.STRING).setCellValue(getStringVal(vo.getArbitrateThreshold()));
|
|
|
|
+ row.createCell(13, CellType.STRING).setCellValue("1");
|
|
|
|
+ row.createCell(14, CellType.STRING).setCellValue("track");
|
|
|
|
+ for (int i = 0; i < 15; i++) {
|
|
row.getCell(i).setCellStyle(style);
|
|
row.getCell(i).setCellStyle(style);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- out=response.getOutputStream();
|
|
|
|
|
|
+ out = response.getOutputStream();
|
|
wb.write(out);
|
|
wb.write(out);
|
|
} finally {
|
|
} finally {
|
|
- if(wb!=null) {
|
|
|
|
|
|
+ if (wb != null) {
|
|
wb.close();
|
|
wb.close();
|
|
}
|
|
}
|
|
- if(out!=null) {
|
|
|
|
|
|
+ if (out != null) {
|
|
out.close();
|
|
out.close();
|
|
}
|
|
}
|
|
}
|
|
}
|