REQ-3201: 存入initMessageId

This commit is contained in:
yanglin 2024-12-11 17:59:23 +08:00
parent 20a799353a
commit eb2537bad9
2 changed files with 9 additions and 6 deletions

View File

@ -152,7 +152,7 @@ public class UpdatableMessageManager {
historyUpdate.setId(history.getId());
MessageBody messageBody = JSON.parseObject(history.getMessageBody(), MessageBody.class);
messageBody.setMsgBody(updateSupport
.setDataVersion(messageBody.parseMsgBody(), message)
.injectUpdatableFields(messageBody.parseMsgBody(), message)
.toJSONString());
historyUpdate.setMessageBody(JSON.toJSONString(messageBody));

View File

@ -79,7 +79,7 @@ public class UpdateSupport {
messageBody.setPayload(JSON.toJSONString(imBody));
history.setMessageBody(JSON.toJSONString(messageBody));
messageUpdate.setBizBody(setDataVersion(update.bizBody(), message));
messageUpdate.setBizBody(injectUpdatableFields(update.bizBody(), message));
history.setImMessageTaskId(0L);
history.setReceivePersonId(message.getReceiverPersonId());
@ -137,10 +137,13 @@ public class UpdateSupport {
collector.finish();
}
public JSONObject setDataVersion(JSONObject obj, UpdatableMessage message) {
obj.put("bizMessageId", message.getBizMessageId());
obj.put("dataVersion", message.getDataVersion());
return obj;
public JSONObject injectUpdatableFields(JSONObject bizBody, UpdatableMessage message) {
MessageUpdateBody body = new MessageUpdateBody();
body.setInitMessageId(message.getNimMessageId());
body.setBizMessageId(message.getBizMessageId());
body.setDataVersion(message.getDataVersion());
bizBody.putAll(JSON.parseObject(JSON.toJSONString(body)));
return bizBody;
}
}