|
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.distributed.print.business.bean.dto.ExaminationImportDto;
|
|
|
import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
@@ -41,6 +42,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
import org.springframework.web.util.WebUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.crypto.ExemptionMechanism;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
@@ -100,6 +102,8 @@ public class BasicDatasourceController {
|
|
|
private SysRoleService sysRoleService;
|
|
|
@Resource
|
|
|
private AnalyzeForReportService analyzeForReportService;
|
|
|
+ @Resource
|
|
|
+ private TBExaminationService tbExaminationService;
|
|
|
|
|
|
@ApiOperation(value = "试卷数据导入")
|
|
|
@RequestMapping(value = "/paper/import", method = RequestMethod.POST)
|
|
@@ -834,6 +838,87 @@ public class BasicDatasourceController {
|
|
|
return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "创建课程")
|
|
|
+ @RequestMapping(value = "/course/create", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ public Result courseCreate(@RequestParam Long schoolId, @RequestParam String examId, @RequestParam String courseCode,@RequestParam String courseName) {
|
|
|
+ basicCourseService.createCourse(schoolId,courseCode,courseName);
|
|
|
+ tbExamCourseService.createCourse(schoolId,SystemConstant.convertIdToLong(examId),courseCode,courseName);
|
|
|
+
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "考务数据同步")
|
|
|
+ @RequestMapping(value = "/examination/sync", method = RequestMethod.POST)
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
|
|
|
+ public Result examinationSync(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file,@RequestParam Long schoolId, @RequestParam String examId) throws IOException, NoSuchFieldException {
|
|
|
+ if (Objects.isNull(file)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("附件不存在");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(schoolId) || schoolId == 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("参数缺失");
|
|
|
+ }
|
|
|
+ List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(file.getInputStream(), Lists.newArrayList(ExaminationDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
+ if (finalExcelErrorList.size() > 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(finalExcelErrorList));
|
|
|
+ }
|
|
|
+ return finalExcelList;
|
|
|
+ });
|
|
|
+
|
|
|
+ List<TBExamination> tbExaminationList = new ArrayList<>();
|
|
|
+ if (Objects.nonNull(finalList) && finalList.size() > 0) {
|
|
|
+ for (int i = 0; i < finalList.size(); i++) {
|
|
|
+ LinkedMultiValueMap<Integer, Object> map = finalList.get(i);
|
|
|
+ List<Object> examinationList = map.get(i);
|
|
|
+ for (int y = 0; y < Objects.requireNonNull(examinationList).size(); y++) {
|
|
|
+ if (examinationList.get(y) instanceof ExaminationDto) {
|
|
|
+ // excel 数据解析
|
|
|
+ ExaminationDto examinationDto = (ExaminationDto) examinationList.get(y);
|
|
|
+ String courseHeaderCode = examinationDto.getCourseHeaderCode();
|
|
|
+ String courseExaminationCode = examinationDto.getCourseExaminationCode();
|
|
|
+ String courseName = examinationDto.getCourseName();
|
|
|
+ String teacherCode = examinationDto.getTeacherCode();
|
|
|
+ String teacherName = examinationDto.getTeacherName();
|
|
|
+ String teachCollegeName = examinationDto.getTeachCollegeName();
|
|
|
+ String credit = examinationDto.getCredit();
|
|
|
+ String studentCode = examinationDto.getStudentCode();
|
|
|
+ String studentName = examinationDto.getStudentName();
|
|
|
+ String inspectCollegeName = examinationDto.getInspectCollegeName();
|
|
|
+ String major = examinationDto.getMajor();
|
|
|
+ String studyType = examinationDto.getStudyType();
|
|
|
+ String grade = examinationDto.getGrade();
|
|
|
+ // 数据组装
|
|
|
+ TBExamination tbExamination = new TBExamination();
|
|
|
+ tbExamination.setId(SystemConstant.getDbUuid());
|
|
|
+ tbExamination.setSchoolId(schoolId);
|
|
|
+ tbExamination.setExamId(SystemConstant.convertIdToLong(examId));
|
|
|
+ tbExamination.setCourseHeaderCode(courseHeaderCode);
|
|
|
+ tbExamination.setExaminationCourseCode(courseExaminationCode);
|
|
|
+ tbExamination.setCourseName(courseName);
|
|
|
+ tbExamination.setTeacherCode(teacherCode);
|
|
|
+ tbExamination.setTeacherName(teacherName);
|
|
|
+ tbExamination.setTeachCollegeName(teachCollegeName);
|
|
|
+ tbExamination.setCredit(credit);
|
|
|
+ tbExamination.setStudentCode(studentCode);
|
|
|
+ tbExamination.setStudentName(studentName);
|
|
|
+ tbExamination.setInspectCollegeName(inspectCollegeName);
|
|
|
+ tbExamination.setMajor(major);
|
|
|
+ tbExamination.setStudyType(studyType);
|
|
|
+ tbExamination.setGrade(grade);
|
|
|
+ tbExaminationList.add(tbExamination);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tbExaminationService.remove(new QueryWrapper<TBExamination>().lambda().eq(TBExamination::getExamId,examId));
|
|
|
+ tbExaminationService.saveBatch(tbExaminationList);
|
|
|
+ return ResultUtil.ok(Collections.singletonMap(SystemConstant.SUCCESS, true));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 更新或新增专业信息
|
|
|
*
|