⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 insertmmscommandaction.java

📁 MM7彩信对接网关示例
💻 JAVA
字号:
/*
 * 创建日期 2005-9-27
 *
 * TODO 要更改此生成的文件的模板,请转至
 * 窗口 - 首选项 - Java - 代码样式 - 代码模板
 */
package com.rainbow.mms.coremanage;

import org.apache.log4j.Logger;
import org.hibernate.Session;
import org.hibernate.Transaction;

import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.ActionSupport;
import com.rainbow.mms.common.MmsCommand;
import com.rainbow.util.tools.HibernateUtil;

/**
 * 新建路由信息的纪录
 * @author TrWorks
 */
public class InsertMmsCommandAction extends ActionSupport {
	private static final long serialVersionUID = 1L;

	private Logger log = Logger.getLogger(InsertMmsCommandAction.class);

	public String execute() throws Exception {
		String result = ERROR;
		String uniformServiceId = ServletActionContext.getRequest().getParameter("uniformServiceId");
		if (uniformServiceId == null || uniformServiceId.equals("")){
			uniformServiceId = ServletActionContext.getRequest().getParameter("uniformId2");
		}
		String gateWayId = ServletActionContext.getRequest().getParameter("gateWayId");
		String commandId = ServletActionContext.getRequest().getParameter("commandId");
		String commandType = ServletActionContext.getRequest().getParameter("commandType");
		String destTermId = ServletActionContext.getRequest().getParameter("destTermId");
		String termMatchFlag = ServletActionContext.getRequest().getParameter("termMatchFlag");
		String msgContent = ServletActionContext.getRequest().getParameter("msgContent");
		msgContent = new String(msgContent.getBytes("iso8859-1"), "GBK");
		String contentMatchFlag = ServletActionContext.getRequest().getParameter("contentMatchFlag");
		String procName = ServletActionContext.getRequest().getParameter("procName");
		procName = new String(procName.getBytes("iso8859-1"), "GBK");
		String srcBy = ServletActionContext.getRequest().getParameter("srcBy");
		String memo = ServletActionContext.getRequest().getParameter("memo");
		memo = new String(memo.getBytes("iso8859-1"), "GBK");
		String isReply = ServletActionContext.getRequest().getParameter("isReply");
		String sIsSmsMo = ServletActionContext.getRequest().getParameter("isSmsMo");

		try{
			Session sess = HibernateUtil.currentSession();
			Transaction tx = sess.beginTransaction();
			MmsCommand mmsCommand = new MmsCommand();
			if(uniformServiceId != null)
			mmsCommand.setUniformServiceId(Integer.parseInt(uniformServiceId));
			if(gateWayId != null)
			mmsCommand.setGateWayId(Integer.parseInt(gateWayId));
			if(commandId != null)
			mmsCommand.setCommandId(Integer.parseInt(commandId));
			mmsCommand.setCommandType(commandType);
			mmsCommand.setDestTermId(destTermId);
			if(termMatchFlag != null)
			mmsCommand.setTermMatchFlag(Integer.parseInt(termMatchFlag));
			mmsCommand.setMsgContent(msgContent);
			if(contentMatchFlag != null)
			mmsCommand.setContentMatchFlag(Integer.parseInt(contentMatchFlag));
			mmsCommand.setProcName(procName);
			if(srcBy != null)
			mmsCommand.setSrcBy(Integer.parseInt(srcBy));
			mmsCommand.setMemo(memo);
			if(isReply != null)
			mmsCommand.setIsReply(Integer.parseInt(isReply));
			if (sIsSmsMo != null){
				mmsCommand.setIsSmsMo(Integer.parseInt(sIsSmsMo));
			}
			else{
				mmsCommand.setIsSmsMo(0);
			}
	
			sess.save(mmsCommand);
			tx.commit();
			result = SUCCESS;
		}
		catch(Exception e){
			e.printStackTrace();
			log.error(e);
		}
		finally{
			HibernateUtil.closeSession();
		}

		return result;

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -