1
0
mirror of synced 2025-12-19 23:08:13 +08:00

🎨 #3178【企业微信】修复会话存档反序列化接口中uint64相关字段定义,使用BigInteger类型

This commit is contained in:
0katekate0
2023-12-07 16:20:26 +08:00
committed by GitHub
parent 1fe8fe4caa
commit 69df6f1bcf
6 changed files with 71 additions and 18 deletions

View File

@@ -196,12 +196,11 @@ public class WxCpMsgAuditServiceImpl implements WxCpMsgAuditService {
@Override
public void getMediaFile(@NonNull long sdk, @NonNull String sdkfileid, String proxy, String passwd, @NonNull long timeout, @NonNull Consumer<byte[]> action) throws WxErrorException {
/**
* 1、媒体文件每次拉取的最大size为512k因此超过512k的文件需要分片拉取。
* 2、若该文件未拉取完整sdk的IsMediaDataFinish接口会返回0同时通过GetOutIndexBuf接口返回下次拉取需要传入GetMediaData的indexbuf。
* 3、indexbuf一般格式如右侧所示”Range:bytes=524288-1048575“:表示这次拉取的是从524288到1048575的分片。单个文件首次拉取填写的indexbuf
* 为空字符串拉取后续分片时直接填入上次返回的indexbuf即可。
*/
/**
* 1、媒体文件每次拉取的最大size为512k因此超过512k的文件需要分片拉取。
* 2、若该文件未拉取完整sdk的IsMediaDataFinish接口会返回0同时通过GetOutIndexBuf接口返回下次拉取需要传入GetMediaData的indexbuf。
* 3、indexbuf一般格式如右侧所示”Range:bytes=524288-1048575“:表示这次拉取的是从524288到1048575的分片。单个文件首次拉取填写的indexbuf为空字符串拉取后续分片时直接填入上次返回的indexbuf即可。
*/
String indexbuf = "";
int ret, data_len = 0;
log.debug("正在分片拉取媒体文件 sdkFileId为{}", sdkfileid);
@@ -215,8 +214,7 @@ public class WxCpMsgAuditServiceImpl implements WxCpMsgAuditService {
}
data_len += Finance.GetDataLen(mediaData);
log.info("正在分片拉取媒体文件 len:{}, data_len:{}, is_finis:{} \n", Finance.GetIndexLen(mediaData), data_len,
Finance.IsMediaDataFinish(mediaData));
log.debug("正在分片拉取媒体文件 len:{}, data_len:{}, is_finish:{} \n", Finance.GetIndexLen(mediaData), data_len, Finance.IsMediaDataFinish(mediaData));
try {
// 大于512k的文件会分片拉取此处需要使用追加写避免后面的分片覆盖之前的数据。

View File

@@ -25,7 +25,7 @@ public class WxCpChatDatas implements Serializable {
private String errMsg;
@SerializedName("sdk")
private long sdk;
private Long sdk;
@SerializedName("chatdata")
private List<WxCpChatData> chatData;

View File

@@ -7,6 +7,7 @@ import lombok.Setter;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
/**
@@ -844,8 +845,11 @@ public class WxCpChatModel implements Serializable {
public static class Details implements Serializable {
private static final long serialVersionUID = -5028321625140879571L;
/**
* 表项id Uint64类型
*/
@SerializedName("id")
private Long id;
private BigInteger id;
@SerializedName("ques")
private String ques;
@@ -943,8 +947,11 @@ public class WxCpChatModel implements Serializable {
@SerializedName("meetingtype")
private Integer meetingType;
/**
* 会议id Uint64类型
*/
@SerializedName("meetingid")
private Long meetingId;
private BigInteger meetingId;
@SerializedName("status")
private Integer status;

View File

@@ -5,6 +5,7 @@ import lombok.Data;
import me.chanjar.weixin.cp.util.json.WxCpGsonBuilder;
import java.io.Serializable;
import java.math.BigInteger;
/**
* 会话存档 文档信息对象
@@ -25,8 +26,11 @@ public class WxCpFileItem implements Serializable {
@SerializedName("sdkfileid")
private String sdkFileId;
/**
* 共享文件的大小 Uint64类型
*/
@SerializedName("filesize")
private Long fileSize;
private BigInteger fileSize;
/**
* From json wx cp file item.

View File

@@ -14,9 +14,11 @@ import java.security.PrivateKey;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.RSAPrivateCrtKeySpec;
import java.util.Base64;
import java.util.Objects;
/**
* The type Wx cp crypt util.
*
* @author qian
*/
public class WxCpCryptUtil extends WxCryptUtil {
@@ -50,11 +52,11 @@ public class WxCpCryptUtil extends WxCryptUtil {
* @throws Exception the exception
*/
public static String decryptPriKey(String encryptRandomKey, String msgAuditPriKey, Integer pkcs1) throws Exception {
if (pkcs1 == null) {
if (Objects.isNull(pkcs1)) {
throw new WxErrorException("请配置会话存档解密方式");
}
if (pkcs1 == 1) {
if (Objects.equals(pkcs1, 1)) {
return decryptPriKeyByPKCS1(encryptRandomKey, msgAuditPriKey);
}