項目介紹
本系統(tǒng)使用Spring+SpringMVC+MyBatis架構(gòu),數(shù)據(jù)庫使用MySQL,前端頁面使用jsp笑诅,專為名宿經(jīng)營打造的管理系統(tǒng),主要給民宿經(jīng)營人員、門店前臺人員等使用。通過本系統(tǒng),民宿經(jīng)營者可以方便的管理自己的房間凡伊、房型,靈活的制定的價格方案窒舟,直觀查看民宿經(jīng)營的核心數(shù)據(jù)系忙,合理分配科學(xué)管理民宿內(nèi)販售的其他商品』莶颍總之银还,能夠幫助民宿主提升民宿管理效率。
功能簡介
主要分為兩個端:店鋪端 和總后臺
一洁墙、店鋪端主要功能:
1.房間管理
添加/修改房間以及房間信息
添加修改名宿內(nèi)售賣的商品
2.旅客管理
添加/修改旅客以及團隊信息
3.住宿管理
添加/修改預(yù)定房間的信息
添加/修改客戶住宿信息
房間結(jié)算
4.財務(wù)管理
顯示今日店鋪的入住信息以及收入情況
5.個人設(shè)置
修改個人基本信息
意見反饋
二蛹疯、后臺主要功能
1.收益預(yù)覽
查看每個類別收入多少錢
2.用戶信息
查看各個店鋪的帳號信息
3.意見反饋
查看各個店鋪的反饋信息
開發(fā)環(huán)境:
- jdk 8
- intellij idea
- tomcat 8.5.40
- mysql 5.7
所用技術(shù):
- Spring+SpringMVC+MyBatis
- layui
- jsp
項目訪問地址
前端訪問地址
http://localhost:8090/login
項目截圖
-
系統(tǒng)功能
系統(tǒng)功能.png -
平臺-用戶信息
平臺-用戶信息.png -
平臺-收益預(yù)覽
收益預(yù)覽.png -
旅客管理-旅客信息
旅客管理-旅客信息.png -
房間設(shè)置-添加房間
房間設(shè)置-添加房間.png -
商品設(shè)置-添加商品
商品設(shè)置-添加商品.png -
住宿登記-結(jié)算
住宿登記-結(jié)算.png
數(shù)據(jù)庫配置
- 數(shù)據(jù)庫配置信息
#配置文件
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost/homestay?useUnicode=true&characterEncoding=utf-8&useSSL=false
jdbc.username=root
jdbc.password=root123
- 數(shù)據(jù)庫配置加載
<!-- 數(shù)據(jù)源dataSource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<!--maxActive: 最大連接數(shù)量 -->
<property name="maxActive" value="150" />
<!--minIdle: 最小空閑連接 -->
<property name="minIdle" value="5" />
<!--maxIdle: 最大空閑連接 -->
<property name="maxIdle" value="20" />
<!--initialSize: 初始化連接 -->
<property name="initialSize" value="30" />
<!--maxWait: 超時等待時間以毫秒為單位 1000等于60秒 -->
<property name="maxWait" value="1000" />
<!-- 在空閑連接回收器線程運行期間休眠的時間值,以毫秒為單位. -->
<property name="timeBetweenEvictionRunsMillis" value="10000" />
<!-- 在每次空閑連接回收器線程(如果有)運行時檢查的連接數(shù)量 -->
<property name="numTestsPerEvictionRun" value="10" />
<!-- 1000 * 60 * 30 連接在池中保持空閑而不被空閑連接回收器線程 -->
<property name="minEvictableIdleTimeMillis" value="10000" />
<property name="validationQuery" value="SELECT NOW() FROM DUAL" />
</bean>
- 資源配置
<mvc:interceptors>
<mvc:interceptor>
<!-- 需要攔截的url路徑 :/order/** 這個是訂單系統(tǒng)的url格式 -->
<mvc:mapping path="/**" />
<mvc:exclude-mapping path="/login"/>
<mvc:exclude-mapping path="/*.js"/>
<mvc:exclude-mapping path="/register"/>
<mvc:exclude-mapping path="/logout"/>
<bean class="com.chengxubang.interceptor.LoginInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>
<!-- 支持aop的注解 -->
<aop:aspectj-autoproxy/>
<!-- 啟動SpringMVC的注解功能 -->
<mvc:annotation-driven/>
<!--靜態(tài)資源放行-->
<mvc:default-servlet-handler/>
<!-- 定義跳轉(zhuǎn)的文件的前后綴 ,視圖解析器配置-->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- 配置文件上傳解析器 -->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 默認編碼 -->
<property name="defaultEncoding" value="utf-8"/>
<!-- 文件大小最大值 -->
<property name="maxUploadSize" value="10485760000"/>
</bean>
業(yè)務(wù)代碼
- 民宿后臺首頁热监,展示收益情況
@RequestMapping("/welcome")
public ModelAndView welcome(ModelAndView modelAndView){
User user=getUser();
HotelRegisterQuery query=new HotelRegisterQuery();
if(!user.getUsername().equals("admin")){
query.setUserId(getUserId());
}
query.setType(0);//旅客收益
List<HotelRegister> type0list=hotelRegisterService.getEarningsByPtype(query);
query.setType(1);//團隊收益
List<HotelRegister> type1list=hotelRegisterService.getEarningsByPtype(query);
String iStr="";
int list0Index=0; //旅客數(shù)據(jù)下標
int list1Index=0; //團隊數(shù)據(jù)下標
String type0Data="";//旅客每月收益
String type1Data="";//團隊每月收益
String month="";
for(int i=1;i<13;i++){
if(i<10){ //小10的情況下拼接0捺弦,方便與查詢數(shù)據(jù)對比
iStr="0"+i;
}else{
iStr=i+"";
}
month+=iStr+",";
if(type0list.size()>0){
if(iStr.equals(type0list.get(list0Index).getSettleTime())){
type0Data=type0Data+type0list.get(list0Index).getAllFee()+",";//如果匹配上月份,就拼接當前月的收益
if(!(list0Index+1>=type0list.size())){ //大于等于list大小孝扛,說明已經(jīng)沒有數(shù)據(jù)
list0Index++;
}
}else{
type0Data=type0Data+"0,";
}
}else{
type0Data=type0Data+"0,";
}
if(type1list.size()>0){
if(iStr.equals(type1list.get(list1Index).getSettleTime())){
type1Data=type1Data+type1list.get(list1Index).getAllFee()+",";
if(!(list1Index+1>=type1list.size())){ //大于等于list大小列吼,說明已經(jīng)沒有數(shù)據(jù)
list1Index++;
}
}else{
type1Data=type1Data+"0,";
}
}else{
type1Data=type1Data+"0,";
}
}
type0Data=type0Data.substring(0,type0Data.length()-1);
type1Data=type1Data.substring(0,type1Data.length()-1);
month=month.substring(0,month.length()-1);
modelAndView.addObject("month",month);
modelAndView.addObject("type0Data",type0Data);
modelAndView.addObject("type1Data",type1Data);
modelAndView.setViewName("welcome");
return modelAndView;
}
//jsp數(shù)據(jù)渲染
<html>
<head>
<script type="text/javascript" src="${ctx}/static/js/echarts-all.js"></script>
</head>
<body>
<div id="main" style="width: 95%;height:666px"></div>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('main'));
// 指定圖表的配置項和數(shù)據(jù)
var option = {
title: {
text: '收益金額折線圖'
},
tooltip: {
trigger: 'axis'
},
legend: {
data:['旅客','團隊']
},
grid: {
left: '3%',
right: '4%',
bottom: '1%',
containLabel: true
},
toolbox: {
feature: {
saveAsImage: {}
}
},
xAxis: {
type: 'category',
boundaryGap: false,
data: [${month}]
},
yAxis: {
type: 'value'
},
series: [
{
name: '旅客',
type: 'line',
stack: '總量',
data: [${type0Data}]
},
{
name: '團隊',
type: 'line',
stack: '總量',
data: [${type1Data}]
}
]
};
// 使用剛指定的配置項和數(shù)據(jù)顯示圖表。
myChart.setOption(option);
</script>
</body>
</html>
- 房間添加
@RequestMapping("/save")
@ResponseBody
public AjaxResult save(Room room){
try {
if(room.getId()!=null){
roomService.update(room);
}else{
RoomQuery query=new RoomQuery();
query.setRoomNum(room.getRoomNum());
query.setUserId(getUserId());
PageList pageList= roomService.getByQuery(query);
if(pageList.getCount()>0){
return new AjaxResult("保存失敗苦始,房間號已經(jīng)存在!",-10002);
}else{
room.setUserId(getUserId());
roomService.add(room);
}
}
return new AjaxResult("保存成功!");
} catch (Exception e) {
e.printStackTrace();
return new AjaxResult("保存失敗:"+e.getMessage(),-10002);
}
}
- 商品添加
@RequestMapping("/save")
@ResponseBody
public AjaxResult save(Goods goods){
try {
if(goods.getId()!=null){
goodsService.update(goods);
}else{
GoodsQuery goodsQuery=new GoodsQuery();
goodsQuery.setGoodName(goods.getGoodName());
goodsQuery.setUserId(getUserId());
PageList pageList=goodsService.getByQuery(goodsQuery);
if(pageList.getCount()>0){
return new AjaxResult("保存失敗,改商品名已經(jīng)存在",-10002);
}else{
goods.setUserId(getUserId());
goodsService.add(goods);
}
}
return new AjaxResult("保存成功!");
} catch (Exception e) {
e.printStackTrace();
return new AjaxResult("保存失敗:"+e.getMessage(),-10002);
}
}
項目后續(xù)
其他ssh寞钥,springboot版本后續(xù)迭代更新,持續(xù)關(guān)注