|
@@ -48,16 +48,18 @@ public class BimModelController {
|
|
@RequestMapping(value = "/uploadFile/{type}", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/uploadFile/{type}", method = RequestMethod.POST)
|
|
public Response uploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type) {
|
|
public Response uploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type) {
|
|
Response rp = fileClient.uploadFile(uploadFile, 1);
|
|
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));
|
|
return Response.ok(bimModelService.save(uploadFile.getOriginalFilename(), fileLocation, type));
|
|
}
|
|
}
|
|
|
|
|
|
@RequestMapping(value = "/uploadFile/{type}/{id}", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/uploadFile/{type}/{id}", method = RequestMethod.POST)
|
|
public Response reUploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type, @PathVariable String id) {
|
|
public Response reUploadFile(@ApiParam(name = "uploadFile", required = true) MultipartFile uploadFile, @PathVariable int type, @PathVariable String id) {
|
|
Response rp = fileClient.uploadFile(uploadFile, 1);
|
|
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));
|
|
return Response.ok(bimModelService.updateFile(uploadFile.getOriginalFilename(), fileLocation, type, id));
|
|
}
|
|
}
|
|
|
|
|