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

📄 intergralmonthsearchaction.java

📁 自己制作的联通CRM,支持客户分类,管理,升级,积分管理等等..
💻 JAVA
字号:
package com.jn0801.intergral.detail;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.jn0801.intergral.Intergralinfo;

/**
 * 月度积分查询的Action类
 * 
 * @author jzh
 * 
 */
public class IntergralMonthSearchAction extends DispatchAction {

	// public ActionForward execute(ActionMapping mapping, ActionForm form,
	// HttpServletRequest request, HttpServletResponse response) {
	// IntergralMonthSearchForm intergralMonthSearchForm =
	// (IntergralMonthSearchForm) form;
	// return null;
	// }

	/**
	 * 显示月度查询界面
	 */
	public ActionForward show(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		List yearlist = new ArrayList();
		for(int i=2007;i<=2020;i++){
			Map map = new HashMap();
			map.put("year", i);
			yearlist.add(map);
		}
		request.setAttribute("yearlist", yearlist);
		
		List monthlist = new ArrayList();
		for(int i=1;i<=12;i++){
			Map map = new HashMap();
			String str = String.valueOf(i+100).substring(1);
			map.put("month", str);
			monthlist.add(map);		
		}
		request.setAttribute("monthlist", monthlist);
		
		
		return mapping.findForward("show");
	}
	
	/**
	 * 查询
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 */
	public ActionForward search(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		IntergralMonthSearchForm intergralMonthSearchForm 
				= (IntergralMonthSearchForm) form;
		
		//时间控件
		List yearlist = new ArrayList();
		for(int i=2007;i<=2020;i++){
			Map map = new HashMap();
			map.put("year", i);
			yearlist.add(map);
		}
		request.setAttribute("yearlist", yearlist);
		
		List monthlist = new ArrayList();
		for(int i=1;i<=12;i++){
			Map map = new HashMap();
			String str = String.valueOf(i+100).substring(1);
			map.put("month", str);
			monthlist.add(map);		
		}
		request.setAttribute("monthlist", monthlist);
		
		//接收页面数据
		String phone = intergralMonthSearchForm.getPhone();  //手机号码
		
		String year_start = intergralMonthSearchForm.getYear_start();
		String month_start = intergralMonthSearchForm.getMonth_start();
		String time_start = year_start + "-" + month_start;   //起始时间
		
		String year_end = intergralMonthSearchForm.getYear_end();
		String month_end = intergralMonthSearchForm.getMonth_end();
		String time_end = year_end + "-" + month_end;     //结束时间
		
		int intergral_start = intergralMonthSearchForm.getIntergral_start(); //起始积分
		int intergral_end = intergralMonthSearchForm.getIntergral_end();  //结束积分
		
		
		//查询积分
		IntergralSearchInf msi = new IntergralSearchImp();
		List<Intergralinfo> intergrallist = msi.searchIntergralByMonth(phone, time_start, time_end, intergral_start,intergral_end);
		
		Long t_phonefree = new Long(0); //话费合计
		Long t_consumeintergral = new Long(0);  //消费积分合计
		Long t_onlineintergral = new Long(0);  //在线积分合计
		
		for (Intergralinfo inter : intergrallist) {
			t_phonefree  = t_phonefree + inter.getPhonefree();
			t_consumeintergral = t_consumeintergral + inter.getConsumeintergral();
			t_onlineintergral = t_onlineintergral + inter.getOnlineintergral();
		}
		
		Long t_intergral = t_consumeintergral + t_onlineintergral;
		
		request.setAttribute("intergrallist", intergrallist);
		request.setAttribute("t_phonefree", t_phonefree);
		request.setAttribute("t_consumeintergral", t_consumeintergral);
		request.setAttribute("t_onlineintergral", t_onlineintergral);
		request.setAttribute("t_intergral", t_intergral);
		
		
		return mapping.findForward("show");
	}
	
	
	
	
	
	
	
	
	
	
	
}

⌨️ 快捷键说明

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