feat(server): generalMessageReq add appClient

This commit is contained in:
金海洋 2023-08-11 14:59:48 +08:00
parent bf93c42afe
commit 7d3ad7b7af
5 changed files with 24 additions and 11 deletions

View File

@ -149,7 +149,7 @@ public class MessageRecordServiceImpl implements MessageRecordService {
public void asyncPushAthena(GeneralMessageReq message, String audioFileName, String moduleName,
List<MessageRecord> pushMessages) {
sendMessage(message.getRelationId(), audioFileName,
moduleName, pushMessages, message.getRouterParams());
moduleName, pushMessages, message.getRouterParams(), message.getAppClient());
}
@ -211,7 +211,7 @@ public class MessageRecordServiceImpl implements MessageRecordService {
* @param audioFileName 语音文件
*/
private void sendMessage(Long relationId, String audioFileName, String moduleName,
List<MessageRecord> pushMessages, Map<String, String> routerParams) {
List<MessageRecord> pushMessages, Map<String, String> routerParams, String appClient) {
ArrayList<MsgRouteTypeEnum> msgRouteTypeEnums = Lists.newArrayList(MsgRouteTypeEnum.ANDROID,
MsgRouteTypeEnum.IOS, MsgRouteTypeEnum.MINI_PROGRAM, MsgRouteTypeEnum.WEBVIEW);
@ -222,6 +222,7 @@ public class MessageRecordServiceImpl implements MessageRecordService {
imMessage.setTy(0);
imMessage.setF("0");
imMessage.setNickName(moduleName);
imMessage.setAppClient(appClient);
pushMessages.forEach(item -> {
String toId = buildToId(item.getToId(), item.getPersonId(), item.getReceiveType(), item.getBizId());
imMessage.setT(toId);

View File

@ -14,6 +14,8 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Objects;
/**
* 友盟推送服务
*/
@ -162,12 +164,11 @@ public class UpushService {
public void sendAndroidCustomizedcast(Message message, MsgBody4Guest msgFromClient)
throws Exception {
AndroidCustomizedcast customizedcast;
if (message.getToId().startsWith("cmp")) {
AndroidCustomizedcast customizedcast = new AndroidCustomizedcast(cmAndroidAppkey, cmAndroidSecret);
if ("cmp".equals(msgFromClient.getAppClient())) {
customizedcast = new AndroidCustomizedcast(cmpAndroidAppkey, cmpAndroidSecret);
} else {
customizedcast = new AndroidCustomizedcast(cmAndroidAppkey, cmAndroidSecret);
}
// TODO Set your alias here, and use comma to split them if there are multiple alias.
// And if you have many alias, you can also upload a file containing these alias, then
// use file_id to send customized notification.
@ -220,13 +221,11 @@ public class UpushService {
public void sendIOSCustomizedcast(Message message, MsgBody4Guest msgFromClient)
throws Exception {
IOSCustomizedcast customizedcast;
if (message.getToId().startsWith("cmp")) {
IOSCustomizedcast customizedcast = new IOSCustomizedcast(cmIosAppkey, cmIosSecret);;
if ("cmp".equals(msgFromClient.getAppClient())) {
customizedcast = new IOSCustomizedcast(cmpIosAppkey, cmpIosSecret);
} else {
customizedcast = new IOSCustomizedcast(cmIosAppkey, cmIosSecret);
}
// TODO Set your alias here, and use comma to split them if there are multiple alias.
// And if you have many alias, you can also upload a file containing these alias, then
// use file_id to send customized notification.

View File

@ -2,6 +2,7 @@ package cn.axzo.msg.center.api.request;
import cn.axzo.msg.center.api.enums.MsgRecordTerminalTypeEnum;
import cn.axzo.msg.center.api.enums.ReceiveTypeEnum;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@ -67,5 +68,10 @@ public class GeneralMessageReq extends AbstractMessage implements Serializable {
public void setTerminalId(Long terminalId) {
this.terminalId = terminalId < 1 ? 0 : terminalId;
}
/**
* appClient cmp, cm
*/
public String appClient;
}

View File

@ -47,4 +47,9 @@ public class MsgBody4Guest {
*/
private Integer ty;
private String userAvatarFileName;
/**
* appClient : cmp: 管理端 cm: 工人
*/
public String appClient;
}

View File

@ -44,4 +44,6 @@ public class MsgBody4GuestDTO {
*/
private Integer ty;
private String userAvatarFileName;
private String appClient;
}