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

📄 showuserdayaction.java

📁 上网计费系统,适用网吧或者自己学习用用JAVA写成
💻 JAVA
字号:
/*
 * Generated by MyEclipse Struts
 * Template path: templates/java/JavaClass.vtl
 */
package com.briup.web.action;

import java.util.Iterator;
import java.util.List;

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

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.briup.dao.bean.Radcheck;
import com.briup.dao.bean.Userday;
import com.briup.service.IService;
import com.briup.util.BeanFactory;
import com.briup.web.form.ShowUserMonthForm;

/**
 * MyEclipse Struts Creation date: 03-23-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/showUserMonth" name="showUserMonthForm"
 *                input="/admin/billing/month.jsp" scope="request"
 * @struts.action-forward name="failed" path="/admin/billing/month.jsp"
 * @struts.action-forward name="success"
 *                        path="/admin/billing/listBusinessMonth.jsp"
 */
public class ShowUserDayAction extends Action {
	/*
	 * Generated Methods
	 */

	/**
	 * Method execute
	 * 
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return ActionForward
	 */
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ShowUserMonthForm showUserMonthForm = (ShowUserMonthForm) form;
		String year = showUserMonthForm.getYear();
		String month = showUserMonthForm.getMonth();
		String day = showUserMonthForm.getDay();
		String name = showUserMonthForm.getBusinessName();
		List userdays = null;
		Radcheck radcheck = null;
		Double totalTime = 0D;
		Double totalFlux = 0D;
		Double totalFee = 0D;
		try {
			IService iService = BeanFactory.getService();
			List lreturn = iService.showUserDay(name, year, month, day);
			if (lreturn.size() >= 2) {
				radcheck = (Radcheck) lreturn.get(0);
				userdays = (List) lreturn.get(1);
				Long productType = radcheck.getProduct().getProductType()
						.getId();
				Iterator iter = userdays.iterator();
				while (iter.hasNext()) {
					Userday userday = (Userday) iter.next();
					totalTime += userday.getTimeDuration();
					totalFlux += userday.getFlux();
				}
				// 按月租收费
				if (productType == 1) {
					totalFee = radcheck.getProduct().getBaseFee()
							* userdays.size();
					// 按小时收费
				} else if (productType == 2) {
					totalFee = totalTime * radcheck.getProduct().getRateFee();
					// 按流量收费
				} else if (productType == 3) {
					totalFee = totalFlux * radcheck.getProduct().getSfee();
				} else if (productType == 4) {
					totalFee = radcheck.getProduct().getBaseFee()
							* userdays.size() + totalTime
							* radcheck.getProduct().getRateFee();
				}
			}

		} catch (Exception e) {
			e.printStackTrace();
			request.setAttribute("message", e.getMessage());
			return mapping.findForward("failed");
		}
		request.setAttribute("totalTime", totalTime);
		request.setAttribute("totalFlux", totalFlux);
		request.setAttribute("totalFee", totalFee);
		request.setAttribute("radcheck", radcheck);
		request.setAttribute("usermonths", userdays);
		return mapping.findForward("success");
	}
}

⌨️ 快捷键说明

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