|  | @@ -7,6 +7,7 @@ import com.ym.mec.thirdparty.message.MessageSenderPlugin;
 | 
	
		
			
				|  |  |  import com.ym.mec.util.http.HttpUtil;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import org.apache.commons.codec.binary.Base64;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.InitializingBean;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -58,7 +59,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  	 * @param content 消息内容
 | 
	
		
			
				|  |  |  	 * @return json对象
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  | -	private JSONObject generateJson(String[] alias, String alert, String content, String url,String sound) {
 | 
	
		
			
				|  |  | +	private JSONObject generateJson(String[] alias, String alert, String content, String url,String sound,String channelId) {
 | 
	
		
			
				|  |  |  		JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  |  		JSONArray platform = new JSONArray();// 平台
 | 
	
		
			
				|  |  |  		platform.add("android");
 | 
	
	
		
			
				|  | @@ -75,6 +76,10 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  		JSONObject android = new JSONObject();// android通知内容
 | 
	
		
			
				|  |  |  		android.put("alert", alert);
 | 
	
		
			
				|  |  |  		android.put("sound", sound.split("\\.")[0]);
 | 
	
		
			
				|  |  | +		if(StringUtils.isNotEmpty(channelId)){
 | 
	
		
			
				|  |  | +			android.put("channelId",channelId);
 | 
	
		
			
				|  |  | +		}
 | 
	
		
			
				|  |  | +		android.put("distribution", "secondary_push");
 | 
	
		
			
				|  |  |  		android.put("builder_id", 1);
 | 
	
		
			
				|  |  |  		JSONObject android_extras = new JSONObject();// android额外参数
 | 
	
		
			
				|  |  |  		android_extras.put("type", "infomation");
 | 
	
	
		
			
				|  | @@ -118,7 +123,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  	 * @param alert 推送消息
 | 
	
		
			
				|  |  |  	 * @param content 推送内容
 | 
	
		
			
				|  |  |  	 */
 | 
	
		
			
				|  |  | -	private String push(String[] alias, String alert, String content, String url,String type,String sound) {
 | 
	
		
			
				|  |  | +	private String push(String[] alias, String alert, String content, String url,String type,String sound,String channelId) {
 | 
	
		
			
				|  |  |  		String base64_auth_string = "";
 | 
	
		
			
				|  |  |  		switch (type){
 | 
	
		
			
				|  |  |  			case "STUDENT":
 | 
	
	
		
			
				|  | @@ -132,7 +137,7 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  				break;
 | 
	
		
			
				|  |  |  		}
 | 
	
		
			
				|  |  |  		String authorization = "Basic " + base64_auth_string;
 | 
	
		
			
				|  |  | -		return sendPostRequest(generateJson(alias, alert, content, url,sound).toString(), authorization);
 | 
	
		
			
				|  |  | +		return sendPostRequest(generateJson(alias, alert, content, url,sound,channelId).toString(), authorization);
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	/**
 | 
	
	
		
			
				|  | @@ -178,9 +183,9 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  | -	public boolean send(String subject, String content, String receiver, String url, String type,String sound) throws IOException {
 | 
	
		
			
				|  |  | +	public boolean send(String subject, String content, String receiver, String url, String type,String sound,String channelId) throws IOException {
 | 
	
		
			
				|  |  |  		String[] alias = { receiver };
 | 
	
		
			
				|  |  | -		String result = this.push(alias, subject, content, url,type,sound);
 | 
	
		
			
				|  |  | +		String result = this.push(alias, subject, content, url,type,sound,channelId);
 | 
	
		
			
				|  |  |  		JSONObject json = JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |  		if (json.containsKey("error")) {
 | 
	
		
			
				|  |  |  			JSONObject jsonObject = json.getJSONObject("error");
 | 
	
	
		
			
				|  | @@ -190,8 +195,8 @@ public class JiguangPushPlugin implements MessageSenderPlugin, InitializingBean
 | 
	
		
			
				|  |  |  	}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  	@Override
 | 
	
		
			
				|  |  | -	public boolean batchSend(String subject, String content, String[] receivers, String url, String type,String sound) throws IOException {
 | 
	
		
			
				|  |  | -		String result = this.push(receivers, subject, content, url,type,sound);
 | 
	
		
			
				|  |  | +	public boolean batchSend(String subject, String content, String[] receivers, String url, String type,String sound,String channelId) throws IOException {
 | 
	
		
			
				|  |  | +		String result = this.push(receivers, subject, content, url,type,sound,channelId);
 | 
	
		
			
				|  |  |  		JSONObject json = JSONObject.parseObject(result);
 | 
	
		
			
				|  |  |  		if (json.containsKey("error")) {
 | 
	
		
			
				|  |  |  			JSONObject jsonObject = json.getJSONObject("error");
 |