?? merchantvoucherprovideaction.java
字號:
/*
* 作者:劉云云
* 時間:2007年12月12日
* 功能:會員信息管理->發放優惠券。
*/
package com.mole.struts.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 com.mole.struts.bean.MerchantVoucherBean;
import com.mole.struts.dao.MerchantVoucherProvideDAO;
import com.mole.struts.form.MerchantVoucherProvideForm;
/**
* MyEclipse Struts Creation date: 12-12-2007
*
* XDoclet definition:
*
* @struts.action validate="true"
* @struts.action-forward name="goMerchantVoucherConsignProvide"
* path="/merchantVoucherConsignProvide.jsp"
*/
public class MerchantVoucherProvideAction 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) {
String storeId = (String) request.getSession().getAttribute("store");
MerchantVoucherProvideDAO dao = new MerchantVoucherProvideDAO();
String action = request.getParameter("action");
if (action == null || action.equals("owner")) {// 獲取發放本店優惠券頁面
String opp = request.getParameter("opp");
if (opp != null && opp.equals("ok")) {
MerchantVoucherProvideForm mpForm = (MerchantVoucherProvideForm) form;
try {
dao.executeProvideVoucherProcedure(storeId
+ mpForm.getCardId(), mpForm.getVoucherId(), mpForm
.getAmount());
} catch (Exception e) {
e.printStackTrace();
}
}
String sql = "SELECT ID,name,amount,discount FROM merchantVoucher WHERE storeID="
+ storeId + " AND type=0";
MerchantVoucherBean[] result = dao.getVoucherInfo(sql);
request.setAttribute("result", result);
request.setAttribute("pageAction", "owner");
return mapping.findForward("goMerchantVoucherProvide");
} else if (action.equals("consign")) {// 獲取發放代發優惠券頁面
String opp = request.getParameter("opp");
if (opp != null && opp.equals("ok")) {
MerchantVoucherProvideForm mpForm = (MerchantVoucherProvideForm) form;
try {
dao.executeProvideVoucherProcedure(storeId
+ mpForm.getCardId(), mpForm.getVoucherId(), mpForm
.getAmount());
} catch (Exception e) {
e.printStackTrace();
}
}
String sql = "SELECT ID,name,amount,discount FROM merchantVoucher WHERE id IN"
+ "( SELECT voucherID FROM bizGroupVoucher WHERE storeID="
+ storeId + ")";
MerchantVoucherBean[] result = dao.getVoucherInfo(sql);
request.setAttribute("result", result);
request.setAttribute("pageAction", "consign");
return mapping.findForward("goMerchantVoucherProvide");
}
return null;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -