yanyan 1 year ago
parent
commit
f841bd3de3
  1. 14
      lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/service/NoticeServiceImpl.java

14
lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/notice/service/NoticeServiceImpl.java

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

Loading…
Cancel
Save