📄 showusermonthaction.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.Usermonth;
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 ShowUserMonthAction 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;// TODO
// Auto-generated
// method
// stub
String year = showUserMonthForm.getYear();
String month = showUserMonthForm.getMonth();
String name = showUserMonthForm.getBusinessName();
List usermonths = null;
Radcheck radcheck = null;
Double totalTime = 0D;
Double totalFlux = 0D;
Double totalFee = 0D;
try {
IService iService = BeanFactory.getService();
List lreturn = iService.showUserMonth(name, year, month);
if (lreturn.size() >= 2) {
radcheck = (Radcheck) lreturn.get(0);
usermonths = (List) lreturn.get(1);
Long productType = radcheck.getProduct().getProductType()
.getId();
Iterator iter = usermonths.iterator();
while (iter.hasNext()) {
Usermonth usermonth = (Usermonth) iter.next();
totalTime += usermonth.getTimeDuration();
totalFlux += usermonth.getFlux();
}
// 按月租收费
if (productType == 1) {
totalFee = radcheck.getProduct().getBaseFee()
* usermonths.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()
* usermonths.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", usermonths);
return mapping.findForward("success");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -