Browse Source

1.修改文件上传为异步处理

wangt 1 year ago
parent
commit
7436573613

+ 11 - 2
wrdep-biz/src/main/java/com/jiayue/biz/controller/DataRecalculationController.java

@@ -6,6 +6,7 @@ import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.apache.commons.io.FileSystem;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.http.entity.ContentType;
@@ -35,13 +36,21 @@ public class DataRecalculationController {
     @Autowired
     DataRecalculationService dataRecalculationService;
 
+    /**
+     * 修改为异步处理文件,避免文件过大前台长时间不响应
+     * @param file
+     * @param equipmentNo
+     * @param recorderNo
+     * @return
+     */
     @PostMapping("/uploadFileAnalysis")
     public AjaxResult uploadFileAnalysis(@RequestParam("file") MultipartFile file, @RequestParam("equipmentNo") String equipmentNo, @RequestParam("recorderNo") String recorderNo) {
         MultipartFile file1 = null;
 
         try {
-            FileUtils.copyInputStreamToFile(file.getInputStream(), new File("../"+file.getOriginalFilename()));
-            file1 = getMultipartFile( new File("../"+file.getOriginalFilename()));
+            String uploadfilePath = "."+  File.separator +"uploadfile"+  File.separator +file.getOriginalFilename();
+            FileUtils.copyInputStreamToFile(file.getInputStream(), new File(uploadfilePath));
+            file1 = getMultipartFile( new File(uploadfilePath));
         } catch (IOException e) {
             throw new RuntimeException(e);
         }

+ 4 - 1
wrdep-biz/src/main/java/com/jiayue/biz/util/CalculationUtil.java

@@ -352,7 +352,10 @@ public class CalculationUtil {
         return value;
     }
 
-    //计算综合风切变
+    /**
+     * 计算综合风切变
+     */
+
     public static BigDecimal getWindShear(List<ProphaseAnemometryData> prophaseAnemometryData, String[] heights) {
         BigDecimal sumWShear = BigDecimal.ZERO;
         BigDecimal total = BigDecimal.ZERO;

+ 3 - 0
wrdep-biz/src/main/resources/application.yml

@@ -37,6 +37,9 @@ server:
 
 # 配置actuator
 management:
+  health:
+    mongo:
+      enabled: false
   endpoints:
     enabled-by-default: true
     web: