| | |
| | | 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; |
| | |
| | | @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(); |
| | | |
| | |
| | | // 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); |
| | |
| | | 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; |