Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-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 fffe5fdc
authored
Jan 12, 2024
by
zhouhaibao
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
java配置添加
1 parent
2b2bacf2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
62 deletions
platform-process/src/main/java/cn/com/glsx/process/modules/sop/java/example/ControllerSendMessageDemo.java
platform-process/src/main/java/cn/com/glsx/process/modules/sop/java/example/ControllerSendMessageDemo.java
View file @
fffe5fd
...
@@ -52,36 +52,57 @@ public class ControllerSendMessageDemo {
...
@@ -52,36 +52,57 @@ public class ControllerSendMessageDemo {
// 获取营销类型 10.短信发送 9.企微群发 8.企微朋友圈
// 获取营销类型 10.短信发送 9.企微群发 8.企微朋友圈
String
sendType
=
SopHelper
.
getValueFromJsonString
(
nodeParam
,
"taskType"
);
String
sendType
=
SopHelper
.
getValueFromJsonString
(
nodeParam
,
"taskType"
);
if
(
StringUtils
.
isNotEmpty
(
sendType
))
{
if
(
StringUtils
.
isNotEmpty
(
sendType
))
{
List
<
CustomerTouchModel
>
customerTouchModels
=
new
ArrayList
<>();
Map
<
String
,
List
<
CustomerInfo
>>
collect
=
customerInfoList
.
stream
()
Map
<
String
,
List
<
CustomerInfo
>>
collect
=
customerInfoList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
CustomerInfo:
:
getUserId
));
.
collect
(
Collectors
.
groupingBy
(
CustomerInfo:
:
getUserId
));
Iterator
<
Entry
<
String
,
List
<
CustomerInfo
>>>
iterator
=
collect
.
entrySet
().
iterator
();
Iterator
<
Entry
<
String
,
List
<
CustomerInfo
>>>
iterator
=
collect
.
entrySet
().
iterator
();
CustomerTouchModel
customerTouchModel
=
new
CustomerTouchModel
();
CustomerTouchModel
customerTouchModel
=
new
CustomerTouchModel
();
while
(
iterator
.
hasNext
())
{
List
<
SopTaskExecuteStaffModel
>
sopTaskExecuteStaffModels
=
new
ArrayList
<>();
List
<
SopTaskExecuteStaffModel
>
sopTaskExecuteStaffModels
=
new
ArrayList
<>();
Entry
<
String
,
List
<
CustomerInfo
>>
next
=
iterator
.
next
();
// 构建基础参数
String
key
=
next
.
getKey
();
List
<
CustomerInfo
>
value
=
next
.
getValue
();
switch
(
sendType
)
{
switch
(
sendType
)
{
case
"10"
:
case
"10"
:
buildMessageParam
(
customerTouchModel
,
value
,
nodeParam
,
sopInst
,
sopInstNode
,
buildDefaultParam
(
customerTouchModel
,
sopInst
,
sopInstNode
,
nodeParam
,
true
);
sopTaskExecuteStaffModels
);
customerTouchModel
.
setSendType
(
1
);
break
;
break
;
case
"8"
:
case
"8"
:
buildMassParam
(
customerTouchModel
,
key
,
value
,
nodeParam
,
sopInst
,
sopInstNode
,
buildDefaultParam
(
customerTouchModel
,
sopInst
,
sopInstNode
,
nodeParam
,
false
);
sopTaskExecuteStaffModels
);
customerTouchModel
.
setChatType
(
"single"
);
customerTouchModel
.
setChatType
(
"single"
);
customerTouchModel
.
setSendType
(
2
);
customerTouchModel
.
setSendType
(
2
);
break
;
break
;
case
"9"
:
case
"9"
:
buildMassParam
(
customerTouchModel
,
key
,
value
,
nodeParam
,
sopInst
,
sopInstNode
,
buildDefaultParam
(
customerTouchModel
,
sopInst
,
sopInstNode
,
nodeParam
,
false
);
sopTaskExecuteStaffModels
);
customerTouchModel
.
setSendType
(
3
);
customerTouchModel
.
setSendType
(
3
);
break
;
break
;
default
:
default
:
break
;
break
;
}
}
while
(
iterator
.
hasNext
())
{
List
<
String
>
phoneList
=
new
ArrayList
<>();
Entry
<
String
,
List
<
CustomerInfo
>>
next
=
iterator
.
next
();
String
key
=
next
.
getKey
();
List
<
CustomerInfo
>
value
=
next
.
getValue
();
switch
(
sendType
)
{
case
"10"
:
List
<
String
>
phones
=
value
.
stream
()
.
filter
(
index
->
StringUtils
.
isNotEmpty
(
index
.
getCustomerPhone
()))
.
map
(
CustomerInfo:
:
getCustomerPhone
).
collect
(
Collectors
.
toList
());
phoneList
.
addAll
(
phones
);
customerTouchModel
.
setSendPhoneList
(
phoneList
);
break
;
case
"8"
:
case
"9"
:
List
<
String
>
sendExecuteList
=
value
.
stream
()
.
filter
(
index
->
StringUtils
.
isNotEmpty
(
index
.
getCustomerPhone
()))
.
map
(
CustomerInfo:
:
getExternalUserId
).
collect
(
Collectors
.
toList
());
SopTaskExecuteStaffModel
sopTaskExecuteStaffModel
=
new
SopTaskExecuteStaffModel
();
sopTaskExecuteStaffModel
.
setSendExternalUserId
(
sendExecuteList
);
sopTaskExecuteStaffModel
.
setSendUserId
(
key
);
sopTaskExecuteStaffModels
.
add
(
sopTaskExecuteStaffModel
);
break
;
default
:
break
;
}
customerTouchModel
.
setExecuteStaffRequestList
(
sopTaskExecuteStaffModels
);
}
}
RestTemplate
restTemplate
=
new
RestTemplate
();
RestTemplate
restTemplate
=
new
RestTemplate
();
System
.
out
.
println
(
"发送消息参数"
+
JSONObject
.
toJSONString
(
customerTouchModel
));
System
.
out
.
println
(
"发送消息参数"
+
JSONObject
.
toJSONString
(
customerTouchModel
));
...
@@ -100,36 +121,8 @@ public class ControllerSendMessageDemo {
...
@@ -100,36 +121,8 @@ public class ControllerSendMessageDemo {
return
(
JSONObject
)
JSONObject
.
toJSON
(
map
);
return
(
JSONObject
)
JSONObject
.
toJSON
(
map
);
}
}
/**
* 构建短信参数
*
* @param customerTouchModel 参数
* @param key 员工id
* @param value 客户信息
* @param nodeParam 节点入参信息
* @param sopInst 实例信息
* @param sopInstNode 实例节点信息
* @param sopTaskExecuteStaffModels
*/
private
static
void
buildMassParam
(
CustomerTouchModel
customerTouchModel
,
String
key
,
List
<
CustomerInfo
>
value
,
String
nodeParam
,
SopInst
sopInst
,
SopInstNode
sopInstNode
,
List
<
SopTaskExecuteStaffModel
>
sopTaskExecuteStaffModels
)
{
buildDefaultParam
(
customerTouchModel
,
sopInst
,
sopInstNode
,
nodeParam
,
sopTaskExecuteStaffModels
,
false
);
List
<
String
>
collect
=
value
.
stream
()
.
filter
(
index
->
StringUtils
.
isNotEmpty
(
index
.
getCustomerPhone
()))
.
map
(
CustomerInfo:
:
getExternalUserId
).
collect
(
Collectors
.
toList
());
SopTaskExecuteStaffModel
sopTaskExecuteStaffModel
=
new
SopTaskExecuteStaffModel
();
sopTaskExecuteStaffModel
.
setSendExternalUserId
(
collect
);
sopTaskExecuteStaffModel
.
setSendUserId
(
key
);
sopTaskExecuteStaffModels
.
add
(
sopTaskExecuteStaffModel
);
customerTouchModel
.
setExecuteStaffRequestList
(
sopTaskExecuteStaffModels
);
}
private
static
void
buildDefaultParam
(
CustomerTouchModel
customerTouchModel
,
SopInst
sopInst
,
private
static
void
buildDefaultParam
(
CustomerTouchModel
customerTouchModel
,
SopInst
sopInst
,
SopInstNode
sopInstNode
,
String
nodeParam
,
SopInstNode
sopInstNode
,
String
nodeParam
,
boolean
flag
)
{
List
<
SopTaskExecuteStaffModel
>
sopTaskExecuteStaffModels
,
boolean
flag
)
{
String
taskParam
=
SopHelper
.
getListValueFromJsonString
(
nodeParam
,
"taskParam"
);
String
taskParam
=
SopHelper
.
getListValueFromJsonString
(
nodeParam
,
"taskParam"
);
String
contentlists
=
SopHelper
.
getListValueFromJsonString
(
taskParam
,
"attachments"
);
String
contentlists
=
SopHelper
.
getListValueFromJsonString
(
taskParam
,
"attachments"
);
customerTouchModel
.
setInstId
(
sopInst
.
getInstId
());
customerTouchModel
.
setInstId
(
sopInst
.
getInstId
());
...
@@ -174,25 +167,4 @@ public class ControllerSendMessageDemo {
...
@@ -174,25 +167,4 @@ public class ControllerSendMessageDemo {
customerTouchModel
.
setContentList
(
customerTouchSourceModels
);
customerTouchModel
.
setContentList
(
customerTouchSourceModels
);
}
}
/**
* 构建短信参数
*
* @param customerTouchModel 参数
* @param value
* @param nodeParam 节点入参信息
* @param sopInst 实例信息
* @param sopInstNode 实例节点信息
* @param sopTaskExecuteStaffModels
*/
private
static
void
buildMessageParam
(
CustomerTouchModel
customerTouchModel
,
List
<
CustomerInfo
>
value
,
String
nodeParam
,
SopInst
sopInst
,
SopInstNode
sopInstNode
,
List
<
SopTaskExecuteStaffModel
>
sopTaskExecuteStaffModels
)
{
buildDefaultParam
(
customerTouchModel
,
sopInst
,
sopInstNode
,
nodeParam
,
sopTaskExecuteStaffModels
,
true
);
List
<
String
>
phones
=
value
.
stream
()
.
filter
(
index
->
StringUtils
.
isNotEmpty
(
index
.
getCustomerPhone
()))
.
map
(
CustomerInfo:
:
getCustomerPhone
).
collect
(
Collectors
.
toList
());
customerTouchModel
.
setSendPhoneList
(
phones
);
}
}
}
\ No newline at end of file
\ No newline at end of file
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