保存进度!
This commit is contained in:
		@@ -1,20 +0,0 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.wechat.common;
 | 
			
		||||
 | 
			
		||||
public class PushMessage {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 向公众号推送通知消息。接口文档参考 彭奕洁 编写《消息发送接口调用文档》
 | 
			
		||||
     * @param url 公众号接口网址。
 | 
			
		||||
     * @param title 通知的标题。
 | 
			
		||||
     * @param notifyType 通知类型。
 | 
			
		||||
     * @param notifyMessage 通知文本内容。
 | 
			
		||||
     */
 | 
			
		||||
    public static void PushNotifyMessage( String url,
 | 
			
		||||
                                          String title,
 | 
			
		||||
                                          String notifyType,
 | 
			
		||||
                                          String notifyMessage )
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,210 @@
 | 
			
		||||
 | 
			
		||||
package com.cpic.xim.wechat.officalAccount;
 | 
			
		||||
 | 
			
		||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
			
		||||
import com.fasterxml.jackson.core.JsonProcessingException;
 | 
			
		||||
import com.fasterxml.jackson.databind.ObjectMapper;
 | 
			
		||||
 | 
			
		||||
public class PushMessage
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 向公众号推送通知消息。接口文档参考 彭奕洁 编写《消息发送接口调用文档》
 | 
			
		||||
     *
 | 
			
		||||
     * @param wechatOfficalAccountURL 公众号接口网址。
 | 
			
		||||
     * @param title                   通知的标题。
 | 
			
		||||
     * @param notifyType              通知类型。
 | 
			
		||||
     * @param notifyMessage           通知文本内容。
 | 
			
		||||
     */
 | 
			
		||||
    public static void PushNotifyMessage( String wechatOfficalAccountURL,
 | 
			
		||||
                                          String title,
 | 
			
		||||
                                          String notifyType,
 | 
			
		||||
                                          String notifyMessage )
 | 
			
		||||
 | 
			
		||||
    {
 | 
			
		||||
        WechatOfficalAccountMessageParameter param = new WechatOfficalAccountMessageParameter();
 | 
			
		||||
 | 
			
		||||
        //param.setUrl( url );
 | 
			
		||||
        param.setFirst( title );
 | 
			
		||||
        param.setKeyword1( notifyType );
 | 
			
		||||
        param.setKeyword1Color( "#ff000000" );
 | 
			
		||||
        param.setKeyword2( notifyMessage );
 | 
			
		||||
 | 
			
		||||
        ObjectMapper mapper = new ObjectMapper();
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            String json = mapper.writeValueAsString( param );
 | 
			
		||||
        }
 | 
			
		||||
        catch ( JsonProcessingException error )
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class WechatOfficalAccountMessageParameter
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    WechatOfficalAccountMessageParameter()
 | 
			
		||||
    {
 | 
			
		||||
        tplID   = 57;
 | 
			
		||||
        groupID = 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("tplid")
 | 
			
		||||
    private int tplID;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("groupid")
 | 
			
		||||
    private int groupID;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("first")
 | 
			
		||||
    private String first;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("keyword1")
 | 
			
		||||
    private String keyword1;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("keyword1color")
 | 
			
		||||
    private String keyword1Color;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("keyword2")
 | 
			
		||||
    private String keyword2;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("keyword2color")
 | 
			
		||||
    private String keyword2Color;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("remark")
 | 
			
		||||
    private String remark;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("remarkcolor")
 | 
			
		||||
    private String remarkColor;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("url")
 | 
			
		||||
    private String url;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("appid")
 | 
			
		||||
    private String appid;
 | 
			
		||||
 | 
			
		||||
    @JsonProperty("pagepath")
 | 
			
		||||
    private String pagePath;
 | 
			
		||||
 | 
			
		||||
    public int getTplID()
 | 
			
		||||
    {
 | 
			
		||||
        return tplID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setTplID( int tplID )
 | 
			
		||||
    {
 | 
			
		||||
        this.tplID = tplID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getGroupID()
 | 
			
		||||
    {
 | 
			
		||||
        return groupID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setGroupID( int groupID )
 | 
			
		||||
    {
 | 
			
		||||
        this.groupID = groupID;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getFirst()
 | 
			
		||||
    {
 | 
			
		||||
        return first;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setFirst( String first )
 | 
			
		||||
    {
 | 
			
		||||
        this.first = first;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getKeyword1()
 | 
			
		||||
    {
 | 
			
		||||
        return keyword1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setKeyword1( String keyword1 )
 | 
			
		||||
    {
 | 
			
		||||
        this.keyword1 = keyword1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getKeyword1Color()
 | 
			
		||||
    {
 | 
			
		||||
        return keyword1Color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setKeyword1Color( String keyword1Color )
 | 
			
		||||
    {
 | 
			
		||||
        this.keyword1Color = keyword1Color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getKeyword2()
 | 
			
		||||
    {
 | 
			
		||||
        return keyword2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setKeyword2( String keyword2 )
 | 
			
		||||
    {
 | 
			
		||||
        this.keyword2 = keyword2;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getKeyword2Color()
 | 
			
		||||
    {
 | 
			
		||||
        return keyword2Color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setKeyword2Color( String keyword2Color )
 | 
			
		||||
    {
 | 
			
		||||
        this.keyword2Color = keyword2Color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getRemark()
 | 
			
		||||
    {
 | 
			
		||||
        return remark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRemark( String remark )
 | 
			
		||||
    {
 | 
			
		||||
        this.remark = remark;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getRemarkColor()
 | 
			
		||||
    {
 | 
			
		||||
        return remarkColor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setRemarkColor( String remarkColor )
 | 
			
		||||
    {
 | 
			
		||||
        this.remarkColor = remarkColor;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getUrl()
 | 
			
		||||
    {
 | 
			
		||||
        return url;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setUrl( String url )
 | 
			
		||||
    {
 | 
			
		||||
        this.url = url;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getAppid()
 | 
			
		||||
    {
 | 
			
		||||
        return appid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setAppid( String appid )
 | 
			
		||||
    {
 | 
			
		||||
        this.appid = appid;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public String getPagePath()
 | 
			
		||||
    {
 | 
			
		||||
        return pagePath;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void setPagePath( String pagePath )
 | 
			
		||||
    {
 | 
			
		||||
        this.pagePath = pagePath;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user