|
@@ -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) {
|