# 毕升office集成demo java 版本 **Repository Path**: ibisheng/demo_java ## Basic Information - **Project Name**: 毕升office集成demo java 版本 - **Description**: 毕升office Java demo - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 9 - **Forks**: 15 - **Created**: 2020-03-18 - **Last Updated**: 2024-08-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 开发环境 - openjdk version "11.0.6" - spring boot 2.x # sring boot 端口 - 端口号:9999 - 端口号修改 src/main/resources/application.yml # 毕升文档Api开发示例 Git pull代码后 #### 修改项目src/main/resources/data/config.json 其中editorHost为毕升文档的地址,该值在demo中会用来拼接成使用毕升文档编辑文件或预览文件所需要的URL; editorCaller为该demo运行所在的地址,该值在demo中会用来拼接为回调地址url,毕升文档从获取文件的URL,以及demo调用毕升文档是参数 apiKey为毕升文档api key,部署完毕升文档之后,可以从控制台许可信息中查询到该值。apiKey将被用来对调用参数进行Hmac md5签名。如果该值不对,调用文档时,将返回错误。 注意:配置文件url的值,需要使用demo服务器,毕升文档所在服务的IP,域名,主机名,不要使用localhost或者127.0.0.1。例如,我们在IP地址为192.168.2.40的服务上部署了毕升文档,在IP地址为192.168.2.66的服务器上运行demo,并且从毕升文档中获取了apikey,则有如下配置: ```json { "editorHost": "http://192.168.2.40", "editorCaller": "http://localhost:9999", "apiKey":"45ae1f8b5d50ea9322a3d8e3326ca0f9" } ``` ![image-20190325220838352](https://bisheng-public.oss-cn-zhangjiakou.aliyuncs.com/resource/image-20190325220838352.png) #### 修改毕升文档配置 为了使得调用毕升文档对文件进行编辑之后,编辑结果能够回调到demo服务器,需要在毕升文档的配置文件中增加配置项,以指明如果是API调用编辑,编辑完成之后应该调用哪个地址来对结果进行回存。 毕升文档的配置文件在你安装的毕升文档目录的 workspace/config/config.yml ![image-20190325220009021](https://bisheng-public.oss-cn-zhangjiakou.aliyuncs.com/resource/image-20190325220009021.png) 编辑config.yml,在配置文件中增加API回调 ```yaml apis: postapiurl: http://192.168.2.66:9090/api/file/saveBack ``` ![image-20190325223245235](https://bisheng-public.oss-cn-zhangjiakou.aliyuncs.com/resource/image-20190325223245235.png) 修改毕升文档的配置之后,需要重启毕升文档服务 ```shell sh restart.sh ``` #### 添加供测试的ms office文件 在项目/resources/storage下拷贝您要编辑的文件 #### 如果要修改前端界面 请下载node版demo,源代码在client目录下,请自行修改 ```bash npm install npm run build 生成在dist中的文件拷贝到/resources/static下、 html入口界面在拷贝到/resources/templates下,支持,注意修改资源引用路径 /resources/static为资源根目录 ``` 然后浏览器打开 http://editorCaller 假如你是在本地运行demo的,可以直接 http://localhost:9999