From aff79ef4ee875cd72b124982f4123e53013f03e4 Mon Sep 17 00:00:00 2001
From: liuhaonan <31457034@qq.com>
Date: 星期五, 13 五月 2022 11:39:29 +0800
Subject: [PATCH] 单灯数据导出
---
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
index d4df841..e8aaca2 100644
--- a/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
+++ b/ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightReportDataService.java
@@ -47,6 +47,7 @@
private final FileProperties properties;
private final AliOssFileServiceImpl fileService;
+ private final LightReportDataMapper lightReportDataMapper;
/**
* 淇濆瓨涓婃姤鐨勭伅蹇冭烦鏁版嵁
@@ -132,7 +133,7 @@
}
@SneakyThrows
- public String exportList(HttpServletRequest request, HttpServletResponse response, String deviceCode) {
+ public void exportList(HttpServletRequest request, HttpServletResponse response, String deviceCode) {
if (SecurityUtils.getClientId() != null) {
PoleBinding one = SpringContextHolder.getBean(PoleBindingService.class).getOne(Wrappers.lambdaQuery(PoleBinding.class).eq(PoleBinding::getDeviceCode, deviceCode)
@@ -149,7 +150,7 @@
}
}
- List<LightReportDataBo> list = baseMapper.listReportData(null, deviceCode);
+ List<LightReportDataBo> list = lightReportDataMapper.listReportData(null, deviceCode);
File file = new File("./" + RandomUtil.randomString(12) + ".xlsx");
@@ -158,8 +159,7 @@
//鏂囦欢娴佸寲杩斿洖缁欏墠绔�
findfile(request, response, file);
//鍒犻櫎鏂囦欢
- file.delete();
- return null;
+ // file.delete();
}
/**
@@ -174,8 +174,6 @@
ServletOutputStream out = null;
FileInputStream ips = null;
try {
- //鑾峰彇鏂囦欢瀛樻斁鐨勮矾寰�
- String fileName = file.getName();
//鑾峰彇鍒版枃瀛� 鏁版嵁搴撻噷瀵瑰簲鐨勯檮浠跺悕瀛楀姞涓婅�佺殑鏂囦欢鍚嶅瓧锛歠ilename 鎴彇鍒板悗闈㈢殑鏂囦欢绫诲瀷 渚嬶細txt 缁勬垚涓�涓柊鐨勬枃浠跺悕瀛楋細newFileName
//鐢熸垚3涓殢鏈烘暟锛岀敤鏉ョ敓鎴愭柊鐨勬枃浠跺悕瀛�
String newFileName = "鍗曠伅鏁版嵁" + RandomUtil.randomString(3) + ".xlsx";
@@ -201,6 +199,7 @@
try {
out.close();
ips.close();
+ file.delete();
} catch (IOException e) {
System.out.println("鍏抽棴娴佸嚭鐜板紓甯�");
e.printStackTrace();
--
Gitblit v1.9.3