首页 前端知识 基于javaweb mysql的ssm酒店管理系统(java ssm jsp bootstrap echarts mysql)

基于javaweb mysql的ssm酒店管理系统(java ssm jsp bootstrap echarts mysql)

2024-08-08 22:08:02 前端知识 前端哥 23 662 我要收藏

基于javaweb+mysql的ssm酒店管理系统(java+ssm+jsp+bootstrap+echarts+mysql)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的SSM酒店管理系统(java+ssm+jsp+bootstrap+echarts+mysql)

项目介绍

本项目为基于ssm+mysql实现的JavaWeb酒店管理系统; 主要功能包括:

管理员登录,收入统计,客房管理,商品管理,客房预订,住宿登记,财务统计,旅客管理,接待对象管理等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:否;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jquery+bootstrap+echarts

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中jdbc.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
			teamPayVo.setDepositMoney(JyaJin);
			teamPayVo.setPayRepairMoney(JyingBuJinE);
			Gson gson=new Gson();
			
	       return gson.toJson(teamPayVo);
		}
	
	
/*--------------------------------------- 团队结账 end------------------------------------------------------------------*/		
	
	
	
	
	
	
	
	
	
	
	//转为散客
	@RequestMapping("/toshiftpersonage")
	public ModelAndView toshiftpersonage(Integer id,Integer stayregisterdetailsId){
		ModelAndView mv=null;
		double zhuSuFei=0;
		double huanFangFei=0;
		double qiTaXiaoFei=0;
		double yaJin=0;
		double zongFeiYong=0;
		String txtname="";
		List<StayRegisterPo> listDeposit=stayRegisterService.selectDepositJinJianBan(id);
		List<StayRegisterPo> listXiaoFei=stayRegisterService.selectConsumptionJinJianBan(id);
		StayRegisterPo list=stayRegisterService.selectInformationXiangQingBan(stayregisterdetailsId);
		for (int i = 0; i < listDeposit.size(); i++) {
			yaJin+=listDeposit.get(i).getDeposit();
		}
		for (int i = 0; i < listXiaoFei.size(); i++) {
			qiTaXiaoFei+=listXiaoFei.get(i).getConsumptionMoney();
		}
		zongFeiYong=list.getSumConst();
		huanFangFei=list.getChangRoomMoney();
		zhuSuFei=zongFeiYong-huanFangFei-qiTaXiaoFei;
		mv=new ModelAndView("/stayregister/shiftpersonage");
		mv.addObject("zhuSuFei",zhuSuFei);
		}
		
		List<AttributePo> listOne=attributeService.selectIsPay();
		mv=new ModelAndView("/stayregister/list");
		if (isBillID==null) {
			isBillID=68;
		}
		if (LvKeLeiXingId==null) {
			LvKeLeiXingId=55;
		}
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		
		Page<StayRegisterPo> vo=new Page<StayRegisterPo>();
		vo.setCurrentPage(currentPage);
		
		if(txtname==null)
		{
			txtname="";
		}
		vo=this.stayRegisterService.pageFuzzyselectOne(LvKeLeiXingId, isBillID, txtname, vo);
		mv.addObject("list",vo);
		mv.addObject("listOne",listOne);
		mv.addObject("LvKeLeiXingId",LvKeLeiXingId);
		mv.addObject("isBillID",isBillID);
		mv.addObject("txtname",txtname);
		return mv;
	}
	
	
	//团队的list查询
	@RequestMapping("/toteamlist")
	public ModelAndView toteamlist(HttpServletRequest request, Integer currentPage,
			String txtname,Integer LvKeLeiXingId,Integer isBillID,Integer tuanDuiID,
			String teamNameId, String teamCodeId, String principalId,
			String contactPhoneNUmberId, String registerTimeId){
		ModelAndView mv=null;
		List<StayRegisterPo> listTeam=null;
		List<StayRegisterPo> listAll=stayRegisterService.selectAll();
		Date date=new Date();
		DateFormat dformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");   //设置日期格式
		Timestamp timestamp=Timestamp.valueOf(dformat.format(date)) ;  //将当前时间转为字符串
		
		int id=0;
		mv.addObject("list",list);
		mv.addObject("id",id);
		mv.addObject("listDeposit",listDeposit);
		mv.addObject("listXiaoFei",listXiaoFei);
		mv.addObject("min",min);
		mv.addObject("max",max);
		return mv;
	}

}
package com.gx.web;

@Controller
@RequestMapping("/RoomSet")
public class RoomSet {
	
	@Autowired
	private AttributeService attributeService;
	
	@Autowired
	private RoomSetService roomSetService;
	
/*	@RequestMapping("/tolist")
	public ModelAndView tolist(){
	
	@Autowired
	private RoomSetService roomSetService;
	
/*	@RequestMapping("/tolist")
	public ModelAndView tolist(){
		ModelAndView mv=null;
		List<RoomSetPo> list=roomSetService.selectAll();
		mv=new ModelAndView("/roomset/roomset");
		mv.addObject("list",list);
		return mv;
	}*/
	
	//分页和模糊查询
	@RequestMapping("/tolist")
	public ModelAndView list(HttpServletRequest request,Integer currentPage,String txtname){
		ModelAndView mv=null;
		mv=new ModelAndView("/roomset/roomset");
		Page<RoomSetPo> vo=new Page<RoomSetPo>();
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		if(txtname==null)
		{
			txtname="";
		}
		vo.setCurrentPage(currentPage);
		vo=this.roomSetService.pageFuzzyselect(txtname, vo);
		mv.addObject("list",vo);
		mv.addObject("txtname",txtname);
		return mv;
	}
	

	@RequestMapping("/toadd")
	public ModelAndView toadd(){
		ModelAndView mv=null;
		List<AttributePo> listOne=attributeService.selectGuestRoomLevel();
		List<AttributePo> listTwo=attributeService.selectRoomState();
		mv=new ModelAndView("/roomset/add");
		mv.addObject("listOne",listOne);
		mv.addObject("listTwo",listTwo);
		return mv;
	}
	
		mv.addObject("principalId",principalId);
		mv.addObject("contactPhoneNUmberId",contactPhoneNUmberId);
		mv.addObject("registerTimeId",registerTimeId);
		mv.addObject("teamSumConst",teamSumConst);
		return mv;
	}
	
	
	
	
	
	
	@ResponseBody
	@RequestMapping(value="/ajaxSelectTeamSumcont")
	public Object ajaxSelectTeamSumcont(Integer tuanDuiID, Integer isBillID){
		double teamSumConst=0;
		List<StayRegisterPo> listTeam=this.stayRegisterService.selectFormTeamId(tuanDuiID, isBillID);
		for (int i = 0; i < listTeam.size(); i++) {
			teamSumConst+=listTeam.get(i).getSumConst();
		}
       Gson gson=new Gson();
       return gson.toJson(teamSumConst);
	}
	
	
	
	@RequestMapping("/toadd")
	public ModelAndView toadd(){
		ModelAndView mv=null;
		mv=new ModelAndView("/stayregister/add");
		return mv;
	}

	
	
/*--------------------------------------- 登记 start------------------------------------------------------------------*/	
	
	//登记
	@RequestMapping("/toregister")
	public ModelAndView toregister(int id,String roomNumber,Integer LvKeLeiXingId){
		ModelAndView mv=null;
		List<AttributePo> listGender=attributeService.selectGender();                      //性别
		List<AttributePo> listNation=attributeService.selectNation();                      //民族
		List<AttributePo> listPassengerLevel=attributeService.selectPassengerLevel();      //旅客级别
		List<AttributePo> listEducationDegree=attributeService.selectEducationDegree();    //文化程度
		List<AttributePo> listPapers=attributeService.selectPapers();                      //证件类型
		List<AttributePo> listThingReason=attributeService.selectThingReason();            //事由
		mv=new ModelAndView("/stayregister/register");
		mv.addObject("roomNumber",roomNumber);
		mv.addObject("stayRegisterId",id);
		mv.addObject("listGender",listGender);

@Controller
@RequestMapping("/RoomSet")
public class RoomSet {
	
	@Autowired
	private AttributeService attributeService;
	
	@Autowired
	private RoomSetService roomSetService;
	
/*	@RequestMapping("/tolist")
	public ModelAndView tolist(){
		ModelAndView mv=null;
		List<RoomSetPo> list=roomSetService.selectAll();
		mv=new ModelAndView("/roomset/roomset");
		mv.addObject("list",list);
		return mv;
	}*/
	
	//分页和模糊查询
	@RequestMapping("/tolist")
	public ModelAndView list(HttpServletRequest request,Integer currentPage,String txtname){
		ModelAndView mv=null;
		mv=new ModelAndView("/roomset/roomset");
		Page<RoomSetPo> vo=new Page<RoomSetPo>();
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		if(txtname==null)
		{
			txtname="";
		}
		vo.setCurrentPage(currentPage);
		vo=this.roomSetService.pageFuzzyselect(txtname, vo);
		mv.addObject("list",vo);
		mv.addObject("txtname",txtname);
		return mv;
	}
	
		double yaJin=0;
		double xiaoFei=0;
		double huanFangFei=0;
		double zongFeiYong=0;
		double zhuSuFei=0;
		double yingBuJinE=0;
		int fangJianShu=0;
		datemin=datemin+" 00:00:00";
	    datemax=datemax+" 23:59:59";
	    Timestamp min=Timestamp.valueOf(datemin);
	    Timestamp max=Timestamp.valueOf(datemax);
	    
		List<StayRegisterPo> listDeposit=stayRegisterService.ajaxSelectTeamDeposit(receiveTargetID, min, max);
		List<StayRegisterPo> listConsumption=stayRegisterService.ajaxSelectTeamConsumption(receiveTargetID, min, max);
		List<StayRegisterPo> list=stayRegisterService.ajaxSelectTeamFormTime(receiveTargetID, min, max);
		for (int i = 0; i < listDeposit.size(); i++) {
			yaJin+=listDeposit.get(i).getDeposit();
			huanFangFei+=listDeposit.get(i).getChangRoomMoney();
		}
		for (int i = 0; i < list.size(); i++) {
			zongFeiYong+=list.get(i).getSumConst();
		}
		for (int i = 0; i < listConsumption.size(); i++) {
			xiaoFei+=listConsumption.get(i).getConsumptionMoney();
		}
		fangJianShu=listConsumption.size();
		zhuSuFei=zongFeiYong-huanFangFei-xiaoFei;
		yingBuJinE=zongFeiYong-yaJin;
		teamPayVo.setStayMoney(zhuSuFei);
		teamPayVo.setChangRoomMoney(huanFangFei);
		teamPayVo.setOtherMoney(xiaoFei);
		teamPayVo.setPayMoney(zongFeiYong);
		teamPayVo.setDepositMoney(yaJin);
		teamPayVo.setPayRepairMoney(yingBuJinE);
		Gson gson=new Gson();
		/*List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("canshu", "zhr");
		map.put("teamPayVo", teamPayVo);
		list.add(map);*/
       return gson.toJson(teamPayVo);
	}
	
	
		double yingBuJinE=0;
		int fangJianShu=0;
		datemin=datemin+" 00:00:00";
	    datemax=datemax+" 23:59:59";
	    Timestamp min=Timestamp.valueOf(datemin);
	    Timestamp max=Timestamp.valueOf(datemax);
	    
		List<StayRegisterPo> listDeposit=stayRegisterService.ajaxSelectTeamDeposit(receiveTargetID, min, max);
		List<StayRegisterPo> listConsumption=stayRegisterService.ajaxSelectTeamConsumption(receiveTargetID, min, max);
		List<StayRegisterPo> list=stayRegisterService.ajaxSelectTeamFormTime(receiveTargetID, min, max);
		for (int i = 0; i < listDeposit.size(); i++) {
			yaJin+=listDeposit.get(i).getDeposit();
			huanFangFei+=listDeposit.get(i).getChangRoomMoney();
		}
		for (int i = 0; i < list.size(); i++) {
			zongFeiYong+=list.get(i).getSumConst();
		}
		for (int i = 0; i < listConsumption.size(); i++) {
			xiaoFei+=listConsumption.get(i).getConsumptionMoney();
		}
		fangJianShu=listConsumption.size();
		zhuSuFei=zongFeiYong-huanFangFei-xiaoFei;
		yingBuJinE=zongFeiYong-yaJin;
		teamPayVo.setStayMoney(zhuSuFei);
		teamPayVo.setChangRoomMoney(huanFangFei);
		teamPayVo.setOtherMoney(xiaoFei);
		teamPayVo.setPayMoney(zongFeiYong);
		teamPayVo.setDepositMoney(yaJin);
		teamPayVo.setPayRepairMoney(yingBuJinE);
		Gson gson=new Gson();
		/*List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("canshu", "zhr");
		map.put("teamPayVo", teamPayVo);
		list.add(map);*/
       return gson.toJson(teamPayVo);
	}
	
	
	
	
	//ajax查询房间信息
		@ResponseBody
		@RequestMapping(value="/timeAjaxSelectRoomThree")
		public Object timeAjaxSelectRoomThree(String id,Double zhuSuFei,Double huanFangFei,
				Double qiTaXiaoFei,Double jieZhangJinE,Double yaJin,Double yingBuJinE){
			double ByaJin=0;
			double BxiaoFei=0;
			double BhuanFangFei=0;
			double BzongFeiYong=0;
	@RequestMapping(value="/selectPassenger")
	public Object selectPassenger(String txtname){
		if(txtname==null){
			txtname="";
		}
		List<PassengerPo> list=passengerService.selectAjaxList(txtname);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	@ResponseBody
	@RequestMapping(value="/selectTarget")
	public Object selectTarget(String txtname){
		if (txtname==null) {
			txtname="";
		}
 	   List<ReceiveTargetPo> list=receiveTargetService.ajaxSelect(txtname);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	@ResponseBody
	@RequestMapping(value="/confirmPassenger")
	public Object confirmPassenger(Integer id){
 	   PassengerPo list=passengerService.selectById(id);
       Gson gson=new Gson();
       return gson.toJson(list.getContactPhoneNumber());
	}
	
	
	//去新增界面
	@RequestMapping("/toadd")
	public ModelAndView toadd(Integer id,String name,Integer type){
		ModelAndView mv=null;
		List<AttributePo> listOne=attributeService.selectPayWay();
		mv=new ModelAndView("/predetermine/add");
		mv.addObject("id",id);
		mv.addObject("name",name);
		mv.addObject("type",type);
		mv.addObject("listOne",listOne);
		return mv;
	}
	
	//新增
	@RequestMapping("/add")
	public ModelAndView add(Integer id,Integer type, String roomIdShuZu,PredeterminePo po,Integer pangduan){
		ModelAndView mv=null;
		if(pangduan!=null){
		double sZongFeiYong10=0;
		double sZongFeiYong11=0;
		double sZongFeiYong12=0;
		double tZongFeiYong1=0;
		double tZongFeiYong2=0;
		double tZongFeiYong3=0;
		double tZongFeiYong4=0;
		double tZongFeiYong5=0;
		double tZongFeiYong6=0;
		double tZongFeiYong7=0;
		double tZongFeiYong8=0;
		double tZongFeiYong9=0;
		double tZongFeiYong10=0;
		double tZongFeiYong11=0;
		double tZongFeiYong12=0;
		int year1=0;
		int year2=0;
		int year3=0;
		int year4=0;
		int year5=0;
		int year6=0;
		int year7=0;
		int year8=0;
		int year9=0;
		int year10=0;
		int year11=0;
		int year12=0;
		int year13=0;
		int month1=0;
		int month2=0;
		int month3=0;
		int month4=0;
		int month5=0;
		int month6=0;
		int month7=0;
		int month8=0;
		int month9=0;
		int month10=0;
		int month11=0;
		int month12=0;
		int month13=0;
		String monthString1="";
		String monthString2="";
	public ModelAndView toteampay(Integer tuanDuiID){
		ModelAndView mv=null;
		TeamPayVo teamPayVo=new TeamPayVo();
		double yaJin=0;
		double xiaoFei=0;
		double huanFangFei=0;
		double zongFeiYong=0;
		double zhuSuFei=0;
		double yingBuJinE=0;
		int fangJianShu=0;
		Date date=new Date();
		DateFormat dformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");   //设置日期格式
		Timestamp timestamp=Timestamp.valueOf(dformat.format(date)) ;  //将当前时间转为字符串
		List<AttributePo> listPayWay=attributeService.selectPayWay();                 //结账方式
		List<StayRegisterPo> listDeposit=stayRegisterService.selectTeamDeposit(tuanDuiID);
		List<StayRegisterPo> listConsumption=stayRegisterService.selectTeamConsumption(tuanDuiID);
		List<StayRegisterPo> list=stayRegisterService.selectFormTeamId(tuanDuiID, 68);
		for (int i = 0; i < listDeposit.size(); i++) {
			yaJin+=listDeposit.get(i).getDeposit();
		}
		for (int i = 0; i < list.size(); i++) {
			zongFeiYong+=list.get(i).getSumConst();
			huanFangFei+=list.get(i).getChangRoomMoney();
		}
		for (int i = 0; i < listConsumption.size(); i++) {
			xiaoFei+=listConsumption.get(i).getConsumptionMoney();
		}
		fangJianShu=list.size();
		zhuSuFei=zongFeiYong-huanFangFei-xiaoFei;
		yingBuJinE=zongFeiYong-yaJin;
		teamPayVo.setStayMoney(zhuSuFei);
		teamPayVo.setChangRoomMoney(huanFangFei);
		teamPayVo.setOtherMoney(xiaoFei);
		teamPayVo.setPayMoney(zongFeiYong);
		teamPayVo.setDepositMoney(yaJin);
		teamPayVo.setPayRepairMoney(yingBuJinE);
		mv=new ModelAndView("/stayregister/teampay");
		mv.addObject("listPayWay",listPayWay);
		mv.addObject("listConsumption",listConsumption);
		mv.addObject("teamPayVo",teamPayVo);
		mv.addObject("fangJianShu",fangJianShu);
		mv.addObject("timestamp",timestamp);
		@RequestMapping("/toadd")
		public ModelAndView toadd(){
			ModelAndView mv=null;
			List<AttributePo> listOne=attributeService.selectUOM();
			List<AttributePo> listTwo=attributeService.selectCommodityType();
			mv=new ModelAndView("/commodity/add");
			mv.addObject("listOne",listOne);
			mv.addObject("listTwo",listTwo);
			return mv;
		}
		
		@RequestMapping("/add")
		public ModelAndView add(CommodityPo commodityPo){
			ModelAndView mv=null;
			commodityService.insertAll(commodityPo);
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
		@RequestMapping("/toupdate")
		public ModelAndView toupdate(int id){
			ModelAndView mv=null;
			List<AttributePo> listOne=attributeService.selectUOM();
			List<AttributePo> listTwo=attributeService.selectCommodityType();
			CommodityPo commodityPo=commodityService.selectById(id);
			mv=new ModelAndView("/commodity/update");
			mv.addObject("listOne",listOne);
			mv.addObject("listTwo",listTwo);
			mv.addObject("listPo",commodityPo);
			return mv;
		}
		
		@RequestMapping("/update")
		public ModelAndView update(CommodityPo commodityPo){
			ModelAndView mv=null;
			commodityService.updateById(commodityPo);
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
			zongFeiYong+=list.get(i).getSumConst();
		}
		for (int i = 0; i < listConsumption.size(); i++) {
			xiaoFei+=listConsumption.get(i).getConsumptionMoney();
		}
		fangJianShu=listConsumption.size();
		zhuSuFei=zongFeiYong-huanFangFei-xiaoFei;
		yingBuJinE=zongFeiYong-yaJin;
		teamPayVo.setStayMoney(zhuSuFei);
		teamPayVo.setChangRoomMoney(huanFangFei);
		teamPayVo.setOtherMoney(xiaoFei);
		teamPayVo.setPayMoney(zongFeiYong);
		teamPayVo.setDepositMoney(yaJin);
		teamPayVo.setPayRepairMoney(yingBuJinE);
		Gson gson=new Gson();
		/*List<Map<String, Object>> list=new ArrayList<Map<String,Object>>();
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("canshu", "zhr");
		map.put("teamPayVo", teamPayVo);
		list.add(map);*/
       return gson.toJson(teamPayVo);
	}
	
	
	
	
	//ajax查询房间信息
		@ResponseBody
		@RequestMapping(value="/timeAjaxSelectRoomThree")
		public Object timeAjaxSelectRoomThree(String id,Double zhuSuFei,Double huanFangFei,
				Double qiTaXiaoFei,Double jieZhangJinE,Double yaJin,Double yingBuJinE){
			double ByaJin=0;
			double BxiaoFei=0;
			double BhuanFangFei=0;
			double BzongFeiYong=0;
			double BzhuSuFei=0;
			TeamPayVo teamPayVo=new TeamPayVo();
			String[] FenGeId=id.split(",");
			for (int i = 0; i < FenGeId.length; i++) {
				StayRegisterPo xiangQing=stayRegisterService.selectSumconst(Integer.parseInt(FenGeId[i]));
			    List<StayRegisterPo> yaJinList=stayRegisterService.selectDepositJinJianBan(Integer.parseInt(FenGeId[i]));
			    List<StayRegisterPo> xiaoFeiList=stayRegisterService.selectConsumptionJinJianBan(Integer.parseInt(FenGeId[i]));
			    for (int j = 0; j < yaJinList.size(); j++) {
					ByaJin+=yaJinList.get(j).getDeposit();
				}
			    for (int j = 0; j < xiaoFeiList.size(); j++) {
					BxiaoFei+=xiaoFeiList.get(j).getConsumptionMoney();
				}
			    if(i==0){
			    	BhuanFangFei+=xiangQing.getChangRoomMoney();
			vo=this.commodityService.pageFuzzyselect(txtname,commodityTypeID, vo);
			mv.addObject("list",vo);
			mv.addObject("txtname",txtname);
			mv.addObject("listOne",listOne);
			mv.addObject("commodityType",commodityTypeID);
			return mv;
		}
		
		
		@RequestMapping("/toadd")
		public ModelAndView toadd(){
			ModelAndView mv=null;
			List<AttributePo> listOne=attributeService.selectUOM();
			List<AttributePo> listTwo=attributeService.selectCommodityType();
			mv=new ModelAndView("/commodity/add");
			mv.addObject("listOne",listOne);
			mv.addObject("listTwo",listTwo);
			return mv;
		}
		
		@RequestMapping("/add")
		public ModelAndView add(CommodityPo commodityPo){
			ModelAndView mv=null;
			commodityService.insertAll(commodityPo);
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
		@RequestMapping("/toupdate")
		public ModelAndView toupdate(int id){
			ModelAndView mv=null;
			List<AttributePo> listOne=attributeService.selectUOM();
			List<AttributePo> listTwo=attributeService.selectCommodityType();
			CommodityPo commodityPo=commodityService.selectById(id);
			mv=new ModelAndView("/commodity/update");
			mv.addObject("listOne",listOne);
			mv.addObject("listTwo",listTwo);
			mv.addObject("listPo",commodityPo);
			return mv;
		}
		
		@RequestMapping("/update")
		public ModelAndView update(CommodityPo commodityPo){
			}
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
		
		
		
		@RequestMapping("/openwindow")
		public ModelAndView openwindow(){
			ModelAndView mv=null;
			mv=new ModelAndView("/commodity/commoditytype");
			return mv;
		}
		
		@RequestMapping("/newadd")
		public ModelAndView newadd(String txtname){
			ModelAndView mv=null;
			int newid=3;
			attributeService.insertAll(newid,txtname);
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
		@RequestMapping("/newdelete")
		public ModelAndView newdelete(String id){
			ModelAndView mv=null;
			String[] FenGe=id.split(",");
			for (int i = 0; i < FenGe.length; i++) {
				attributeService.deleteById(Integer.parseInt(FenGe[i]));
			}
			mv=new ModelAndView("redirect:/Commodity/tolist.do");
			return mv;
		}
		
		
		@ResponseBody
		@RequestMapping(value="/YZ")
		public Object YZ(String commodityName){
			int YorN=commodityService.selectYZ(commodityName);
			Gson gson =new Gson();
			return gson.toJson(YorN);
	//去修改界面
	@RequestMapping("/toupdate")
	public ModelAndView toupdate(Integer id){
		idP=null;
		fangJianId=null;
		ModelAndView mv=null;
		int idid=0;
		PredeterminePo zuwenPo=predetermineService.findById(id);        //根据预订id来查询预订数据
		int lvKeId=zuwenPo.getPassengerID();                            //获取预订旅客id
		int teamId=zuwenPo.getPredetermineTargetID();                   //获取预订团队id
		List<PredeterminePo> teamList=null;
		List<PredeterminePo> lvKeList=null;
		List<AttributePo> listOne=attributeService.selectPayWay();
		double yaJin=0;
		int zhengShu=0;
		String nameString="";
		List<RoomSetPo> roomSetPolist=new ArrayList<RoomSetPo>();
		RoomSetPo roomSetPo=null;
		int type=0;
		mv=new ModelAndView("/predetermine/update");
		if (lvKeId==0) {
			idid=teamId;
			teamList=predetermineService.findTeamId(teamId);
			idP=new int[teamList.size()];
			fangJianId=new int[teamList.size()];
			for (int i = 0; i < teamList.size(); i++) {
				yaJin+=teamList.get(i).getDeposit();
				roomSetPo=roomSetService.selectById(teamList.get(i).getRoomID());
				roomSetPolist.add(roomSetPo);
				idP[i]=teamList.get(i).getId();
				fangJianId[i]=teamList.get(i).getRoomID();
			}
            zhengShu=(int)yaJin;
            mv.addObject("listList",teamList);
            nameString=teamList.get(0).getReceiveTeamName();
            type=1;
		}else {
			idid=lvKeId;
			lvKeList=predetermineService.findLvKeId(lvKeId);
			idP=new int[lvKeList.size()];
			fangJianId=new int[lvKeList.size()];
			for (int i = 0; i < lvKeList.size(); i++) {
				yaJin+=lvKeList.get(i).getDeposit();
				roomSetPo=roomSetService.selectById(lvKeList.get(i).getRoomID());
				roomSetPolist.add(roomSetPo);
				idP[i]=lvKeList.get(i).getId();
				fangJianId[i]=lvKeList.get(i).getRoomID();
			}
            zhengShu=(int)yaJin;

@Controller
@RequestMapping("/Login")
public class Login {
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private StayRegisterService stayRegisterService;
	
	@RequestMapping("/tologin")
	public String tologin(){
		return "/login/login";
	}
	
	@RequestMapping("/tomain")
	public ModelAndView tomain(UserPo user){
		ModelAndView mv=null;
		double zongFeiYongOne=0;
		double zongFeiYongTwo=0;
		UserPo u=userService.selectLogin(user);
		List<StayRegisterPo> list=stayRegisterService.selectAll();
		for (int i = 0; i < list.size(); i++) {
			if (list.get(i).getReceiveTargetID()==2) {
				zongFeiYongOne+=list.get(i).getSumConst();
			}else {
				zongFeiYongTwo+=list.get(i).getSumConst();
			}
		}
		
		if (u!=null) {
			mv=new ModelAndView("/main/main");
		}else {
			mv=new ModelAndView("/login/login");
		}
		mv.addObject("zongFeiYongOne",zongFeiYongOne);
		mv.addObject("zongFeiYongTwo",zongFeiYongTwo);
		return mv;
	}
	

}
package com.gx.web;

		Page<StayRegisterPo> vo=new Page<StayRegisterPo>();
		vo.setCurrentPage(currentPage);
		
		if (datemin=="" || datemax=="" || datemin==null || datemax==null) {
			List<StayRegisterPo> listJinE=this.stayRegisterService.selectPayJingJianBanNot();
			for (int i = 0; i < listJinE.size(); i++) {
				chuZuFangJianShu++;
				JieZhangJinE+=listJinE.get(i).getSumConst();
			}
			
			List<StayRegisterPo> listRenShu=this.stayRegisterService.selectPayStayNumberNot();
			for (int i = 0; i < listRenShu.size(); i++) {
				zhuSuRenShu++;
			}
			
			List<StayRegisterPo> listXiaoFei=this.stayRegisterService.selectPayXiaoFeiNot();
			for (int i = 0; i < listXiaoFei.size(); i++) {
				xiaoFeiJinE+=listXiaoFei.get(i).getConsumptionMoney();
			}
			
			vo=this.stayRegisterService.pageFuzzyselectFour(vo);
		}else {
			String dateminString=datemin+" 00:00:00";
		    String datemaxString=datemax+" 23:59:59";
		    Timestamp min=Timestamp.valueOf(dateminString);
		    Timestamp max=Timestamp.valueOf(datemaxString);
			
			List<StayRegisterPo> listJinE=this.stayRegisterService.selectPayJingJianBan(min,max);
			for (int i = 0; i < listJinE.size(); i++) {
				chuZuFangJianShu++;
				JieZhangJinE+=listJinE.get(i).getSumConst();
			}
			
			List<StayRegisterPo> listRenShu=this.stayRegisterService.selectPayStayNumber(min,max);
			for (int i = 0; i < listRenShu.size(); i++) {
				zhuSuRenShu++;
			}
			
			List<StayRegisterPo> listXiaoFei=this.stayRegisterService.selectPayXiaoFei(min,max);
			for (int i = 0; i < listXiaoFei.size(); i++) {
				xiaoFeiJinE+=listXiaoFei.get(i).getConsumptionMoney();
			}
			vo=this.stayRegisterService.pageFuzzyselectFive(min, max, vo);
		}
		mv.addObject("list",vo);
		mv.addObject("chuZuFangJianShu",chuZuFangJianShu);
		mv.addObject("zhuSuRenShu",zhuSuRenShu);
		mv.addObject("xiaoFeiJinE",xiaoFeiJinE);
	//ajax旅客
	@ResponseBody
	@RequestMapping(value="/selectPassenger")
	public Object selectPassenger(String txtname){
		if(txtname==null){
			txtname="";
		}
		List<PassengerPo> list=passengerService.selectAjaxList(txtname);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	@ResponseBody
	@RequestMapping(value="/selectTarget")
	public Object selectTarget(String txtname){
		if (txtname==null) {
			txtname="";
		}
 	   List<ReceiveTargetPo> list=receiveTargetService.ajaxSelect(txtname);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	@ResponseBody
	@RequestMapping(value="/confirmPassenger")
	public Object confirmPassenger(Integer id){
 	   PassengerPo list=passengerService.selectById(id);
       Gson gson=new Gson();
       return gson.toJson(list.getContactPhoneNumber());
	}
	
	
	//去新增界面
	@RequestMapping("/toadd")
	public ModelAndView toadd(Integer id,String name,Integer type){
		ModelAndView mv=null;
		List<AttributePo> listOne=attributeService.selectPayWay();
		mv=new ModelAndView("/predetermine/add");
		mv.addObject("id",id);
		mv.addObject("name",name);
		mv.addObject("type",type);
		mv.addObject("listOne",listOne);
		return mv;
	}
	
	//新增
	@RequestMapping("/add")
	public ModelAndView add(Integer id,Integer type, String roomIdShuZu,PredeterminePo po,Integer pangduan){
		ModelAndView mv=null;
	public ModelAndView toconsumption(Integer id,String lvKeName,Integer currentPage,
			Integer LvKeLeiXingId,Integer isBillID){
		ModelAndView mv=null;
		fangjianId=id;
		lvkeName=lvKeName;
		Page<StayRegisterPo> vo=new Page<StayRegisterPo>();
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		vo.setCurrentPage(currentPage);
		List<AttributePo> listOne=attributeService.selectCommodityType();
		vo=this.stayRegisterService.pageConsumption(id, vo);
		mv=new ModelAndView("/stayregister/consumption");
		mv.addObject("listOne",listOne);
		mv.addObject("stayId",id);
		mv.addObject("lvKeName",lvKeName);
		mv.addObject("list",vo);
		mv.addObject("LvKeLeiXingId",LvKeLeiXingId);
		mv.addObject("isBillID",isBillID);
		return mv;
	}
	
	//新增
	@RequestMapping("/consumption")
	public ModelAndView consumption(String id,String Number,
			int consumptionStayRegisterID,Integer LvKeLeiXingId){
		ModelAndView mv=null;
	    Date date=new Date();
		DateFormat dformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");   //设置日期格式
		Timestamp timestamp=Timestamp.valueOf(dformat.format(date)) ;  //将当前时间转为字符串

		String[] FenGeId=id.split(",");
		String[] FenGeNumber=Number.split(",");
		StayRegisterPo stayRegisterPo=new StayRegisterPo();
		for (int i = 0; i < FenGeId.length; i++) {
			CommodityPo commodityPo=commodityService.selectById(Integer.parseInt(FenGeId[i]));
			stayRegisterPo.setConsumptionCommodityID(Integer.parseInt(FenGeId[i]));
			stayRegisterPo.setConsumptionStayRegisterID(consumptionStayRegisterID);
			stayRegisterPo.setConsumptionNumber(FenGeNumber[i]);
			stayRegisterPo.setConsumptionTime(timestamp);
			double money=Integer.parseInt(FenGeNumber[i])*(Double.parseDouble(commodityPo.getSalePrice()));
			stayRegisterPo.setConsumptionMoney(money);
			stayRegisterService.insertConsumptiondetails(stayRegisterPo);
		stayRegisterService.insertAll(stayRegisterPo);
		int id=stayRegisterPo.getId();
		stayRegisterPo.setDepositStayRegisterID(id);
		stayRegisterPo.setDepositRegisterTime(stayRegisterPo.getRegisterTime());
		stayRegisterService.insertDeposit(stayRegisterPo);
		RoomSetPo roomSetPoToRoomState=new RoomSetPo();
		roomSetPoToRoomState.setId(fangJianId);                      //给新的 Po 赋房间ID的值
		roomSetPoToRoomState.setRoomStateID(65);                     //给新的 Po 赋房态的值
		roomSetService.updateByIdToRoomState(roomSetPoToRoomState);  //根据 房间ID 来修改 当前被选中的房间的房态
		mv=new ModelAndView("redirect:/StayRegister/tolist.do?LvKeLeiXingId="+LvKeLeiXingId);
		return mv;
	}
	
	
/*--------------------------------------- 安排房间  end ------------------------------------------------------------------*/	
	
	
	
	
	
	
	
/*--------------------------------------- 换房 start------------------------------------------------------------------*/	
	
	//换房
	@RequestMapping("/tochangroom")
	public ModelAndView tochangroom(Integer id,String lvKeName,Integer LvKeLeiXingId){
		ModelAndView mv=null;
		fangjianId=id;
		lvkeName=lvKeName;
		
		Date date=new Date();
		DateFormat dformat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");   //设置日期格式
		Timestamp timestamp=Timestamp.valueOf(dformat.format(date)) ;  //将当前时间转为字符串
		
		long xiangChaTianShu;                       //相差时间:毫秒
		long days=0;                                  //相差天数
		long hours=0;                                 //相差小时
		long daysOne=0;
		long hourOne=0;
		String zhuSu="";                            //住宿天数或小时
		Timestamp registerTime;                     //登记时间
		double yaJin=0;             				//押金
		double shangPinXiaoFei=0;   				//商品消费
		double zhuSuFei=0;        				    //住宿费
		double fangJia=0;         				    //房价
		int chuZuFangShi=0;      				    //出租方式
		String huanFangShiJian;                     //换房时间
		List<StayRegisterPo> list=stayRegisterService.selectChangRoom(id);
		List<StayRegisterPo> listSource=stayRegisterService.selectMoney(id);
		registerTime=list.get(0).getRegisterTime();                                    //获取登记时间
		zhuSu=list.get(0).getStayNumber();                                             //获取住宿天数或小时
		fangJia=list.get(0).getRoomStandardPriceDay();                                 //获取房价/天
					zhuSuFei=daysOne*fangJia;
					zhuDianTianShuOne=daysOne;
				}
				if (hourOne>=6 & hourOne<=15) {
					zhuSuFei=daysOne*fangJia+(0.5*fangJia);
					zhuDianTianShuOne=daysOne+0.5;
				}else if(hourOne>15){
					zhuSuFei=(daysOne+1)*fangJia;
					zhuDianTianShuOne=daysOne+1;
				}
				if(hours<6){
					zhuDianTianShu=days;
				}
				if (hours>=6 & hours<=15) {
					zhuDianTianShu=days+0.5;
				}else if(hours>15){
					zhuDianTianShu=days+1;
				}
			}else if(chuZuFangShi==25){
				
			}
			shengZhuDianTianShu=Integer.parseInt(zhuSu)-zhuDianTianShuOne-zhuDianTianShu;
		}
		
		for (int i = 0; i < list.size(); i++) {
			yaJin+=list.get(i).getDeposit();
		}
		for (int i = 0; i < listSource.size(); i++) {
			shangPinXiaoFei+=listSource.get(i).getConsumptionMoney();
		}
		
		mv=new ModelAndView("/stayregister/changroom");
		mv.addObject("lvKeName",lvKeName);
		mv.addObject("list",list);
		mv.addObject("yaJin",yaJin);
		mv.addObject("shangPinXiaoFei",shangPinXiaoFei);
		mv.addObject("zhuSuFei",zhuSuFei);
		mv.addObject("stayId",id);
		mv.addObject("zhuDianTianShu",zhuDianTianShu);
		mv.addObject("timestamp",timestamp);
		mv.addObject("LvKeLeiXingId",LvKeLeiXingId);
		return mv;
	}
	
	
	@RequestMapping("/confirmChangRoom")
	public ModelAndView confirmChangRoom(Integer id, Integer roomId, Double changRoomMoney, 
			Timestamp changRoomTime,Integer LvKeLeiXingId){
		ModelAndView mv=null;
		int chuZuFangShi=0;      				    //出租方式
		List<StayRegisterPo> listSource=stayRegisterService.selectMoney(consumptionStayRegisterID);
		int chuZuFangShiId=listSource.get(0).getRentOutTypeID();                                      //出租方式ID
		int zhuDianShiChang=Integer.parseInt(listSource.get(0).getStayNumber());                    //住店时长     
		double fangJiaTian=listSource.get(0).getRoomStandardPriceDay();                             //房价/天
		double fangJia=listSource.get(0).getRoomStandardPrice();                                    //房价/小时
		int zuiDaShiChang=Integer.parseInt(listSource.get(0).getRoomMaxDuration());                 //最大时长
		int shouDuanShiChang=Integer.parseInt(listSource.get(0).getRoomFirstDuration());            //首段时长
		double shouDuanJiaGe=listSource.get(0).getRoomFirstPrice();                                 //首段价格
		double xiaoFeiJiaGe=0;
		double zhuSuFei=0;
		if(chuZuFangShiId==26){
		    zhuSuFei=fangJiaTian*zhuDianShiChang;                                      //房价乘以天数得总费
		}else if(chuZuFangShiId==25){
			if (shouDuanShiChang >= zhuDianShiChang) { 
				zhuSuFei=shouDuanJiaGe;                              //首时段时长大于 他输入的钟点数     那么按 首段价格计算
			}else if (shouDuanShiChang <= zhuDianShiChang && zhuDianShiChang <= zuiDaShiChang) {
				int xiaoShi=zhuDianShiChang-shouDuanShiChang;                 //如果输入的钟点数 在 最大时长的范围之内
				zhuSuFei= shouDuanJiaGe+xiaoShi*fangJia;                   // 且大于等于首段时长 ,那么 计算出
			}else if(zhuDianShiChang>zuiDaShiChang){
				zhuSuFei=fangJiaTian;                                     //假如 输入的钟点数大于最大时长那么 按一天的价格计算
			}
		}
		for (int i = 0; i < listSource.size(); i++) {
			xiaoFeiJiaGe+=listSource.get(i).getConsumptionMoney();
		}
		double zongFeiYong=xiaoFeiJiaGe+zhuSuFei;
		stayRegisterService.updateSumConst(consumptionStayRegisterID, zongFeiYong);
		
		return mv;
	}
	
	@ResponseBody
	@RequestMapping(value="/tianJiaShangPin")
	public Object tianJiaShangPin(String name,int cboid){
		if(name==null){
			name="";
		}
		List<CommodityPo> listAjax=commodityService.fuzzySelect(name, cboid);
       Gson gson=new Gson();
       return gson.toJson(listAjax);
	}
	
/*--------------------------------------- 消费明细  end ------------------------------------------------------------------*/	
	
	

	
	
/*--------------------------------------- 散客结账 start------------------------------------------------------------------*/		
	
	@RequestMapping("/topay")
	public ModelAndView topay(Integer id,String lvKeName){
		ModelAndView mv=null;
		String monthString4="";
		String monthString5="";
		String monthString6="";
		String monthString7="";
		String monthString8="";
		String monthString9="";
		String monthString10="";
		String monthString11="";
		String monthString12="";
		String monthString13="";
		Calendar cal = Calendar.getInstance();
		int year = cal.get(Calendar.YEAR);         //获取年
		int month = cal.get(Calendar.MONTH) + 1;   //获取月
		int day = cal.get(Calendar.DATE);         //获取日
		
		month=month+1;
		month1=month;
		year1=year;
		
		month2=month-1;
		month3=month-2;
		month4=month-3;
		month5=month-4;
		month6=month-5;
		month7=month-6;
		month8=month-7;
		month9=month-8;
		month10=month-9;
		month11=month-10;
		month12=month-11;
		month13=month-12;
		if (month2<=0) {
			month2=month2+12;
			year2=year-1;
		}else {
			year2=year;
		}
		if (month3<=0) {
			month3=12+month3;
			year3=year-1;
		if (tuanDuiID==null) {
			listTeam=this.stayRegisterService.selectFormTeamIdTwo(isBillID);
		}else {
			listTeam=this.stayRegisterService.selectFormTeamId(tuanDuiID, isBillID);
		}
		if (currentPage==null) {
			currentPage=1;
		}else if (currentPage==0) {
			currentPage=1;
		}
		
		for (int i = 0; i < listTeam.size(); i++) {
			teamSumConst+=listTeam.get(i).getSumConst();
		}

		Page<StayRegisterPo> vo=new Page<StayRegisterPo>();
		vo.setCurrentPage(currentPage);
		
		if(txtname==null)
		{
			txtname="";
		}
		if (tuanDuiID==null) {
			vo=this.stayRegisterService.pageFuzzyselectThree(isBillID, txtname, vo);
		}else {
			vo=this.stayRegisterService.pageFuzzyselectTwo(tuanDuiID, isBillID, txtname, vo);
		}
		mv.addObject("list",vo);
		mv.addObject("listOne",listOne);
		mv.addObject("LvKeLeiXingId",LvKeLeiXingId);
		mv.addObject("isBillID",isBillID);
		mv.addObject("txtname",txtname);
		mv.addObject("tuanDui",tuanDuiID);
		mv.addObject("teamNameId",teamNameId);
		mv.addObject("teamCodeId",teamCodeId);
		mv.addObject("principalId",principalId);
		mv.addObject("contactPhoneNUmberId",contactPhoneNUmberId);
		mv.addObject("registerTimeId",registerTimeId);
		mv.addObject("teamSumConst",teamSumConst);
		return mv;
	}
	
	
	
	public Object ajaxTeamSelectRoom(String roomNumber,Integer receiveTargetID){
	   List<StayRegisterPo> list=new ArrayList<StayRegisterPo>();
	   list=stayRegisterService.ajaxSelectTeamRoom(receiveTargetID, roomNumber);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	//ajax查询房间信息
	@ResponseBody
	@RequestMapping(value="/timeAjaxSelectRoomOne")
	public Object timeAjaxSelectRoomOne(Integer receiveTargetID,String datemin,String datemax){
	   datemin=datemin+" 00:00:00";
	   datemax=datemax+" 23:59:59";
	   Timestamp min=Timestamp.valueOf(datemin);
	   Timestamp max=Timestamp.valueOf(datemax);
	   List<StayRegisterPo> list=new ArrayList<StayRegisterPo>();
	   list=stayRegisterService.ajaxSelectTeamFormTime(receiveTargetID, min, max);
       Gson gson=new Gson();
       return gson.toJson(list);
	}
	
	//ajax查询房间信息
	@ResponseBody
	@RequestMapping(value="/timeAjaxSelectRoomTwo")
	public Object timeAjaxSelectRoomTwo(Integer receiveTargetID,String datemin,String datemax){
		TeamPayVo teamPayVo=new TeamPayVo();
		double yaJin=0;
		double xiaoFei=0;
		double huanFangFei=0;
		double zongFeiYong=0;
		double zhuSuFei=0;
		double yingBuJinE=0;
		int fangJianShu=0;
		datemin=datemin+" 00:00:00";
	    datemax=datemax+" 23:59:59";
	    Timestamp min=Timestamp.valueOf(datemin);
	    Timestamp max=Timestamp.valueOf(datemax);
	    
		List<StayRegisterPo> listDeposit=stayRegisterService.ajaxSelectTeamDeposit(receiveTargetID, min, max);
		List<StayRegisterPo> listConsumption=stayRegisterService.ajaxSelectTeamConsumption(receiveTargetID, min, max);
		List<StayRegisterPo> list=stayRegisterService.ajaxSelectTeamFormTime(receiveTargetID, min, max);
		for (int i = 0; i < listDeposit.size(); i++) {
			yaJin+=listDeposit.get(i).getDeposit();
			huanFangFei+=listDeposit.get(i).getChangRoomMoney();
		}
		for (int i = 0; i < list.size(); i++) {
			zongFeiYong+=list.get(i).getSumConst();
		}
		for (int i = 0; i < listConsumption.size(); i++) {
			xiaoFei+=listConsumption.get(i).getConsumptionMoney();
		}

请添加图片描述

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

转载请注明出处或者链接地址:https://www.qianduange.cn//article/15021.html
标签
评论
发布的文章

前端-axios应用在html文件

2024-08-15 23:08:39

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!