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
c3070782
Commit
c3070782
authored
Dec 01, 2023
by
wuwenlong
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/main'
parents
ce23a0e9
0b1be224
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
23 deletions
+93
-23
MessageReminderEnum.java
...src/main/java/share/common/enums/MessageReminderEnum.java
+34
-0
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
+25
-5
Device.java
share-system/src/main/java/share/system/domain/Device.java
+4
-4
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/MessageReminderEnum.java
0 → 100644
View file @
c3070782
package
share
.
common
.
enums
;
public
enum
MessageReminderEnum
{
//预约到期通知:oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8,订单开始通知:K8fbcKVq46w9o7Ekpesn74WPjwxnbso947YZiYBQw9c,订单结单通知:HB2_moQRQrXC2cKw6zE08NU3AQO9Ggj3aAOg0lIgecg
RESERVER
(
"预约到期通知"
,
"oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8"
),
START
(
"订单开始通知"
,
"K8fbcKVq46w9o7Ekpesn74WPjwxnbso947YZiYBQw9c"
),
END
(
"订单结单通知"
,
"HB2_moQRQrXC2cKw6zE08NU3AQO9Ggj3aAOg0lIgecg"
);
private
String
name
;
private
String
value
;
MessageReminderEnum
()
{
}
MessageReminderEnum
(
String
name
,
String
value
)
{
this
.
name
=
name
;
this
.
value
=
value
;
}
public
String
getname
()
{
return
name
;
}
public
void
setname
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
share-common/src/main/java/share/common/enums/ReceiptRdeisEnum.java
View file @
c3070782
...
...
@@ -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 @
c3070782
...
...
@@ -9,9 +9,9 @@ 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
;
import
share.common.constant.Constants
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
...
...
@@ -20,7 +20,6 @@ import share.system.domain.SConsumer;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SOrder
;
import
share.system.domain.SRoom
;
import
share.system.mapper.SRoomMapper
;
import
share.system.service.*
;
import
java.util.*
;
...
...
@@ -32,7 +31,6 @@ import java.util.stream.Collectors;
*/
@Component
(
"orderTask"
)
public
class
OrderTask
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
OrderTask
.
class
);
@Autowired
...
...
@@ -62,7 +60,15 @@ public class OrderTask {
@Autowired
private
DeviceOpService
deviceOpService
;
@Autowired
private
RedisTemplate
redisTemplate
;
final
int
ZERO
=
0
;
//10分钟的常量
final
long
TEN_MINUTES
=
60
*
10
;
//9分钟的常量
final
long
NINE_MINUTES
=
60
*
9
;
public
void
autoCancel
()
{
String
redisKey
=
Constants
.
ORDER_AUTO_CANCEL_KEY
;
...
...
@@ -209,10 +215,24 @@ 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"
);
//时间到期前10分钟到9分
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
if
(
expire
<
TEN_MINUTES
&&
expire
>
NINE_MINUTES
)
{
}
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/domain/Device.java
View file @
c3070782
package
share
.
system
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.*
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
share.common.annotation.Excel
;
import
share.common.core.domain.BaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
lombok.Data
;
/**
* 设备信息对象 s_device
...
...
@@ -16,6 +13,7 @@ import lombok.Data;
* @date 2023-11-04
*/
@Data
@TableName
(
value
=
"s_device"
)
public
class
Device
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -58,10 +56,12 @@ public class Device extends BaseEntity
/** 分组 */
@Excel
(
name
=
"分组"
)
@TableField
(
value
=
"`group`"
)
private
String
group
;
/** 设备状态: 0 在线、1 开门状态、2 反锁、3 门磁 */
@Excel
(
name
=
"设备状态"
)
@TableField
(
value
=
"`status`"
)
private
String
status
;
/** 设备位置 */
...
...
share-system/src/main/java/share/system/mapper/SConsumptionRecordsMapper.java
View file @
c3070782
...
...
@@ -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 @
c3070782
...
...
@@ -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 @
c3070782
...
...
@@ -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 @
c3070782
...
...
@@ -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