⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 merchantbizgroupjoinaction.java

📁 基于struts的网上商店源码
💻 JAVA
字号:
/*
 * 作者:刘云云
 * 时间:2007年11月28日
 * 功能: 处理商家的商圈请求
 * 
 */
package com.mole.struts.action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

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.MerchantBizGroupJoinBean;
import com.mole.struts.dao.MerchantBizGroupJoinDAO;
import com.mole.struts.form.MerchantBizGroupJoinForm;

/**
 * MyEclipse Struts Creation date: 11-26-2007
 * 
 * XDoclet definition:
 * 
 * @struts.action path="/merchantJoinBizGroup" name="merchantJoinBizGroupForm"
 *                input="/form/merchantJoinBizGroup.jsp" scope="request"
 *                validate="true"
 */
public class MerchantBizGroupJoinAction 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");
		HttpSession session = request.getSession();
		String action = request.getParameter("action");
		MerchantBizGroupJoinDAO dao = new MerchantBizGroupJoinDAO();
		if (action == null || action.equals("show")) {// 获取显示商圈请求的页面
			String tig = request.getParameter("tig");
			request.setAttribute("tig", tig);
			String id = request.getParameter("id");
			String sql = "SELECT Name,storeTypeName,cityName,areaName,description,joinDate,ID"
					+ ",ISNULL(typeName2,''),ISNULL(typeName3,''),ISNULL(typeName4,'') FROM v_bizgroupAppMember "
					+ " WHERE bizgroupID=" + id;
			MerchantBizGroupJoinBean[] records = dao.getBizGroupMember(sql);
			request.setAttribute("result", records);
			return mapping.findForward("goMerchantBizGroupJoinDeal");

		} else if (action.equals("apply")) {// 获取发起商圈请求的页面
			String id = request.getParameter("id");
			request.setAttribute("id", id);

			String pageAction = request.getParameter("pageAction");

			String sql = "select * from BizGroupMember where BizGroupID=" + id
					+ " and StoreID='" + storeId + "'";
			ArrayList<Object[]> checkOut = null;
			checkOut = dao.executeQuery(sql);
			if (checkOut.size() != 0) {
				session.setAttribute("message", "您可能已经申请过!");
				session.setAttribute("title", "错误信息");
				if (pageAction.equals("search")) {
					session.setAttribute("returnUrl",
							"merchantBizGroupSearch.do");
				} else if (pageAction.equals("favorite")) {
					session.setAttribute("returnUrl",
							"merchantBizGroupFavorite.do");
				} else {
					session.setAttribute("returnUrl", "null");
				}
				return mapping.findForward("goMessage");
			}
			return mapping.findForward("goMerchantBizGroupJoin");

		} else if (action.equals("join")) { // 发取商圈请求
			MerchantBizGroupJoinForm mbgjFrom = (MerchantBizGroupJoinForm) form;
			try {
				dao.executeJoinPro(mbgjFrom.getId(), storeId, mbgjFrom
						.getDescription());
			} catch (Exception e) {
				e.printStackTrace();
			}
			session.setAttribute("message", "申请成功");
			session.setAttribute("title", "申请信息");
			session.setAttribute("returnUrl",
					"merchantBizGroupAttend.do?page=0");
			return mapping.findForward("goMessage");

		} else if (action.equals("agree")) {// 同意商家的商圈请求
			String memberId = request.getParameter("memberId");
			String sql = "UPDATE BizGroupMember SET state=1 WHERE Id="
					+ memberId;
			dao.executeUpdate(sql);
			return new ActionForward("/merchantBizGroupJoin.do?action=show");

		} else if (action.equals("refuse")) {// 拒绝商家的商圈请求
			String memberId = request.getParameter("memberId");
			String sql = "UPDATE BizGroupMember SET state=3 WHERE Id="
					+ memberId;
			dao.executeUpdate(sql);
			return new ActionForward("/merchantBizGroupJoin.do?action=show");

		}
		return null;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -