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
c9c1bc98
Commit
c9c1bc98
authored
Jun 05, 2024
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改模版分享页面跳转逻辑
parent
5b922a0e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
WechatNewServiceImpl.java
.../java/share/system/service/impl/WechatNewServiceImpl.java
+14
-7
No files found.
share-system/src/main/java/share/system/service/impl/WechatNewServiceImpl.java
View file @
c9c1bc98
...
...
@@ -508,7 +508,13 @@ public class WechatNewServiceImpl implements WechatNewService {
*/
@Override
public
Boolean
sendPublicTemplateMessage
(
OfficialAccountTemplate
templateMessage
)
{
String
accessToken
=
getPublicAccessToken
();
boolean
exists
=
redisUtil
.
exists
(
WeChatConstants
.
REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY
);
String
accessToken
=
null
;
if
(
exists
)
{
accessToken
=
redisUtil
.
get
(
WeChatConstants
.
REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY
).
toString
();
}
else
{
accessToken
=
getPublicAccessToken
();
}
String
url
=
StrUtil
.
format
(
WeChatConstants
.
WECHAT_PUBLIC_SEND_TEMPLATE_URL
,
accessToken
);
JSONObject
jsonData
=
JSONObject
.
parseObject
(
JSONObject
.
toJSONString
(
templateMessage
));
String
result
=
restTemplateUtil
.
postJsonData
(
url
,
jsonData
);
...
...
@@ -516,14 +522,15 @@ public class WechatNewServiceImpl implements WechatNewService {
if
(
ObjectUtil
.
isNull
(
data
))
{
throw
new
BaseException
(
"微信平台接口异常,没任何数据返回!"
);
}
if
(
data
.
containsKey
(
"errcode"
)
&&
!
data
.
getString
(
"errcode"
).
equals
(
"0"
)
&&
!
data
.
getString
(
"errcode"
).
equals
(
"40014"
))
{
if
(
data
.
containsKey
(
"errcode"
)
&&
!
data
.
getString
(
"errcode"
).
equals
(
"0"
)
&&
!
data
.
getString
(
"errcode"
).
equals
(
"40014"
)
&&
!
data
.
getString
(
"errcode"
).
equals
(
"40001"
)
)
{
if
(
data
.
containsKey
(
"errmsg"
))
{
wxExceptionDispose
(
data
,
"微信公众号发送模板消息异常"
);
// throw new BaseException("微信接口调用失败:" + data.getString("errcode") + data.getString("errmsg"));
logger
.
error
(
"微信接口调用失败:"
+
data
.
getString
(
"errcode"
)
+
data
.
getString
(
"errmsg"
));
}
}
else
if
(
data
.
getString
(
"errcode"
).
equals
(
"40014"
))
{
}
else
if
(
data
.
getString
(
"errcode"
).
equals
(
"40014"
)
||
data
.
getString
(
"errcode"
).
equals
(
"40001"
))
{
getPublicAccessToken
();
return
sendPublicTemplateMessage
(
templateMessage
);
}
return
Boolean
.
TRUE
;
...
...
@@ -579,10 +586,6 @@ public class WechatNewServiceImpl implements WechatNewService {
@Override
public
Boolean
sendPublicTemplateMessage
(
SOrder
byOrderNo
,
MessageReminderEnum
messageReminderEnum
,
Long
consumerId
)
{
OfficialAccountTemplate
officialAccountTemplate
=
new
OfficialAccountTemplate
();
Miniprogram
miniprogram
=
new
Miniprogram
();
miniprogram
.
setAppid
(
weChatConfig
.
getAppId
());
miniprogram
.
setPagepath
(
"/pages/orderResult/orderResult?orderNo="
+
byOrderNo
.
getOrderNo
()
+
"&share=share"
);
officialAccountTemplate
.
setMiniprogram
(
miniprogram
);
HashMap
<
String
,
SendTemplateMessageItemVo
>
data
=
new
HashMap
<>();
SStore
sStore
=
storeService
.
getById
(
byOrderNo
.
getStoreId
());
SRoomVo
sRoomVo
=
roomService
.
selectSRoomById
(
byOrderNo
.
getRoomId
());
...
...
@@ -612,6 +615,9 @@ public class WechatNewServiceImpl implements WechatNewService {
//预约时间
data
.
put
(
"time1"
,
new
SendTemplateMessageItemVo
(
preEndDateStr
));
}
else
if
(
messageReminderEnum
.
equals
(
MessageReminderEnum
.
ORDER_RESERVE
))
{
Miniprogram
miniprogram
=
new
Miniprogram
();
miniprogram
.
setAppid
(
weChatConfig
.
getAppId
());
miniprogram
.
setPagepath
(
"/pages/orderResult/orderResult?orderNo="
+
byOrderNo
.
getOrderNo
()
+
"&share=share"
);
officialAccountTemplate
.
setTemplate_id
(
MessageReminderEnum
.
ORDER_RESERVE
.
getValue
());
//门店名称
data
.
put
(
"thing2"
,
new
SendTemplateMessageItemVo
(
"武汉"
+
sStore
.
getName
()
+
"("
+
sRoomVo
.
getName
()
+
")"
));
...
...
@@ -623,6 +629,7 @@ public class WechatNewServiceImpl implements WechatNewService {
data
.
put
(
"phrase11"
,
new
SendTemplateMessageItemVo
(
OrderTypeEnum
.
getNameByCode
(
byOrderNo
.
getOrderType
())));
//商品名称
data
.
put
(
"thing21"
,
new
SendTemplateMessageItemVo
(
msg
));
officialAccountTemplate
.
setMiniprogram
(
miniprogram
);
}
officialAccountTemplate
.
setData
(
data
);
return
sendPublicTemplateMessage
(
officialAccountTemplate
);
...
...
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