酒店管理系统
一、系统演示
酒店管理系统
二、项目介绍
酒店管理系统 酒店客房管理系统
基于ssm的酒店管理系统 ,实现了酒店前台信息展示,数据统计,客房管理,商品管理,住宿管理,财务管理,旅客管理等功能;
框架:spring,spingmvc,jQuery,bootstrap
数据库框架:MyBatis
数据库:MySQL8.0
项目构建工具:Maven
IDE:IDEA
JDK:1.8
三、系统运行界面图
四、系统部分功能截图
五、部分代码展示
package com.wzy.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.google.gson.Gson;
import com.wzy.page.Page;
import com.wzy.pojo.AttributePo;
import com.wzy.pojo.CommodityPo;
import com.wzy.service.AttributeService;
import com.wzy.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
/**
* 增加商品
* @Auther: wzy
* @Date: 2021/01/25/9:00
* @Description:
*/
@Controller
@RequestMapping("/Commodity")
public class Commodity {
@Autowired
private CommodityService commodityService;
@Autowired
private AttributeService attributeService;
//分页和模糊查询
@RequestMapping("/tolist")
public ModelAndView list(HttpServletRequest request, Integer currentPage, String txtname, Integer commodityTypeID) {
ModelAndView mv = null;
List<AttributePo> listOne = attributeService.selectCommodityType();
mv = new ModelAndView("/commodity/list");
Page<CommodityPo> vo = new Page<CommodityPo>();
if (currentPage == null) {
currentPage = 1;
} else if (currentPage == 0) {
currentPage = 1;
}
if (txtname == null) {
txtname = "";
}
vo.setCurrentPage(currentPage);
if (commodityTypeID == null || commodityTypeID == 76) {
commodityTypeID = 76;
vo = this.commodityService.pageFuzzySelectAll(txtname, vo);
} else {
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) {
ModelAndView mv = null;
commodityService.updateById(commodityPo);
mv = new ModelAndView("redirect:/Commodity/tolist.do");
return mv;
}
@RequestMapping("/delete")
public ModelAndView delete(String id) {
ModelAndView mv = null;
String[] FenGe = id.split(",");
for (int i = 0; i < FenGe.length; i++) {
commodityService.deleteById(Integer.parseInt(FenGe[i]));
}
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);
}
}
package com.wzy.controller;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import com.wzy.pojo.StayRegisterPo;
import com.wzy.service.AttributeService;
import com.wzy.service.RoomSetService;
import com.wzy.service.StayRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* 数据视图
* @Auther: wzy
* @Date: 2021/01/23/9:00
* @Description:
*/
@Controller
@RequestMapping("/DateView")
public class DateView {
@Autowired
private StayRegisterService stayRegisterService;
@Autowired
private RoomSetService roomSetService;
@Autowired
private AttributeService attributeService;
@RequestMapping("/tolist")
public ModelAndView list(Integer type) {
ModelAndView mv = null;
double sZongFeiYong1 = 0;
double sZongFeiYong2 = 0;
double sZongFeiYong3 = 0;
double sZongFeiYong4 = 0;
double sZongFeiYong5 = 0;
double sZongFeiYong6 = 0;
double sZongFeiYong7 = 0;
double sZongFeiYong8 = 0;
double sZongFeiYong9 = 0;
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 = "";
String monthString3 = "";
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) + 2; //获取月
int day = cal.get(Calendar.DATE); //获取日
int maxDay=cal.getActualMaximum(Calendar.DATE);
//month=month+1;
year1 = year;
month1 = month;
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;
} else {
year3 = year;
}
if (month4 <= 0) {
month4 = 12 + month4;
year4 = year - 1;
} else {
year4 = year;
}
if (month5 <= 0) {
month5 = 12 + month5;
year5 = year - 1;
} else {
year5 = year;
}
if (month6 <= 0) {
month6 = 12 + month6;
year6 = year - 1;
} else {
year6 = year;
}
if (month7 <= 0) {
month7 = 12 + month7;
year7 = year - 1;
} else {
year7 = year;
}
if (month8 <= 0) {
month8 = 12 + month8;
year8 = year - 1;
} else {
year8 = year;
}
if (month9 <= 0) {
month9 = 12 + month9;
year9 = year - 1;
} else {
year9 = year;
}
if (month10 <= 0) {
month10 = 12 + month10;
year10 = year - 1;
} else {
year10 = year;
}
if (month11 <= 0) {
month11 = 12 + month11;
year11 = year - 1;
} else {
year11 = year;
}
if (month12 <= 0) {
month12 = 12 + month12;
year12 = year - 1;
} else {
year12 = year;
}
if (month13 <= 0) {
month13 = 12 + month13;
year13 = year - 1;
}else {
year13 = year;
}
monthString1 = String.valueOf(month1-1);
monthString2 = String.valueOf(month2);
monthString3 = String.valueOf(month3);
monthString4 = String.valueOf(month4);
monthString5 = String.valueOf(month5);
monthString6 = String.valueOf(month6);
monthString7 = String.valueOf(month7);
monthString8 = String.valueOf(month8);
monthString9 = String.valueOf(month9);
monthString10 = String.valueOf(month10);
monthString11 = String.valueOf(month11);
monthString12 = String.valueOf(month12);
monthString13 = String.valueOf(month13);
if (monthString1.length() == 1) {
monthString1 = "0" + monthString1;
}
if (monthString2.length() == 1) {
monthString2 = "0" + monthString2;
}
if (monthString3.length() == 1) {
monthString3 = "0" + monthString3;
}
if (monthString4.length() == 1) {
monthString4 = "0" + monthString4;
}
if (monthString5.length() == 1) {
monthString5 = "0" + monthString5;
}
if (monthString6.length() == 1) {
monthString6 = "0" + monthString6;
}
if (monthString7.length() == 1) {
monthString7 = "0" + monthString7;
}
if (monthString8.length() == 1) {
monthString8 = "0" + monthString8;
}
if (monthString9.length() == 1) {
monthString9 = "0" + monthString9;
}
if (monthString10.length() == 1) {
monthString10 = "0" + monthString10;
}
if (monthString11.length() == 1) {
monthString11 = "0" + monthString11;
}
if (monthString12.length() == 1) {
monthString12 = "0" + monthString12;
}
if (monthString13.length() == 1) {
monthString13 = "0" + monthString13;
}
Timestamp timestamp1 = Timestamp.valueOf(year1 + "-" + monthString1 + "-" + maxDay + " 23:59:59");
Timestamp timestamp2 = Timestamp.valueOf(year2 + "-" + monthString2 + "-" + "01" + " 00:00:00");
Timestamp timestamp3 = Timestamp.valueOf(year3 + "-" + monthString3 + "-" + "01" + " 00:00:00");
Timestamp timestamp4 = Timestamp.valueOf(year4 + "-" + monthString4 + "-" + "01" + " 00:00:00");
Timestamp timestamp5 = Timestamp.valueOf(year5 + "-" + monthString5 + "-" + "01" + " 00:00:00");
Timestamp timestamp6 = Timestamp.valueOf(year6 + "-" + monthString6 + "-" + "01" + " 00:00:00");
Timestamp timestamp7 = Timestamp.valueOf(year7 + "-" + monthString7 + "-" + "01" + " 00:00:00");
Timestamp timestamp8 = Timestamp.valueOf(year8 + "-" + monthString8 + "-" + "01" + " 00:00:00");
Timestamp timestamp9 = Timestamp.valueOf(year9 + "-" + monthString9 + "-" + "01" + " 00:00:00");
Timestamp timestamp10 = Timestamp.valueOf(year10 + "-" + monthString10 + "-" + "01" + " 00:00:00");
Timestamp timestamp11 = Timestamp.valueOf(year11 + "-" + monthString11 + "-" + "01" + " 00:00:00");
Timestamp timestamp12 = Timestamp.valueOf(year12 + "-" + monthString12 + "-" + "01" + " 00:00:00");
Timestamp timestamp13 = Timestamp.valueOf(year13 + "-" + monthString13 + "-" + "01" + " 00:00:00");
long timestamp;
Date date = new Date();
DateFormat dformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //设置日期格式
List<StayRegisterPo> list1 = stayRegisterService.selectShuJuTongJi(timestamp2, timestamp1);
List<StayRegisterPo> list2 = stayRegisterService.selectShuJuTongJi(timestamp3, timestamp2);
List<StayRegisterPo> list3 = stayRegisterService.selectShuJuTongJi(timestamp4, timestamp3);
List<StayRegisterPo> list4 = stayRegisterService.selectShuJuTongJi(timestamp5, timestamp4);
List<StayRegisterPo> list5 = stayRegisterService.selectShuJuTongJi(timestamp6, timestamp5);
List<StayRegisterPo> list6 = stayRegisterService.selectShuJuTongJi(timestamp7, timestamp6);
List<StayRegisterPo> list7 = stayRegisterService.selectShuJuTongJi(timestamp8, timestamp7);
List<StayRegisterPo> list8 = stayRegisterService.selectShuJuTongJi(timestamp9, timestamp8);
List<StayRegisterPo> list9 = stayRegisterService.selectShuJuTongJi(timestamp10, timestamp9);
List<StayRegisterPo> list10 = stayRegisterService.selectShuJuTongJi(timestamp11, timestamp10);
List<StayRegisterPo> list11 = stayRegisterService.selectShuJuTongJi(timestamp12, timestamp11);
List<StayRegisterPo> list12 = stayRegisterService.selectShuJuTongJi(timestamp13, timestamp12);
for (int i = 0; i < list1.size(); i++) {
if (list1.get(i).getReceiveTargetID() == 2) {
sZongFeiYong1 += list1.get(i).getSumConst();
} else {
tZongFeiYong1 += list1.get(i).getSumConst();
}
}
for (int i = 0; i < list2.size(); i++) {
if (list2.get(i).getReceiveTargetID() == 2) {
sZongFeiYong2 += list2.get(i).getSumConst();
} else {
tZongFeiYong2 += list2.get(i).getSumConst();
}
}
for (int i = 0; i < list3.size(); i++) {
if (list3.get(i).getReceiveTargetID() == 2) {
sZongFeiYong3 += list3.get(i).getSumConst();
} else {
tZongFeiYong3 += list3.get(i).getSumConst();
}
}
for (int i = 0; i < list4.size(); i++) {
if (list4.get(i).getReceiveTargetID() == 2) {
sZongFeiYong4 += list4.get(i).getSumConst();
} else {
tZongFeiYong4 += list4.get(i).getSumConst();
}
}
for (int i = 0; i < list5.size(); i++) {
if (list5.get(i).getReceiveTargetID() == 2) {
sZongFeiYong5 += list5.get(i).getSumConst();
} else {
tZongFeiYong5 += list5.get(i).getSumConst();
}
}
for (int i = 0; i < list6.size(); i++) {
if (list6.get(i).getReceiveTargetID() == 2) {
sZongFeiYong6 += list6.get(i).getSumConst();
} else {
tZongFeiYong6 += list6.get(i).getSumConst();
}
}
for (int i = 0; i < list7.size(); i++) {
if (list7.get(i).getReceiveTargetID() == 2) {
sZongFeiYong7 += list7.get(i).getSumConst();
} else {
tZongFeiYong7 += list7.get(i).getSumConst();
}
}
for (int i = 0; i < list8.size(); i++) {
if (list8.get(i).getReceiveTargetID() == 2) {
sZongFeiYong8 += list8.get(i).getSumConst();
} else {
tZongFeiYong8 += list8.get(i).getSumConst();
}
}
for (int i = 0; i < list9.size(); i++) {
if (list9.get(i).getReceiveTargetID() == 2) {
sZongFeiYong9 += list9.get(i).getSumConst();
} else {
tZongFeiYong9 += list9.get(i).getSumConst();
}
}
for (int i = 0; i < list10.size(); i++) {
if (list10.get(i).getReceiveTargetID() == 2) {
sZongFeiYong10 += list10.get(i).getSumConst();
} else {
tZongFeiYong10 += list10.get(i).getSumConst();
}
}
for (int i = 0; i < list11.size(); i++) {
if (list11.get(i).getReceiveTargetID() == 2) {
sZongFeiYong11 += list11.get(i).getSumConst();
} else {
tZongFeiYong11 += list11.get(i).getSumConst();
}
}
for (int i = 0; i < list12.size(); i++) {
if (list12.get(i).getReceiveTargetID() == 2) {
sZongFeiYong12 += list12.get(i).getSumConst();
} else {
tZongFeiYong12 += list12.get(i).getSumConst();
}
}
month1 = (month1 - 1) == 0 ? 12 : month1 - 1;
month2 = (month2 - 1) == 0 ? 12 : month2 - 1;
month3 = (month3 - 1) == 0 ? 12 : month3 - 1;
month4 = (month4 - 1) == 0 ? 12 : month4 - 1;
month5 = (month5 - 1) == 0 ? 12 : month5 - 1;
month6 = (month6 - 1) == 0 ? 12 : month6 - 1;
month7 = (month7 - 1) == 0 ? 12 : month7 - 1;
month8 = (month8 - 1) == 0 ? 12 : month8 - 1;
month9 = (month9 - 1) == 0 ? 12 : month9 - 1;
month10 = (month10 - 1) == 0 ? 12 : month10 - 1;
month11 = (month11 - 1) == 0 ? 12 : month11 - 1;
month12 = (month12 - 1) == 0 ? 12 : month12 - 1;
double tZong = tZongFeiYong1 + tZongFeiYong2 + tZongFeiYong3 + tZongFeiYong4 + tZongFeiYong5 + tZongFeiYong6 + tZongFeiYong7 + tZongFeiYong8 + tZongFeiYong9 + tZongFeiYong10 + tZongFeiYong11 + tZongFeiYong12;
double sZong = sZongFeiYong1 + sZongFeiYong2 + sZongFeiYong3 + sZongFeiYong4 + sZongFeiYong5 + sZongFeiYong6 + sZongFeiYong7 + sZongFeiYong8 + sZongFeiYong9 + sZongFeiYong10 + sZongFeiYong11 + sZongFeiYong12;
if (type == 1) {
mv = new ModelAndView("/dateview/shili");
}
if (type == 2) {
mv = new ModelAndView("/dateview/pie");
mv.addObject("sZong", sZong);
}
if (type == 3) {
mv = new ModelAndView("/dateview/piet");
mv.addObject("tZong", tZong);
}
mv.addObject("sZongFeiYong1", sZongFeiYong1);
mv.addObject("sZongFeiYong2", sZongFeiYong2);
mv.addObject("sZongFeiYong3", sZongFeiYong3);
mv.addObject("sZongFeiYong4", sZongFeiYong4);
mv.addObject("sZongFeiYong5", sZongFeiYong5);
mv.addObject("sZongFeiYong6", sZongFeiYong6);
mv.addObject("sZongFeiYong7", sZongFeiYong7);
mv.addObject("sZongFeiYong8", sZongFeiYong8);
mv.addObject("sZongFeiYong9", sZongFeiYong9);
mv.addObject("sZongFeiYong10", sZongFeiYong10);
mv.addObject("sZongFeiYong11", sZongFeiYong11);
mv.addObject("sZongFeiYong12", sZongFeiYong12);
mv.addObject("tZongFeiYong1", tZongFeiYong1);
mv.addObject("tZongFeiYong2", tZongFeiYong2);
mv.addObject("tZongFeiYong3", tZongFeiYong3);
mv.addObject("tZongFeiYong4", tZongFeiYong4);
mv.addObject("tZongFeiYong5", tZongFeiYong5);
mv.addObject("tZongFeiYong6", tZongFeiYong6);
mv.addObject("tZongFeiYong7", tZongFeiYong7);
mv.addObject("tZongFeiYong8", tZongFeiYong8);
mv.addObject("tZongFeiYong9", tZongFeiYong9);
mv.addObject("tZongFeiYong10", tZongFeiYong10);
mv.addObject("tZongFeiYong11", tZongFeiYong11);
mv.addObject("tZongFeiYong12", tZongFeiYong12);
mv.addObject("year1", year1 + "年" + month1 + "月");
mv.addObject("year2", year2 + "年" + month2 + "月");
mv.addObject("year3", year3 + "年" + month3 + "月");
mv.addObject("year4", year4 + "年" + month4 + "月");
mv.addObject("year5", year5 + "年" + month5 + "月");
mv.addObject("year6", year6 + "年" + month6 + "月");
mv.addObject("year7", year7 + "年" + month7 + "月");
mv.addObject("year8", year8 + "年" + month8 + "月");
mv.addObject("year9", year9 + "年" + month9 + "月");
mv.addObject("year10", year10 + "年" + month10 + "月");
mv.addObject("year11", year11 + "年" + month11 + "月");
mv.addObject("year12", year12 + "年" + month12 + "月");
return mv;
}
@RequestMapping("/toRoomList")
public ModelAndView roomList() {
String bigRoom = "大床房";
String oneRoom = "单人普通间";
String twoRoom = "普通双人间";
String twoRoom2 = "标准双人间";
String bigRoom2 = "豪华单间";
String twoRoom3 = "豪华双人间";
String yuGang = "浴缸间";
String movieRoom = "影视房";
String meetingRoom = "会议室";
String bestRoom = "总统套房";
int count1 = 0;
int count2 = 0;
int count3 = 0;
int count4 = 0;
int count5 = 0;
int count6 = 0;
int count7 = 0;
int count8 = 0;
int count9 = 0;
int count10 = 0;
Calendar cal = Calendar.getInstance();
int year = cal.get(Calendar.YEAR); //获取年
int month = cal.get(Calendar.MONTH) + 2; //获取月
int day = cal.get(Calendar.DATE); //获取日
month = month - 12;
if (month <= 0) {
year -= 1;
month += 12;
}
String stringMonth = String.valueOf(month);
if (stringMonth.length() == 1) {
stringMonth = "0" + stringMonth;
}
Timestamp timestamp = Timestamp.valueOf(year + "-" + stringMonth + "-" + "01" + " 00:00:00");
List<Integer> list = stayRegisterService.selectAllRoomNum(timestamp);
for (Integer id : list) {
int LevelId = roomSetService.selectLevelById(id);
//大床房
if (LevelId == 8) {
count1++;
}
//单人普通间
if (LevelId == 9) {
count2++;
}
//二人普通间
if (LevelId == 10) {
count3++;
}
//二人标准间
if (LevelId == 11) {
count4++;
}
//豪华单人间
if (LevelId == 12) {
count5++;
}
//会议室
if (LevelId == 13) {
count9++;
}
//总统套房
if (LevelId == 14) {
count10++;
}
//浴缸
if (LevelId == 74) {
count7++;
}
// 影视
if (LevelId == 75) {
count8++;
}
//豪华双人间
if (LevelId == 77) {
count6++;
}
}
//各个类型房间数
int size1 = roomSetService.countRoomByLevel(8);
int size2 = roomSetService.countRoomByLevel(9);
int size3 = roomSetService.countRoomByLevel(10);
int size4 = roomSetService.countRoomByLevel(11);
int size5 = roomSetService.countRoomByLevel(12);
int size6 = roomSetService.countRoomByLevel(77);
int size7 = roomSetService.countRoomByLevel(74);
int size8 = roomSetService.countRoomByLevel(75);
int size9 = roomSetService.countRoomByLevel(13);
int size10 = roomSetService.countRoomByLevel(14);
//所有房间总数
double countSize = size1 + size2 + size3 + size4 + size5 + size6 + size7 + size8 + size9 + size10;
//房间的类型个数
int typeSize = attributeService.selectGuestRoomLevel().size();
double sumCount = count1 + count2 + count3 + count4 + count5 + count6 + count7 + count8 + count9 + count10;
double ratio1 = (count1 == 0 ? 0 : ((size1 / countSize) / (count1 / sumCount)) / typeSize);
double ratio2 = (count2 == 0 ? 0 : ((size2 / countSize) / (count2 / sumCount)) / typeSize);
double ratio3 = (count3 == 0 ? 0 : ((size3 / countSize) / (count3 / sumCount)) / typeSize);
double ratio4 = (count4 == 0 ? 0 : ((size4 / countSize) / (count4 / sumCount)) / typeSize);
double ratio5 = (count5 == 0 ? 0 : ((size5 / countSize) / (count5 / sumCount)) / typeSize);
double ratio6 = (count6 == 0 ? 0 : ((size6 / countSize) / (count6 / sumCount)) / typeSize);
double ratio7 = (count7 == 0 ? 0 : ((size7 / countSize) / (count7 / sumCount)) / typeSize);
double ratio8 =( count8 == 0 ? 0 : ((size8 / countSize) / (count8 / sumCount)) / typeSize);
double ratio9 = (count9 == 0 ? 0 : ((size9 / countSize) / (count9 / sumCount)) / typeSize);
double ratio10 = (count10 == 0 ? 0 : ((size10 / countSize) / (count10 / sumCount)) / typeSize);
ModelAndView mv = null;
mv = new ModelAndView("/dateview/roomRatio");
mv.addObject("bigRoom", bigRoom);
mv.addObject("oneRoom", oneRoom);
mv.addObject("twoRoom", twoRoom);
mv.addObject("twoRoom2", twoRoom2);
mv.addObject("bigRoom2", bigRoom2);
mv.addObject("twoRoom3", twoRoom3);
mv.addObject("yuGang", yuGang);
mv.addObject("movieRoom", movieRoom);
mv.addObject("meetingRoom", meetingRoom);
mv.addObject("bestRoom", bestRoom);
mv.addObject("sizeRatio", 1);
mv.addObject("sumCount", (int)sumCount);
mv.addObject("ratio1", ratio1);
mv.addObject("ratio2", ratio2);
mv.addObject("ratio3", ratio3);
mv.addObject("ratio4", ratio4);
mv.addObject("ratio5", ratio5);
mv.addObject("ratio6", ratio6);
mv.addObject("ratio7", ratio7);
mv.addObject("ratio8", ratio8);
mv.addObject("ratio9", ratio9);
mv.addObject("ratio10", ratio10);
mv.addObject("count1", count1);
mv.addObject("count2", count2);
mv.addObject("count3", count3);
mv.addObject("count4", count4);
mv.addObject("count5", count5);
mv.addObject("count6", count6);
mv.addObject("count7", count7);
mv.addObject("count8", count8);
mv.addObject("count9", count9);
mv.addObject("count10", count10);
return mv;
}
}
package com.wzy.controller;
import java.sql.Timestamp;
import java.util.List;
import com.wzy.page.Page;
import com.wzy.pojo.StayRegisterPo;
import com.wzy.service.StayRegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
/**
* 查询账单
* @Auther: wzy
* @Date: 2021/01/29/9:00
* @Description:
*/
@Controller
@RequestMapping("/FinancialStatistics")
public class FinancialStatistics {
@Autowired
private StayRegisterService stayRegisterService;
@RequestMapping("/tolist")
public ModelAndView tolist(String datemin, String datemax,Integer currentPage){
ModelAndView mv=null;
int chuZuFangJianShu=0;
int zhuSuRenShu=0;
double xiaoFeiJinE=0;
double JieZhangJinE=0;
if (currentPage==null) {
currentPage=1;
}else if (currentPage==0) {
currentPage=1;
}
mv=new ModelAndView("/financialstatistics/financialstatistics");
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";//最小时间拼0点
String datemaxString=datemax+" 23:59:59";//最大时间拼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);
mv.addObject("JieZhangJinE",JieZhangJinE);
mv.addObject("min",datemin);
mv.addObject("max",datemax);
return mv;
}
@RequestMapping("/toinformation")
public ModelAndView toinformation(Integer id,Integer stayregisterdetailsId,String min, String max){
ModelAndView mv=null;
double zhuSuFei=0;
double huanFangFei=0;
double qiTaXiaoFei=0;
double yaJin=0;
double zongFeiYong=0;
List<StayRegisterPo> listDeposit=stayRegisterService.selectDepositById(id);
List<StayRegisterPo> listXiaoFei=stayRegisterService.selectXiaoFeiMingXi(id);
List<StayRegisterPo> list=stayRegisterService.selectAllInformation(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.get(0).getSumConst();
huanFangFei=list.get(0).getChangRoomMoney();
zhuSuFei=zongFeiYong-huanFangFei-qiTaXiaoFei;
mv=new ModelAndView("/financialstatistics/particulars");
mv.addObject("zhuSuFei",zhuSuFei);
mv.addObject("qiTaXiaoFei",qiTaXiaoFei);
mv.addObject("yaJin",yaJin);
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;
}
}
六、底部获取源码(9.9¥带走)
有问题,或者需要协助调试运行项目的也可以