|
@@ -106,6 +106,9 @@ public class TRBasicInfoController {
|
|
|
@Resource
|
|
|
TCFinalScoreService tcFinalScoreService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ RedisUtil redisUtil;
|
|
|
+
|
|
|
@ApiOperation(value = "报告管理列表")
|
|
|
@RequestMapping(value = "/report/list", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "分页查询", response = ObeScoreResult.class)})
|
|
@@ -187,35 +190,53 @@ public class TRBasicInfoController {
|
|
|
@RequestMapping(value = "/report/again/calculate", method = RequestMethod.POST)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "查看报告", response = ReportResult.class)})
|
|
|
@Transactional
|
|
|
+ @Aac(rateLimit = @RateLimit(count = 1, period = 1000L))
|
|
|
public Result reportAgainCalculate(@ApiParam(value = "培养方案id", required = true) @RequestParam Long cultureProgramId,
|
|
|
@ApiParam(value = "课程id", required = true) @RequestParam Long courseId,
|
|
|
@ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber) {
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- ObeCourseOutline obeCourseOutline = obeCourseOutlineService.findByCultureProgramIdAndCourseId(cultureProgramId,
|
|
|
- courseId);
|
|
|
-
|
|
|
- ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId());
|
|
|
- log.info("ObeCourseWeightResult:{}", JacksonUtil.parseJson(obeCourseWeightResult));
|
|
|
- TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber);
|
|
|
- if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("未找到试卷蓝图信息");
|
|
|
+ String lockKey = SystemConstant.REDIS_COURSE_DEGREE_DATA_PREFIX + cultureProgramId + "_" + courseId;
|
|
|
+ boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_COURSE_DEGREE_DATA_TIME_OUT);
|
|
|
+ if (!lock) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("正在重新计算数据,请稍候再试!");
|
|
|
}
|
|
|
- MarkPaper markPaper = printCommonService.getMarkPaper(null, tcPaperStruct.getPaperNumber(), courseId);
|
|
|
+ TRBasicInfo trBasicInfoAgainCalculate = null;
|
|
|
+ try {
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ ObeCourseOutline obeCourseOutline = obeCourseOutlineService.findByCultureProgramIdAndCourseId(cultureProgramId,
|
|
|
+ courseId);
|
|
|
|
|
|
- TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(cultureProgramId, courseId, paperNumber);
|
|
|
- trBasicInfoService.clearReportData(cultureProgramId, courseId, paperNumber,
|
|
|
- Objects.nonNull(tcPaperStruct.getDimensionSign())
|
|
|
- && tcPaperStruct.getDimensionSign().longValue()
|
|
|
- != obeCourseWeightResult.getDimensionSign().longValue());
|
|
|
-
|
|
|
- TRBasicInfo trBasicInfoAgainCalculate = trBasicInfoService.getReportView(null, markPaper, sysUser.getId(),
|
|
|
- obeCourseWeightResult, cultureProgramId, courseId);
|
|
|
- if (Objects.nonNull(trBasicInfo)) {
|
|
|
- trBasicInfoAgainCalculate.setCalculate(trBasicInfo);
|
|
|
+ ObeCourseWeightResult obeCourseWeightResult = trBasicInfoService.findCourseWeightResultRmi(obeCourseOutline.getId());
|
|
|
+ log.info("ObeCourseWeightResult:{}", JacksonUtil.parseJson(obeCourseWeightResult));
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(cultureProgramId, courseId, paperNumber);
|
|
|
+ if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到试卷蓝图信息");
|
|
|
+ }
|
|
|
+ MarkPaper markPaper = printCommonService.getMarkPaper(null, tcPaperStruct.getPaperNumber(), courseId);
|
|
|
+
|
|
|
+ TRBasicInfo trBasicInfo = trBasicInfoService.queryBasicInfo(cultureProgramId, courseId, paperNumber);
|
|
|
+ trBasicInfoService.clearReportData(cultureProgramId, courseId, paperNumber,
|
|
|
+ Objects.nonNull(tcPaperStruct.getDimensionSign())
|
|
|
+ && tcPaperStruct.getDimensionSign().longValue()
|
|
|
+ != obeCourseWeightResult.getDimensionSign().longValue());
|
|
|
+
|
|
|
+ trBasicInfoAgainCalculate = trBasicInfoService.getReportView(null, markPaper, sysUser.getId(),
|
|
|
+ obeCourseWeightResult, cultureProgramId, courseId);
|
|
|
+ if (Objects.nonNull(trBasicInfo)) {
|
|
|
+ trBasicInfoAgainCalculate.setCalculate(trBasicInfo);
|
|
|
+ }
|
|
|
+ //课程目标达成评价明细结果-课程目标达成评价值图
|
|
|
+ trBasicInfoService.save(trBasicInfoAgainCalculate);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
+ if (e instanceof ApiException) {
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
+ } else {
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
+ }
|
|
|
+ } finally {
|
|
|
+ redisUtil.releaseLock(lockKey);
|
|
|
}
|
|
|
- //课程目标达成评价明细结果-课程目标达成评价值图
|
|
|
- trBasicInfoService.save(trBasicInfoAgainCalculate);
|
|
|
- return ResultUtil.ok(trBasicInfoAgainCalculate.getReportResult());
|
|
|
+ return ResultUtil.ok(Objects.nonNull(trBasicInfoAgainCalculate) ? trBasicInfoAgainCalculate.getReportResult() : trBasicInfoAgainCalculate);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "保存报告")
|