Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-execute-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4279ccca
authored
Jan 08, 2024
by
Hayreal
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复小程序卡片消息-生成测试链接
1 parent
718513b6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
32 deletions
platform-execute/src/main/java/cn/com/glsx/execute/modules/converter/rop/RopRequestConveter.java
platform-execute/src/main/java/cn/com/glsx/execute/modules/service/sopTask/ExecuteTaskService.java
platform-execute/src/test/java/cn/com/glsx/cn/com/glsx/sopTask/ExecuteTaskServiceTest.java
platform-execute/src/main/java/cn/com/glsx/execute/modules/converter/rop/RopRequestConveter.java
View file @
4279ccc
...
@@ -251,7 +251,8 @@ public class RopRequestConveter {
...
@@ -251,7 +251,8 @@ public class RopRequestConveter {
if
(
dto
.
getMiniprogram
()
!=
null
)
{
if
(
dto
.
getMiniprogram
()
!=
null
)
{
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.title"
,
dto
.
getMiniprogram
().
getTitle
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.title"
,
dto
.
getMiniprogram
().
getTitle
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.appId"
,
dto
.
getMiniprogram
().
getAppId
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.appId"
,
dto
.
getMiniprogram
().
getAppId
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.mediaId"
,
dto
.
getMiniprogram
().
getPicMediaId
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.picMediaId"
,
dto
.
getMiniprogram
().
getPicMediaId
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].miniprogram.page"
,
dto
.
getMiniprogram
().
getPage
());
}
}
if
(
dto
.
getVideo
()
!=
null
)
{
if
(
dto
.
getVideo
()
!=
null
)
{
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].video.mediaId"
,
dto
.
getVideo
().
getMediaId
());
paramsMap
.
add
(
field
.
getName
()
+
"["
+
i
+
"].video.mediaId"
,
dto
.
getVideo
().
getMediaId
());
...
...
platform-execute/src/main/java/cn/com/glsx/execute/modules/service/sopTask/ExecuteTaskService.java
View file @
4279ccc
...
@@ -23,17 +23,23 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -23,17 +23,23 @@ import com.alibaba.fastjson.JSONObject;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.common.utils.StringUtils
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
CommonConstant
.
SUCCESS
;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
CommonConstant
.
SUCCESS
;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
DracConstant
.
AttType
.*;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
DracConstant
.
AttType
.*;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
DracConstant
.
DracLink
.*;
/**
/**
...
@@ -56,6 +62,9 @@ public class ExecuteTaskService {
...
@@ -56,6 +62,9 @@ public class ExecuteTaskService {
@Resource
@Resource
private
SopNodeTaskInfoService
sopNodeTaskInfoService
;
private
SopNodeTaskInfoService
sopNodeTaskInfoService
;
@Autowired
private
Environment
environment
;
/**
/**
* 企微群发
* 企微群发
...
@@ -86,7 +95,7 @@ public class ExecuteTaskService {
...
@@ -86,7 +95,7 @@ public class ExecuteTaskService {
}
}
resultList
.
add
(
result
);
resultList
.
add
(
result
);
// 保存任务
// 保存任务
saveTask
(
request
.
getExecuteStaffRequestList
(),
request
.
getInstId
(),
request
.
getNodeId
());
saveTask
(
request
.
getExecuteStaffRequestList
(),
request
.
getInstId
(),
request
.
getNodeId
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -106,7 +115,6 @@ public class ExecuteTaskService {
...
@@ -106,7 +115,6 @@ public class ExecuteTaskService {
AddWorkWechatExternalContactMsgTemplateRequestDTO
sendWorkDTO
=
new
AddWorkWechatExternalContactMsgTemplateRequestDTO
();
AddWorkWechatExternalContactMsgTemplateRequestDTO
sendWorkDTO
=
new
AddWorkWechatExternalContactMsgTemplateRequestDTO
();
String
chatType
=
request
.
getChatType
();
String
chatType
=
request
.
getChatType
();
if
(
StringUtils
.
isEmpty
(
chatType
))
{
if
(
StringUtils
.
isEmpty
(
chatType
))
{
//
throw
new
AdminException
(
ResultEnum
.
CHAT_TYPE_EMPTY
);
throw
new
AdminException
(
ResultEnum
.
CHAT_TYPE_EMPTY
);
}
}
sendWorkDTO
.
setChatType
(
chatType
);
sendWorkDTO
.
setChatType
(
chatType
);
...
@@ -136,34 +144,87 @@ public class ExecuteTaskService {
...
@@ -136,34 +144,87 @@ public class ExecuteTaskService {
* @return
* @return
*/
*/
private
List
<
AttContent
>
uploadMediaToQy
(
List
<
AttContent
>
contentList
,
Integer
merchantId
,
Integer
sendType
)
{
private
List
<
AttContent
>
uploadMediaToQy
(
List
<
AttContent
>
contentList
,
Integer
merchantId
,
Integer
sendType
)
{
AttContent
miniPathConvert
=
null
;
for
(
AttContent
attContent
:
contentList
)
{
for
(
AttContent
attContent
:
contentList
)
{
UpLoadMediaToWorkWechatRequestDTO
workWechatDTO
=
new
UpLoadMediaToWorkWechatRequestDTO
();
UpLoadMediaToWorkWechatRequestDTO
workWechatDTO
=
new
UpLoadMediaToWorkWechatRequestDTO
();
Integer
attType
=
attContent
.
getAttType
();
Integer
attType
=
attContent
.
getAttType
();
if
(
attType
.
equals
(
URI
))
{
// 构建短链
workWechatDTO
.
setMerchantId
(
merchantId
);
workWechatDTO
.
setContent
(
buildShortURL
(
attContent
.
getAttContent
()));
workWechatDTO
.
setAttType
(
attType
);
workWechatDTO
.
setSendType
(
sendType
);
// 群发小程序卡片消息
if
(
attType
.
equals
(
MINIPROGRAM
))
{
// 测试环境生成短链
String
miniPathConvertUri
=
environment
.
getProperty
(
"drac.welcomeconfig.qywechat.message.minipath.convert"
);
if
(
"on"
.
equals
(
miniPathConvertUri
))
{
miniPathConvert
=
buildMiniPathTestURL
(
attContent
,
merchantId
);
}
attContent
.
setAttContent
(
getMiniProgramMessage
(
attContent
,
merchantId
,
sendType
));
continue
;
continue
;
}
else
{
}
else
{
workWechatDTO
.
setContent
(
attContent
.
getAttContent
());
workWechatDTO
.
setContent
(
attContent
.
getAttContent
());
}
}
workWechatDTO
.
setMerchantId
(
merchantId
);
if
(!
attType
.
equals
(
TEXT
))
{
workWechatDTO
.
setAttType
(
attType
);
workWechatDTO
.
setSendType
(
sendType
);
if
(
attType
.
equals
(
TEXT
))
continue
;
String
mediaId
=
workWechatService
.
uploadMediaGetMediaId
(
workWechatDTO
);
String
mediaId
=
workWechatService
.
uploadMediaGetMediaId
(
workWechatDTO
);
if
(
StringUtils
.
isEmpty
(
mediaId
))
{
if
(
StringUtils
.
isEmpty
(
mediaId
))
{
throw
new
AdminException
(
ResultEnum
.
UPLOAD_MEDIA_FAIL
);
throw
new
AdminException
(
ResultEnum
.
UPLOAD_MEDIA_FAIL
);
}
}
attContent
.
setMediaId
(
mediaId
);
attContent
.
setMediaId
(
mediaId
);
// if (attType.equals(VEDIO)){
}
// String firstOfVideoMediaId = workWechatService.uploadMediaGetMediaId(workWechatDTO);
}
// attContent.setThumbMediaId(firstOfVideoMediaId);
/*
// }
支持测试环境测试活动小程序链接,如果存在活动则自动生成一个小程序短链用于测试
*/
if
(
miniPathConvert
!=
null
&&
sendType
.
equals
(
SendTypeEnum
.
GROUP_MESSAGE
.
getValue
()))
{
contentList
.
add
(
miniPathConvert
);
}
}
return
contentList
;
return
contentList
;
}
}
/**
/**
* 生成测试环境小程序短链
*
* @param attContent
* @param merchantId
* @return
*/
private
AttContent
buildMiniPathTestURL
(
AttContent
attContent
,
Integer
merchantId
)
{
JSONObject
miniProgramConfig
=
JSONObject
.
parseObject
(
attContent
.
getAttContent
());
// 生成短链
String
shortUrl
=
getMiniProgramShortUrl
(
attContent
.
getAttContent
(),
merchantId
);
JSONObject
object
=
new
JSONObject
();
object
.
put
(
link_title_key
,
miniProgramConfig
.
getString
(
"title"
));
object
.
put
(
link_picurl_key
,
miniProgramConfig
.
getString
(
"pic_url"
));
object
.
put
(
link_url_key
,
shortUrl
);
AttContent
content
=
new
AttContent
();
content
.
setAttContent
(
object
.
toJSONString
());
content
.
setAttType
(
URI
);
return
content
;
}
private
String
getMiniProgramMessage
(
AttContent
attContent
,
Integer
merchantId
,
Integer
sendType
)
{
JSONObject
miniConfigJson
=
JSONObject
.
parseObject
(
attContent
.
getAttContent
());
// 上传小程序封面图片获取mediaId
UpLoadMediaToWorkWechatRequestDTO
requestDTO
=
new
UpLoadMediaToWorkWechatRequestDTO
();
requestDTO
.
setSendType
(
sendType
);
requestDTO
.
setMerchantId
(
merchantId
);
requestDTO
.
setContent
(
miniConfigJson
.
getString
(
"pic_url"
));
requestDTO
.
setAttType
(
IMAGE
);
String
mediaId
=
workWechatService
.
uploadMediaGetMediaId
(
requestDTO
);
miniConfigJson
.
put
(
"mediaId"
,
mediaId
);
// 小程序page转码
try
{
miniConfigJson
.
put
(
"page"
,
URLEncoder
.
encode
(
miniConfigJson
.
getString
(
"page"
),
"UTF-8"
));
}
catch
(
UnsupportedEncodingException
e
)
{
log
.
info
(
"{}"
,
e
.
getMessage
(),
e
);
}
return
miniConfigJson
.
toJSONString
();
}
/**
* 构建短链
* 构建短链
*
*
* @param attContent
* @param attContent
...
@@ -206,7 +267,7 @@ public class ExecuteTaskService {
...
@@ -206,7 +267,7 @@ public class ExecuteTaskService {
result
.
setJobId
(
sendResponse
.
getData
().
getJobId
());
result
.
setJobId
(
sendResponse
.
getData
().
getJobId
());
}
}
resultList
.
add
(
result
);
resultList
.
add
(
result
);
saveTask
(
request
.
getExecuteStaffRequestList
(),
request
.
getInstId
(),
request
.
getNodeId
());
saveTask
(
request
.
getExecuteStaffRequestList
(),
request
.
getInstId
(),
request
.
getNodeId
());
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"发送朋友圈失败:{}"
,
e
);
log
.
error
(
"发送朋友圈失败:{}"
,
e
);
}
}
...
@@ -217,7 +278,7 @@ public class ExecuteTaskService {
...
@@ -217,7 +278,7 @@ public class ExecuteTaskService {
List
<
AttContent
>
contentList
=
request
.
getContentList
();
List
<
AttContent
>
contentList
=
request
.
getContentList
();
boolean
present
=
contentList
.
stream
().
anyMatch
(
v
->
v
.
getAttType
().
equals
(
MINIPROGRAM
));
boolean
present
=
contentList
.
stream
().
anyMatch
(
v
->
v
.
getAttType
().
equals
(
MINIPROGRAM
));
if
(
present
){
if
(
present
)
{
AttContent
attContent
=
contentList
.
stream
().
filter
(
v
->
v
.
getAttType
().
equals
(
MINIPROGRAM
)).
findFirst
().
get
();
AttContent
attContent
=
contentList
.
stream
().
filter
(
v
->
v
.
getAttType
().
equals
(
MINIPROGRAM
)).
findFirst
().
get
();
// 获取小程序短链
// 获取小程序短链
String
shortUrl
=
getMiniProgramShortUrl
(
attContent
.
getAttContent
(),
request
.
getMerchantId
());
String
shortUrl
=
getMiniProgramShortUrl
(
attContent
.
getAttContent
(),
request
.
getMerchantId
());
...
@@ -294,10 +355,10 @@ public class ExecuteTaskService {
...
@@ -294,10 +355,10 @@ public class ExecuteTaskService {
if
(
ropResponseDTO
.
getCode
().
equals
(
SUCCESS
))
{
if
(
ropResponseDTO
.
getCode
().
equals
(
SUCCESS
))
{
// 保存任务
// 保存任务
List
<
SopTaskExecuteStaffRequest
>
executeStaffRequestList
=
request
.
getExecuteStaffRequestList
();
List
<
SopTaskExecuteStaffRequest
>
executeStaffRequestList
=
request
.
getExecuteStaffRequestList
();
List
<
SopNodeTaskInfo
>
sopNodeTaskInfoList
=
new
ArrayList
<>();
List
<
SopNodeTaskInfo
>
sopNodeTaskInfoList
=
new
ArrayList
<>();
for
(
SopTaskExecuteStaffRequest
sopTaskExecuteStaffRequest
:
executeStaffRequestList
)
{
for
(
SopTaskExecuteStaffRequest
sopTaskExecuteStaffRequest
:
executeStaffRequestList
)
{
List
<
String
>
sendExternalUserId
=
sopTaskExecuteStaffRequest
.
getSendExternalUserId
();
List
<
String
>
sendExternalUserId
=
sopTaskExecuteStaffRequest
.
getSendExternalUserId
();
SopNodeTaskInfo
sopNodeTaskInfo
=
new
SopNodeTaskInfo
();
SopNodeTaskInfo
sopNodeTaskInfo
=
new
SopNodeTaskInfo
();
sopNodeTaskInfo
.
setInstId
(
request
.
getInstId
());
sopNodeTaskInfo
.
setInstId
(
request
.
getInstId
());
sopNodeTaskInfo
.
setNodeId
(
request
.
getNodeId
());
sopNodeTaskInfo
.
setNodeId
(
request
.
getNodeId
());
sopNodeTaskInfo
.
setUserId
(
sopTaskExecuteStaffRequest
.
getSendUserId
());
sopNodeTaskInfo
.
setUserId
(
sopTaskExecuteStaffRequest
.
getSendUserId
());
...
@@ -306,11 +367,11 @@ public class ExecuteTaskService {
...
@@ -306,11 +367,11 @@ public class ExecuteTaskService {
sopNodeTaskInfoList
.
add
(
sopNodeTaskInfo
);
sopNodeTaskInfoList
.
add
(
sopNodeTaskInfo
);
}
}
}
}
saveTask
(
executeStaffRequestList
,
request
.
getInstId
(),
request
.
getNodeId
());
saveTask
(
executeStaffRequestList
,
request
.
getInstId
(),
request
.
getNodeId
());
return
ropResponseDTO
.
getData
();
return
ropResponseDTO
.
getData
();
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"触达中心-发送员工失败:{}"
,
e
.
getMessage
());
log
.
error
(
"触达中心-发送员工失败:{}"
,
e
.
getMessage
());
throw
new
AdminException
(
e
.
getMessage
());
throw
new
AdminException
(
e
.
getMessage
());
}
}
}
}
...
@@ -318,10 +379,10 @@ public class ExecuteTaskService {
...
@@ -318,10 +379,10 @@ public class ExecuteTaskService {
}
}
private
void
saveTask
(
List
<
SopTaskExecuteStaffRequest
>
executeStaffRequestList
,
String
instId
,
Integer
nodeId
)
{
private
void
saveTask
(
List
<
SopTaskExecuteStaffRequest
>
executeStaffRequestList
,
String
instId
,
Integer
nodeId
)
{
List
<
SopNodeTaskInfo
>
sopNodeTaskInfoList
=
new
ArrayList
<>();
List
<
SopNodeTaskInfo
>
sopNodeTaskInfoList
=
new
ArrayList
<>();
for
(
SopTaskExecuteStaffRequest
sopTaskExecuteStaffRequest
:
executeStaffRequestList
)
{
for
(
SopTaskExecuteStaffRequest
sopTaskExecuteStaffRequest
:
executeStaffRequestList
)
{
List
<
String
>
sendExternalUserId
=
sopTaskExecuteStaffRequest
.
getSendExternalUserId
();
List
<
String
>
sendExternalUserId
=
sopTaskExecuteStaffRequest
.
getSendExternalUserId
();
SopNodeTaskInfo
sopNodeTaskInfo
=
new
SopNodeTaskInfo
();
SopNodeTaskInfo
sopNodeTaskInfo
=
new
SopNodeTaskInfo
();
sopNodeTaskInfo
.
setInstId
(
instId
);
sopNodeTaskInfo
.
setInstId
(
instId
);
sopNodeTaskInfo
.
setNodeId
(
nodeId
);
sopNodeTaskInfo
.
setNodeId
(
nodeId
);
sopNodeTaskInfo
.
setUserId
(
sopTaskExecuteStaffRequest
.
getSendUserId
());
sopNodeTaskInfo
.
setUserId
(
sopTaskExecuteStaffRequest
.
getSendUserId
());
...
@@ -387,7 +448,7 @@ public class ExecuteTaskService {
...
@@ -387,7 +448,7 @@ public class ExecuteTaskService {
String
attContent
=
content
.
getAttContent
();
String
attContent
=
content
.
getAttContent
();
if
(
content
.
getAttType
().
equals
(
MINIPROGRAM
))
{
if
(
content
.
getAttType
().
equals
(
MINIPROGRAM
))
{
String
shortUrl
=
getMiniProgramShortUrl
(
attContent
,
request
.
getMerchantId
());
String
shortUrl
=
getMiniProgramShortUrl
(
attContent
,
request
.
getMerchantId
());
if
(
StringUtils
.
isNotEmpty
(
shortUrl
)){
if
(
StringUtils
.
isNotEmpty
(
shortUrl
))
{
builder
.
append
(
shortUrl
);
builder
.
append
(
shortUrl
);
}
}
continue
;
continue
;
...
@@ -399,11 +460,10 @@ public class ExecuteTaskService {
...
@@ -399,11 +460,10 @@ public class ExecuteTaskService {
/**
/**
*
* @param attContent
* @param attContent
* @return
* @return
*/
*/
public
String
getMiniProgramShortUrl
(
String
attContent
,
Integer
merchantId
)
{
public
String
getMiniProgramShortUrl
(
String
attContent
,
Integer
merchantId
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
attContent
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
attContent
);
MiniProShortUrlConfigRequest
urlLinkRequest
=
new
MiniProShortUrlConfigRequest
();
MiniProShortUrlConfigRequest
urlLinkRequest
=
new
MiniProShortUrlConfigRequest
();
urlLinkRequest
.
setAppId
(
jsonObject
.
getString
(
"appId"
));
urlLinkRequest
.
setAppId
(
jsonObject
.
getString
(
"appId"
));
...
@@ -413,7 +473,7 @@ public class ExecuteTaskService {
...
@@ -413,7 +473,7 @@ public class ExecuteTaskService {
urlLinkRequest
.
setParam
(
pathAndParam
.
split
(
"\\?"
)[
1
]);
urlLinkRequest
.
setParam
(
pathAndParam
.
split
(
"\\?"
)[
1
]);
urlLinkRequest
.
setMerchantId
(
merchantId
);
urlLinkRequest
.
setMerchantId
(
merchantId
);
RopResponseDTO
<
String
>
responseDTO
=
workWechatService
.
getMiniprogramUrlLink
(
urlLinkRequest
);
RopResponseDTO
<
String
>
responseDTO
=
workWechatService
.
getMiniprogramUrlLink
(
urlLinkRequest
);
if
(
responseDTO
.
getCode
().
equals
(
SUCCESS
)){
if
(
responseDTO
.
getCode
().
equals
(
SUCCESS
))
{
return
buildShortURL
(
responseDTO
.
getData
());
return
buildShortURL
(
responseDTO
.
getData
());
}
}
return
null
;
return
null
;
...
...
platform-execute/src/test/java/cn/com/glsx/cn/com/glsx/sopTask/ExecuteTaskServiceTest.java
View file @
4279ccc
...
@@ -8,6 +8,7 @@ import cn.com.glsx.execute.modules.model.sopTask.SopTaskToCustomerExecuteRequest
...
@@ -8,6 +8,7 @@ import cn.com.glsx.execute.modules.model.sopTask.SopTaskToCustomerExecuteRequest
import
cn.com.glsx.execute.modules.model.sopTask.SopTaskExecuteStaffRequest
;
import
cn.com.glsx.execute.modules.model.sopTask.SopTaskExecuteStaffRequest
;
import
cn.com.glsx.execute.modules.model.sopTask.SopTaskToStaffExecuteRequest
;
import
cn.com.glsx.execute.modules.model.sopTask.SopTaskToStaffExecuteRequest
;
import
cn.com.glsx.execute.modules.service.sopTask.ExecuteTaskService
;
import
cn.com.glsx.execute.modules.service.sopTask.ExecuteTaskService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -15,6 +16,10 @@ import java.util.ArrayList;
...
@@ -15,6 +16,10 @@ import java.util.ArrayList;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
DracConstant
.
AttType
.
IMAGE
;
import
static
cn
.
com
.
glsx
.
execute
.
modules
.
constant
.
DracConstant
.
AttType
.
MINIPROGRAM
;
@Slf4j
public
class
ExecuteTaskServiceTest
extends
BaseTest
{
public
class
ExecuteTaskServiceTest
extends
BaseTest
{
@Autowired
@Autowired
...
@@ -89,7 +94,7 @@ public class ExecuteTaskServiceTest extends BaseTest {
...
@@ -89,7 +94,7 @@ public class ExecuteTaskServiceTest extends BaseTest {
request
.
setSendPhoneList
(
Arrays
.
asList
(
"19527148013"
));
request
.
setSendPhoneList
(
Arrays
.
asList
(
"19527148013"
));
List
<
AttContent
>
list
=
new
ArrayList
<>();
List
<
AttContent
>
list
=
new
ArrayList
<>();
AttContent
content
=
new
AttContent
();
AttContent
content
=
new
AttContent
();
content
.
setAttType
(
DracConstant
.
AttType
.
MINIPROGRAM
);
content
.
setAttType
(
MINIPROGRAM
);
content
.
setAttContent
(
"{\"appId\":\"wxe100667a63c1856ac\",\"page\":\"packageShopmall/packageEquity/pages/freecard/freecard?id=27&merchantId=44211227&nodeId=6&sopId=72876469150\"}"
);
content
.
setAttContent
(
"{\"appId\":\"wxe100667a63c1856ac\",\"page\":\"packageShopmall/packageEquity/pages/freecard/freecard?id=27&merchantId=44211227&nodeId=6&sopId=72876469150\"}"
);
list
.
add
(
content
);
list
.
add
(
content
);
request
.
setContentList
(
list
);
request
.
setContentList
(
list
);
...
@@ -133,20 +138,30 @@ public class ExecuteTaskServiceTest extends BaseTest {
...
@@ -133,20 +138,30 @@ public class ExecuteTaskServiceTest extends BaseTest {
list
.
add
(
contentText
);
list
.
add
(
contentText
);
AttContent
contentUrl
=
new
AttContent
();
AttContent
contentUrl
=
new
AttContent
();
contentUrl
.
setAttType
(
2
);
contentUrl
.
setAttType
(
IMAGE
);
contentUrl
.
setAttContent
(
"http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png"
);
contentUrl
.
setAttContent
(
"http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png"
);
list
.
add
(
contentUrl
);
list
.
add
(
contentUrl
);
request
.
setContentList
(
list
);
request
.
setContentList
(
list
);
List
<
SopTaskExecuteStaffRequest
>
requestList
=
new
ArrayList
<>();
List
<
SopTaskExecuteStaffRequest
>
requestList
=
new
ArrayList
<>();
SopTaskExecuteStaffRequest
staffRequest
=
new
SopTaskExecuteStaffRequest
();
SopTaskExecuteStaffRequest
staffRequest
=
new
SopTaskExecuteStaffRequest
();
staffRequest
.
setSendUserId
(
"wo-ZewEAAAuEZrLUMtmMbvLVAb61FQBw"
);
staffRequest
.
setSendUserId
(
"wo-ZewEAAAuEZrLUMtmMbvLVAb61FQBw"
);
staffRequest
.
setSendExternalUserId
(
Arrays
.
asList
(
"wm-ZewEAAAJeAz81dCoCCOmEa4aHJ1rA"
));
//
staffRequest.setSendExternalUserId(Arrays.asList("wm-ZewEAAAJeAz81dCoCCOmEa4aHJ1rA"));
requestList
.
add
(
staffRequest
);
requestList
.
add
(
staffRequest
);
request
.
setExecuteStaffRequestList
(
requestList
);
request
.
setExecuteStaffRequestList
(
requestList
);
request
.
setSupMerchantNo
(
44211227
);
request
.
setSupMerchantNo
(
44211227
);
request
.
setChatType
(
"single"
);
request
.
setChatType
(
"single"
);
request
.
setSendType
(
2
);
request
.
setSendType
(
2
);
log
.
info
(
"发送图片消息:{}"
,
request
);
executeTaskService
.
sendGroupMessage
(
request
);
/*-------------------------------------------------------*/
List
<
AttContent
>
miniProgramContentList
=
new
ArrayList
<>();
AttContent
miniProgramContent
=
new
AttContent
();
miniProgramContent
.
setAttContent
(
"{\"appId\":\"wxe10067a63c1856ac\",\"title\":\"您有一个新资讯,请及时查看\",\"page\":\"packageMine/pages/questionnaire/questionnaire?id={0}&merchantId={1}&nodeId={2}&sopId={3}\",\n"
+
"\"pic_url\":\"http://img01.glsx.com.cn/upload/biz/dracMini-qy-10004.png\"}"
);
miniProgramContent
.
setAttType
(
MINIPROGRAM
);
miniProgramContentList
.
add
(
miniProgramContent
);
request
.
setContentList
(
miniProgramContentList
);
log
.
info
(
"发送小程序消息:{}"
,
request
);
executeTaskService
.
sendGroupMessage
(
request
);
executeTaskService
.
sendGroupMessage
(
request
);
}
}
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment