package com.fzzy.igds.api.v1.data; import com.alibaba.fastjson.JSONObject; import lombok.Data; import java.io.Serializable; /** * @Description 接口回复封装类 * @Author CZT * @Date 2026/1/7 10:02 */ @Data public class ApiV1Resp implements Serializable { /** * 返回码 */ public static final String CODE_SUCCESS = "200"; public static final String CODE_ERROR = "400"; /*-----消息头-----*/ private String sn; //设备、系统编码 private String auth; //权限标识 private String sign; //权限签名 private String outId; //自定义编码 private String functionId; //功能码 private Long timestamp; //时间戳 private String respCode; //返回码 private String respMsg; //返回说明 /*-----消息体-----*/ private T data; public ApiV1Resp() { super(); } public ApiV1Resp(String respCode, String respMsg, T data, ApiV1Req req) { this.data = data; this.sn = req.getSn(); this.auth = req.getAuth(); this.sign = req.getSign(); this.outId = req.getOutId(); this.functionId = req.getFunctionId(); this.timestamp = System.currentTimeMillis(); this.respCode = respCode; this.respMsg = respMsg; } public static ApiV1Resp success(Object data, ApiV1Req req) { return new ApiV1Resp<>(CODE_SUCCESS, null, data, req); } public static ApiV1Resp error(String respMsg, ApiV1Req req) { return new ApiV1Resp<>(CODE_ERROR, respMsg, null, req); } }