首页>代码>java web酒店后台管理系统代码下载>/JavaPrj_9/src/com/hotelmaster/action/CheckoutController.java
package com.hotelmaster.action;

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

import org.apache.log4j.Logger;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.hotelmaster.home.web.util.BalancementUtil;
import com.hotelmaster.po.Balancement;
import com.hotelmaster.po.Guest;
import com.hotelmaster.po.GuestHistory;
import com.hotelmaster.service.BusinessService;

public class CheckoutController extends MultiActionController{
	private final static Logger log = Logger.getLogger(CheckinController.class);
	private BusinessService businessService;
	
	public ModelAndView init(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	}
	/**
	 * 
	 * 生成结账单信息 更新登记单 客史资料
	 *
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ModelAndView checkout(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		request.setCharacterEncoding("UTF-8"); 				//设置请求编码格式
		response.setContentType("text/json;charset=utf-8"); //设置响应文本格式
		String cioGuestCardId = null;						//客户证件号码
		if(request.getParameter("cioGuestCardId")!=null){	//判断客户证件号码是否为空
			cioGuestCardId=(String)request.
					getParameter("cioGuestCardId").trim();	//获得客户证件号码
		}
		Guest guest = businessService.
						findGuestByGtCardId(cioGuestCardId);//查找客户信息
		String gtId = guest.getGtId();						//获得客户编号	
		Balancement balancement=BalancementUtil.
							createBalancement(request,gtId);//设置结账信息
		String bmId = businessService.
						createBalancement(balancement);		//保存结账信息
		GuestHistory guestHistroy = BalancementUtil.
						createGuestHistory(request,bmId,gtId);//设置客户记录信息
		businessService.createGuestHistory(guestHistroy);	//保存客户记录信息
        response.getWriter().write("{success: true}");		//输出成功信息
		return null;
	}
	public BusinessService getBusinessService() {
		return businessService;
	}

	public void setBusinessService(BusinessService businessService) {
		this.businessService = businessService;
	}
	
}
最近下载更多
微笑刺客  LV21 2024年11月25日
张泽帅  LV6 2024年10月17日
不不要  LV1 2024年5月15日
rrya58  LV1 2024年5月12日
微信网友_6906962132258816  LV7 2024年4月15日
大大大大大大D  LV2 2024年1月3日
12345678aaa  LV1 2023年12月19日
2741658843  LV1 2023年12月15日
sworduhan  LV1 2023年12月9日
asdfasfs12321  LV1 2023年10月25日
最近浏览更多
唐唐丶  LV34 2月17日
srl2881552  LV10 1月7日
2602275348  LV12 2024年12月24日
拜托你仔细听  LV3 2024年12月23日
微笑刺客  LV21 2024年11月25日
ww6688 2024年11月22日
暂无贡献等级
张泽帅  LV6 2024年10月17日
shunlun8855  LV1 2024年10月14日
DelinDelin 2024年8月3日
暂无贡献等级
是数据库  LV3 2024年7月31日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友