Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_ht
Commits
99234a00
Commit
99234a00
authored
Oct 18, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
room status dev;
parent
e549dcab
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
365 additions
and
219 deletions
+365
-219
SCleanConsumerController.java
...share/web/controller/system/SCleanConsumerController.java
+0
-1
RoomStatusEnum.java
...mmon/src/main/java/share/common/enums/RoomStatusEnum.java
+27
-0
DateUtils.java
share-common/src/main/java/share/common/utils/DateUtils.java
+2
-0
SRoomController.java
...ain/java/share/web/controller/system/SRoomController.java
+20
-7
SOrder.java
share-system/src/main/java/share/system/domain/SOrder.java
+14
-199
RoomStatusVo.java
...em/src/main/java/share/system/domain/vo/RoomStatusVo.java
+55
-0
SOrderMapper.java
...ystem/src/main/java/share/system/mapper/SOrderMapper.java
+3
-1
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+13
-1
RoomStatusService.java
...src/main/java/share/system/service/RoomStatusService.java
+22
-0
RoomStatusServiceImpl.java
...java/share/system/service/impl/RoomStatusServiceImpl.java
+150
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+20
-1
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+2
-6
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+37
-3
No files found.
share-admin/src/main/java/share/web/controller/system/SCleanConsumerController.java
View file @
99234a00
...
@@ -74,7 +74,6 @@ public class SCleanConsumerController extends BaseController
...
@@ -74,7 +74,6 @@ public class SCleanConsumerController extends BaseController
public
AjaxResult
add
(
@RequestBody
SConsumer
sConsumer
)
public
AjaxResult
add
(
@RequestBody
SConsumer
sConsumer
)
{
{
sConsumer
.
setRoleType
(
"1"
);
sConsumer
.
setRoleType
(
"1"
);
sConsumer
.
setOpenId
(
"0"
);
return
toAjax
(
sConsumerService
.
insertSConsumer
(
sConsumer
));
return
toAjax
(
sConsumerService
.
insertSConsumer
(
sConsumer
));
}
}
...
...
share-common/src/main/java/share/common/enums/RoomStatusEnum.java
0 → 100644
View file @
99234a00
package
share
.
common
.
enums
;
/**
* @Author wwl
* @Date 2023/10/18 17:33
*/
public
enum
RoomStatusEnum
{
FREE
(
1
,
"空闲"
),
HOLD
(
2
,
"占用"
);
private
Integer
value
;
private
String
name
;
RoomStatusEnum
(
Integer
value
,
String
name
)
{
this
.
value
=
value
;
this
.
name
=
name
;
}
public
Integer
getValue
()
{
return
value
;
}
public
String
getName
()
{
return
name
;
}
}
share-common/src/main/java/share/common/utils/DateUtils.java
View file @
99234a00
...
@@ -24,6 +24,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
...
@@ -24,6 +24,8 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public
static
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
String
YYYY_MM_DD
=
"yyyy-MM-dd"
;
public
static
String
YYYY_MM_DD_HH
=
"yyyy-MM-dd HH"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYYMMDDHHMMSS
=
"yyyyMMddHHmmss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
public
static
String
YYYY_MM_DD_HH_MM_SS
=
"yyyy-MM-dd HH:mm:ss"
;
...
...
share-front/src/main/java/share/web/controller/system/SRoomController.java
View file @
99234a00
package
share
.
web
.
controller
.
system
;
package
share
.
web
.
controller
.
system
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -16,10 +17,12 @@ import share.common.core.domain.AjaxResult;
...
@@ -16,10 +17,12 @@ import share.common.core.domain.AjaxResult;
import
share.common.core.domain.R
;
import
share.common.core.domain.R
;
import
share.common.enums.BusinessType
;
import
share.common.enums.BusinessType
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.service.ISRoomService
;
import
share.system.service.ISRoomService
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.utils.poi.ExcelUtil
;
import
share.common.core.page.TableDataInfo
;
import
share.common.core.page.TableDataInfo
;
import
share.system.service.RoomStatusService
;
/**
/**
* 房间Controller
* 房间Controller
...
@@ -30,24 +33,24 @@ import share.common.core.page.TableDataInfo;
...
@@ -30,24 +33,24 @@ import share.common.core.page.TableDataInfo;
@RestController
@RestController
@RequestMapping
(
"/front/room"
)
@RequestMapping
(
"/front/room"
)
@Api
(
tags
=
"房间信息"
)
@Api
(
tags
=
"房间信息"
)
public
class
SRoomController
extends
BaseController
public
class
SRoomController
extends
BaseController
{
{
@Autowired
@Autowired
private
ISRoomService
sRoomService
;
private
ISRoomService
sRoomService
;
@Autowired
private
RoomStatusService
roomStatusService
;
/**
/**
* 查询房间列表
* 查询房间列表
*/
*/
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SRoom
sRoom
)
public
TableDataInfo
list
(
SRoom
sRoom
)
{
{
startPage
();
startPage
();
List
<
SRoomVo
>
list
=
sRoomService
.
selectSRoomList
(
sRoom
);
List
<
SRoomVo
>
list
=
sRoomService
.
selectSRoomList
(
sRoom
);
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
/**
/**
* 获取房间详细信息
* 获取房间详细信息
*/
*/
...
@@ -56,13 +59,23 @@ public class SRoomController extends BaseController
...
@@ -56,13 +59,23 @@ public class SRoomController extends BaseController
public
R
<
SRoomVo
>
getInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
public
R
<
SRoomVo
>
getInfo
(
@RequestParam
(
"id"
)
Long
id
)
{
SRoom
room
=
sRoomService
.
getById
(
id
);
SRoom
room
=
sRoomService
.
getById
(
id
);
SRoomVo
vo
=
null
;
SRoomVo
vo
=
null
;
if
(
Objects
.
nonNull
(
room
))
{
if
(
Objects
.
nonNull
(
room
))
{
vo
=
new
SRoomVo
();
vo
=
new
SRoomVo
();
BeanUtils
.
copyProperties
(
room
,
vo
);
BeanUtils
.
copyProperties
(
room
,
vo
);
}
}
return
R
.
ok
(
vo
);
return
R
.
ok
(
vo
);
}
}
/**
* 获取房间详细信息
*/
@ApiOperation
(
value
=
"房间状态(房间详情下单时段列表T+1天)"
)
@RequestMapping
(
value
=
"/roomStatus"
,
method
=
RequestMethod
.
GET
)
public
R
<
List
<
RoomStatusVo
>>
getRoomStatus
(
@RequestParam
(
"storeId"
)
Long
storeId
,
@RequestParam
(
"roomId"
)
Long
roomId
,
@RequestParam
(
"day"
)
Date
day
)
{
return
R
.
ok
(
roomStatusService
.
roomStatus
(
storeId
,
roomId
,
day
));
}
}
}
share-system/src/main/java/share/system/domain/SOrder.java
View file @
99234a00
...
@@ -2,6 +2,7 @@ package share.system.domain;
...
@@ -2,6 +2,7 @@ package share.system.domain;
import
java.util.Date
;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.annotation.Excel
;
...
@@ -13,6 +14,7 @@ import share.common.core.domain.BaseEntity;
...
@@ -13,6 +14,7 @@ import share.common.core.domain.BaseEntity;
* @author ruoyi
* @author ruoyi
* @date 2023-10-09
* @date 2023-10-09
*/
*/
@Data
public
class
SOrder
extends
BaseEntity
public
class
SOrder
extends
BaseEntity
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
...
@@ -20,6 +22,10 @@ public class SOrder extends BaseEntity
...
@@ -20,6 +22,10 @@ public class SOrder extends BaseEntity
/** 订单ID */
/** 订单ID */
private
Long
id
;
private
Long
id
;
private
Long
storeId
;
private
Long
roomId
;
/** 订单类型(0:订房订单,1:续房订单,2:充值订单) */
/** 订单类型(0:订房订单,1:续房订单,2:充值订单) */
@Excel
(
name
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
)
@Excel
(
name
=
"订单类型(0:订房订单,1:续房订单,2:充值订单)"
)
private
Integer
orderType
;
private
Integer
orderType
;
...
@@ -73,214 +79,23 @@ public class SOrder extends BaseEntity
...
@@ -73,214 +79,23 @@ public class SOrder extends BaseEntity
private
Integer
status
;
private
Integer
status
;
/** 开始时间 */
/** 开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
startDate
;
private
Date
startDate
;
/** 结束时间 */
/** 结束时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
endDate
;
private
Date
endDate
;
/** 预约开始时间 */
/** 预约开始时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"预约开始时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
preStartDate
;
private
Date
preStartDate
;
/** 预约结束时间 */
/** 预约结束时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd
HH:mm
"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"预约结束时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd
HH:mm
"
)
private
Date
preEndDate
;
private
Date
preEndDate
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setOrderType
(
Integer
orderType
)
{
this
.
orderType
=
orderType
;
}
public
Integer
getOrderType
()
{
return
orderType
;
}
public
void
setSerialNumber
(
Long
serialNumber
)
{
this
.
serialNumber
=
serialNumber
;
}
public
Long
getSerialNumber
()
{
return
serialNumber
;
}
public
void
setConsumerId
(
Long
consumerId
)
{
this
.
consumerId
=
consumerId
;
}
public
Long
getConsumerId
()
{
return
consumerId
;
}
public
void
setConsumerName
(
String
consumerName
)
{
this
.
consumerName
=
consumerName
;
}
public
String
getConsumerName
()
{
return
consumerName
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setOriginalPrice
(
Integer
originalPrice
)
{
this
.
originalPrice
=
originalPrice
;
}
public
Integer
getOriginalPrice
()
{
return
originalPrice
;
}
public
void
setPayWays
(
Integer
payWays
)
{
this
.
payWays
=
payWays
;
}
public
Integer
getPayWays
()
{
return
payWays
;
}
public
void
setRealPrice
(
Integer
realPrice
)
{
this
.
realPrice
=
realPrice
;
}
public
Integer
getRealPrice
()
{
return
realPrice
;
}
public
void
setIsUseCoupon
(
Integer
isUseCoupon
)
{
this
.
isUseCoupon
=
isUseCoupon
;
}
public
Integer
getIsUseCoupon
()
{
return
isUseCoupon
;
}
public
void
setCouponType
(
String
couponType
)
{
this
.
couponType
=
couponType
;
}
public
String
getCouponType
()
{
return
couponType
;
}
public
void
setCouponName
(
String
couponName
)
{
this
.
couponName
=
couponName
;
}
public
String
getCouponName
()
{
return
couponName
;
}
public
void
setCouponId
(
String
couponId
)
{
this
.
couponId
=
couponId
;
}
public
String
getCouponId
()
{
return
couponId
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStartDate
(
Date
startDate
)
{
this
.
startDate
=
startDate
;
}
public
Date
getStartDate
()
{
return
startDate
;
}
public
void
setEndDate
(
Date
endDate
)
{
this
.
endDate
=
endDate
;
}
public
Date
getEndDate
()
{
return
endDate
;
}
public
void
setPreStartDate
(
Date
preStartDate
)
{
this
.
preStartDate
=
preStartDate
;
}
public
Date
getPreStartDate
()
{
return
preStartDate
;
}
public
void
setPreEndDate
(
Date
preEndDate
)
{
this
.
preEndDate
=
preEndDate
;
}
public
Date
getPreEndDate
()
{
return
preEndDate
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"orderType"
,
getOrderType
())
.
append
(
"serialNumber"
,
getSerialNumber
())
.
append
(
"consumerId"
,
getConsumerId
())
.
append
(
"consumerName"
,
getConsumerName
())
.
append
(
"description"
,
getDescription
())
.
append
(
"originalPrice"
,
getOriginalPrice
())
.
append
(
"payWays"
,
getPayWays
())
.
append
(
"realPrice"
,
getRealPrice
())
.
append
(
"isUseCoupon"
,
getIsUseCoupon
())
.
append
(
"couponType"
,
getCouponType
())
.
append
(
"couponName"
,
getCouponName
())
.
append
(
"couponId"
,
getCouponId
())
.
append
(
"status"
,
getStatus
())
.
append
(
"startDate"
,
getStartDate
())
.
append
(
"endDate"
,
getEndDate
())
.
append
(
"createBy"
,
getCreateBy
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"updateBy"
,
getUpdateBy
())
.
append
(
"updateTime"
,
getUpdateTime
())
.
append
(
"remark"
,
getRemark
())
.
append
(
"preStartDate"
,
getPreStartDate
())
.
append
(
"preEndDate"
,
getPreEndDate
())
.
toString
();
}
}
}
share-system/src/main/java/share/system/domain/vo/RoomStatusVo.java
0 → 100644
View file @
99234a00
package
share
.
system
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.core.domain.BaseEntity
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* 房间状态对象
*
* @author wuwenlong
* @date 2023-10-18
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"SRoomStatusVo"
,
description
=
"房间状态对象"
)
public
class
RoomStatusVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 房间ID
*/
@ApiModelProperty
(
value
=
"房间ID"
)
private
Long
roomId
;
/**
* 门店ID
*/
@ApiModelProperty
(
value
=
"门店ID"
)
private
Long
storeId
;
@ApiModelProperty
(
value
=
"时段 yyyy-mm-dd HH"
)
private
String
timeHour
;
@ApiModelProperty
(
value
=
"状态 1:空闲;2:占用"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"占用开始时间"
)
private
Date
startHoldTime
;
@ApiModelProperty
(
value
=
"占用结束时间"
)
private
Date
endHoldTime
;
}
share-system/src/main/java/share/system/mapper/SOrderMapper.java
View file @
99234a00
package
share
.
system
.
mapper
;
package
share
.
system
.
mapper
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
share.system.domain.SOrder
;
import
share.system.domain.SOrder
;
/**
/**
...
@@ -9,7 +11,7 @@ import share.system.domain.SOrder;
...
@@ -9,7 +11,7 @@ import share.system.domain.SOrder;
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
public
interface
SOrderMapper
public
interface
SOrderMapper
extends
BaseMapper
<
SOrder
>
{
{
/**
/**
* 查询订单
* 查询订单
...
...
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
99234a00
package
share
.
system
.
service
;
package
share
.
system
.
service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
share.system.domain.SOrder
;
import
share.system.domain.SOrder
;
/**
/**
...
@@ -9,7 +12,7 @@ import share.system.domain.SOrder;
...
@@ -9,7 +12,7 @@ import share.system.domain.SOrder;
* @author ruoyi
* @author ruoyi
* @date 2023-09-27
* @date 2023-09-27
*/
*/
public
interface
ISOrderService
public
interface
ISOrderService
extends
IService
<
SOrder
>
{
{
/**
/**
* 查询订单
* 查询订单
...
@@ -58,4 +61,13 @@ public interface ISOrderService
...
@@ -58,4 +61,13 @@ public interface ISOrderService
* @return 结果
* @return 结果
*/
*/
public
int
deleteSOrderById
(
Long
id
);
public
int
deleteSOrderById
(
Long
id
);
/**
* 查询房间指定日T+1的订单
* @param storeId
* @param roomId
* @param day
* @return
*/
List
<
SOrder
>
listByRoomInfo
(
Long
storeId
,
Long
roomId
,
Date
day
);
}
}
share-system/src/main/java/share/system/service/RoomStatusService.java
0 → 100644
View file @
99234a00
package
share
.
system
.
service
;
import
share.system.domain.vo.RoomStatusVo
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author wwl
* @Date 2023/10/18 14:19
*/
public
interface
RoomStatusService
{
/**
* 通过门店ID,房间ID,日期查询房间T+1天时段状态
* @param storeId
* @param roomId
* @return List<RoomStatusVo>
*/
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
);
}
share-system/src/main/java/share/system/service/impl/RoomStatusServiceImpl.java
0 → 100644
View file @
99234a00
package
share
.
system
.
service
.
impl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
share.common.enums.RoomStatusEnum
;
import
share.common.utils.DateUtils
;
import
share.common.utils.StringUtils
;
import
share.system.domain.SOrder
;
import
share.system.domain.SStore
;
import
share.system.domain.vo.RoomStatusVo
;
import
share.system.service.ISOrderService
;
import
share.system.service.ISStoreService
;
import
share.system.service.RoomStatusService
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicReference
;
/**
* @Author wwl
* @Date 2023/10/18 14:45
*/
@Service
public
class
RoomStatusServiceImpl
implements
RoomStatusService
{
private
final
static
String
[]
LOCKS
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
,
"21"
,
"22"
,
"23"
};
//当前时间锁定延迟分钟
private
final
static
Integer
LOCK_DELAY_MINUTE
=
30
;
@Autowired
private
ISStoreService
storeService
;
@Autowired
private
ISOrderService
orderService
;
@Override
public
List
<
RoomStatusVo
>
roomStatus
(
Long
storeId
,
Long
roomId
,
Date
day
)
{
//查询门店营业时间
SStore
store
=
storeService
.
getById
(
storeId
);
// 通过门店及房间查询指定日期T+1的订单
List
<
SOrder
>
orderList
=
orderService
.
listByRoomInfo
(
storeId
,
roomId
,
day
);
List
<
RoomStatusVo
>
voList
=
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
day
);
voList
.
addAll
(
generatorRoomStatusList
(
store
,
roomId
,
orderList
,
DateUtils
.
addDays
(
day
,
1
)));
return
voList
;
}
private
List
<
RoomStatusVo
>
generatorRoomStatusList
(
SStore
store
,
Long
roomId
,
List
<
SOrder
>
orderList
,
Date
day
){
String
nowTime
=
"00:00"
;
String
dayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
);
//如果day等于当天,nowTime设置为当前时间+30分钟
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
DateUtils
.
getNowDate
()))){
nowTime
=
DateUtils
.
parseDateToStr
(
"HH:mm"
,
DateUtils
.
addMinutes
(
DateUtils
.
getNowDate
(),
LOCK_DELAY_MINUTE
));
}
List
<
RoomStatusVo
>
voList
=
new
ArrayList
<>();
String
finalNowTime
=
nowTime
;
Arrays
.
stream
(
LOCKS
).
forEach
(
lock
->
{
RoomStatusVo
vo
=
new
RoomStatusVo
();
Integer
lockInt
=
Integer
.
parseInt
(
lock
);
String
timeHour
=
""
;
if
(
Integer
.
compare
(
lockInt
,
new
Integer
(
10
))
==
0
){
timeHour
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
+
"0"
+
lock
;
}
else
{
timeHour
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
)
+
lock
;
}
vo
.
setStoreId
(
store
.
getId
());
vo
.
setRoomId
(
roomId
);
vo
.
setTimeHour
(
timeHour
);
Date
timeHourDate
=
DateUtils
.
parseDate
(
timeHour
);
setTimeHourStatus
(
vo
,
timeHourDate
,
store
,
orderList
,
dayStr
,
finalNowTime
);
voList
.
add
(
vo
);
});
return
voList
;
}
//设置时间段房间可预约状态(可预约:大于营业开始时间,小于营业结束时间,大于当前时间,当前时间没有订单)
private
void
setTimeHourStatus
(
RoomStatusVo
vo
,
Date
timeHourDate
,
SStore
store
,
List
<
SOrder
>
orderList
,
String
day
,
String
finalNowTime
){
vo
.
setStatus
(
RoomStatusEnum
.
FREE
.
getValue
());
//当前时段小于营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()))==-
1
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为营业开始时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
().
split
(
":"
)[
0
]))
==
0
){
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenStartTime
()));
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
//当前时段大于营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()))==
1
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
//判断是否是同一个小时,如果是同一个小时,占用开始时间为营业结束时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
().
split
(
":"
)[
0
]))
==
0
){
vo
.
setStartHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
store
.
getOpenEndTime
()));
}
else
{
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
}
}
//当前时段小于当前时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
))==-
1
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
vo
.
setStartHoldTime
(
timeHourDate
);
//判断是否是同一个小时,如果是同一个小时,占用结束时间为当前时间
if
(
timeHourDate
.
compareTo
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
.
split
(
":"
)[
0
]))
==
0
){
vo
.
setEndHoldTime
(
DateUtils
.
parseDate
(
day
+
" "
+
finalNowTime
));
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
}
checkTimeHourToOrder
(
vo
,
timeHourDate
,
orderList
);
}
private
void
checkTimeHourToOrder
(
RoomStatusVo
vo
,
Date
timeHourDate
,
List
<
SOrder
>
orderList
){
if
(
CollectionUtils
.
isNotEmpty
(
orderList
)){
orderList
.
stream
().
forEach
(
order
->
{
Date
orderStartDate
=
Objects
.
nonNull
(
order
.
getStartDate
())?
order
.
getStartDate
():
order
.
getPreStartDate
();
Date
orderEndDate
=
Objects
.
nonNull
(
order
.
getEndDate
())?
order
.
getEndDate
():
order
.
getPreEndDate
();
if
(
timeHourDate
.
compareTo
(
orderStartDate
)==
1
&&
timeHourDate
.
compareTo
(
orderEndDate
)==
0
){
vo
.
setStatus
(
RoomStatusEnum
.
HOLD
.
getValue
());
//判断订单开始时间是否是同一个小时,如果是同一个小时,占用结束时间为订单开始时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
vo
.
setEndHoldTime
(
orderStartDate
);
}
else
{
//占用结束时间为当前时段59分59秒
vo
.
setEndHoldTime
(
DateUtils
.
addSeconds
(
timeHourDate
,
59
*
60
+
59
));
}
//判断订单结束时间是否是同一个小时,如果是同一个小时,占用开始时间为订单结束时间
if
(
StringUtils
.
equals
(
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
timeHourDate
)
,
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD_HH
,
orderStartDate
))){
vo
.
setStartHoldTime
(
orderEndDate
);
}
else
{
//占用开始时间为当前时段0分0秒
vo
.
setStartHoldTime
(
timeHourDate
);
}
}
});
}
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
99234a00
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -15,7 +20,7 @@ import share.system.service.ISOrderService;
...
@@ -15,7 +20,7 @@ import share.system.service.ISOrderService;
* @date 2023-09-27
* @date 2023-09-27
*/
*/
@Service
@Service
public
class
SOrderServiceImpl
implements
ISOrderService
public
class
SOrderServiceImpl
extends
ServiceImpl
<
SOrderMapper
,
SOrder
>
implements
ISOrderService
{
{
@Autowired
@Autowired
private
SOrderMapper
sOrderMapper
;
private
SOrderMapper
sOrderMapper
;
...
@@ -93,4 +98,18 @@ public class SOrderServiceImpl implements ISOrderService
...
@@ -93,4 +98,18 @@ public class SOrderServiceImpl implements ISOrderService
{
{
return
sOrderMapper
.
deleteSOrderById
(
id
);
return
sOrderMapper
.
deleteSOrderById
(
id
);
}
}
@Override
public
List
<
SOrder
>
listByRoomInfo
(
Long
storeId
,
Long
roomId
,
Date
day
)
{
LambdaQueryWrapper
<
SOrder
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
//TODO order表待调整
queryWrapper
.
eq
(
SOrder:
:
getStoreId
,
storeId
);
queryWrapper
.
eq
(
SOrder:
:
getRoomId
,
roomId
);
String
nowDayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
day
);
String
nextDayStr
=
DateUtils
.
parseDateToStr
(
DateUtils
.
YYYY_MM_DD
,
DateUtils
.
addDays
(
day
,
1
));
queryWrapper
.
apply
(
"(DATE_FORMAT(IFNULL(start_date,per_start_date), '%Y-%m-%d') = '"
+
nowDayStr
+
"' "
+
" OR DATE_FORMAT(IFNULL(start_date,per_start_date), '%Y-%m-%d') = '"
+
nextDayStr
+
"')"
);
queryWrapper
.
apply
(
"ORDER BY IFNULL(start_date,per_start_date) "
);
return
list
(
queryWrapper
);
}
}
}
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
99234a00
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.utils.DateUtils
;
import
share.common.utils.DateUtils
;
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
share.system.domain.SStore
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.domain.vo.SRoomVo
;
import
share.system.mapper.SRoomMapper
;
import
share.system.mapper.SRoomMapper
;
import
share.system.domain.SRoom
;
import
share.system.domain.SRoom
;
...
@@ -142,6 +137,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
...
@@ -142,6 +137,7 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper,SRoom> implements
return
convertDoListToVoList
(
roomList
);
return
convertDoListToVoList
(
roomList
);
}
}
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
){
private
List
<
SRoomVo
>
convertDoListToVoList
(
List
<
SRoom
>
roomList
){
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
List
<
SRoomVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
roomList
)){
if
(
CollectionUtils
.
isNotEmpty
(
roomList
)){
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
99234a00
...
@@ -136,13 +136,30 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -136,13 +136,30 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
request
.
setStatus
(
YesNoEnum
.
yes
.
getIndex
().
toString
());
request
.
setStatus
(
YesNoEnum
.
yes
.
getIndex
().
toString
());
}
}
listVoCheck
(
request
);
listVoCheck
(
request
);
Double
nowLng
=
Double
.
parseDouble
(
request
.
getNowLongitude
());
Double
nowLat
=
Double
.
parseDouble
(
request
.
getNowLatitude
());
SStore
store
=
new
SStore
();
SStore
store
=
new
SStore
();
store
.
setStatus
(
request
.
getStatus
());
store
.
setStatus
(
request
.
getStatus
());
List
<
SStore
>
storeList
=
sStoreMapper
.
selectSStoreList
(
store
);
List
<
SStore
>
storeList
=
sStoreMapper
.
selectSStoreList
(
store
);
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
StringUtils
.
isNotBlank
(
request
.
getNowLongitude
()))
{
voList
=
convertDosToVosSortByDst
(
storeList
,
request
);
}
else
{
voList
=
convertDosToVos
(
storeList
);
}
handleSStoreVoList
(
voList
);
return
voList
;
}
/**
* 门店DO集合转换VO集合,按距离排序
* @param storeList
* @param request
* @return
*/
private
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
){
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
)){
if
(
CollectionUtils
.
isNotEmpty
(
storeList
)){
Double
nowLng
=
Double
.
parseDouble
(
request
.
getNowLongitude
());
Double
nowLat
=
Double
.
parseDouble
(
request
.
getNowLatitude
());
SpatialContext
geo
=
SpatialContext
.
GEO
;
SpatialContext
geo
=
SpatialContext
.
GEO
;
storeList
.
stream
().
forEach
(
o
->
{
storeList
.
stream
().
forEach
(
o
->
{
double
distance
=
geo
.
calcDistance
(
geo
.
makePoint
(
nowLng
,
nowLat
)
double
distance
=
geo
.
calcDistance
(
geo
.
makePoint
(
nowLng
,
nowLat
)
...
@@ -155,10 +172,27 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -155,10 +172,27 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
});
});
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
storeVo
->
Double
.
parseDouble
(
storeVo
.
getDistance
())));
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
storeVo
->
Double
.
parseDouble
(
storeVo
.
getDistance
())));
}
}
handleSStoreVoList
(
voList
);
return
voList
;
return
voList
;
}
}
/**
* 门店DO集合转换VO集合,按距离排序
* @param storeList
* @return
*/
private
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
){
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
)){
storeList
.
stream
().
forEach
(
o
->
{
SStoreVo
vo
=
new
SStoreVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
voList
.
add
(
vo
);
});
}
return
voList
;
}
private
void
listVoCheck
(
SStoreRequest
request
)
throws
BaseException
{
private
void
listVoCheck
(
SStoreRequest
request
)
throws
BaseException
{
if
(
StringUtils
.
isNotBlank
(
request
.
getNowLongitude
())||
StringUtils
.
isNotBlank
(
request
.
getNowLatitude
()))
{
if
(
StringUtils
.
isNotBlank
(
request
.
getNowLongitude
())||
StringUtils
.
isNotBlank
(
request
.
getNowLatitude
()))
{
try
{
try
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment