|
|
|
@ -371,18 +371,14 @@ public class NoticeServiceImpl implements INoticeService |
|
|
|
public AjaxResult transPdf(Notice notice) { |
|
|
|
List<byte[]> pngs = new ArrayList<>(); |
|
|
|
long startTime = System.currentTimeMillis(); |
|
|
|
System.out.println("地址。。。。 " + filePath+notice.getUrl()); |
|
|
|
// 将文件地址和文件名拼接成路径 注意:线上环境不能使用\\拼接
|
|
|
|
if (com.zdxt.common.util.StringUtils.isNotEmpty(notice.getUrl())){ |
|
|
|
String url = notice.getUrl(); |
|
|
|
int index = url.indexOf("upload"); // 找到"示例"的索引位置
|
|
|
|
if (index != -1) { |
|
|
|
url = url.substring(index + "upload".length()); |
|
|
|
} |
|
|
|
notice.setUrl(url); |
|
|
|
notice.setUrl(notice.getUrl().replace("/profile", filePath)); |
|
|
|
} else{ |
|
|
|
return AjaxResult.success(pngs); |
|
|
|
} |
|
|
|
System.out.println("测试地址。。。。 " + filePath+notice.getUrl()); |
|
|
|
File file = new File(filePath+notice.getUrl()); |
|
|
|
System.out.println("地址。。。。 " + notice.getUrl()); |
|
|
|
File file = new File(notice.getUrl()); |
|
|
|
try { |
|
|
|
// 写入文件
|
|
|
|
PDDocument doc = PDDocument.load(file); |
|
|
|
|