|
@ -272,7 +272,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void batchExport(String reportId, String paramKey, HttpServletResponse response) { |
|
|
public void batchExport(String bizId, String reportId, String paramKey, HttpServletResponse response) { |
|
|
|
|
|
|
|
|
// 1. 首先去积木服务,查询出报表数据源的详细信息,包括报表url,isList;获取到哪一列是id(idFieldName)
|
|
|
// 1. 首先去积木服务,查询出报表数据源的详细信息,包括报表url,isList;获取到哪一列是id(idFieldName)
|
|
|
|
|
|
|
|
@ -308,7 +308,7 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 2. 调用该url的接口,获取到一个列表,根据idFieldName取出ID列
|
|
|
// 2. 调用该url的接口,获取到一个列表,根据idFieldName取出ID列
|
|
|
List<String> ids = listIds(paramKey, apiUrl, isHttps, idFieldName); |
|
|
List<String> ids = listIds(bizId, paramKey, apiUrl, isHttps, idFieldName); |
|
|
|
|
|
|
|
|
// 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载
|
|
|
// 3. 然后以这一列作为查询条件,循环,继续调用该接口,得到单条数据,每一条数据都下载一个excel,最后将其打包为一个压缩包下载
|
|
|
Path storePath = makeTemporaryDownloadDir(reportId); |
|
|
Path storePath = makeTemporaryDownloadDir(reportId); |
|
@ -428,6 +428,18 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor |
|
|
public void downloadXlsByBatchByBizId(String reportId, List<String> bizIds, JimuReportExportRequestDTO param, Path xlsxStorePath, ArrayList<File> files, |
|
|
public void downloadXlsByBatchByBizId(String reportId, List<String> bizIds, JimuReportExportRequestDTO param, Path xlsxStorePath, ArrayList<File> files, |
|
|
CountDownLatch cdl) { |
|
|
CountDownLatch cdl) { |
|
|
for (String id : bizIds) { |
|
|
for (String id : bizIds) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
Thread.sleep(200l); |
|
|
|
|
|
} catch (InterruptedException e) { |
|
|
|
|
|
final String errorMsg = ExceptionUtils.getErrorStackTrace(e); |
|
|
|
|
|
log.error("【报表批量导出】循环导出-请求jmreport,等待过程中睡眠发生意外:{}", errorMsg); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//if (!Arrays.asList("1501821697823608834","1501821694665297922","1501821695114088450","1501821695177003009","1501821695269277697","1501821695344775169","1501821695579656193","1501821695676125186","1501821695755816962","1501821695843897346","1501821695978115074","1501821696108138497","1501821696179441665","1501821696229773313","1501821696284299266","1501821696334630913","1501821696393351170","1501821696452071426","1501821696502403073","1501821696582094849","1501821696645009409","1501821696758255617","1501821696871501826","1501821696917639169","1501821696955387906","1501821696993136641","1501821697135742977","1501821697181880321","1501821697232211969","1501821697274155009").contains(id)) {
|
|
|
|
|
|
// continue;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
param.getQueryParam().setId(id); |
|
|
param.getQueryParam().setId(id); |
|
|
final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); |
|
|
final Response response = jiMuReportOpenFeignClient.exportAllExcelStream(param); |
|
|
// 取出文件后缀
|
|
|
// 取出文件后缀
|
|
@ -498,13 +510,13 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl<IcCustomerRepor |
|
|
* @param idFieldName |
|
|
* @param idFieldName |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
public List<String> listIds(String paramKey, String apiUrl, boolean isHttps, String idFieldName) { |
|
|
public List<String> listIds(String id, String paramKey, String apiUrl, boolean isHttps, String idFieldName) { |
|
|
apiUrl = apiUrl.replace("${id}", ""); |
|
|
apiUrl = apiUrl.replace("'${id}'", id == null ? "" : id); |
|
|
apiUrl = apiUrl.replace("${paramKey}", paramKey); |
|
|
apiUrl = apiUrl.replace("'${paramKey}'", paramKey); |
|
|
|
|
|
|
|
|
Map<String, Object> headers = new HashMap<>(); |
|
|
Map<String, Object> headers = new HashMap<>(); |
|
|
headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); |
|
|
headers.put(Constant.AUTHORIZATION_HEADER, EpmetRequestHolder.getHeader(Constant.AUTHORIZATION_HEADER)); |
|
|
Result<String> stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{}", headers); |
|
|
Result<String> stringResult = HttpClientManager.getInstance().sendPost(apiUrl, isHttps, "{\"id\":" + id + "}", headers); |
|
|
|
|
|
|
|
|
JSONObject dataJsonObject = JSON.parseObject(stringResult.getData()); |
|
|
JSONObject dataJsonObject = JSON.parseObject(stringResult.getData()); |
|
|
Object data = dataJsonObject.get("data"); |
|
|
Object data = dataJsonObject.get("data"); |
|
|