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
28dfeabc
Commit
28dfeabc
authored
Mar 27, 2024
by
YG8999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
门店添加订单预定时间
parent
b43788c3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
0 deletions
+119
-0
SStoreVo.java
...system/src/main/java/share/system/domain/vo/SStoreVo.java
+15
-0
SOrderMapper.java
...ystem/src/main/java/share/system/mapper/SOrderMapper.java
+2
-0
ISOrderService.java
...em/src/main/java/share/system/service/ISOrderService.java
+2
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+5
-0
SStoreServiceImpl.java
...ain/java/share/system/service/impl/SStoreServiceImpl.java
+51
-0
SOrderMapper.xml
...-system/src/main/resources/mapper/system/SOrderMapper.xml
+44
-0
No files found.
share-system/src/main/java/share/system/domain/vo/SStoreVo.java
View file @
28dfeabc
...
@@ -78,4 +78,19 @@ public class SStoreVo extends BaseEntity
...
@@ -78,4 +78,19 @@ public class SStoreVo extends BaseEntity
@ApiModelProperty
(
name
=
"美团点评店铺id"
)
@ApiModelProperty
(
name
=
"美团点评店铺id"
)
private
String
openShopUuid
;
private
String
openShopUuid
;
/**
* 当天最后预定订单时间
*/
private
Long
orderTime
;
/**
* 0-无,1-分钟,2-小时
*/
private
Integer
orderTimeType
;
/**
* 当天最后预定订单类型
*/
private
Integer
orderType
;
}
}
share-system/src/main/java/share/system/mapper/SOrderMapper.java
View file @
28dfeabc
...
@@ -68,4 +68,6 @@ public interface SOrderMapper extends BaseMapper<SOrder>
...
@@ -68,4 +68,6 @@ public interface SOrderMapper extends BaseMapper<SOrder>
SOrder
getInfoByEntity
(
SOrder
orderParam
);
SOrder
getInfoByEntity
(
SOrder
orderParam
);
List
<
SOrder
>
selectSOrderByMaxTime
(
SOrder
order
);
List
<
SOrder
>
selectSOrderByMaxTime
(
SOrder
order
);
List
<
SOrder
>
selectSOrderByStoreIdAndMaxTime
(
SOrder
order
);
}
}
share-system/src/main/java/share/system/service/ISOrderService.java
View file @
28dfeabc
...
@@ -213,4 +213,6 @@ public interface ISOrderService extends IService<SOrder>
...
@@ -213,4 +213,6 @@ public interface ISOrderService extends IService<SOrder>
List
<
SOrderVo
>
exportList
(
SOrder
sOrder
);
List
<
SOrderVo
>
exportList
(
SOrder
sOrder
);
List
<
SOrder
>
selectSOrderByMaxTime
(
SOrder
orderQuery
);
List
<
SOrder
>
selectSOrderByMaxTime
(
SOrder
orderQuery
);
List
<
SOrder
>
selectSOrderByStoreIdAndMaxTime
(
SOrder
orderQuery
);
}
}
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
28dfeabc
...
@@ -700,6 +700,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
...
@@ -700,6 +700,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return
baseMapper
.
selectSOrderByMaxTime
(
orderQuery
);
return
baseMapper
.
selectSOrderByMaxTime
(
orderQuery
);
}
}
@Override
public
List
<
SOrder
>
selectSOrderByStoreIdAndMaxTime
(
SOrder
orderQuery
)
{
return
baseMapper
.
selectSOrderByStoreIdAndMaxTime
(
orderQuery
);
}
/**
/**
* 新增订单
* 新增订单
*
*
...
...
share-system/src/main/java/share/system/service/impl/SStoreServiceImpl.java
View file @
28dfeabc
package
share
.
system
.
service
.
impl
;
package
share
.
system
.
service
.
impl
;
import
cn.hutool.core.date.DateUnit
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.NumberUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
...
@@ -28,6 +30,7 @@ import share.system.request.SStoreRequest;
...
@@ -28,6 +30,7 @@ import share.system.request.SStoreRequest;
import
share.system.service.*
;
import
share.system.service.*
;
import
java.util.*
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -301,6 +304,13 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -301,6 +304,13 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
private
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
)
{
private
List
<
SStoreVo
>
convertDosToVosSortByDst
(
List
<
SStore
>
storeList
,
SStoreRequest
request
)
{
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
// 查询每一个房间最后一条预定订单下单时间
Date
now
=
DateUtil
.
date
();
SOrder
orderQuery
=
new
SOrder
();
orderQuery
.
setCreateTime
(
DateUtil
.
offsetHour
(
now
,
-
3
));
List
<
SOrder
>
orderList
=
orderService
.
selectSOrderByStoreIdAndMaxTime
(
orderQuery
);
Map
<
Long
,
SOrder
>
orderMap
=
Optional
.
ofNullable
(
orderList
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
toMap
(
SOrder:
:
getStoreId
,
Function
.
identity
()));
Double
nowLng
=
Double
.
parseDouble
(
request
.
getNowLongitude
());
Double
nowLng
=
Double
.
parseDouble
(
request
.
getNowLongitude
());
Double
nowLat
=
Double
.
parseDouble
(
request
.
getNowLatitude
());
Double
nowLat
=
Double
.
parseDouble
(
request
.
getNowLatitude
());
SpatialContext
geo
=
SpatialContext
.
GEO
;
SpatialContext
geo
=
SpatialContext
.
GEO
;
...
@@ -310,6 +320,23 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -310,6 +320,23 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
SStoreVo
vo
=
new
SStoreVo
();
SStoreVo
vo
=
new
SStoreVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
BeanUtils
.
copyProperties
(
o
,
vo
);
vo
.
setDistance
(
distance
+
""
);
vo
.
setDistance
(
distance
+
""
);
// 计算当天预定最后预定时间
SOrder
order
=
orderMap
.
get
(
vo
.
getId
());
if
(
order
!=
null
)
{
long
betweenMinute
=
DateUtil
.
between
(
order
.
getCreateTime
(),
now
,
DateUnit
.
MINUTE
);
if
(
betweenMinute
<
60
)
{
vo
.
setOrderTimeType
(
1
);
vo
.
setOrderTime
(
betweenMinute
);
}
else
{
long
betweenHour
=
DateUtil
.
between
(
order
.
getCreateTime
(),
now
,
DateUnit
.
HOUR
);
vo
.
setOrderTimeType
(
2
);
vo
.
setOrderTime
(
betweenHour
);
}
vo
.
setOrderType
(
order
.
getOrderType
());
}
else
{
vo
.
setOrderTimeType
(
0
);
vo
.
setOrderTime
(
0L
);
}
voList
.
add
(
vo
);
voList
.
add
(
vo
);
});
});
return
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
storeVo
->
Double
.
parseDouble
(
storeVo
.
getDistance
()))).
collect
(
Collectors
.
toList
());
return
voList
.
stream
().
sorted
(
Comparator
.
comparing
(
storeVo
->
Double
.
parseDouble
(
storeVo
.
getDistance
()))).
collect
(
Collectors
.
toList
());
...
@@ -326,9 +353,33 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
...
@@ -326,9 +353,33 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
private
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
)
{
private
List
<
SStoreVo
>
convertDosToVos
(
List
<
SStore
>
storeList
)
{
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
List
<
SStoreVo
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
storeList
))
{
// 查询每一个房间最后一条预定订单下单时间
Date
now
=
DateUtil
.
date
();
SOrder
orderQuery
=
new
SOrder
();
orderQuery
.
setCreateTime
(
DateUtil
.
offsetHour
(
now
,
-
3
));
List
<
SOrder
>
orderList
=
orderService
.
selectSOrderByStoreIdAndMaxTime
(
orderQuery
);
Map
<
Long
,
SOrder
>
orderMap
=
Optional
.
ofNullable
(
orderList
).
orElse
(
new
ArrayList
<>()).
stream
().
collect
(
Collectors
.
toMap
(
SOrder:
:
getStoreId
,
Function
.
identity
()));
storeList
.
stream
().
forEach
(
o
->
{
storeList
.
stream
().
forEach
(
o
->
{
SStoreVo
vo
=
new
SStoreVo
();
SStoreVo
vo
=
new
SStoreVo
();
BeanUtils
.
copyProperties
(
o
,
vo
);
BeanUtils
.
copyProperties
(
o
,
vo
);
// 计算当天预定最后预定时间
SOrder
order
=
orderMap
.
get
(
vo
.
getId
());
if
(
order
!=
null
)
{
long
betweenMinute
=
DateUtil
.
between
(
order
.
getCreateTime
(),
now
,
DateUnit
.
MINUTE
);
if
(
betweenMinute
<
60
)
{
vo
.
setOrderTimeType
(
1
);
vo
.
setOrderTime
(
betweenMinute
);
}
else
{
long
betweenHour
=
DateUtil
.
between
(
order
.
getCreateTime
(),
now
,
DateUnit
.
HOUR
);
vo
.
setOrderTimeType
(
2
);
vo
.
setOrderTime
(
betweenHour
);
}
vo
.
setOrderType
(
order
.
getOrderType
());
}
else
{
vo
.
setOrderTimeType
(
0
);
vo
.
setOrderTime
(
0L
);
}
voList
.
add
(
vo
);
voList
.
add
(
vo
);
});
});
}
}
...
...
share-system/src/main/resources/mapper/system/SOrderMapper.xml
View file @
28dfeabc
...
@@ -200,6 +200,50 @@
...
@@ -200,6 +200,50 @@
and DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d')
and DATE_FORMAT(create_time, '%Y-%m-%d') = DATE_FORMAT(#{createTime}, '%Y-%m-%d')
group by room_id) t on t.id = s.id;
group by room_id) t on t.id = s.id;
</select>
</select>
<select
id=
"selectSOrderByStoreIdAndMaxTime"
parameterType=
"SOrder"
resultMap=
"SOrderResult"
>
select s.id,
s.order_no,
s.out_trade_no,
s.historical_order_no,
s.order_type,
s.pay_type,
s.pay_status,
s.store_id,
s.room_id,
s.consumer_id,
s.consumer_name,
s.consumer_phone,
s.pack_id,
s.pack_price,
s.coupon_id,
s.coupon_price,
s.total_price,
s.pay_price,
s.pay_time,
s.time_long,
s.pre_start_date,
s.pre_end_date,
s.start_date,
s.end_date,
s.status,
s.refund_status,
s.refund_reason,
s.refund_reason_time,
s.refund_price,
s.is_delete,
s.create_by,
s.create_time,
s.update_by,
s.update_time,
s.arrival_time,
s.remark
from s_order s inner join (
select store_id, max(create_time) as create_time, max(id) as id from s_order
where
pay_status = 1 and is_delete = 0 and refund_status = 0
and create_time >= #{createTime}
group by store_id) t on t.id = s.id
</select>
<insert
id=
"insertSOrder"
parameterType=
"SOrder"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
<insert
id=
"insertSOrder"
parameterType=
"SOrder"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into s_order
insert into s_order
...
...
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