Browse Source

断点续传

xiaoqiao 3 months ago
parent
commit
9abac138b9

+ 4 - 4
src/main/java/com/bowintek/smartsearch/controller/WellInfoController.java

@@ -198,7 +198,7 @@ public class WellInfoController {
         return RespGenerstor.success(wellInfoService.selectoilWaterDailyList(commonWellNameList));
     }
 
-    /*@GetMapping("/downFile")
+    @GetMapping("/downFile")
     public void downFile(HttpServletResponse response, Integer isShow, String filePath, String fileName) throws Exception {
         Map<String, String> getParams = new HashMap<>();
         getParams.put("fileName", fileName);
@@ -233,8 +233,8 @@ public class WellInfoController {
             os.close();
         }
         log.info("下载完成~~~~");
-    }*/
-    @GetMapping("/downFile")
+    }
+   /* @GetMapping("/downFile")
     public void downFile(HttpServletResponse response,@RequestHeader(value = "Range", required = false) String range, Integer isShow, String filePath, String fileName) throws Exception {
         Map<String, String> getParams = new HashMap<>();
         getParams.put("fileName", fileName);
@@ -312,7 +312,7 @@ public class WellInfoController {
         }
         fi.close();
         return Base64.getMimeEncoder().encodeToString(buffer);
-    }
+    }*/
 
     @GetMapping("/downFileImage")
     public BaseResponse<String> downFileImage(String fileName) throws IOException {

+ 11 - 11
vue/src/components/basic/file-preview/index.vue

@@ -28,10 +28,10 @@ import VueOfficePdf from '@vue-office/pdf'
 //引入VueOfficeExcel组件
 import VueOfficeExcel from '@vue-office/excel'
 import '@vue-office/excel/lib/index.css'
-//import {handleloadByGet} from "@/utils/downloadFile";
-import axios from 'axios';
+import {handleloadByGet} from "@/utils/downloadFile";
+/*import axios from 'axios';
 import {ACCESS_TOKEN_KEY} from "@/enums/cacheEnum";
-import {Storage} from '@/utils/Storage';
+import {Storage} from '@/utils/Storage';*/
 
 export default defineComponent({
   name: 'b-file-preview',
@@ -53,17 +53,17 @@ export default defineComponent({
     const previewUrl = ref<any>();
     const fileSuffix = ref("");
 
-    async function loadFile() {
-      /*let fileName = stripHtmlTags(props.fileName);
+     function loadFile() {
+      let fileName = stripHtmlTags(props.fileName);
       let filePath = stripHtmlTags(props.filePath);
       fileSuffix.value = fileName?.substring(fileName?.lastIndexOf('.') + 1).toLowerCase();
 
       if (props.accept?.indexOf(fileSuffix.value) < 0) {
         $message.error("不支持预览的文件格式!");
         return;
-      }*/
+      }
       spinning.value = true;
-      /*handleloadByGet("/api/wellInfo/downFile", {
+      handleloadByGet("/api/wellInfo/downFile", {
         isShow: 1,
         fileName: fileName,
         filePath: filePath
@@ -84,11 +84,11 @@ export default defineComponent({
         //previewUrl.value = new Blob([res.data], {type: "application/octet-stream"});
         // previewUrl.value = res.data;
 
-      })*/
-      await downloadFileInChunks();
+      })
+      //await downloadFileInChunks();
     }
 
-    async function downloadFileInChunks(chunkSize = 1024 * 1024) {
+   /* async function downloadFileInChunks(chunkSize = 1024 * 1024) {
       let fileName = stripHtmlTags(props.fileName);
       let filePath = stripHtmlTags(props.filePath);
       fileSuffix.value = fileName?.substring(fileName?.lastIndexOf('.') + 1).toLowerCase();
@@ -144,7 +144,7 @@ export default defineComponent({
         spinning.value = false;
         visible.value = true;
       }
-    }
+    }*/
 
     function changeHandle(event) {
       let file = event.target.files[0]