📄 addacountaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package unicom.action;
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 org.apache.struts.action.DynaActionForm;
import unicom.factory.*;
import unicom.bean.Account;
import unicom.service.IAccountService;
/**
* @author 陈才旭
* 日期:Apr 18, 2008
* 功能:低端action,用于处理增加手机账户
* 优点:
* 缺点:
* 建议:注意权限的空置问题
*/
public class AddAcountAction extends IdentityFilter {
//为指定手机号码指定账户
public boolean addAccount(ActionForm form)
{
DynaActionForm dynaForm = (DynaActionForm)form;
String mobileNumber = (String)dynaForm.get("mobileNumber");
String accountId = (String)dynaForm.get("accountId");
String accountName = (String)dynaForm.get("accountName");
String accountAddress =(String)dynaForm.get("accountAddress");
String accountCharge = (String)dynaForm.get("accountCharge");
Account account = new Account();
account.setId(accountId);
account.setName(accountName);
account.setAddress(accountAddress);
account.setBalance(Double.parseDouble(accountCharge));
//调用业务逻辑bean,完成为手机指定账户功能
IAccountService accountService = ServiceFactory.createAccountService();
return accountService.addAccount(account, mobileNumber);
}
//为指定手机号码指定账户
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
if(super.isAdminLogin(request))
{
if(addAccount(form))
{
request.setAttribute("msg", "恭喜!指定账户成功");
return mapping.findForward("msgpage");
}else{
request.setAttribute("msg", "系统正忙!稍后在试");
return mapping.findForward("msgpage");
}
}else{
if(super.isOperLogin(request))
{
if(addAccount(form))
{
request.setAttribute("msg", "恭喜!增加账户成功");
return mapping.findForward("msgOperpage");
}else{
request.setAttribute("msg", "系统正忙!稍后在试");
return mapping.findForward("msgOperpage");
}
}else{
request.setAttribute("msg", "你还未登录");
return mapping.findForward("index");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -