📄 mmsbillmtquery.java
字号:
/*
* Created on 2005-10-31
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.rainbow.mms.queryservice;
import java.text.DateFormat;
import java.util.List;
import java.util.Date;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import com.opensymphony.webwork.ServletActionContext;
import com.opensymphony.xwork.Action;
import com.opensymphony.xwork.ActionContext;
import com.rainbow.mms.common.CMCCMM7SubmitMsg;
import com.rainbow.util.tools.HibernateUtil;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class MmsBillMtQuery implements Action {
/* (non-Javadoc)
* @see com.opensymphony.xwork.Action#execute()
*/
public String execute() throws Exception {
// TODO Auto-generated method stub
String mobile = ServletActionContext.getRequest().getParameter("mobile");
int gatewayId = Integer.parseInt(ServletActionContext.getRequest().getParameter("gatewayId"));
String beginTime = ServletActionContext.getRequest().getParameter("beginTime");
String endTime = ServletActionContext.getRequest().getParameter("endTime");
if (mobile == null || beginTime == null || endTime == null){
return ERROR;
}
DateFormat dateFormat= DateFormat.getDateInstance();
Date begin = dateFormat.parse(beginTime);
Date end = dateFormat.parse(endTime);
String result = ERROR;
//System.out.println("开始时间:"+beginTime);
//System.out.println("手机号码:"+mobile);
//System.out.println("开始时间:"+begin);
//System.out.println("结束时间:"+end);
//System.out.println("开始时间字符:"+begin);
List listResult = null;
try{
Session sess = HibernateUtil.currentSession();
Criteria cr = sess.createCriteria(CMCCMM7SubmitMsg.class);
listResult = cr.add(Restrictions.eq("gateWayID", new Integer(gatewayId))).
add(Restrictions.eq("dstNum", mobile.trim())).
add(Restrictions.between("actualSendTime", begin, end)).list();
result = SUCCESS;
ActionContext.getContext().getSession().put("listResult", listResult);
}
catch(Exception e){
e.printStackTrace();
result = ERROR;
}
finally{
HibernateUtil.closeSession();
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -