Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Evan Liu
hms
提交
85acb73d
H
hms
项目概览
Evan Liu
/
hms
通知
10
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hms
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
85acb73d
编写于
8月 13, 2021
作者:
刘
刘兴
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://gitee.com/liuxing997/hotel-management-system
上级
0bf75769
55153b67
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
135 addition
and
7 deletion
+135
-7
HMS/src/main/java/com/hqyj/seven/dao/CustomerDao.java
HMS/src/main/java/com/hqyj/seven/dao/CustomerDao.java
+1
-0
HMS/src/main/java/com/hqyj/seven/dao/EnterDao.java
HMS/src/main/java/com/hqyj/seven/dao/EnterDao.java
+2
-0
HMS/src/main/java/com/hqyj/seven/dao/Feedao.java
HMS/src/main/java/com/hqyj/seven/dao/Feedao.java
+1
-0
HMS/src/main/java/com/hqyj/seven/service/CustomerService.java
...src/main/java/com/hqyj/seven/service/CustomerService.java
+5
-0
HMS/src/main/java/com/hqyj/seven/service/EnterService.java
HMS/src/main/java/com/hqyj/seven/service/EnterService.java
+2
-0
HMS/src/main/java/com/hqyj/seven/service/FeeService.java
HMS/src/main/java/com/hqyj/seven/service/FeeService.java
+3
-0
HMS/src/main/java/com/hqyj/seven/service/HouseService.java
HMS/src/main/java/com/hqyj/seven/service/HouseService.java
+2
-1
HMS/src/main/java/com/hqyj/seven/service/impl/CustomerServiceImpl.java
...java/com/hqyj/seven/service/impl/CustomerServiceImpl.java
+7
-2
HMS/src/main/java/com/hqyj/seven/service/impl/EnterServiceImpl.java
...in/java/com/hqyj/seven/service/impl/EnterServiceImpl.java
+4
-0
HMS/src/main/java/com/hqyj/seven/service/impl/FeeServiceImpl.java
...main/java/com/hqyj/seven/service/impl/FeeServiceImpl.java
+3
-0
HMS/src/main/java/com/hqyj/seven/service/impl/HouseServiceImpl.java
...in/java/com/hqyj/seven/service/impl/HouseServiceImpl.java
+99
-3
HMS/src/main/resources/mapper/CustomerDaoMapper.xml
HMS/src/main/resources/mapper/CustomerDaoMapper.xml
+3
-0
HMS/src/main/resources/mapper/enterDaoMapper.xml
HMS/src/main/resources/mapper/enterDaoMapper.xml
+3
-1
未找到文件。
HMS/src/main/java/com/hqyj/seven/dao/CustomerDao.java
浏览文件 @
85acb73d
...
@@ -8,4 +8,5 @@ import java.util.List;
...
@@ -8,4 +8,5 @@ import java.util.List;
public
interface
CustomerDao
{
public
interface
CustomerDao
{
List
<
Customer
>
queryAll
();
List
<
Customer
>
queryAll
();
int
updataByCustomerIdToremainder
(
@Param
(
"money"
)
double
money
,
@Param
(
"id"
)
int
id
);
int
updataByCustomerIdToremainder
(
@Param
(
"money"
)
double
money
,
@Param
(
"id"
)
int
id
);
Customer
queryByCustomer
(
int
CustomerId
);
}
}
HMS/src/main/java/com/hqyj/seven/dao/EnterDao.java
浏览文件 @
85acb73d
package
com.hqyj.seven.dao
;
package
com.hqyj.seven.dao
;
import
com.hqyj.seven.pojo.Enter
;
import
com.hqyj.seven.pojo.Enter
;
import
org.apache.ibatis.annotations.Param
;
public
interface
EnterDao
{
public
interface
EnterDao
{
int
inserintoEnter
(
Enter
enter
);
int
inserintoEnter
(
Enter
enter
);
Enter
queryByHouseIdAndTime
(
@Param
(
"HouseId"
)
int
HouseId
,
@Param
(
"time"
)
String
time
);
}
}
HMS/src/main/java/com/hqyj/seven/dao/Feedao.java
浏览文件 @
85acb73d
...
@@ -6,4 +6,5 @@ import com.hqyj.seven.pojo.Fee;
...
@@ -6,4 +6,5 @@ import com.hqyj.seven.pojo.Fee;
public
interface
Feedao
{
public
interface
Feedao
{
//插入数据
//插入数据
int
inserintoFee
(
Fee
fee
);
int
inserintoFee
(
Fee
fee
);
}
}
HMS/src/main/java/com/hqyj/seven/service/CustomerService.java
浏览文件 @
85acb73d
package
com.hqyj.seven.service
;
package
com.hqyj.seven.service
;
import
com.hqyj.seven.pojo.Customer
;
public
interface
CustomerService
{
public
interface
CustomerService
{
//住房更新金额
int
updateByNameToRemainder
(
double
money
,
int
id
);
int
updateByNameToRemainder
(
double
money
,
int
id
);
//按id查找用户
Customer
queryById
(
int
customerId
);
}
}
HMS/src/main/java/com/hqyj/seven/service/EnterService.java
浏览文件 @
85acb73d
...
@@ -5,4 +5,6 @@ import com.hqyj.seven.pojo.Enter;
...
@@ -5,4 +5,6 @@ import com.hqyj.seven.pojo.Enter;
public
interface
EnterService
{
public
interface
EnterService
{
int
insertEnter
(
Enter
enter
);
int
insertEnter
(
Enter
enter
);
//安照房间号和住房时间查找住房id
Enter
queryByHouseIdAndTime
(
int
CustomerId
,
String
time
);
}
}
HMS/src/main/java/com/hqyj/seven/service/FeeService.java
浏览文件 @
85acb73d
package
com.hqyj.seven.service
;
package
com.hqyj.seven.service
;
import
com.hqyj.seven.pojo.Enter
;
import
com.hqyj.seven.pojo.Fee
;
import
com.hqyj.seven.pojo.Fee
;
public
interface
FeeService
{
public
interface
FeeService
{
//插入数据
//插入数据
int
insertFee
(
Fee
fee
);
int
insertFee
(
Fee
fee
);
//安照房间号和住房时间查找住房id
}
}
HMS/src/main/java/com/hqyj/seven/service/HouseService.java
浏览文件 @
85acb73d
...
@@ -4,6 +4,7 @@ import com.hqyj.seven.pojo.Enter;
...
@@ -4,6 +4,7 @@ import com.hqyj.seven.pojo.Enter;
import
com.hqyj.seven.pojo.House
;
import
com.hqyj.seven.pojo.House
;
import
com.hqyj.seven.pojo.User
;
import
com.hqyj.seven.pojo.User
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -27,5 +28,5 @@ public interface HouseService {
...
@@ -27,5 +28,5 @@ public interface HouseService {
//删除客房
//删除客房
int
deleteHouseI
(
int
house_id
);
int
deleteHouseI
(
int
house_id
);
//住房功能
//住房功能
int
checkIn
(
int
customerId
,
String
name
,
int
day
)
;
public
Map
<
String
,
Object
>
checkIn
(
int
customerId
,
String
name
,
int
day
,
int
numberOfPeople
,
int
userId
)
throws
ParseException
;
}
}
HMS/src/main/java/com/hqyj/seven/service/impl/CustomerServiceImpl.java
浏览文件 @
85acb73d
package
com.hqyj.seven.service.impl
;
package
com.hqyj.seven.service.impl
;
import
com.hqyj.seven.dao.CustomerDao
;
import
com.hqyj.seven.dao.CustomerDao
;
import
com.hqyj.seven.pojo.Customer
;
import
com.hqyj.seven.service.CustomerService
;
import
com.hqyj.seven.service.CustomerService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -9,9 +10,13 @@ import org.springframework.stereotype.Service;
...
@@ -9,9 +10,13 @@ import org.springframework.stereotype.Service;
public
class
CustomerServiceImpl
implements
CustomerService
{
public
class
CustomerServiceImpl
implements
CustomerService
{
@Autowired
@Autowired
private
CustomerDao
customerDao
;
private
CustomerDao
customerDao
;
@Override
@Override
public
int
updateByNameToRemainder
(
double
money
,
int
id
)
{
public
int
updateByNameToRemainder
(
double
money
,
int
id
)
{
return
customerDao
.
updataByCustomerIdToremainder
(
money
,
id
);
return
customerDao
.
updataByCustomerIdToremainder
(
money
,
id
);
}
//按用户id查找信息
@Override
public
Customer
queryById
(
int
customerId
)
{
return
customerDao
.
queryByCustomer
(
customerId
);
}
}
}
}
HMS/src/main/java/com/hqyj/seven/service/impl/EnterServiceImpl.java
浏览文件 @
85acb73d
...
@@ -15,4 +15,8 @@ public class EnterServiceImpl implements EnterService {
...
@@ -15,4 +15,8 @@ public class EnterServiceImpl implements EnterService {
public
int
insertEnter
(
Enter
enter
)
{
public
int
insertEnter
(
Enter
enter
)
{
return
enterDao
.
inserintoEnter
(
enter
);
return
enterDao
.
inserintoEnter
(
enter
);
}
}
@Override
public
Enter
queryByHouseIdAndTime
(
int
CustomerId
,
String
time
)
{
return
enterDao
.
queryByHouseIdAndTime
(
CustomerId
,
time
);
}
}
}
HMS/src/main/java/com/hqyj/seven/service/impl/FeeServiceImpl.java
浏览文件 @
85acb73d
package
com.hqyj.seven.service.impl
;
package
com.hqyj.seven.service.impl
;
import
com.hqyj.seven.dao.Feedao
;
import
com.hqyj.seven.dao.Feedao
;
import
com.hqyj.seven.pojo.Enter
;
import
com.hqyj.seven.pojo.Fee
;
import
com.hqyj.seven.pojo.Fee
;
import
com.hqyj.seven.service.FeeService
;
import
com.hqyj.seven.service.FeeService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -17,4 +18,6 @@ public class FeeServiceImpl implements FeeService {
...
@@ -17,4 +18,6 @@ public class FeeServiceImpl implements FeeService {
return
feedao
.
inserintoFee
(
fee
);
return
feedao
.
inserintoFee
(
fee
);
}
}
}
}
HMS/src/main/java/com/hqyj/seven/service/impl/HouseServiceImpl.java
浏览文件 @
85acb73d
package
com.hqyj.seven.service.impl
;
package
com.hqyj.seven.service.impl
;
import
com.hqyj.seven.dao.CustomerDao
;
import
com.hqyj.seven.dao.EnterDao
;
import
com.hqyj.seven.dao.Feedao
;
import
com.hqyj.seven.dao.HouseDao
;
import
com.hqyj.seven.dao.HouseDao
;
import
com.hqyj.seven.pojo.Customer
;
import
com.hqyj.seven.pojo.Enter
;
import
com.hqyj.seven.pojo.Enter
;
import
com.hqyj.seven.pojo.Fee
;
import
com.hqyj.seven.pojo.House
;
import
com.hqyj.seven.pojo.House
;
import
com.hqyj.seven.service.HouseService
;
import
com.hqyj.seven.service.HouseService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -15,7 +23,12 @@ import java.util.Map;
...
@@ -15,7 +23,12 @@ import java.util.Map;
public
class
HouseServiceImpl
implements
HouseService
{
public
class
HouseServiceImpl
implements
HouseService
{
@Autowired
@Autowired
private
HouseDao
houseDao
;
private
HouseDao
houseDao
;
@Autowired
private
CustomerDao
customerDao
;
@Autowired
private
EnterDao
enterDao
;
@Autowired
private
Feedao
feedao
;
@Override
@Override
public
Map
<
String
,
Object
>
reservation
(
int
customerId
,
String
name
)
{
public
Map
<
String
,
Object
>
reservation
(
int
customerId
,
String
name
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
...
@@ -65,8 +78,91 @@ public class HouseServiceImpl implements HouseService {
...
@@ -65,8 +78,91 @@ public class HouseServiceImpl implements HouseService {
return
houseDao
.
deleteHouse
(
house_id
);
return
houseDao
.
deleteHouse
(
house_id
);
}
}
@Override
@Override
public
int
checkIn
(
int
customerId
,
String
name
,
int
day
)
{
//参数分别为顾客id,房间name,入住人数,userID
return
houseDao
.
updateByHouseNametocheckIn
(
customerId
,
name
,
day
);
public
Map
<
String
,
Object
>
checkIn
(
int
customerId
,
String
name
,
int
day
,
int
numberOfPeople
,
int
userId
)
throws
ParseException
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
//按照name获取house数据
House
house
=
houseDao
.
queryByHousename
(
name
);
//按照id获取customer数据
Customer
customer
=
customerDao
.
queryByCustomer
(
customerId
);
Date
time
=
new
Date
();
//更新字符串 如果numberOfPeople=2,字符串则更新为2人已入住
String
str1
=
numberOfPeople
+
"人已入住"
;
//预定时间+day为预定退房时间,实际退房时间 退房时更新
int
day2
=
day
*
24
*
60
*
60
*
1000
;
long
time2
=
time
.
getTime
()+
day2
;
Date
time3
=
new
Date
(
time2
);
System
.
out
.
println
(
time
);
//如果房间是空闲则之间可以入住
if
(
house
.
getState
().
equals
(
"空闲"
))
{
double
money
=
house
.
getPrice
()*
day
;
//如果余额不足则会提示
if
(
money
>
customer
.
getRemainder
())
result
.
put
(
"用户余额不足可以尝试充值或者减少预定住房时间"
,-
1
);
else
{
//更新顾客表余额的数据
customerDao
.
updataByCustomerIdToremainder
(
money
,
customerId
);
//插入顾客表
enterDao
.
inserintoEnter
(
new
Enter
(
house
.
getHouseId
(),
customerId
,
numberOfPeople
,
time
,
time3
,
null
,
money
,
1
,
userId
,
"已结账"
,
house
.
getPrice
()));
//设置时间格式为yyyy-MM-dd HH:mm:ss以便插入
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//规范化插入表时的时间和获取的时间有点误差
long
day3
=
time
.
getTime
()+
500
;
Date
time4
=
new
Date
(
day3
);
Enter
enter
=
enterDao
.
queryByHouseIdAndTime
(
house
.
getHouseId
(),
sdf
.
format
(
time4
));
//插入缴费表
feedao
.
inserintoFee
(
new
Fee
(
enter
.
getEnter_id
(),
"缴费"
,
customerId
,
money
,
house
.
getHouseId
(),
str1
,
userId
,
"会员卡扣费"
));
//更新房间为入住
houseDao
.
updateByHouseNametocheckIn
(
customerId
,
name
,
day
);
result
.
put
(
"入住成功"
,
1
);
}
}
else
{
if
((
house
.
getState
().
equals
(
"已定"
)))
{
//判断预定房间号的顾客id和现在的顾客id是否一致
if
(
house
.
getCustomerId
()
==
customerId
)
{
double
money
=
house
.
getPrice
()
*
day
;
//如果余额不足则会提示
if
(
money
>
customer
.
getRemainder
())
result
.
put
(
"用户余额不足可以尝试充值或者减少预定住房时间"
,
-
1
);
else
{
//更新顾客表余额的数据
customerDao
.
updataByCustomerIdToremainder
(
money
,
customerId
);
//插入顾客表
enterDao
.
inserintoEnter
(
new
Enter
(
house
.
getHouseId
(),
customerId
,
numberOfPeople
,
time
,
time3
,
null
,
money
,
1
,
userId
,
"已结账"
,
house
.
getPrice
()));
//设置时间格式为yyyy-MM-dd HH:mm:ss以便插入
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
//规范化插入表时的时间和获取的时间有点误差
long
day3
=
time
.
getTime
()
+
500
;
Date
time4
=
new
Date
(
day3
);
Enter
enter
=
enterDao
.
queryByHouseIdAndTime
(
house
.
getHouseId
(),
sdf
.
format
(
time4
));
//插入缴费表
feedao
.
inserintoFee
(
new
Fee
(
enter
.
getEnter_id
(),
"缴费"
,
customerId
,
money
,
house
.
getHouseId
(),
str1
,
userId
,
"会员卡扣费"
));
//更新房间为入住
houseDao
.
updateByHouseNametocheckIn
(
customerId
,
name
,
day
);
result
.
put
(
"入住预定的房间成功"
,
2
);
}
}
else
{
result
.
put
(
"此房间不是该顾客预定的哟"
,
-
3
);
}
}
else
{
result
.
put
(
"房间预定或者已经入住"
,
-
2
);
}
}
return
result
;
}
}
}
}
HMS/src/main/resources/mapper/CustomerDaoMapper.xml
浏览文件 @
85acb73d
...
@@ -8,6 +8,9 @@
...
@@ -8,6 +8,9 @@
<update
id=
"updataByCustomerIdToremainder"
parameterType=
"com.hqyj.seven.pojo.Customer"
>
<update
id=
"updataByCustomerIdToremainder"
parameterType=
"com.hqyj.seven.pojo.Customer"
>
update customer set remainder=remainder-#{money} where customer_id=#{id}
update customer set remainder=remainder-#{money} where customer_id=#{id}
</update>
</update>
<select
id=
"queryByCustomer"
resultType=
"com.hqyj.seven.pojo.Customer"
>
select * from customer where customer_id=#{CustomerId}
</select>
<!-- <resultMap id="customerBaseResultMap" type="com.hqyj.seven.pojo.Customer">-->
<!-- <resultMap id="customerBaseResultMap" type="com.hqyj.seven.pojo.Customer">-->
<!-- <id column="customer_id" property="customerId" />-->
<!-- <id column="customer_id" property="customerId" />-->
<!-- <result column="cname" property="name" />-->
<!-- <result column="cname" property="name" />-->
...
...
HMS/src/main/resources/mapper/enterDaoMapper.xml
浏览文件 @
85acb73d
...
@@ -11,5 +11,7 @@
...
@@ -11,5 +11,7 @@
(#{house_id},#{customer_id},#{customer_info},#{start_time},#{end_time_estimate},#{end_time_actual},#{fee_total},
(#{house_id},#{customer_id},#{customer_info},#{start_time},#{end_time_estimate},#{end_time_actual},#{fee_total},
#{fee_info},#{user_id},#{state},#{price})
#{fee_info},#{user_id},#{state},#{price})
</insert>
</insert>
<select
id=
"queryByHouseIdAndTime"
resultType=
"com.hqyj.seven.pojo.Enter"
>
select * from enter where house_id=#{HouseId} and start_time=#{time}
</select>
</mapper>
</mapper>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录