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
e387b1f9
Commit
e387b1f9
authored
Nov 28, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在自动任务中增加续费声音提醒
parent
20128729
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
11 deletions
+75
-11
VoiceEnum.java
share-common/src/main/java/share/common/enums/VoiceEnum.java
+4
-0
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+58
-5
DeviceMapper.java
...ystem/src/main/java/share/system/mapper/DeviceMapper.java
+1
-1
DeviceService.java
...tem/src/main/java/share/system/service/DeviceService.java
+1
-1
DeviceServiceImpl.java
...ain/java/share/system/service/impl/DeviceServiceImpl.java
+1
-1
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+5
-2
SRoomServiceImpl.java
...main/java/share/system/service/impl/SRoomServiceImpl.java
+5
-1
No files found.
share-common/src/main/java/share/common/enums/VoiceEnum.java
View file @
e387b1f9
...
...
@@ -40,6 +40,10 @@ public enum VoiceEnum {
return
name
+
value
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
e387b1f9
package
share
.
quartz
.
task
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
com.alibaba.fastjson2.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.dianping.openapi.sdk.api.oauth.entity.CustomerRefreshTokenResponse
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
...
...
@@ -17,10 +20,9 @@ import org.springframework.stereotype.Component;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.OrderStatusEnum
;
import
share.common.enums.OrderTypeEnum
;
import
share.common.enums.ReceiptRdeisEnum
;
import
share.common.enums.RoomStatusEnum
;
import
share.common.enums.*
;
import
share.common.exception.base.BaseException
;
import
share.system.domain.Device
;
import
share.system.domain.SOrder
;
import
share.system.domain.SRoom
;
import
share.system.service.*
;
...
...
@@ -54,6 +56,12 @@ public class RedisTask {
@Autowired
private
ISRoomService
roomService
;
@Autowired
private
MqttxService
mqttxService
;
@Autowired
private
DeviceService
deviceService
;
public
void
AuToReceiptCode
()
{
//获取redis中所有以tuangou.receipt.prepare开头的key
...
...
@@ -101,6 +109,50 @@ public class RedisTask {
//获取key对应的value
String
value
=
redisUtil
.
get
(
String
.
valueOf
(
o
));
JSONObject
jsonObject
=
new
JSONObject
(
value
);
long
expire
=
redisUtil
.
getExpire
(
o
);
//判断时间是否在15分钟到14分钟
if
(
expire
<
60
*
15
&&
expire
>
60
*
14
)
{
//语音
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
SOrder
sOrder
=
isOrderService
.
selectSOrderByOrderNo
(
orderNo
);
//判断订单单是否存在
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
LambdaQueryWrapper
<
Device
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_0001
.
getCode
());
Device
device
=
deviceService
.
getOne
(
deviceLambdaQueryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
device
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
mqttxService
.
actionExecute
(
device
.
getDevId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER1
.
getValue
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
return
;
}
//判断时间是否在5分钟到4分钟
if
(
expire
<
60
*
5
&&
expire
>
60
*
4
)
{
String
orderNo
=
jsonObject
.
getStr
(
"orderNo"
);
SOrder
sOrder
=
isOrderService
.
selectSOrderByOrderNo
(
orderNo
);
//判断订单单是否存在
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
LambdaQueryWrapper
<
Device
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_0001
.
getCode
());
Device
device
=
deviceService
.
getOne
(
deviceLambdaQueryWrapper
);
if
(
ObjectUtils
.
isEmpty
(
device
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
mqttxService
.
actionExecute
(
device
.
getDevId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
RENEWAL_REMINDER2
.
getValue
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
return
;
}
Date
expirationTime
=
jsonObject
.
getDate
(
"expirationTime"
);
//判断是否过期
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
...
...
@@ -109,7 +161,8 @@ public class RedisTask {
SOrder
sOrder
=
isOrderService
.
selectSOrderByOrderNo
(
orderNo
);
//判断订单单是否存在
if
(
ObjectUtils
.
isEmpty
(
sOrder
))
{
return
;
redisUtil
.
delete
(
o
);
throw
new
BaseException
(
"订单不存在!"
);
}
//查询当前门店房间下是否有续单
SOrder
order
=
new
SOrder
();
...
...
share-system/src/main/java/share/system/mapper/DeviceMapper.java
View file @
e387b1f9
...
...
@@ -82,5 +82,5 @@ public interface DeviceMapper extends BaseMapper<Device>
int
clearDeviceRoomId
(
Device
device
);
Device
selectDeviceByRoomId
(
Long
roomId
);
List
<
Device
>
selectDeviceByRoomId
(
Long
roomId
);
}
share-system/src/main/java/share/system/service/DeviceService.java
View file @
e387b1f9
...
...
@@ -71,5 +71,5 @@ public interface DeviceService extends IService<Device>
List
<
Device
>
notRoomIdList
(
Device
device
);
List
<
Device
>
selectDeviceListByIds
(
List
<
Long
>
collect
);
Device
selectDeviceByRoomId
(
Long
roomId
);
List
<
Device
>
selectDeviceByRoomId
(
Long
roomId
);
}
share-system/src/main/java/share/system/service/impl/DeviceServiceImpl.java
View file @
e387b1f9
...
...
@@ -123,7 +123,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
}
@Override
public
Device
selectDeviceByRoomId
(
Long
roomId
)
{
public
List
<
Device
>
selectDeviceByRoomId
(
Long
roomId
)
{
return
deviceMapper
.
selectDeviceByRoomId
(
roomId
);
}
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
e387b1f9
...
...
@@ -307,7 +307,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
// 加入自动未支付自动取消队列
redisUtil
.
lPush
(
Constants
.
ORDER_AUTO_CANCEL_KEY
,
sOrder
.
getOrderNo
());
}
save
(
sOrder
);
if
(
response
.
getStatus
().
equals
(
YesNoEnum
.
yes
.
getFlag
()))
{
if
(
Objects
.
nonNull
(
request
.
getCouponId
())
&&
request
.
getCouponId
()
!=
0
)
{
SConsumerCoupon
byId
=
consumerCouponService
.
getById
(
request
.
getCouponId
());
...
...
@@ -327,6 +326,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
}
save
(
sOrder
);
return
response
;
}
...
...
@@ -762,7 +762,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
if
(
Objects
.
isNull
(
sRoomVo
))
{
throw
new
BaseException
(
"房间不存在!"
);
}
Device
one
=
deviceService
.
selectDeviceByRoomId
(
sOrder
.
getRoomId
());
LambdaQueryWrapper
<
Device
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getRoomId
,
sOrder
.
getRoomId
());
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_CCEE
.
getCode
());
Device
one
=
deviceService
.
getOne
(
deviceLambdaQueryWrapper
);
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
...
...
share-system/src/main/java/share/system/service/impl/SRoomServiceImpl.java
View file @
e387b1f9
...
...
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
share.common.enums.DeviceType
;
import
share.common.enums.RoleTypeEnum
;
import
share.common.exception.base.BaseException
;
import
share.common.utils.DateUtils
;
...
...
@@ -231,7 +232,10 @@ public class SRoomServiceImpl extends ServiceImpl<SRoomMapper, SRoom> implements
if
(
Objects
.
isNull
(
room
))
{
throw
new
RuntimeException
(
"房间不存在"
);
}
Device
one
=
deviceService
.
selectDeviceByRoomId
(
id
);
LambdaQueryWrapper
<
Device
>
deviceLambdaQueryWrapper
=
new
LambdaQueryWrapper
<>();
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getRoomId
,
id
);
deviceLambdaQueryWrapper
.
eq
(
Device:
:
getDevType
,
DeviceType
.
DEVICE_CCEE
.
getCode
());
Device
one
=
deviceService
.
getOne
(
deviceLambdaQueryWrapper
);
if
(
Objects
.
isNull
(
one
))
{
throw
new
BaseException
(
"设备不存在!"
);
}
...
...
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