AbstractSendMessage.java 2.67 KB
package com.yoho.message.sdk.service;

import java.util.Arrays;
import java.util.List;

import com.yoho.message.sdk.common.model.MessageCenterCommonEvent;

/**
 * 
 * <Description> 通用类<br>
 * 
 * @author amos.shan<br>
 * @version 1.0<br>
 * @taskId <br>
 * @CreateDate 2016年12月22日 <br>
 */
public abstract class AbstractSendMessage {
	public static final int PAGE_SIZE = 1000;

	public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey, String uid) {
		List<String> uids = Arrays.asList(uid);
		return new MessageCenterCommonEvent(sendScene, sendSceneKey, uids);
	}

	public MessageCenterCommonEvent genMessageCenterCommonEventPublicCode(String sendScene, String sendSceneKey,int publicNumberCode, String uid) {
		List<String> uids = Arrays.asList(uid);
		MessageCenterCommonEvent messageCenterCommonEvent = new MessageCenterCommonEvent(sendScene, sendSceneKey, uids);
		messageCenterCommonEvent.setPublicNumberCode(publicNumberCode);
		return messageCenterCommonEvent;
	}


	public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey, int miniappType, String uid) {
		List<String> uids = Arrays.asList(uid);

		// 原来用 miniappFlg = 1 or 0 来标识是否是小程序
		// 为了支持多小程序,miniappType (miniappFlg=1 实际上是 miniappType=0的小程序)
		// 其他的 miniappFlg = miniappType
		if (miniappType == 1){
			miniappType = 0;
		}
		return new MessageCenterCommonEvent(sendScene, sendSceneKey, miniappType, uids);
	}

	public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey, int miniappType, int publicNumberCode, String uid) {
		List<String> uids = Arrays.asList(uid);

		// 原来用 miniappFlg = 1 or 0 来标识是否是小程序
		// 为了支持多小程序,miniappType (miniappFlg=1 实际上是 miniappType=0的小程序)
		// 其他的 miniappFlg = miniappType
		if (miniappType == 1){
			miniappType = 0;
		}
		return new MessageCenterCommonEvent(sendScene, sendSceneKey, miniappType, publicNumberCode, uids);
	}


	public MessageCenterCommonEvent genMessageCenterCommonEvent(String sendScene, String sendSceneKey, int miniappType, int publicNumberCode, List<String> uids) {

		// 原来用 miniappFlg = 1 or 0 来标识是否是小程序
		// 为了支持多小程序,miniappType (miniappFlg=1 实际上是 miniappType=0的小程序)
		// 其他的 miniappFlg = miniappType
		if (miniappType == 1){
			miniappType = 0;
		}
		MessageCenterCommonEvent messageCenterCommonEvent = new MessageCenterCommonEvent(sendScene, sendSceneKey, miniappType, uids);
		messageCenterCommonEvent.setPublicNumberCode(publicNumberCode);
		return messageCenterCommonEvent;
	}


}