diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java index 4192dc95..9a5179da 100644 --- a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/controller/SysFileController.java @@ -1,14 +1,12 @@ package com.yanzhu.file.controller; import com.yanzhu.common.core.utils.StringUtils; +import com.yanzhu.file.utils.ByteArrayMultipartFile; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import com.yanzhu.common.core.domain.R; import com.yanzhu.common.core.utils.file.FileUtils; @@ -16,6 +14,8 @@ import com.yanzhu.file.service.ISysFileService; import com.yanzhu.system.api.domain.SysFile; import javax.servlet.http.HttpServletResponse; +import java.util.Base64; +import java.util.Map; /** * 文件请求处理 @@ -52,6 +52,33 @@ public class SysFileController } } + /** + * Base64 图片上传请求 + */ + @PostMapping("/uploadBase64Image") + public R uploadBase64Image(@RequestBody Map data) { + try { + // 去除 Base64 数据可能包含的前缀,如 "data:image/png;base64," + String base64Image=data.get("base64Image"); + String base64Data = base64Image; + if (base64Image.contains(",")) { + base64Data = base64Image.split(",")[1]; + } + // 解码 Base64 数据 + byte[] imageBytes = Base64.getDecoder().decode(base64Data); + // 生成临时文件名,可根据实际需求修改 + String fileName = "base64_image_" + System.currentTimeMillis() + ".png"; + // 创建 MultipartFile 对象 + MultipartFile multipartFile = new ByteArrayMultipartFile(imageBytes, fileName, "application/octet-stream"); + // 调用上传方法 + return upload(multipartFile); + } catch (Exception e) { + log.error("Base64 图片上传失败", e); + return R.fail(e.getMessage()); + } + } + + /** * 文件上传请求 */ diff --git a/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/ByteArrayMultipartFile.java b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/ByteArrayMultipartFile.java new file mode 100644 index 00000000..456db139 --- /dev/null +++ b/yanzhu-modules/yanzhu-file/src/main/java/com/yanzhu/file/utils/ByteArrayMultipartFile.java @@ -0,0 +1,60 @@ +package com.yanzhu.file.utils; + + +import org.springframework.web.multipart.MultipartFile; + +import java.io.*; + +public class ByteArrayMultipartFile implements MultipartFile { + private final byte[] fileContent; + private final String fileName; + private final String contentType; + + public ByteArrayMultipartFile(byte[] fileContent, String fileName, String contentType) { + this.fileContent = fileContent; + this.fileName = fileName; + this.contentType = contentType; + } + + @Override + public String getName() { + return fileName; + } + + @Override + public String getOriginalFilename() { + return fileName; + } + + @Override + public String getContentType() { + return contentType; + } + + @Override + public boolean isEmpty() { + return fileContent == null || fileContent.length == 0; + } + + @Override + public long getSize() { + return fileContent.length; + } + + @Override + public byte[] getBytes() throws IOException { + return fileContent; + } + + @Override + public InputStream getInputStream() throws IOException { + return new ByteArrayInputStream(fileContent); + } + + @Override + public void transferTo(File dest) throws IOException, IllegalStateException { + try (FileOutputStream fos = new FileOutputStream(dest)) { + fos.write(fileContent); + } + } +} \ No newline at end of file diff --git a/yanzhu-ui-vue3/src/api/bim/bim.js b/yanzhu-ui-vue3/src/api/bim/bim.js index 8f2658bf..5e285f05 100644 --- a/yanzhu-ui-vue3/src/api/bim/bim.js +++ b/yanzhu-ui-vue3/src/api/bim/bim.js @@ -31,3 +31,33 @@ export function roamingDeleteById(data) { params: data, }); } + +export function viewpointAdd(data) { + return request({ + url: "/manage/api/bim/viewpoint/add", + method: "post", + data: data, + }); +} + +export function viewpointGet(data) { + return request({ + url: "/manage/api/bim/viewpoint/get", + method: "get", + params: data, + }); +} +export function viewpointUpdateByName(data) { + return request({ + url: "/manage/api/bim/viewpoint/updateName", + method: "post", + data: data, + }); +} +export function viewpointDeleteById(data) { + return request({ + url: "/manage/api/bim/viewpoint/deleteById", + method: "get", + params: data, + }); +} diff --git a/yanzhu-ui-vue3/src/views/bim/bimSetting/CustomViewpoint.vue b/yanzhu-ui-vue3/src/views/bim/bimSetting/CustomViewpoint.vue index 8193e69c..c51503db 100644 --- a/yanzhu-ui-vue3/src/views/bim/bimSetting/CustomViewpoint.vue +++ b/yanzhu-ui-vue3/src/views/bim/bimSetting/CustomViewpoint.vue @@ -128,6 +128,7 @@ export default { pagination: { current: 1, pageSize: 10, + total: 0, }, isRoaming: false, isRoamingHistory: false, @@ -188,7 +189,6 @@ export default { projectId: this.currentPrjId, } roamingGet(params).then((res) => { - console.log(res) this.pagination.total = res.data.pageInfo.totalCount let datas = res.data.rows if (datas.length > 0) datas.forEach((x) => (x.play = 0)) diff --git a/yanzhu-ui-vue3/src/views/bim/bimSetting/Viewpoint.vue b/yanzhu-ui-vue3/src/views/bim/bimSetting/Viewpoint.vue new file mode 100644 index 00000000..bf3c6457 --- /dev/null +++ b/yanzhu-ui-vue3/src/views/bim/bimSetting/Viewpoint.vue @@ -0,0 +1,275 @@ + + + + + diff --git a/yanzhu-ui-vue3/src/views/bim/bimSetting/index.vue b/yanzhu-ui-vue3/src/views/bim/bimSetting/index.vue index 7ac2b448..08881d15 100644 --- a/yanzhu-ui-vue3/src/views/bim/bimSetting/index.vue +++ b/yanzhu-ui-vue3/src/views/bim/bimSetting/index.vue @@ -31,11 +31,12 @@
{{param.title }}
- + +
@@ -46,12 +47,13 @@ import { listBimModel } from '@/api/bim/bimModel' import ModelFloorTree from './ModelFloorTree.vue' import PersonRoaming from './PersonRoaming.vue' import CustomViewpoint from './CustomViewpoint.vue' - +import Viewpoint from './Viewpoint.vue' export default { components: { ModelFloorTree, PersonRoaming, CustomViewpoint, + Viewpoint, }, data() { return { @@ -112,6 +114,9 @@ export default { if (n == 2) { this.param.title = '自定义视点漫游' } + if (n == 3) { + this.param.title = '视点管理' + } }, NotificationPopup(parameter) { this.param = parameter @@ -133,7 +138,8 @@ export default { // }) }, doToolsClose() { - this.activeMenu = -1 + this.activeMenu = 0 + this.resetScene() }, notifClose() { this.activeMenu = -1 @@ -196,7 +202,7 @@ export default { }).then((d) => { this.models = d.rows || [] if (this.models.length == 0) { - this.$model.msgError('暂无模型,请先关联模型') + this.$modal.msgError('暂无模型,请先关联模型') } else { this.showTree = true }