瀏覽代碼

新增同步题库试卷结构功能

wangliang 1 年之前
父節點
當前提交
87964eeba1

+ 8 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/TCFinalScoreController.java

@@ -115,6 +115,10 @@ public class TCFinalScoreController {
                                    @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
                                    @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber);
         printCommonService.getLock(examId, courseCode, paperNumber);
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber;
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber;
+        boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA_TIME_OUT);
+        if (!lock) {
+            throw ExceptionResultEnum.ERROR.exception("正在导入数据,请稍候再试!");
+        }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
             map = tcFinalScoreService.finalScoreExcelImport(file, examId, courseCode, paperNumber);
             map = tcFinalScoreService.finalScoreExcelImport(file, examId, courseCode, paperNumber);
@@ -140,6 +144,10 @@ public class TCFinalScoreController {
                                  @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
                                  @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber);
         printCommonService.getLock(examId, courseCode, paperNumber);
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.SYNC + examId + "_" + courseCode + "_" + paperNumber;
         String lockKey = SystemConstant.REDIS_FINAL_SCORE_DATA_FLOW_PREFIX + SystemConstant.SYNC + examId + "_" + courseCode + "_" + paperNumber;
+        boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_LOCK_IMPORT_EXAM_DATA_TIME_OUT);
+        if (!lock) {
+            throw ExceptionResultEnum.ERROR.exception("正在同步数据,请稍候再试!");
+        }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
             map = tcFinalScoreService.finalScoreSync(examId, courseCode, paperNumber);
             map = tcFinalScoreService.finalScoreSync(examId, courseCode, paperNumber);

+ 8 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/TCPaperStructController.java

@@ -81,6 +81,10 @@ public class TCPaperStructController {
                                               @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
                                               @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber);
         printCommonService.getLock(examId, courseCode, paperNumber);
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber;
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.IMPORT + examId + "_" + courseCode + "_" + paperNumber;
+        boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_PAPER_STRUCT_TIME_OUT);
+        if (!lock) {
+            throw ExceptionResultEnum.ERROR.exception("正在导入数据,请稍候再试!");
+        }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
             map = tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber);
             map = tcPaperStructService.paperStructExcelImport(file, examId, courseCode, paperNumber);
@@ -106,6 +110,10 @@ public class TCPaperStructController {
                                                      @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
                                                      @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
         printCommonService.getLock(examId, courseCode, paperNumber);
         printCommonService.getLock(examId, courseCode, paperNumber);
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.SYNC + examId + "_" + courseCode + "_" + paperNumber;
         String lockKey = SystemConstant.REDIS_PAPER_STRUCT_FLOW_PREFIX + SystemConstant.SYNC + examId + "_" + courseCode + "_" + paperNumber;
+        boolean lock = redisUtil.lock(lockKey, SystemConstant.REDIS_PAPER_STRUCT_TIME_OUT);
+        if (!lock) {
+            throw ExceptionResultEnum.ERROR.exception("正在同步数据,请稍候再试!");
+        }
         Map<String, String> map = null;
         Map<String, String> map = null;
         try {
         try {
             map = tcPaperStructService.paperStructSync(examId, courseCode, paperNumber);
             map = tcPaperStructService.paperStructSync(examId, courseCode, paperNumber);