📄 certifyinforegisteraction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package org.bestteam.web.struts.action;
import java.lang.reflect.InvocationTargetException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.actions.DispatchAction;
import org.bestteam.domain.ActualNameAttestation;
import org.bestteam.domain.CreditCard;
import org.bestteam.domain.PaymentCard;
import org.bestteam.domain.UserInfo;
import org.bestteam.service.RegisterService;
public class CertifyinfoRegisterAction extends DispatchAction {
private RegisterService registerService;
public void setRegisterService(RegisterService registerService) {
this.registerService = registerService;
}
public ActionForward certifyinfoRegister(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
UserInfo userinfo = new UserInfo();
try {
String actualName = (String) PropertyUtils.getProperty(form, "actualName");
String identityCard = (String) PropertyUtils.getProperty(form, "identityCard");
String telephone = (String) PropertyUtils.getProperty(form, "telephone");
String address = (String) PropertyUtils.getProperty(form, "address");
int userId = new Integer(session.getAttribute("userId").toString());
userinfo.setUserId(userId);
ActualNameAttestation atu = new ActualNameAttestation();
atu.setUserinfo(userinfo);
atu.setActualName(actualName);
atu.setAddress(address);
atu.setIdentityCard(identityCard);
atu.setTelephone(telephone);
registerService.registerActualNameAttestation(atu);
session.setAttribute("isActualName", "true");
} catch (IllegalAccessException e) {
request.setAttribute("errorMessage", "参数不正确");
request.setAttribute("forwardPage", "certifyinfoRegister.jsp");
e.printStackTrace();
return mapping.findForward("fail");
} catch (InvocationTargetException e) {
request.setAttribute("errorMessage", "参数不正确");
request.setAttribute("forwardPage", "certifyinfoRegister.jsp");
e.printStackTrace();
return mapping.findForward("fail");
} catch (NoSuchMethodException e) {
request.setAttribute("errorMessage", "参数不正确");
request.setAttribute("forwardPage", "certifyinfoRegister.jsp");
e.printStackTrace();
return mapping.findForward("fail");
}
request.setAttribute("Message", "注册实名认证成功");
request.setAttribute("forwardPage", "userinfo.jsp");
return mapping.findForward("success");
}
public ActionForward registerCreditcard(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ActionForward forward = mapping.findForward("failure");
try {
String cardId = (String) PropertyUtils.getProperty(form, "cardId");
System.out.println(cardId);
CreditCard creditCard = new CreditCard();
creditCard.setId(new Integer(cardId));
UserInfo userinfo = new UserInfo();
int userId = new Integer(request.getSession().getAttribute("userId").toString());
userinfo.setUserName(request.getSession().getAttribute("username").toString());
userinfo.setUserId(userId);
PaymentCard paymentCard = new PaymentCard();
paymentCard.setUserId(userId);
paymentCard.setCreditCard(creditCard);
boolean state = registerService.registerPaymentCard(paymentCard,userinfo);
if (!state){
request.setAttribute("message", "银行账号不存在,请检查后重新输入!");
forward = mapping.findForward("failure");
}
else{
forward = mapping.findForward("success");
request.getSession().setAttribute("isPayment", "true");
}
// request.getSession().setAttribute("paymentCardId", "");
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return forward;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -