package cn.hmsoft.weixin.processor;

import cn.hmsoft.weixin.entity.message.TextMessage;
import cn.hmsoft.weixin.entity.reply.TextReply;
import cn.hmsoft.weixin.entity.reply.WeiXinReply;
import cn.hmsoft.weixin.util.WeiXinParamUtil;

public class TextProcessor extends AbstractProcessor<TextMessage> {

	@Override
	protected WeiXinReply handle() throws Exception {
		String msg = this.jsonEntity.getContent();
		if (wxDefine.getMsgReplyMap().containsKey(msg)) {
			TextReply reply = new TextReply();
			reply.setContent(wxDefine.getMsgReplyMap().get(msg));
			return reply;
		} 
		if(wxDefine.getMsgReplyMap().containsKey(WeiXinParamUtil.MsgReplyDefault)){
			TextReply reply = new TextReply();
			reply.setContent(wxDefine.getMsgReplyMap().get(WeiXinParamUtil.MsgReplyDefault));
			return reply;
		}
		return null;
	}
}
