|
@@ -2,6 +2,7 @@ package com.qmth.distributed.print.api;
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
|
+import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
|
|
import com.qmth.distributed.print.business.bean.dto.CourseWeightDto;
|
|
import com.qmth.distributed.print.business.bean.excel.PaperStructDto;
|
|
import com.qmth.distributed.print.business.bean.excel.PaperStructDto;
|
|
import com.qmth.distributed.print.business.bean.params.report.PaperStructParams;
|
|
import com.qmth.distributed.print.business.bean.params.report.PaperStructParams;
|
|
@@ -38,6 +39,7 @@ import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -55,9 +57,6 @@ import java.util.stream.Collectors;
|
|
public class TCPaperStructController {
|
|
public class TCPaperStructController {
|
|
private final static Logger log = LoggerFactory.getLogger(TCPaperStructController.class);
|
|
private final static Logger log = LoggerFactory.getLogger(TCPaperStructController.class);
|
|
|
|
|
|
- @Resource
|
|
|
|
- TCFinalScoreService tcFinalScoreService;
|
|
|
|
-
|
|
|
|
@Resource
|
|
@Resource
|
|
MarkQuestionService markQuestionService;
|
|
MarkQuestionService markQuestionService;
|
|
|
|
|
|
@@ -70,6 +69,9 @@ public class TCPaperStructController {
|
|
@Resource
|
|
@Resource
|
|
PrintCommonService printCommonService;
|
|
PrintCommonService printCommonService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ RedisUtil redisUtil;
|
|
|
|
+
|
|
@ApiOperation(value = "导入试卷结构")
|
|
@ApiOperation(value = "导入试卷结构")
|
|
@RequestMapping(value = "/final_score/paper_struct/import", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/final_score/paper_struct/import", method = RequestMethod.POST)
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.IMPORT)
|
|
@@ -78,8 +80,22 @@ public class TCPaperStructController {
|
|
@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
- tcFinalScoreService.getFinalScoreSyncLock(examId, courseCode, paperNumber);
|
|
|
|
- return ResultUtil.ok(tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber));
|
|
|
|
|
|
+ printCommonService.getLock(examId, courseCode, paperNumber);
|
|
|
|
+ String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber;
|
|
|
|
+ Map<String, String> map = null;
|
|
|
|
+ try {
|
|
|
|
+ map = tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber);
|
|
|
|
+ } 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);
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(map);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "同步试卷蓝图结构")
|
|
@ApiOperation(value = "同步试卷蓝图结构")
|
|
@@ -89,8 +105,22 @@ public class TCPaperStructController {
|
|
public Result finalScorePaperStructDimensionSync(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
public Result finalScorePaperStructDimensionSync(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
- tcFinalScoreService.getFinalScoreSyncLock(examId, courseCode, paperNumber);
|
|
|
|
- return ResultUtil.ok();
|
|
|
|
|
|
+ printCommonService.getLock(examId, courseCode, paperNumber);
|
|
|
|
+ String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.SYNC + examId + "_" + courseCode + "_" + paperNumber;
|
|
|
|
+ Map<String, String> map = null;
|
|
|
|
+ try {
|
|
|
|
+// map = tcFinalScoreService.finalScoreExcelSync(examId, courseCode, paperNumber);
|
|
|
|
+ } 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);
|
|
|
|
+ }
|
|
|
|
+ return ResultUtil.ok(map);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "期末成绩试卷蓝图保存")
|
|
@ApiOperation(value = "期末成绩试卷蓝图保存")
|
|
@@ -102,7 +132,7 @@ public class TCPaperStructController {
|
|
if (bindingResult.hasErrors()) {
|
|
if (bindingResult.hasErrors()) {
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
}
|
|
}
|
|
- tcFinalScoreService.getFinalScoreSyncLock(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
|
|
|
+ printCommonService.getLock(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(paperStructParams.getExamId(), paperStructParams.getCourseCode());
|
|
CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(paperStructParams.getExamId(), paperStructParams.getCourseCode());
|
|
for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
|
|
for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
|
|
for (PaperStructDimensionResult paperStructDimensionResult : paperStructParams.getPaperStruct()) {
|
|
for (PaperStructDimensionResult paperStructDimensionResult : paperStructParams.getPaperStruct()) {
|
|
@@ -151,7 +181,7 @@ public class TCPaperStructController {
|
|
public Result finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
public Result finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
- tcFinalScoreService.getFinalScoreSyncLock(examId, courseCode, paperNumber);
|
|
|
|
|
|
+ printCommonService.getLock(examId, courseCode, paperNumber);
|
|
List<PaperStructDimensionResult> paperStructDimensionResultList = null;
|
|
List<PaperStructDimensionResult> paperStructDimensionResultList = null;
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
|
|
if (Objects.isNull(tcPaperStruct) || Objects.isNull(tcPaperStruct.getPaperStruct())) {
|