feat:完成家族小秘书消息对接(和之前的家族逻辑一样,只是协议码不对)

fix:修复公会小秘书消息文案展示不完整问题
This commit is contained in:
max
2024-05-21 19:13:37 +08:00
parent cab7e3542e
commit 6229ba57be
10 changed files with 439 additions and 80 deletions

View File

@@ -19,6 +19,15 @@ import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_DRAW_GIFT
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_EXPER_LEVEL_UP_NOTICE;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_CREATE;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DISMISS;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_INVITE;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_APPLY;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DEAL_APPLY;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_DEAL_INVITE;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_REMOVE_MEMBER;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAMILY_SET_MANAGER;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_MEMBER_COUNT;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_ROOM_NOTIFY;
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_GROUP_CHAT_TOPIC;
@@ -116,6 +125,7 @@ import com.chwl.core.miniworld.bean.MWChatMemberCountAttachment;
import com.chwl.core.miniworld.bean.MWChatTopicAttachment;
import com.chwl.core.miniworld.bean.OpenAudioPartyAttachment;
import com.chwl.core.module_hall.im.ClanAttachment;
import com.chwl.core.module_hall.im.FamilyAttachment;
import com.chwl.core.public_chat_hall.attachment.AitFriendsAttachment;
import com.chwl.core.public_chat_hall.attachment.AitMeAttachment;
import com.chwl.core.room.bean.LeaveModeAttachment;
@@ -379,6 +389,21 @@ public class CustomAttachParser implements MsgAttachmentParser {
break;
}
break;
case CUSTOM_MSG_FAMILY:
switch (second) {
case CUSTOM_MSG_FAMILY_INVITE:
case CUSTOM_MSG_FAMILY_DEAL_INVITE:
case CUSTOM_MSG_FAMILY_APPLY:
case CUSTOM_MSG_FAMILY_DEAL_APPLY:
case CUSTOM_MSG_FAMILY_SET_MANAGER:
case CUSTOM_MSG_FAMILY_REMOVE_MEMBER:
case CUSTOM_MSG_FAMILY_CREATE:
case CUSTOM_MSG_FAMILY_DISMISS:
attachment = new FamilyAttachment(second);
break;
}
break;
case CUSTOM_MSG_CLAN:
switch (second) {

View File

@@ -503,6 +503,20 @@ public class CustomAttachment implements MsgAttachment {
// 头条-更新
public static final int CUSTOM_MSG_HEADLINE_CHANGED = 108;
public static final int CUSTOM_MSG_HEADLINE_CHANGED_SUB = 1081;
/**
* 家族
*/
public static final int CUSTOM_MSG_FAMILY = 110;
public static final int CUSTOM_MSG_FAMILY_INVITE = 1101;
public static final int CUSTOM_MSG_FAMILY_DEAL_INVITE = 1102;
public static final int CUSTOM_MSG_FAMILY_APPLY = 1103;
public static final int CUSTOM_MSG_FAMILY_DEAL_APPLY = 1104;
public static final int CUSTOM_MSG_FAMILY_SET_MANAGER = 1105;
public static final int CUSTOM_MSG_FAMILY_REMOVE_MEMBER = 1106;
public static final int CUSTOM_MSG_FAMILY_CREATE = 1107;
public static final int CUSTOM_MSG_FAMILY_DISMISS = 1108;
/**
* 自定义消息附件的类型,根据该字段区分不同的自定义消息
*/

View File

@@ -0,0 +1,49 @@
package com.chwl.core.module_hall.im;
import androidx.annotation.Keep;
import com.alibaba.fastjson.JSONObject;
import com.chwl.core.im.custom.bean.CustomAttachment;
import com.google.gson.Gson;
/**
* 模厅消息
* Created by lvzebiao on 2019/1/7.
*/
@Keep
public class FamilyAttachment extends CustomAttachment {
private FamilyImMsgInfo familyImMsgInfo;
public FamilyAttachment() {
this(CUSTOM_MSG_FAMILY);
}
public FamilyAttachment(int second) {
super(CUSTOM_MSG_FAMILY, second);
}
@Override
protected void parseData(JSONObject data) {
try {
familyImMsgInfo = new Gson().fromJson(data.toJSONString(), FamilyImMsgInfo.class);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected JSONObject packData() {
try {
String jsonStr = new Gson().toJson(familyImMsgInfo);
return JSONObject.parseObject(jsonStr);
} catch (Exception e) {
e.printStackTrace();
return new JSONObject();
}
}
public FamilyImMsgInfo getFamilyImMsgInfo() {
return familyImMsgInfo;
}
}

View File

@@ -0,0 +1,72 @@
package com.chwl.core.module_hall.im;
import androidx.annotation.Keep;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import lombok.Data;
/**
* Created by lvzebiao on 2019/1/8.
*/
@Keep
@Data
public class FamilyImMsgInfo implements Serializable{
/**
* 已过期
*/
public final static int MSG_TYPE_OUT_OF_DATE = 1;
/**
* 已处理
*/
public final static int MSG_TYPE_HAS_HANDLE = 2;
/**
* 已同意
*/
public final static int MSG_TYPE_HAS_AGREE = 3;
/**
* 已拒绝
*/
public final static int MSG_TYPE_HAS_REJECT = 4;
private String url;
private int type;
/**后台给的显示内容*/
private String layout;
/**{@link com.chwl.core.im.custom.bean.RouterType}*/
private int routerType;
private String routerValue;
public static Map<String, Object> convertToMap(FamilyImMsgInfo info) {
Map<String, Object> localExtension = new HashMap<>();
localExtension.put("url", info.getUrl());
localExtension.put("type", info.getType());
localExtension.put("layout", info.getLayout());
localExtension.put("routerType", info.getRouterType());
localExtension.put("routerValue", info.getRouterValue());
return localExtension;
}
public static FamilyImMsgInfo convertMapToObject(Map<String, Object> localExtension) {
FamilyImMsgInfo info = new FamilyImMsgInfo();
if (localExtension != null) {
info.setUrl((String) localExtension.get("url"));
info.setType((Integer) localExtension.get("type"));
info.setLayout((String) localExtension.get("layout"));
Object routerType = localExtension.get("routerType");
if (routerType != null) {
info.setRouterType((Integer) routerType);
}
Object routerValue = localExtension.get("routerValue");
if (routerValue != null) {
info.setRouterValue((String) routerValue);
}
}
return info;
}
}