|
@@ -33,6 +33,7 @@ import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
import com.qmth.teachcloud.common.entity.SysConfig;
|
|
import com.qmth.teachcloud.common.entity.SysConfig;
|
|
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.FieldUniqueEnum;
|
|
import com.qmth.teachcloud.common.enums.ImportTemplateEnum;
|
|
import com.qmth.teachcloud.common.enums.ImportTemplateEnum;
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
@@ -42,6 +43,9 @@ import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -70,6 +74,7 @@ import java.util.stream.Collectors;
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
|
|
public class TRBasicInfoController {
|
|
public class TRBasicInfoController {
|
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(TRBasicInfoController.class);
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
PrintCommonService printCommonService;
|
|
PrintCommonService printCommonService;
|
|
@@ -113,7 +118,7 @@ public class TRBasicInfoController {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) {
|
|
MarkPaper markPaper = printCommonService.getMarkPaper(examId, paperNumber);
|
|
MarkPaper markPaper = printCommonService.getMarkPaper(examId, paperNumber);
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
- TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
|
|
|
+ TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
|
|
|
CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
@@ -169,13 +174,27 @@ public class TRBasicInfoController {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
- TRBasicInfo trBasicInfoDb = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, trBasicInfo.getExamId()).eq(TRBasicInfo::getCourseCode, trBasicInfo.getCourseCode()).eq(TRBasicInfo::getPaperNumber, trBasicInfo.getPaperNumber()));
|
|
|
|
- if (Objects.isNull(trBasicInfoDb)) {
|
|
|
|
- trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
|
|
|
|
- MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
|
|
|
|
- trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId(), trBasicInfoService.findCourseWeightResultRmi(trBasicInfo.getExamId(), trBasicInfo.getCourseCode()));
|
|
|
|
- } else {
|
|
|
|
- trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
|
|
|
|
|
|
+ TRBasicInfo trBasicInfoDb = null;
|
|
|
|
+ try {
|
|
|
|
+ trBasicInfoDb = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(trBasicInfo.getExamId(), trBasicInfo.getCourseCode(), trBasicInfo.getPaperNumber());
|
|
|
|
+ if (Objects.isNull(trBasicInfoDb)) {
|
|
|
|
+ trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
|
|
|
|
+ MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
|
|
|
|
+ trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId(), trBasicInfoService.findCourseWeightResultRmi(trBasicInfo.getExamId(), trBasicInfo.getCourseCode()));
|
|
|
|
+ } else {
|
|
|
|
+ trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
|
+ if (e instanceof DuplicateKeyException) {
|
|
|
|
+ String errorColumn = e.getCause().toString();
|
|
|
|
+ String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
|
+ throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
|
|
|
|
+ } else if (e instanceof ApiException) {
|
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
|
+ } else {
|
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return ResultUtil.ok(trBasicInfoService.saveOrUpdate(trBasicInfoDb));
|
|
return ResultUtil.ok(trBasicInfoService.saveOrUpdate(trBasicInfoDb));
|
|
}
|
|
}
|
|
@@ -193,7 +212,7 @@ public class TRBasicInfoController {
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
|
|
|
|
- TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
|
|
|
+ TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
Objects.requireNonNull(trBasicInfo, "没有报告信息");
|
|
Objects.requireNonNull(trBasicInfo, "没有报告信息");
|
|
Objects.requireNonNull(trBasicInfo.getCourseEvaluationResult(), "没有课程目标信息");
|
|
Objects.requireNonNull(trBasicInfo.getCourseEvaluationResult(), "没有课程目标信息");
|
|
Objects.requireNonNull(trBasicInfo.getCourseEvaluationResultDetail(), "没有课程考生信息");
|
|
Objects.requireNonNull(trBasicInfo.getCourseEvaluationResultDetail(), "没有课程考生信息");
|
|
@@ -299,7 +318,7 @@ public class TRBasicInfoController {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
|
|
@ApiParam(value = "true:报告,false:成绩管理", required = true) @RequestParam boolean report) throws IOException {
|
|
@ApiParam(value = "true:报告,false:成绩管理", required = true) @RequestParam boolean report) throws IOException {
|
|
ReportChangeResult reportChangeResult = new ReportChangeResult();
|
|
ReportChangeResult reportChangeResult = new ReportChangeResult();
|
|
- List<TCUsualScore> tcUsualScoreList = tcUsualScoreService.list(new QueryWrapper<TCUsualScore>().lambda().eq(TCUsualScore::getExamId, examId).eq(TCUsualScore::getCourseCode, courseCode).eq(TCUsualScore::getPaperNumber, paperNumber));
|
|
|
|
|
|
+ List<TCUsualScore> tcUsualScoreList = tcUsualScoreService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
if (CollectionUtils.isNotEmpty(tcUsualScoreList)) {
|
|
if (CollectionUtils.isNotEmpty(tcUsualScoreList)) {
|
|
Set<String> usualScoreCourseSet = new LinkedHashSet<>();
|
|
Set<String> usualScoreCourseSet = new LinkedHashSet<>();
|
|
TCUsualScore tcUsualScore = tcUsualScoreList.get(0);
|
|
TCUsualScore tcUsualScore = tcUsualScoreList.get(0);
|
|
@@ -329,7 +348,7 @@ public class TRBasicInfoController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
|
|
|
+ TRBasicInfo trBasicInfo = trBasicInfoService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
if (Objects.nonNull(trBasicInfo) && Objects.nonNull(trBasicInfo.getCourseEvaluationResultDetail())) {
|
|
if (Objects.nonNull(trBasicInfo) && Objects.nonNull(trBasicInfo.getCourseEvaluationResultDetail())) {
|
|
JSONObject jsonObject = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResultDetail());
|
|
JSONObject jsonObject = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResultDetail());
|
|
List<CourseTargetWordDto> courseTargetWordDtoList = JSONArray.parseArray(jsonObject.get("targetWordMap").toString(), CourseTargetWordDto.class);
|
|
List<CourseTargetWordDto> courseTargetWordDtoList = JSONArray.parseArray(jsonObject.get("targetWordMap").toString(), CourseTargetWordDto.class);
|