Przeglądaj źródła

裂解炉炉管测压 - 图片上传、识别顺序修改

wangggziwen 1 rok temu
rodzic
commit
56b765f224

+ 16 - 16
master/src/main/java/com/ruoyi/project/production/controller/TFurnancePressureController.java

@@ -103,6 +103,22 @@ public class TFurnancePressureController extends BaseController
                            @RequestParam("isInlet") boolean isInlet,
                            @RequestParam("pType") String pType,
                            @RequestParam("pId") String pId) throws IOException {
+        // 上传图片
+        if (file.isEmpty())
+        {
+            return AjaxResult.error("上传失败,文件为空!");
+        }
+        String url = FileUploadUtils.upload(RuoYiConfig.getFilePath("/"+ pType), file);
+        long size = file.getSize()/1024;
+        TCommonfile tCommonfile = new TCommonfile();
+        tCommonfile.setFileUrl(url);
+        tCommonfile.setFileName(file.getOriginalFilename());
+        tCommonfile.setCreaterCode(String.valueOf(getUserId()));
+        tCommonfile.setpId(Long.parseLong(pId));
+        tCommonfile.setpType(pType);
+        tCommonfile.setFileSize(String.valueOf(size));
+        tCommonfileService.insertTCommonfile(tCommonfile);
+
         // 判断图片中的压力仪表数量
         int num = 0;
         switch (furnanceName) {
@@ -256,22 +272,6 @@ public class TFurnancePressureController extends BaseController
                 break;
         }
 
-        // 上传图片
-        if (file.isEmpty())
-        {
-            return AjaxResult.error("上传失败,文件为空!");
-        }
-        String url = FileUploadUtils.upload(RuoYiConfig.getFilePath("/"+ pType), file);
-        long size = file.getSize()/1024;
-        TCommonfile tCommonfile = new TCommonfile();
-        tCommonfile.setFileUrl(url);
-        tCommonfile.setFileName(file.getOriginalFilename());
-        tCommonfile.setCreaterCode(String.valueOf(getUserId()));
-        tCommonfile.setpId(Long.parseLong(pId));
-        tCommonfile.setpType(pType);
-        tCommonfile.setFileSize(String.valueOf(size));
-        tCommonfileService.insertTCommonfile(tCommonfile);
-
         //组装返回
         JSONObject returnObj = new JSONObject();
         returnObj.put("readings", newArray);