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
90ac1a09
Commit
90ac1a09
authored
Dec 01, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
在自动任务中增加订阅消息推送
parent
da387aba
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
16 deletions
+55
-16
pom.xml
share-front/pom.xml
+1
-5
WxMsgPushController.java
...java/share/web/controller/common/WxMsgPushController.java
+21
-2
OrderTask.java
share-quartz/src/main/java/share/quartz/task/OrderTask.java
+10
-5
RedisTask.java
share-quartz/src/main/java/share/quartz/task/RedisTask.java
+5
-0
WxMaConfiguration.java
.../src/main/java/share/system/config/WxMaConfiguration.java
+1
-1
WxMaProperties.java
...tem/src/main/java/share/system/config/WxMaProperties.java
+1
-1
WechatNewService.java
.../src/main/java/share/system/service/WechatNewService.java
+4
-0
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+5
-0
SOrderServiceImpl.java
...ain/java/share/system/service/impl/SOrderServiceImpl.java
+7
-2
WechatNewServiceImpl.java
.../java/share/system/service/impl/WechatNewServiceImpl.java
+0
-0
No files found.
share-front/pom.xml
View file @
90ac1a09
...
...
@@ -53,11 +53,7 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.8.16
</version>
</dependency>
<dependency>
<groupId>
com.github.binarywang
</groupId>
<artifactId>
weixin-java-miniapp
</artifactId>
<version>
4.5.0
</version>
</dependency>
</dependencies>
<build>
...
...
share-front/src/main/java/share/web/controller/common/WxMsgPushController.java
View file @
90ac1a09
...
...
@@ -6,13 +6,16 @@ import cn.hutool.core.date.LocalDateTimeUtil;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
me.chanjar.weixin.common.error.WxErrorException
;
import
org.springframework.beans.factory.annotation.
Value
;
import
org.springframework.beans.factory.annotation.
Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
share.system.config.WxMaProperties
;
import
share.system.domain.vo.SendTemplateMessageItemVo
;
import
share.system.domain.vo.TemplateMessageVo
;
import
share.system.service.WechatNewService
;
import
share.system.util.WXMsgPushUtils
;
import
share.web.core.config.WxMaProperties
;
import
java.time.LocalDateTime
;
...
...
@@ -63,6 +66,22 @@ public class WxMsgPushController {
@GetMapping
(
"/getOpenId"
)
public
void
getOpenId
(
String
openId
)
throws
Exception
{
// HashMap<String, SendTemplateMessageItemVo> data = new HashMap<>();
// TemplateMessageVo templateMessageVo = new TemplateMessageVo();
// templateMessageVo.setTouser(openId);
// templateMessageVo.setTemplate_id("oTc000e4NHkoc7v9OLBZiwM6Q6SFzguemrx6d0iuVS8");
// templateMessageVo.setUrl("http://www.baidu.com");
// data.put("thing4", new SendTemplateMessageItemVo("预约门店"));
// data.put("thing7", new SendTemplateMessageItemVo("服务名称"));
// data.put("date3", new SendTemplateMessageItemVo(LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm:ss")));
// data.put("thing5", new SendTemplateMessageItemVo("地址"));
// templateMessageVo.setData(data);
// log.info("开始发送消息!!!!");
// Boolean b = wechatNewService.sendMiniSubscribeMessage(templateMessageVo);
// if(b){
// log.info("消息发送成功!!!!");
// }
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"thing4"
,
"预约门店"
);
map
.
put
(
"thing7"
,
"服务名称"
);
...
...
share-quartz/src/main/java/share/quartz/task/OrderTask.java
View file @
90ac1a09
...
...
@@ -16,10 +16,8 @@ import share.common.constant.Constants;
import
share.common.core.redis.RedisUtil
;
import
share.common.enums.*
;
import
share.common.exception.base.BaseException
;
import
share.system.domain.SConsumer
;
import
share.system.domain.SConsumerCoupon
;
import
share.system.domain.SOrder
;
import
share.system.domain.SRoom
;
import
share.system.domain.*
;
import
share.system.domain.vo.TemplateMessageVo
;
import
share.system.service.*
;
import
java.util.*
;
...
...
@@ -63,6 +61,10 @@ public class OrderTask {
@Autowired
private
RedisTemplate
redisTemplate
;
@Autowired
private
WechatNewService
wechatNewService
;
final
int
ZERO
=
0
;
//10分钟的常量
final
long
TEN_MINUTES
=
60
*
10
;
...
...
@@ -227,7 +229,8 @@ public class OrderTask {
//时间到期前10分钟到9分
long
expire
=
(
expirationTime
.
getTime
()
-
new
Date
().
getTime
())
/
1000
;
if
(
expire
<
TEN_MINUTES
&&
expire
>
NINE_MINUTES
)
{
SOrder
byOrderNo
=
orderService
.
getByOrderNo
(
String
.
valueOf
(
o
));
wechatNewService
.
sendMiniSubscribeMessage
(
byOrderNo
,
MessageReminderEnum
.
RESERVER
)
}
if
(
expirationTime
.
getTime
()
<
new
Date
().
getTime
())
{
sOrders
.
add
(
orderService
.
getByOrderNo
(
String
.
valueOf
(
o
)));
...
...
@@ -255,6 +258,8 @@ public class OrderTask {
room
.
setUpdateTime
(
new
Date
());
}
});
//推送订单开始预定消息
wechatNewService
.
sendMiniSubscribeMessage
(
item
,
MessageReminderEnum
.
START
);
//到达预定时间进行通电
deviceOpService
.
openOrCloseDevice
(
item
.
getRoomId
(),
item
.
getConsumerPhone
(),
OpTypeEnum
.
GET_ELECTRIC
.
getCode
(),
false
,
ZERO
);
}
...
...
share-quartz/src/main/java/share/quartz/task/RedisTask.java
View file @
90ac1a09
...
...
@@ -47,6 +47,9 @@ public class RedisTask {
@Autowired
private
DeviceOpService
deviceOpService
;
@Autowired
private
WechatNewService
wechatNewService
;
//15分钟的常量
final
long
FIFTEEN_MINUTES
=
60
*
15
;
//14分钟的常量
...
...
@@ -158,6 +161,8 @@ public class RedisTask {
if
(
b
)
{
//删除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-
front/src/main/java/share/web/core
/config/WxMaConfiguration.java
→
share-
system/src/main/java/share/system
/config/WxMaConfiguration.java
View file @
90ac1a09
package
share
.
web
.
core
.
config
;
package
share
.
system
.
config
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl
;
...
...
share-
front/src/main/java/share/web/core
/config/WxMaProperties.java
→
share-
system/src/main/java/share/system
/config/WxMaProperties.java
View file @
90ac1a09
package
share
.
web
.
core
.
config
;
package
share
.
system
.
config
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
...
share-system/src/main/java/share/system/service/WechatNewService.java
View file @
90ac1a09
package
share
.
system
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
share.common.enums.MessageReminderEnum
;
import
share.system.domain.SOrder
;
import
share.system.domain.vo.*
;
import
share.system.response.WeChatJsSdkConfigResponse
;
...
...
@@ -94,6 +96,8 @@ public interface WechatNewService {
*/
Boolean
sendMiniSubscribeMessage
(
TemplateMessageVo
templateMessage
);
Boolean
sendMiniSubscribeMessage
(
SOrder
byOrderNo
,
MessageReminderEnum
messageReminderEnum
);
/**
* 获取微信公众号自定义菜单配置
* (使用本自定义菜单查询接口可以获取默认菜单和全部个性化菜单信息)
...
...
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
90ac1a09
...
...
@@ -347,6 +347,11 @@ public class QPServiceImpl implements QPService {
}
/**
* 适用店铺查询接口
*
* @return
*/
@Override
public
List
<
CustomerKeyShopScopeResponseEntity
>
scope
()
{
Boolean
b
=
redisUtil
.
exists
(
ReceiptRdeisEnum
.
MT_SESSION_KEY
.
getValue
());
...
...
share-system/src/main/java/share/system/service/impl/SOrderServiceImpl.java
View file @
90ac1a09
...
...
@@ -93,7 +93,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
private
ISConsumptionRecordsService
sConsumptionRecordsService
;
@Autowired
private
MqttxService
mqttx
Service
;
private
WechatNewService
wechatNew
Service
;
/**
* 查询订单
...
...
@@ -335,6 +335,11 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumptionRecords
.
setPayType
(
PayTypeEnum
.
WECHAT
.
getName
());
sConsumptionRecords
.
setSign
(
SignEnum
.
BURDEN
.
getValue
());
sConsumptionRecordsService
.
insertSConsumptionRecords
(
sConsumptionRecords
);
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
());
}
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RENEW
.
getCode
()))
{
sOrder
.
setStartDate
(
sOrder
.
getPreStartDate
());
...
...
@@ -651,7 +656,7 @@ 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
{
}
else
if
(
sOrder
.
getOrderType
().
equals
(
OrderTypeEnum
.
RESERVER
.
getCode
()))
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"orderNo"
,
sOrder
.
getOrderNo
());
map
.
put
(
"expirationTime"
,
sOrder
.
getPreStartDate
().
toString
());
...
...
share-system/src/main/java/share/system/service/impl/WechatNewServiceImpl.java
View file @
90ac1a09
This diff is collapsed.
Click to expand it.
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