dcs 7 miesięcy temu
rodzic
commit
6b2f095e36

+ 6 - 4
virgo.bim/src/main/java/com/bosshand/virgo/bim/controller/BimModelController.java

@@ -48,16 +48,18 @@ public class BimModelController {
     @RequestMapping(value = "/uploadFile/{type}", method = RequestMethod.POST)
     public Response uploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type) {
         Response rp = fileClient.uploadFile(uploadFile, 1);
-        String str = rp.getData().toString();
-        String fileLocation = str.substring(str.lastIndexOf("http"), str.indexOf(",", str.lastIndexOf("http")));
+        String data = JSONObject.toJSONString(rp.getData());
+        JSONObject jsonObject = JSONObject.parseObject(data);
+        String fileLocation = jsonObject.getJSONObject("node").getString("url");
         return Response.ok(bimModelService.save(uploadFile.getOriginalFilename(), fileLocation, type));
     }
 
     @RequestMapping(value = "/uploadFile/{type}/{id}", method = RequestMethod.POST)
     public Response reUploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type, @PathVariable String id) {
         Response rp = fileClient.uploadFile(uploadFile, 1);
-        String str = rp.getData().toString();
-        String fileLocation = str.substring(str.lastIndexOf("http"), str.indexOf(",", str.lastIndexOf("http")));
+        String data = JSONObject.toJSONString(rp.getData());
+        JSONObject jsonObject = JSONObject.parseObject(data);
+        String fileLocation = jsonObject.getJSONObject("node").getString("url");
         return Response.ok(bimModelService.updateFile(uploadFile.getOriginalFilename(), fileLocation, type, id));
     }