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
272b91b1
Commit
272b91b1
authored
Nov 30, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下单成功增加redis,自动更新订单状态自动任务改为从redis获取数据
parent
a45f1f27
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
16 deletions
+45
-16
ReceiptRdeisEnum.java
...on/src/main/java/share/common/enums/ReceiptRdeisEnum.java
+2
-1
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+15
-2
SConsumptionRecordsMapper.java
...n/java/share/system/mapper/SConsumptionRecordsMapper.java
+2
-1
SConsumptionRecordsServiceImpl.java
...e/system/service/impl/SConsumptionRecordsServiceImpl.java
+7
-11
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+6
-0
SConsumptionRecordsMapper.xml
...ain/resources/mapper/system/SConsumptionRecordsMapper.xml
+13
-1
No files found.
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
272b91b1
...
...
@@ -6,7 +6,8 @@ public enum ReceiptRdeisEnum {
MT_SESSION_KEY
(
2
,
"MT_SESSION_KEY"
),
MT_SESSION_OBJECT_KEY
(
3
,
"MT_SESSION_OBJECT_KEY"
),
ORDER_NO_KEY
(
4
,
"ORDER_NO_KEY."
),
ACCESS_TOKEN_KEY
(
5
,
"ACCESS_TOKEN_KEY."
);
ACCESS_TOKEN_KEY
(
5
,
"ACCESS_TOKEN_KEY."
),
ORDER_NO
(
6
,
"ORDER_NO."
);
private
Integer
code
;
...
...
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
272b91b1
...
...
@@ -9,6 +9,7 @@ import cn.hutool.json.JSONObject;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.support.TransactionTemplate
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -62,6 +63,9 @@ public class OrderTask {
@Autowired
private
DeviceOpService
deviceOpService
;
@Autowired
private
RedisTemplate
redisTemplate
;
final
int
ZERO
=
0
;
public
void
autoCancel
()
{
...
...
@@ -209,10 +213,19 @@ public class OrderTask {
//预约订单到期自动更新订单状态,更新房间状态
public
void
autoToStore
()
{
//查询所有已支付的订单
List
<
SOrder
>
sOrders
=
orderService
.
validOrder
(
);
if
(
CollectionUtils
.
isEmpty
(
sOrders
)
)
{
Set
<
String
>
keys
=
redisTemplate
.
keys
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
"*"
);
if
(
keys
.
size
()
==
0
)
{
return
;
}
List
<
SOrder
>
sOrders
=
new
ArrayList
<>();
keys
.
stream
().
forEach
(
o
->
{
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
o
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
sOrders
.
add
(
orderService
.
getByOrderNo
(
String
.
valueOf
(
o
)));
}
});
List
<
Long
>
roomIds
=
sOrders
.
stream
().
map
(
SOrder:
:
getRoomId
).
collect
(
Collectors
.
toList
());
List
<
SRoom
>
roomList
=
roomService
.
listByIds
(
roomIds
);
sOrders
.
stream
().
forEach
(
item
->
{
...
...
share-system/src/main/java/share/system/mapper/SConsumptionRecordsMapper.java
View file @
272b91b1
...
...
@@ -2,6 +2,7 @@ package share.system.mapper;
import
java.util.List
;
import
share.system.domain.SConsumptionRecords
;
import
share.system.domain.vo.SConsumptionRecordsVo
;
/**
* 消费记录Mapper接口
...
...
@@ -25,7 +26,7 @@ public interface SConsumptionRecordsMapper
* @param sConsumptionRecords 消费记录
* @return 消费记录集合
*/
public
List
<
SConsumptionRecords
>
selectSConsumptionRecordsList
(
SConsumptionRecords
sConsumptionRecords
);
public
List
<
SConsumptionRecords
Vo
>
selectSConsumptionRecordsList
(
SConsumptionRecords
sConsumptionRecords
);
/**
* 新增消费记录
...
...
share-system/src/main/java/share/system/service/impl/SConsumptionRecordsServiceImpl.java
View file @
272b91b1
...
...
@@ -57,31 +57,27 @@ public class SConsumptionRecordsServiceImpl implements ISConsumptionRecordsServi
@Override
public
List
<
SConsumptionRecordsVo
>
selectSConsumptionRecordsList
(
SConsumptionRecords
sConsumptionRecords
)
{
List
<
SConsumptionRecords
>
sConsumptionRecordsList
=
sConsumptionRecordsMapper
.
selectSConsumptionRecordsList
(
sConsumptionRecords
);
List
<
SConsumptionRecords
Vo
>
sConsumptionRecordsList
=
sConsumptionRecordsMapper
.
selectSConsumptionRecordsList
(
sConsumptionRecords
);
//获取消费记录的用户id集合
List
<
Long
>
collect
=
sConsumptionRecordsList
.
stream
().
map
(
SConsumptionRecords:
:
getConsumerId
).
collect
(
Collectors
.
toList
());
//获取用户id集合的用户信息
List
<
SConsumer
>
sConsumers
=
sConsumerMapper
.
selectBatchIds
(
collect
);
List
<
Long
>
oredrIds
=
sConsumptionRecordsList
.
stream
().
map
(
SConsumptionRecords:
:
getOrderId
).
collect
(
Collectors
.
toList
());
List
<
SOrder
>
sOrders
=
sOrderMapper
.
selectBatchIds
(
oredrIds
);
List
<
SConsumptionRecordsVo
>
sConsumptionRecordsVoList
=
new
ArrayList
<>();
sConsumptionRecordsList
.
stream
().
forEach
(
item
->
{
SConsumptionRecordsVo
sConsumptionRecordsVo
=
new
SConsumptionRecordsVo
();
BeanUtils
.
copyProperties
(
item
,
sConsumptionRecordsVo
);
sConsumers
.
stream
().
forEach
(
vo
->
{
if
(
sConsumptionRecordsVo
.
getConsumerId
().
equals
(
vo
.
getId
()))
{
sConsumptionRecordsVo
.
setNickName
(
vo
.
getNickName
());
sConsumptionRecordsVo
.
setPhone
(
vo
.
getPhone
());
if
(
item
.
getConsumerId
().
equals
(
vo
.
getId
()))
{
item
.
setNickName
(
vo
.
getNickName
());
item
.
setPhone
(
vo
.
getPhone
());
}
});
sOrders
.
stream
().
forEach
(
vo
->
{
if
(
sConsumptionRecordsVo
.
getOrderId
().
equals
(
vo
.
getId
()))
{
sConsumptionRecordsVo
.
setOrderNo
(
vo
.
getOrderNo
());
if
(
item
.
getOrderId
().
equals
(
vo
.
getId
()))
{
item
.
setOrderNo
(
vo
.
getOrderNo
());
}
});
sConsumptionRecordsVoList
.
add
(
sConsumptionRecordsVo
);
});
return
sConsumptionRecords
Vo
List
;
return
sConsumptionRecordsList
;
}
/**
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
272b91b1
...
...
@@ -628,6 +628,12 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
map
.
put
(
"expirationTime"
,
sOrder
.
getEndDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO_KEY
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
else
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
JSONObject
jsonObject
=
new
JSONObject
(
map
);
redisUtils
.
set
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
(),
jsonObject
.
toString
());
}
baseMapper
.
updateById
(
sOrder
);
Long
couponId
=
sOrder
.
getCouponId
();
...
...
share-system/src/main/resources/mapper/system/SConsumptionRecordsMapper.xml
View file @
272b91b1
...
...
@@ -15,6 +15,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"createTime"
column=
"create_time"
/>
</resultMap>
<resultMap
type=
"SConsumptionRecordsVo"
id=
"SConsumptionRecordsResultVo"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"consumerId"
column=
"consumer_id"
/>
<result
property=
"orderId"
column=
"order_id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"price"
column=
"price"
/>
<result
property=
"payType"
column=
"pay_type"
/>
<result
property=
"sign"
column=
"sign"
/>
<result
property=
"createTime"
column=
"create_time"
/>
</resultMap>
<sql
id=
"selectSConsumptionRecordsVo"
>
select id,
consumer_id,
...
...
@@ -27,7 +38,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from s_consumption_records
</sql>
<select
id=
"selectSConsumptionRecordsList"
parameterType=
"SConsumptionRecords"
resultMap=
"SConsumptionRecordsResult"
>
<select
id=
"selectSConsumptionRecordsList"
parameterType=
"SConsumptionRecords"
resultMap=
"SConsumptionRecordsResultVo"
>
<include
refid=
"selectSConsumptionRecordsVo"
/>
<where>
<if
test=
"name != null and name != ''"
>
and name = #{name}
</if>
...
...
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