刘光辉
13 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package jnpf.bizcommon.onlyoffice.entity;
 
import lombok.Data;
 
import java.util.List;
 
/**
 * OnlyOffice 保存回调的请求体。
 *
 * <p>字段是 OnlyOffice 定死的一套,**config 里的自定义字段不会回传**——所以业务上下文
 * (bizModule/bizDataId)只能在签发 config 时落库,回调时靠 {@link #key} 反查会话表。
 *
 * <p>同理不要把业务参数拼在 callbackUrl 的 query 上:DS 会存下每个会话的 callbackUrl
 * 并挑其中一份回调(status 2 用最后改动者的),拼在 URL 上的参数会取到不确定的那份。
 */
@Data
public class OnlyOfficeCallbackParam {
 
    /** 文档版本标识,与 onlyoffice_session.doc_key 对应。必返字段,是唯一可靠的关联锚点 */
    private String key;
 
    /**
     * 文档状态:
     * 1 编辑中 / 2 准备保存 / 3 保存出错 / 4 无改动关闭 / 6 强制保存 / 7 强制保存出错
     */
    private Integer status;
 
    /** 编辑后文档的下载地址,status 为 2/3/6/7 时才有 */
    private String url;
 
    /** 下载文件的扩展名 */
    private String filetype;
 
    /** 参与编辑的用户 id;status 2/6 时返回的是最后改动者,不是全部参与者 */
    private List<String> users;
 
    /** 强制保存的触发类型,status 6/7 时才有 */
    private Integer forcesavetype;
 
    /** 用户动作列表,元素形如 {"type":0|1|2,"userid":"xxx"} */
    private List<Object> actions;
 
    /** DS 侧签发的 JWT。多数部署经 Authorization 头传递,此处兼容放在 body 的形态 */
    private String token;
 
    /** 文档状态取值 */
    public static final class Status {
        public static final int EDITING = 1;
        public static final int READY_FOR_SAVING = 2;
        public static final int SAVE_ERROR = 3;
        public static final int CLOSED_NO_CHANGES = 4;
        public static final int FORCE_SAVING = 6;
        public static final int FORCE_SAVE_ERROR = 7;
 
        private Status() {
        }
    }
}