📄 acceptoperationaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.jn0801.operation.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.beanutils.BeanUtils;
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.common.UserInfo;
import com.jn0801.grademanage.GradeDealIFC;
import com.jn0801.login.systemuser.SystemuserBean;
import com.jn0801.operation.Acceptoperation;
import com.jn0801.operation.AcceptoperationIFC;
import com.jn0801.operation.form.AcceptoperationForm;
import com.jn0801.phonefeeinfo.PhoneinfoIFC;
import com.jn0801.phonefeeinfo.phoneinfo;
/**
* 业务受理的Action Creation date: 08-14-2008
*
* XDoclet definition:
*
* @struts.action path="/acceptoper" name="acceptoperationForm"
* input="/form/acceptoperation.jsp" scope="request"
* validate="true"
*/
public class AcceptoperationAction extends DispatchAction {
private AcceptoperationIFC acceptoperationIFC;
private GradeDealIFC gradeDeal;
private PhoneinfoIFC phoneinfo;
public PhoneinfoIFC getPhoneinfo() {
return phoneinfo;
}
public void setPhoneinfo(PhoneinfoIFC phoneinfo) {
this.phoneinfo = phoneinfo;
}
public GradeDealIFC getGradeDeal() {
return gradeDeal;
}
public void setGradeDeal(GradeDealIFC gradeDeal) {
this.gradeDeal = gradeDeal;
}
/**
* Method execute 写入业务受理表Action
*
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward saveAccept(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
AcceptoperationForm acceptoperationForm = (AcceptoperationForm) form;
Acceptoperation acceptoperation = new Acceptoperation();
boolean tag = true;
boolean take = true;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
String accepttime = format.format(new Date()); // 取出当前系统日期
HttpSession session = request.getSession();
SystemuserBean userBean = (SystemuserBean) session.getAttribute("userbean");//取出取用户ID
int emnid = userBean.getRealname();//取出用户ID
try {
BeanUtils.copyProperties(acceptoperation, acceptoperationForm);
} catch (Exception e) {
// TODO: handle exception
}
acceptoperation.setAccepttime(accepttime);
acceptoperation.setEmnid(new Long(emnid));
String phone = acceptoperation.getUserid().toString();// 取出用户ID;
take = this.gradeDeal.isExist(phone);
PrintWriter out = null;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
if (take == false) {
out.println("<script>" + "alert('对不起该用户号码不存在');"
+ "window.history.back();" + "</script>");
} else {
tag = this.acceptoperationIFC.saveAcceptoperation(acceptoperation);
if (tag == true) {
out.println("<script>alert('" + "业务受理已经提交成功"
+ "');window.location.href='"
+ request.getContextPath() + "/operation.do"
+ "';</script>");
} else {
out.println("<script>" + "alert('对不起业务受理提交失败');"
+ "window.history.back();" + "</script>");
}
}
return null;
}
/**
* 检查立即开机条件Action
*
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward checkDredge(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException {
UserInfo userInfo = new UserInfo();
phoneinfo phonebean = new phoneinfo();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
String bootstrap = format.format(new Date()); // 取出当前系统日期
PrintWriter out = null;
boolean take = true;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
String phone = request.getParameter("userid");// 取出用户ID
take = this.gradeDeal.isExist(phone);
if (take == false) {
out.println("<script>" + "alert('对不起该用户号码不存在');window.location.href='"
+ request.getContextPath() + "/operation.do?"
+ "';</script>");
} else {
userInfo = this.gradeDeal.selectuser(phone,new Long(-1),null);// 取出该用户的全部信息
if (userInfo.getBootstrap() == null) {// 判断用户是否开通了此项业务
userInfo.setBootstrap(bootstrap);
this.gradeDeal.update(userInfo);
out.println("<script>alert('" + "该用户可以开通本业务"
+ "');window.location.href='"
+ request.getContextPath() + "/operation.do?"
+ "';</script>");
} else {
if (userInfo.getBootstrap().equals(bootstrap)) {// 如果用户已经开通此项业务则判断是不是在同一个月内开通,如不是在同月则判断该用户是否欠费
out.println("<script>alert('" + "该用户本月已经开通本业务,不能继续开通!"
+ "');window.location.href='"
+ request.getContextPath() + "/operation.do?"
+ "';</script>");
} else {
Long userid = userInfo.getUserid();// 用户ID
String mdate = bootstrap;// 当前系统日期
phonebean = this.phoneinfo.selectphoneinfo(userid, mdate);// 取出该用户的费用信息
if ((phonebean.getPrepay() - phonebean.getMoney()) < 0) {
out.println("<script>alert('" + "该用户已经欠费,需补足费用后开通本业务!"
+ "');window.location.href='"
+ request.getContextPath() + "/operation.do?"
+ "';</script>");
} else {
out.println("<script>alert('" + "该用户可以开通本业务"
+ "');window.location.href='"
+ request.getContextPath() + "/operation.do?"
+ "';</script>");
}
}
}
}
return null;
}
/**
* 检查用户授信金额的Action
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward checkCredit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserInfo userInfo = new UserInfo();
String phone = request.getParameter("userid");// 取出用户ID
PrintWriter out = null;
PrintWriter pw = response.getWriter();
boolean take = true;
String overdraft = "";
String meg = "";
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
take = this.gradeDeal.isExist(phone);
if (take == false) {
meg="对不起该用户号码不能为空或者号码不存在!";
out.print(meg);
out.flush();
} else {
userInfo = this.gradeDeal.selectuser(phone,new Long(-1),null);
if(userInfo.getIsmember()==1){//判断该用户是否为会员
if(userInfo.getUsergrade().equals("银卡")){
overdraft = "50";
}
if (userInfo.getUsergrade().equals("金卡")){
overdraft = "80";
}
if (userInfo.getUsergrade().equals("钻石卡")){
overdraft = "100";
}
out.print(overdraft);
out.flush();
}
else{
meg="该用户不能使用本服务";
out.print(meg);
out.flush();
}
}
return null;
}
/**
* 显示用户旧的信息(地址,邮编,联系电话)
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward changedemandinfo(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserInfo userInfo = new UserInfo();
String phone = request.getParameter("userid");// 取出用户ID
String mschangetype = request.getParameter("mschangetype");//取出变更的类型的值
PrintWriter out = null;
boolean take = true;
String meg = "";
String rs = "";
Long rs2;
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
take = this.gradeDeal.isExist(phone);
if (take == false) {
meg="对不起该用户号码不能为空或者号码不存在!";
out.print(meg);
out.flush();
} else {
userInfo = this.gradeDeal.selectuser(phone,new Long(-1),null);
if(mschangetype.equals("1")){
rs = userInfo.getPostaddress();
}
if(mschangetype.equals("2")){
rs = userInfo.getTel();
}
if(mschangetype.equals("3")){
rs2 = userInfo.getPostalcode();
out.print(rs2);
out.flush();
}
out.print(rs);
out.flush();
}
return null;
}
/**
* 检查用户是否能开通备卡激活服务
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward checkstandby(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserInfo userInfo = new UserInfo();
String phone = request.getParameter("userid");// 取出用户ID
PrintWriter out = null;
PrintWriter pw = response.getWriter();
boolean take = true;
String meg = "";
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
take = this.gradeDeal.isExist(phone);
if (take == false) {
meg="对不起该用户号码不能为空或者号码不存在!";
out.print(meg);
out.flush();
} else {
userInfo = this.gradeDeal.selectuser(phone,new Long(-1),null);
if(userInfo.getIsmember()==1){//判断该用户是否为会员
if (userInfo.getUsergrade().equals("钻石卡")){
meg = "该用户可以开通本业务!";
}
else{
meg="该用户不能使用本服务";
}
out.print(meg);
out.flush();
}
else{
meg="该用户不能使用本服务";
out.print(meg);
out.flush();
}
}
return null;
}
/**
* 检查用户是否能开通客户经理上门服务
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws IOException
*/
public ActionForward checkbespeak(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws IOException {
UserInfo userInfo = new UserInfo();
String phone = request.getParameter("userid");// 取出用户ID
PrintWriter out = null;
PrintWriter pw = response.getWriter();
boolean take = true;
String meg = "";
try {
out = response.getWriter();
} catch (IOException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
take = this.gradeDeal.isExist(phone);
if (take == false) {
meg="对不起该用户号码不能为空或者号码不存在!";
out.print(meg);
out.flush();
} else {
userInfo = this.gradeDeal.selectuser(phone,new Long(-1),null);
if(userInfo.getIsmember()==1){//判断该用户是否为会员
if (userInfo.getUsergrade().equals("钻石卡")){
meg = "该用户可以开通本业务!";
}
if(userInfo.getUsergrade().equals("金卡")){
meg = "该用户可以开通本业务!";
}
else{
meg="该用户不能使用本服务";
}
out.print(meg);
out.flush();
}
else{
meg="该用户不能使用本服务";
out.print(meg);
out.flush();
}
}
return null;
}
public AcceptoperationIFC getAcceptoperationIFC() {
return acceptoperationIFC;
}
public void setAcceptoperationIFC(AcceptoperationIFC acceptoperationIFC) {
this.acceptoperationIFC = acceptoperationIFC;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -