|
|
@@ -2,7 +2,7 @@ package com.uas.report.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.lowagie.text.pdf.PdfReader;
|
|
|
-import com.uas.report.SpecialProperties;
|
|
|
+import com.uas.report.DynamicProperties;
|
|
|
import com.uas.report.schedule.model.TaskInformation;
|
|
|
import com.uas.report.schedule.service.Executable;
|
|
|
import com.uas.report.schedule.service.TaskService;
|
|
|
@@ -30,7 +30,7 @@ import java.util.*;
|
|
|
public class FileServiceImpl implements FileService {
|
|
|
|
|
|
@Autowired
|
|
|
- private SpecialProperties specialProperties;
|
|
|
+ private DynamicProperties dynamicProperties;
|
|
|
|
|
|
@Autowired
|
|
|
private TaskService taskService;
|
|
|
@@ -72,9 +72,9 @@ public class FileServiceImpl implements FileService {
|
|
|
throw new IllegalArgumentException("参数不能为空:sourceUserName,destinationUserNames");
|
|
|
}
|
|
|
byte[] data = null;
|
|
|
- String stantardJrxmlsUrl = String.format(specialProperties.getStandardJrxmlsUrl(), sourceUserName);
|
|
|
+ String stantardJrxmlsUrl = String.format(dynamicProperties.getStandardJrxmlsUrl(), sourceUserName);
|
|
|
// 如果本机提供标准模板下载,直接从本地获取数据
|
|
|
- if (specialProperties.getHasStandardJrxmls()) {
|
|
|
+ if (dynamicProperties.getHasStandardJrxmls()) {
|
|
|
data = getStandardJrxmls(sourceUserName);
|
|
|
}
|
|
|
// 本机没有标准模板,则先下载标准模板数据
|
|
|
@@ -123,7 +123,7 @@ public class FileServiceImpl implements FileService {
|
|
|
}
|
|
|
|
|
|
String fileName = file.getOriginalFilename();
|
|
|
- StringBuilder stringBuilder = new StringBuilder(specialProperties.getLocalBaseDir()).append("/");
|
|
|
+ StringBuilder stringBuilder = new StringBuilder(dynamicProperties.getLocalBaseDir()).append("/");
|
|
|
// jrxml模板和图片分别放在jrxml和Picture文件夹下,其他资源放在当前账套根路径下
|
|
|
if (fileType.equals("jrxml")) {
|
|
|
stringBuilder.append(userName).append("/").append("jrxml").append("/");
|
|
|
@@ -180,7 +180,7 @@ public class FileServiceImpl implements FileService {
|
|
|
@Override
|
|
|
public String getJrxmlFilePath(String userName, String reportName) {
|
|
|
ReportUtils.checkParameters(userName, reportName);
|
|
|
- return new StringBuilder(getMasterPath(userName)).append(specialProperties.getLocalJrxmlDir()).append("/")
|
|
|
+ return new StringBuilder(getMasterPath(userName)).append(dynamicProperties.getLocalJrxmlDir()).append("/")
|
|
|
.append(reportName).append(".jrxml").toString();
|
|
|
}
|
|
|
|
|
|
@@ -189,7 +189,7 @@ public class FileServiceImpl implements FileService {
|
|
|
if (StringUtils.isEmpty(userName)) {
|
|
|
throw new IllegalArgumentException("参数不能为空:userName");
|
|
|
}
|
|
|
- return new StringBuilder(specialProperties.getLocalBaseDir()).append("/").append(userName).toString();
|
|
|
+ return new StringBuilder(dynamicProperties.getLocalBaseDir()).append("/").append(userName).toString();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -197,11 +197,11 @@ public class FileServiceImpl implements FileService {
|
|
|
if (StringUtils.isEmpty(userName)) {
|
|
|
throw new IllegalArgumentException("未传入当前账套名称!");
|
|
|
}
|
|
|
- if (!specialProperties.getHasStandardJrxmls()) {
|
|
|
+ if (!dynamicProperties.getHasStandardJrxmls()) {
|
|
|
throw new IllegalStateException("没有" + userName + "标准模板!");
|
|
|
}
|
|
|
try {
|
|
|
- return ZipUtils.zipFolder(getMasterPath(specialProperties.getStandardMaster()) + "/" + userName,
|
|
|
+ return ZipUtils.zipFolder(getMasterPath(dynamicProperties.getStandardMaster()) + "/" + userName,
|
|
|
FileServiceImpl.fileFilter);
|
|
|
} catch (Throwable e) {
|
|
|
throw new IOException("压缩失败", e);
|
|
|
@@ -213,10 +213,10 @@ public class FileServiceImpl implements FileService {
|
|
|
if (StringUtils.isEmpty(userName)) {
|
|
|
throw new IllegalArgumentException("未传入当前账套名称!");
|
|
|
}
|
|
|
- if (!specialProperties.getHasStandardJrxmls()) {
|
|
|
+ if (!dynamicProperties.getHasStandardJrxmls()) {
|
|
|
throw new IllegalStateException("没有" + userName + "标准模板!");
|
|
|
}
|
|
|
- downloadZip(specialProperties.getStandardMaster() + "/" + userName, response);
|
|
|
+ downloadZip(dynamicProperties.getStandardMaster() + "/" + userName, response);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -514,7 +514,7 @@ public class FileServiceImpl implements FileService {
|
|
|
return null;
|
|
|
}
|
|
|
// 获取相对路径,须将本地资源根路径替换掉,并且文件分隔符统一使用 '/'
|
|
|
- return file.getPath().replace(new File(specialProperties.getLocalBaseDir()).getPath(), "").replace("\\", "/");
|
|
|
+ return file.getPath().replace(new File(dynamicProperties.getLocalBaseDir()).getPath(), "").replace("\\", "/");
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -589,7 +589,7 @@ public class FileServiceImpl implements FileService {
|
|
|
}
|
|
|
// 不是绝对路径的话,则相对于模板根路径
|
|
|
if (isAbsolutePath == null || !isAbsolutePath) {
|
|
|
- filePath = specialProperties.getLocalBaseDir() + "/" + filePath;
|
|
|
+ filePath = dynamicProperties.getLocalBaseDir() + "/" + filePath;
|
|
|
}
|
|
|
return filePath;
|
|
|
}
|