|
@@ -11,10 +11,7 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
|
|
import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
|
|
-import com.qmth.teachcloud.common.util.GsonUtil;
|
|
|
|
-import com.qmth.teachcloud.common.util.Result;
|
|
|
|
-import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
|
-import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
|
|
|
+import com.qmth.teachcloud.common.util.*;
|
|
import com.qmth.teachcloud.obe.been.dto.CourseWeightDetailDto;
|
|
import com.qmth.teachcloud.obe.been.dto.CourseWeightDetailDto;
|
|
import com.qmth.teachcloud.obe.been.dto.CourseWeightDto;
|
|
import com.qmth.teachcloud.obe.been.dto.CourseWeightDto;
|
|
import com.qmth.teachcloud.obe.been.dto.TCUsualScoreDto;
|
|
import com.qmth.teachcloud.obe.been.dto.TCUsualScoreDto;
|
|
@@ -89,39 +86,35 @@ public class TCUsualScoreController {
|
|
@ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
|
|
public void usualScoreTemplateDownload(@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
public void usualScoreTemplateDownload(@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
@ApiParam(value = "课程id", required = true) @RequestParam Long courseId) throws IOException {
|
|
@ApiParam(value = "课程id", required = true) @RequestParam Long courseId) throws IOException {
|
|
- ObeCourseOutline obeCourseOutline = obeCourseOutlineService.findByCultureProgramIdAndCourseId(
|
|
|
|
- cultureProgramId, courseId);
|
|
|
|
-
|
|
|
|
- ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId(), true);
|
|
|
|
- List<CourseWeightDto> courseWeightDtoList = obeCourseWeightResult.getSubmitForm();
|
|
|
|
-
|
|
|
|
List<ExcelField> excelFieldList = new ArrayList<>();
|
|
List<ExcelField> excelFieldList = new ArrayList<>();
|
|
excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true))));
|
|
excelFieldList.addAll(new ArrayList<>(Arrays.asList(new ExcelField("studentCode", "学号", true), new ExcelField("name", "姓名", true))));
|
|
- courseWeightDtoList.stream().peek(e -> {
|
|
|
|
- List<CourseWeightDetailDto> courseWeightDetailDtoList = e.getEvaluationList();
|
|
|
|
- courseWeightDetailDtoList.stream().peek(s -> {
|
|
|
|
- if (Objects.nonNull(s.getEnable()) && s.getEnable() && !Objects.equals(s.getEvaluationName(),
|
|
|
|
- SystemConstant.FINAL_SCORE_STR)) {
|
|
|
|
- excelFieldList.add(new ExcelField(s.getEvaluationName(), s.getEvaluationName(), true));
|
|
|
|
- }
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- }).collect(Collectors.toList());
|
|
|
|
- if (excelFieldList.size() == 2) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未设置评价方式,请在课程考核设置先设置评价方式再下载平时成绩导入模版");
|
|
|
|
- }
|
|
|
|
|
|
+ excelFieldList = this.getUsualScoreList(cultureProgramId, courseId, excelFieldList);
|
|
printCommonService.scoreDownLoadExaminationTemplate(
|
|
printCommonService.scoreDownLoadExaminationTemplate(
|
|
"1、所有字段均为必填字段;\n" + "2、平时成绩各项数据均需要填写;\n" + "3、请不要删除此行,也不要删除模板中的任何列。\n" + "4、使用前请先删除样例数据。", "sheet1",
|
|
"1、所有字段均为必填字段;\n" + "2、平时成绩各项数据均需要填写;\n" + "3、请不要删除此行,也不要删除模板中的任何列。\n" + "4、使用前请先删除样例数据。", "sheet1",
|
|
"平时成绩导入模版", excelFieldList);
|
|
"平时成绩导入模版", excelFieldList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "导入平时成绩-获取作业集合")
|
|
|
|
+ @RequestMapping(value = "/usual_score/template_download/list", method = RequestMethod.POST)
|
|
|
|
+ @OperationLogDetail(operationType = OperationTypeEnum.SELECT)
|
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "作业集合信息", response = Object.class)})
|
|
|
|
+ public Result usualScoreTemplateDownloadList(@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
|
|
+ @ApiParam(value = "课程id", required = true) @RequestParam Long courseId) {
|
|
|
|
+ List<ExcelField> excelFieldList = new ArrayList<>();
|
|
|
|
+ excelFieldList = this.getUsualScoreList(cultureProgramId, courseId, excelFieldList);
|
|
|
|
+ excelFieldList.stream().peek(s -> s.setNull()).collect(Collectors.toList());
|
|
|
|
+ return ResultUtil.ok(JacksonUtil.parseJson(excelFieldList));
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value = "导入平时成绩")
|
|
@ApiOperation(value = "导入平时成绩")
|
|
@RequestMapping(value = "/usual_score/import", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/usual_score/import", method = RequestMethod.POST)
|
|
@OperationLogDetail(operationType = OperationTypeEnum.IMPORT)
|
|
@OperationLogDetail(operationType = OperationTypeEnum.IMPORT)
|
|
@ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "导入成功", response = EditResult.class)})
|
|
public Result usualScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
public Result usualScoreImport(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,
|
|
@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
- @ApiParam(value = "课程id", required = true) @RequestParam Long courseId) throws IOException {
|
|
|
|
- return ResultUtil.ok(tcUsualScoreService.usualScoreExcelImport(file, cultureProgramId, courseId));
|
|
|
|
|
|
+ @ApiParam(value = "课程id", required = true) @RequestParam Long courseId,
|
|
|
|
+ @ApiParam(value = "作业分数集合") @RequestParam(required = false) String usualScoreList) throws IOException {
|
|
|
|
+ return ResultUtil.ok(tcUsualScoreService.usualScoreExcelImport(file, cultureProgramId, courseId, usualScoreList));
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "平时成绩列表")
|
|
@ApiOperation(value = "平时成绩列表")
|
|
@@ -202,4 +195,33 @@ public class TCUsualScoreController {
|
|
}
|
|
}
|
|
return ResultUtil.ok(true);
|
|
return ResultUtil.ok(true);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取平时作业集合
|
|
|
|
+ *
|
|
|
|
+ * @param cultureProgramId
|
|
|
|
+ * @param courseId
|
|
|
|
+ * @param excelFieldList
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ protected List<ExcelField> getUsualScoreList(Long cultureProgramId, Long courseId, List<ExcelField> excelFieldList) {
|
|
|
|
+ ObeCourseOutline obeCourseOutline = obeCourseOutlineService.findByCultureProgramIdAndCourseId(
|
|
|
|
+ cultureProgramId, courseId);
|
|
|
|
+ ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId(), true);
|
|
|
|
+ List<CourseWeightDto> courseWeightDtoList = obeCourseWeightResult.getSubmitForm();
|
|
|
|
+
|
|
|
|
+ courseWeightDtoList.stream().peek(e -> {
|
|
|
|
+ List<CourseWeightDetailDto> courseWeightDetailDtoList = e.getEvaluationList();
|
|
|
|
+ courseWeightDetailDtoList.stream().peek(s -> {
|
|
|
|
+ if (Objects.nonNull(s.getEnable()) && s.getEnable() && !Objects.equals(s.getEvaluationName(),
|
|
|
|
+ SystemConstant.FINAL_SCORE_STR)) {
|
|
|
|
+ excelFieldList.add(new ExcelField(s.getEvaluationName(), s.getEvaluationName(), true));
|
|
|
|
+ }
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+ if (excelFieldList.size() == 2) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未设置评价方式,请在课程考核设置先设置评价方式再下载平时成绩导入模版");
|
|
|
|
+ }
|
|
|
|
+ return excelFieldList;
|
|
|
|
+ }
|
|
}
|
|
}
|