|
|
@@ -74,12 +74,19 @@ public class FileServiceImpl implements FileService {
|
|
|
throw new ReportException("参数不能为空:sourceUserName,destinationUserNames");
|
|
|
}
|
|
|
try {
|
|
|
+ byte[] data = null;
|
|
|
String stantardJrxmlsUrl = String.format(sysConf.getStandardJrxmlsUrl(), sourceUserName);
|
|
|
- logger.info("get standardJrxmls from " + stantardJrxmlsUrl + "...");
|
|
|
- // 获取标准模板数据
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(IOUtils.toString(HttpClients.createDefault()
|
|
|
- .execute(new HttpGet(URI.create(stantardJrxmlsUrl))).getEntity().getContent()));
|
|
|
- byte[] data = jsonObject.getBytes("data");
|
|
|
+ // 如果本机提供标准模板下载,直接从本地获取数据
|
|
|
+ if (stantardJrxmlsUrl.contains(sysConf.getHost())) {
|
|
|
+ data = getStandardJrxmls(sourceUserName);
|
|
|
+ }
|
|
|
+ // 本机没有标准模板,则先下载标准模板数据
|
|
|
+ else {
|
|
|
+ logger.info("get standardJrxmls from " + stantardJrxmlsUrl + "...");
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(IOUtils.toString(HttpClients.createDefault()
|
|
|
+ .execute(new HttpGet(URI.create(stantardJrxmlsUrl))).getEntity().getContent()));
|
|
|
+ data = jsonObject.getBytes("data");
|
|
|
+ }
|
|
|
if (ArrayUtils.isEmpty(data)) {
|
|
|
throw new ReportException("标准模板不存在");
|
|
|
}
|