吉安感知网项目-后端
linwei
2026-07-11 62091bb640608f24812e069947928c49b4ebdedf
feat(resource): 集成OnlyOffice文档编辑功能
1 files modified
10 ■■■■ changed files
drone-ops/drone-resource/src/main/java/org/sxkj/resource/controller/AttachController.java 10 ●●●● patch | view | raw | blame | history
drone-ops/drone-resource/src/main/java/org/sxkj/resource/controller/AttachController.java
@@ -21,6 +21,7 @@
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.DateTimeUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
@@ -421,8 +422,9 @@
    @ApiOperationSupport(order = 10)
    @ApiOperation(value = "获取OnlyOffice配置", notes = "根据附件ID查询附件信息,返回包含当前用户信息和附件信息的OnlyOffice文档编辑器配置")
    public R<Map<String, Object>> getOnlyOfficeConfig(
            HttpServletRequest request,
            @ApiParam(value = "附件ID", required = true) @RequestParam Long attachId) {
        HttpServletRequest request,
        @ApiParam(value = "附件ID", required = true) @RequestParam Long attachId,
        @RequestParam(value = "mode", required = false) String mode) {
        // 1. 获取当前登录用户信息
        BladeUser user = AuthUtil.getUser();
@@ -445,7 +447,7 @@
        // 5. 构建编辑器配置
        Map<String, Object> editorConfig = new HashMap<>();
        editorConfig.put("customization", customization);
        editorConfig.put("mode", "edit");
        editorConfig.put("mode", StringUtil.isBlank(mode) ? "view" : mode);
        editorConfig.put("callbackUrl", onlyofficeCallbackUrl);
        editorConfig.put("lang", "zh-CN");
        editorConfig.put("user", userConfig);
@@ -508,6 +510,8 @@
        log.info("ONLYOFFICE配置生成完成,attachId: {}, documentUrl: {}", attachId, documentUrl);
        return R.data(result1);
    }
    public static final Integer MAX_KEY_LENGTH = 20;
    public static final Integer ANONYMOUS_USER_ID = 4;
    public static final Integer KILOBYTE_SIZE = 1024;