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

📄 insertmonthcustomconfigaction.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.MmsMonthCustomConfig;
import com.rainbow.util.tools.HibernateUtil;

/**
 * 新建包月定制业务的配置纪录
 * @author TrWorks
 */
public class InsertMonthCustomConfigAction  extends ActionSupport {
	private static final long serialVersionUID = 1L;

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

	public String execute() throws Exception {
		String result = ERROR;
		String mcId = ServletActionContext.getRequest().getParameter("mcId");
		String uniformId = ServletActionContext.getRequest().getParameter("uniformId");
		String gateWayId = ServletActionContext.getRequest().getParameter("gateWayId");
		String name = ServletActionContext.getRequest().getParameter("name");
		name = new String(name.getBytes("iso8859-1"), "GBK");
		String regContentID = ServletActionContext.getRequest().getParameter("regContentID");

		try{
			Session sess = HibernateUtil.currentSession();
			Transaction tx = sess.beginTransaction();
			MmsMonthCustomConfig mmsMonthCustomConfig = new MmsMonthCustomConfig();
			if(mcId != null)
			mmsMonthCustomConfig.setMcId(Integer.parseInt(mcId));
			if(uniformId != null)
			mmsMonthCustomConfig.setUniformId(Integer.parseInt(uniformId));
			if(gateWayId != null)
			mmsMonthCustomConfig.setGateWayId(Integer.parseInt(gateWayId));
			if(regContentID != null)
				mmsMonthCustomConfig.setRegContentID(Integer.parseInt(regContentID));
			mmsMonthCustomConfig.setName(name);			
			sess.save(mmsMonthCustomConfig);
			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 + -