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
901111fd
Commit
901111fd
authored
Jan 18, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加微信小程序订阅消息
parent
c651553d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
39 deletions
+40
-39
MessageReminderEnum.java
...src/main/java/share/common/enums/MessageReminderEnum.java
+17
-7
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+6
-11
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+2
-2
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+1
-1
WechatNewServiceImpl.java
.../java/share/system/service/impl/WechatNewServiceImpl.java
+14
-18
No files found.
share-common/src/main/java/share/common/enums/MessageReminderEnum.java
View file @
901111fd
package
share
.
common
.
enums
;
public
enum
MessageReminderEnum
{
//预约到期通知:oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8,订单开始通知:K8fbcKVq46w9o7Ekpesn74WPjwxnbso947YZiYBQw9c,订单结单通知:HB2_moQRQrXC2cKw6zE08NU3AQO9Ggj3aAOg0lIgecg
RESERVER
(
"预约到期通知"
,
"oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8"
),
START
(
"订单开始通知"
,
"K8fbcKVq46w9o7Ekpesn74RThj_Yw6hFNwA-A5L3XA0"
),
END
(
"订单结单通知"
,
"HB2_moQRQrXC2cKw6zE08NU3AQO9Ggj3aAOg0lIgecg"
);
RESERVER
(
"预约成功通知"
,
"UkvsRnZkZB_w3MqXPbRhi4jEk8ML4N9PWT3rnd3Bhxg"
,
"若因事迟到,迟到部分时间不延期不退还"
),
START
(
"订单开始通知"
,
"K8fbcKVq46w9o7Ekpesn70wK3mYjXqdSfFUth4AufqU"
,
"您的凑角房间使用订单即将开始"
),
END
(
"订单结单通知"
,
"HB2_moQRQrXC2cKw6zE08FF8UZJ5ue1h_qXZhvOkacc"
,
"您的房间使用时间还剩15分钟"
);
private
String
name
;
private
String
value
;
private
String
tips
;
MessageReminderEnum
()
{
}
MessageReminderEnum
(
String
name
,
String
value
)
{
MessageReminderEnum
(
String
name
,
String
value
,
String
tips
)
{
this
.
name
=
name
;
this
.
value
=
value
;
this
.
tips
=
tips
;
}
public
String
get
n
ame
()
{
public
String
get
N
ame
()
{
return
name
;
}
public
void
set
n
ame
(
String
name
)
{
public
void
set
N
ame
(
String
name
)
{
this
.
name
=
name
;
}
...
...
@@ -31,4 +33,12 @@ public enum MessageReminderEnum {
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
public
String
getTips
()
{
return
tips
;
}
public
void
setTips
(
String
tips
)
{
this
.
tips
=
tips
;
}
}
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
901111fd
...
...
@@ -76,9 +76,9 @@ public class OrderTask {
final
int
ZERO
=
0
;
//10分钟的常量
final
long
TEN_MINUTES
=
60
*
1
0
;
final
long
TEN_MINUTES
=
60
*
3
0
;
//9分钟的常量
final
long
NINE_MINUTES
=
60
*
9
;
final
long
NINE_MINUTES
=
60
*
2
9
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
//14分钟的常量
...
...
@@ -248,12 +248,11 @@ public class OrderTask {
logger
.
info
(
"订单号为:"
+
jsonObject
.
getStr
(
"orderNo"
)
+
"的订单不存在"
);
return
;
}
//时间到期前
10分钟到
9分
//时间到期前
30分钟到2
9分
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
// if (expire < TEN_MINUTES && expire > NINE_MINUTES) {
// SOrder byOrderNo = orderService.getByOrderNo(String.valueOf(orderNo));
// wechatNewService.sendMiniSubscribeMessage(byOrderNo, MessageReminderEnum.RESERVER);
// }
if
(
expire
<
TEN_MINUTES
&&
expire
>
NINE_MINUTES
)
{
wechatNewService
.
sendMiniSubscribeMessage
(
byOrderNo
,
MessageReminderEnum
.
START
);
}
//判断时间是否在15分钟到14分钟
if
(
expire
<
FIFTEEN_MINUTES
&&
expire
>
FOURTEEN_MINUTES
)
{
SStore
sStore
=
storeService
.
getById
(
byOrderNo
.
getStoreId
());
...
...
@@ -291,10 +290,6 @@ public class OrderTask {
room
.
setUpdateTime
(
new
Date
());
}
});
// logger.info("开始发送消息!!!!");
// //推送订单开始预定消息
// wechatNewService.sendMiniSubscribeMessage(item, MessageReminderEnum.START);
// logger.info("发送消息结束!!!!");
logger
.
info
(
"开始通电!!!!"
);
//到达预定时间进行通电
deviceOpService
.
openOrCloseDevice
(
item
.
getRoomId
(),
item
.
getConsumerPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
false
,
ZERO
);
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
901111fd
...
...
@@ -226,6 +226,8 @@ public class RedisTask {
SRoom
sRoom
=
sRoomList
.
stream
().
filter
(
item
->
item
.
getId
().
equals
(
sOrder
.
getRoomId
())).
findFirst
().
orElse
(
null
);
// 通知用户
smsService
.
sendSmsOrderEndRemind
(
sOrder
.
getConsumerPhone
(),
sStore
,
sRoom
);
//推送订单结束消息
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
END
);
//通知保洁人员
sConsumerService
.
selectListByStoreId
(
sOrder
.
getStoreId
()).
stream
().
forEach
(
item
->
{
// 循环发送短信提示门店保洁打扫卫生
...
...
@@ -263,8 +265,6 @@ public class RedisTask {
boolean
b
=
isCleanRecordsService
.
addSCleanRecords
(
sOrder
.
getStoreId
(),
sOrder
.
getRoomId
());
//删除redis中的值
redisUtil
.
delete
(
o
);
//推送订单结束消息
// wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.END);
deviceOpService
.
actionExecute
(
sOrder
.
getRoomId
(),
sOrder
.
getConsumerPhone
(),
VoiceEnum
.
SEND_CUSTOMER
.
getCode
(),
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_PATTERN
),
DateUtil
.
format
(
DateUtil
.
offsetMinute
(
new
Date
(),
1
),
DatePattern
.
NORM_DATETIME_PATTERN
),
"1"
);
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
901111fd
...
...
@@ -990,7 +990,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
device1
.
setRoomId
(
sOrder
.
getRoomId
());
device1
.
setDevType
(
DeviceType
.
DEVICE_0001
.
getCode
());
redisUtils
.
delete
(
ReceiptRdeisEnum
.
ORDER_NO
.
getValue
()
+
sOrder
.
getOrderNo
());
// wechatNewService.sendMiniSubscribeMessage(sOrder, MessageReminderEnum.START
);
wechatNewService
.
sendMiniSubscribeMessage
(
sOrder
,
MessageReminderEnum
.
RESERVER
);
//开门、取电
deviceOpService
.
openDoor
(
sRoomVo
.
getId
(),
sOrder
.
getConsumerPhone
());
//语音
...
...
share-system/src/main/java/share/system/service/impl/WechatNewServiceImpl.java
View file @
901111fd
...
...
@@ -529,7 +529,9 @@ public class WechatNewServiceImpl implements WechatNewService {
public
Boolean
sendMiniSubscribeMessage
(
SOrder
byOrderNo
,
MessageReminderEnum
messageReminderEnum
)
{
//发送模板消息 预约提醒到期
TemplateMessageVo
templateMessageVo
=
new
TemplateMessageVo
();
String
url
=
"https://www.coujio.com/front-api/order/"
+
byOrderNo
.
getOrderNo
();
// String url = "https://www.coujio.com/front-api/order/" + byOrderNo.getOrderNo();
//测试页面
String
url
=
"/pages/orderResult/orderResult?orderNo="
+
byOrderNo
.
getOrderNo
();
templateMessageVo
.
setPage
(
url
);
templateMessageVo
.
setMiniprogram_state
(
"trial"
);
HashMap
<
String
,
SendTemplateMessageItemVo
>
data
=
new
HashMap
<>();
...
...
@@ -543,21 +545,17 @@ public class WechatNewServiceImpl implements WechatNewService {
String
preEndDateStr
=
DateUtil
.
format
(
preEndDate
,
DatePattern
.
NORM_DATETIME_MINUTE_FORMATTER
);
SConsumerToken
tokenByUserId
=
sConsumerTokenService
.
getTokenByUserId
(
byOrderNo
.
getConsumerId
());
String
date
=
preStartDateStr
+
"~"
+
preEndDateStr
;
String
address
=
sStore
.
getAddress
();
if
(
address
.
length
()
>
20
)
{
address
=
address
.
substring
(
0
,
20
);
}
templateMessageVo
.
setTouser
(
tokenByUserId
.
getToken
());
if
(
messageReminderEnum
.
equals
(
MessageReminderEnum
.
RESERVER
))
{
templateMessageVo
.
setTemplate_id
(
MessageReminderEnum
.
RESERVER
.
getValue
());
//
添加门店名称
data
.
put
(
"thing
4
"
,
new
SendTemplateMessageItemVo
(
"武汉"
+
sStore
.
getName
()));
//
订单门店
data
.
put
(
"thing
5
"
,
new
SendTemplateMessageItemVo
(
"武汉"
+
sStore
.
getName
()));
//服务名称
data
.
put
(
"thin
g7
"
,
new
SendTemplateMessageItemVo
(
sRoomVo
.
getName
()));
//
预约
时间
data
.
put
(
"
date3
"
,
new
SendTemplateMessageItemVo
(
date
));
//
地址
data
.
put
(
"thing
5"
,
new
SendTemplateMessageItemVo
(
address
));
data
.
put
(
"thin
6
"
,
new
SendTemplateMessageItemVo
(
sRoomVo
.
getName
()));
//
订单
时间
data
.
put
(
"
time7
"
,
new
SendTemplateMessageItemVo
(
date
));
//
温馨提示
data
.
put
(
"thing
4"
,
new
SendTemplateMessageItemVo
(
MessageReminderEnum
.
RESERVER
.
getTips
()
));
}
else
if
(
messageReminderEnum
.
equals
(
MessageReminderEnum
.
START
))
{
templateMessageVo
.
setTemplate_id
(
MessageReminderEnum
.
START
.
getValue
());
//预约门店
...
...
@@ -566,10 +564,8 @@ public class WechatNewServiceImpl implements WechatNewService {
data
.
put
(
"thing7"
,
new
SendTemplateMessageItemVo
(
sRoomVo
.
getName
()));
//预约时间
data
.
put
(
"time8"
,
new
SendTemplateMessageItemVo
(
date
));
//地址
data
.
put
(
"thing9"
,
new
SendTemplateMessageItemVo
(
address
));
//订单金额
data
.
put
(
"amount4"
,
new
SendTemplateMessageItemVo
(
String
.
valueOf
(
byOrderNo
.
getPackPrice
())));
//温馨提示
data
.
put
(
"thing5"
,
new
SendTemplateMessageItemVo
(
MessageReminderEnum
.
START
.
getTips
()));
}
else
if
(
messageReminderEnum
.
equals
(
MessageReminderEnum
.
END
))
{
templateMessageVo
.
setTemplate_id
(
MessageReminderEnum
.
END
.
getValue
());
//订单门店
...
...
@@ -578,8 +574,8 @@ public class WechatNewServiceImpl implements WechatNewService {
data
.
put
(
"thing6"
,
new
SendTemplateMessageItemVo
(
sRoomVo
.
getName
()));
//订单时间
data
.
put
(
"time7"
,
new
SendTemplateMessageItemVo
(
date
));
//
地址
data
.
put
(
"thing
8"
,
new
SendTemplateMessageItemVo
(
address
));
//
温馨提示
data
.
put
(
"thing
4"
,
new
SendTemplateMessageItemVo
(
MessageReminderEnum
.
END
.
getTips
()
));
}
templateMessageVo
.
setData
(
data
);
return
sendMiniSubscribeMessage
(
templateMessageVo
);
...
...
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