Ver Fonte

merge from release_v4.1.3

deason há 2 anos atrás
pai
commit
f4a2b87fe9

+ 26 - 0
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/DevOpsController.java

@@ -0,0 +1,26 @@
+package cn.com.qmth.examcloud.core.questions.api.controller;
+
+import cn.com.qmth.examcloud.web.support.Naked;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Api(tags = "运维接口")
+@RestController
+@RequestMapping("${api_cqb}")
+public class DevOpsController {
+
+    private static final Logger log = LoggerFactory.getLogger(DevOpsController.class);
+
+    @Naked
+    @ApiOperation(value = "运维监控检测接口")
+    @GetMapping("/devops")
+    public Long devops() {
+        return System.currentTimeMillis();
+    }
+
+}

+ 1 - 1
examcloud-core-questions-base/pom.xml

@@ -60,7 +60,7 @@
         </dependency>
         <dependency>
             <groupId>cn.com.qmth.examcloud.rpc</groupId>
-            <artifactId>examcloud-core-questions-api-client</artifactId>
+            <artifactId>examcloud-core-questions-api</artifactId>
             <version>${project.version}</version>
         </dependency>
         <dependency>

+ 16 - 1
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/word/DocxProcessUtil.java

@@ -152,7 +152,7 @@ public final class DocxProcessUtil {
     public static boolean isText(P p) {
         List<Object> mathList = getAllElementFromObject(p, CTOMath.class);
         List<Object> mathParaList = getAllElementFromObject(p, CTOMathPara.class);
-        List<Object> drawList = getAllElementFromObject(p, Drawing.class);
+        List<Object> drawList = getAllImageElementFromObject(p);
         if (mathParaList.size() > 0 || mathList.size() > 0 || drawList.size() > 0) {
             return false;
         } else {
@@ -378,6 +378,21 @@ public final class DocxProcessUtil {
         }
         return result;
     }
+    public static List<Object> getAllImageElementFromObject(Object obj) {
+
+        List<Object> result = new ArrayList<>();
+        if (obj instanceof JAXBElement)
+            obj = ((JAXBElement<?>) obj).getValue();
+        if (obj.getClass().equals(Drawing.class)||obj.getClass().equals(Pict.class))
+            result.add(obj);
+        else if (obj instanceof ContentAccessor) {
+            List<?> children = ((ContentAccessor) obj).getContent();
+            for (Object child : children) {
+                result.addAll(getAllImageElementFromObject(child));
+            }
+        }
+        return result;
+    }
     public static List<Object> getAllElementWithBrFromObject(Object obj, Class<?> toSearch) {
 
         List<Object> result = new ArrayList<>();

+ 2 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExportTemplateServiceImpl.java

@@ -224,6 +224,7 @@ public class ExportTemplateServiceImpl implements ExportTemplateService {
 			throw new StatusException("60001", "创建模板文件失败");
 		}
 		if (!FileDisposeUtil.saveUrlAs(fileUrl, localFilePath)) {
+			f.delete();
 			throw new StatusException("60002", "获取模板到本地失败");
 		}
 	}
@@ -277,6 +278,7 @@ public class ExportTemplateServiceImpl implements ExportTemplateService {
 			throw new StatusException("80001", "创建模板文件失败");
 		}
 		if (!FileDisposeUtil.saveUrlAs(fileUrl, localFilePath)) {
+			f.delete();
 			throw new StatusException("80002", "获取模板到本地失败");
 		} else {
 			try {