浏览代码

添加调试日志

helongjun 3 年之前
父节点
当前提交
57f23b6f17
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/main/java/com/ads/business/service/impl/DocServiceImpl.java

+ 4 - 1
src/main/java/com/ads/business/service/impl/DocServiceImpl.java

@@ -34,6 +34,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -341,8 +342,9 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
         log.info("createPath---路径:{}", createPath);
         // 生成图片
         LinkedList<String> images = getPdfImages(createPath, path + imageFilePath);
-        if (images.size() == 0) {
+        if (CollectionUtils.isEmpty(images)) {
             int pageSize = PdfUtil.toImages(createPath);
+            log.info("toImages :" + pageSize);
             if (pageSize > 0) {
                 for (int i = 1; i <= pageSize; i++) {
                     images.add(path + imageFilePath + i + ".png");
@@ -648,6 +650,7 @@ public class DocServiceImpl extends ServiceImpl<DocDao, Doc> implements DocServi
     public LinkedList<String> getPdfImages(String pdfPath, String parentPath) {
         LinkedList<String> images = new LinkedList<>();
         File imagesDirectory = new File(pdfPath.substring(0, pdfPath.lastIndexOf('.')));
+        log.info("imagesDirectory exists:" + imagesDirectory.exists());
         if (imagesDirectory.exists()) {
             File[] files = imagesDirectory.listFiles();
             if (null != files && files.length > 0) {