소스 검색

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof 4 년 전
부모
커밋
20a1d6087d

+ 4 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/cache/CreatePdfCacheUtil.java

@@ -20,4 +20,8 @@ public class CreatePdfCacheUtil {
     public static String getPaperType(String key) {
         return (String) redisUtil.get(RedisKeyHelper.paperTypeKey(key));
     }
+
+    public static void deletePaperType(String key) {
+        redisUtil.delete(RedisKeyHelper.paperTypeKey(key));
+    }
 }

+ 20 - 15
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -390,7 +390,26 @@ public class CreatePdfUtil {
                 + "_" + examDetail.getExamPlace()
                 + "_" + examDetailCourse.getCourseCode()
                 + "_" + examDetailCourse.getPaperNumber();
+
+        //抽取卷型
+        DrawRuleEnum drawRule = Objects.nonNull(examPrintPlan.getDrawRule()) ? examPrintPlan.getDrawRule() : DrawRuleEnum.ONE;
+        //未曝光卷型
+        String unexposedPaperType = examTaskDetail.getUnexposedPaperType();
+        //已曝光卷型
+        String exposedPaperType = examTaskDetail.getExposedPaperType();
+        if (drawRule == DrawRuleEnum.ONE) {
+            if (Objects.isNull(unexposedPaperType)) {
+                CreatePdfCacheUtil.deletePaperType(key);
+                throw ExceptionResultEnum.ERROR.exception("当前没有未曝光的卷型");
+            }
+        } else {
+            if (Objects.isNull(exposedPaperType) && Objects.isNull(unexposedPaperType)) {
+                CreatePdfCacheUtil.deletePaperType(key);
+                throw ExceptionResultEnum.ERROR.exception("当前没有未曝光的卷型");
+            }
+        }
         String paperType = null;
+        String[] paperTypes = null;
         boolean lock = true;
         for (int i = 0; i < SystemConstant.MAX_RETRY_COUNT; i++) {
             lock = redisUtil.lock(key, SystemConstant.REDIS_CACHE_TIME_OUT);
@@ -398,23 +417,9 @@ public class CreatePdfUtil {
                 try {
                     paperType = CreatePdfCacheUtil.getPaperType(key);
                     if (Objects.isNull(paperType)) {
-                        //抽取卷型
-                        DrawRuleEnum drawRule = Objects.nonNull(examPrintPlan.getDrawRule()) ? examPrintPlan.getDrawRule() : DrawRuleEnum.ONE;
-                        //未曝光卷型
-                        String unexposedPaperType = examTaskDetail.getUnexposedPaperType();
-                        //已曝光卷型
-                        String exposedPaperType = examTaskDetail.getExposedPaperType();
-                        String[] paperTypes = null;
                         if (drawRule == DrawRuleEnum.ONE) {
-                            if (Objects.isNull(unexposedPaperType)) {
-                                throw ExceptionResultEnum.ERROR.exception("当前没有未曝光的卷型");
-                            } else {
-                                paperTypes = unexposedPaperType.split(",");
-                            }
+                            paperTypes = unexposedPaperType.split(",");
                         } else {
-                            if (Objects.isNull(exposedPaperType) && Objects.isNull(unexposedPaperType)) {
-                                throw ExceptionResultEnum.ERROR.exception("当前没有未曝光的卷型");
-                            }
                             if (Objects.nonNull(unexposedPaperType)) {
                                 paperTypes = unexposedPaperType.split(",");
                             } else {