|
@@ -1,19 +1,20 @@
|
|
|
package com.platform.rest.controller.excel;
|
|
|
|
|
|
-import cn.hutool.core.collection.CollectionUtil;
|
|
|
+import com.platform.common.util.FileUtils;
|
|
|
import com.platform.common.util.R;
|
|
|
-import com.platform.dao.util.ExcelUtil;
|
|
|
-import com.platform.dao.vo.export.sb.ExportSbTypeVO;
|
|
|
import com.platform.rest.log.annotation.SysLog;
|
|
|
-import com.platform.service.activiti.ActivitiAssignStrategy;
|
|
|
import com.platform.service.excel.ExcelImportStrategy;
|
|
|
-import com.platform.service.sb.SbInfoService;
|
|
|
-import com.platform.service.sb.impl.SbInfoServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.util.ResourceUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.BufferedInputStream;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -52,4 +53,23 @@ public class ExcelImportController {
|
|
|
return new R("导入失败");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文件下载
|
|
|
+ */
|
|
|
+ @GetMapping("/download")
|
|
|
+ public void downloadExcel(@RequestParam("downloadType") Integer downloadType, HttpServletResponse response) {
|
|
|
+ File file1 = new File("./");
|
|
|
+ String filePath = file1.getAbsolutePath();
|
|
|
+ filePath = filePath.substring(0,filePath.length()-1);
|
|
|
+ switch (downloadType){
|
|
|
+ case 1 :
|
|
|
+ filePath += "/db/sparePartInfo.xls";
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ filePath += "/db/checkstandard.xls";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ FileUtils.downloadFile(filePath,response);
|
|
|
+ }
|
|
|
}
|