Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
8d45264e
Commit
8d45264e
authored
Jun 09, 2025
by
徐高华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
群发素材接口
parent
fc47d5d4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
1 deletions
+116
-1
MaterialApiService.java
...com/gic/haoban/manage/api/service/MaterialApiService.java
+3
-0
pom.xml
haoban-manage3-service/pom.xml
+5
-0
GroupChatPlanService.java
...ban/manage/service/service/chat/GroupChatPlanService.java
+1
-0
GroupChatPlanServiceImpl.java
...e/service/service/chat/impl/GroupChatPlanServiceImpl.java
+99
-1
MaterialApiServiceImpl.java
...nage/service/service/out/impl/MaterialApiServiceImpl.java
+5
-0
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+3
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/MaterialApiService.java
View file @
8d45264e
...
@@ -94,4 +94,7 @@ public interface MaterialApiService {
...
@@ -94,4 +94,7 @@ public interface MaterialApiService {
* @param qdto
* @param qdto
*/
*/
void
materialSortCategory
(
MaterialCategorySortQDTO
qdto
);
void
materialSortCategory
(
MaterialCategorySortQDTO
qdto
);
//mediaType1群发 2朋友圈
public
List
<
String
>
getImageMediaId
(
String
wxEnterpriseId
,
List
<
ContentMaterialDTO
>
imageList
,
int
mediaType
)
;
}
}
haoban-manage3-service/pom.xml
View file @
8d45264e
...
@@ -247,6 +247,11 @@
...
@@ -247,6 +247,11 @@
<artifactId>
task-allocation-sdk
</artifactId>
<artifactId>
task-allocation-sdk
</artifactId>
<version>
${task-allocation-sdk}
</version>
<version>
${task-allocation-sdk}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-canvas-api
</artifactId>
<version>
${gic-canvas-api}
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/GroupChatPlanService.java
View file @
8d45264e
...
@@ -42,6 +42,7 @@ public interface GroupChatPlanService {
...
@@ -42,6 +42,7 @@ public interface GroupChatPlanService {
void
stopByMsgid
(
Long
planId
);
void
stopByMsgid
(
Long
planId
);
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
)
;
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
)
;
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
,
String
enterpriseId
,
String
taskId
)
;
void
noticeTimer
(
String
params
);
void
noticeTimer
(
String
params
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/chat/impl/GroupChatPlanServiceImpl.java
View file @
8d45264e
...
@@ -7,6 +7,10 @@ import java.util.concurrent.ExecutorService;
...
@@ -7,6 +7,10 @@ import java.util.concurrent.ExecutorService;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.gic.canvas.api.dto.node.CanvasNodeDTO
;
import
com.gic.canvas.api.dto.node.QWMassContactNodeDTO
;
import
com.gic.canvas.api.dto.node.extract.MaterialExternalResources
;
import
com.gic.canvas.api.service.CanvasApiService
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
import
com.gic.haoban.manage.api.dto.CommonMQDTO
;
...
@@ -29,6 +33,8 @@ import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImp
...
@@ -29,6 +33,8 @@ import com.gic.haoban.manage.service.service.content.impl.GroupMessageServiceImp
import
com.gic.haoban.manage.service.util.StreamUtils
;
import
com.gic.haoban.manage.service.util.StreamUtils
;
import
com.gic.haoban.task.api.dto.TaskSettingDTO
;
import
com.gic.haoban.task.api.dto.TaskSettingDTO
;
import
com.gic.haoban.task.api.service.SettingApiService
;
import
com.gic.haoban.task.api.service.SettingApiService
;
import
com.gic.haoban.task.manage.api.dto.MarketClueTaskDTO
;
import
com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService
;
import
com.gic.haoban.task.manage.api.service.QywxGroupSendCanvasApiService
;
import
com.gic.haoban.task.manage.api.service.QywxGroupSendCanvasApiService
;
import
com.gic.thirdparty.cloudfile.CloudFileUtil
;
import
com.gic.thirdparty.cloudfile.CloudFileUtil
;
import
com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum
;
import
com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum
;
...
@@ -142,6 +148,10 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
...
@@ -142,6 +148,10 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
private
SettingApiService
settingApiService
;
private
SettingApiService
settingApiService
;
@Autowired
@Autowired
private
QwMomentPlanAttendMapper
qwMomentPlanAttendMapper
;
private
QwMomentPlanAttendMapper
qwMomentPlanAttendMapper
;
@Autowired
private
IMarketClueTaskApiService
marketClueTaskApiService
;
@Autowired
private
CanvasApiService
canvasApiService
;
private
static
GicMQClient
mqClient
=
GICMQClientUtil
.
getClientInstance
();
private
static
GicMQClient
mqClient
=
GICMQClientUtil
.
getClientInstance
();
...
@@ -896,7 +906,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
...
@@ -896,7 +906,7 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
@Override
@Override
public
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
)
{
public
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
)
{
Date
startTime
=
DateUtil
.
addNumForSecond
(
sendTime
,-
30
)
;
Date
startTime
=
DateUtil
.
addNumForSecond
(
sendTime
,-
30
)
;
Date
endTime
=
DateUtil
.
addNumForMinute
(
sendTime
,
1
)
;
Date
endTime
=
DateUtil
.
addNumForMinute
(
sendTime
,
2
)
;
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
()
;
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
...
@@ -916,6 +926,94 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
...
@@ -916,6 +926,94 @@ public class GroupChatPlanServiceImpl implements GroupChatPlanService {
return
null
;
return
null
;
}
}
@Override
public
String
getQwMsgId
(
String
staffId
,
Date
sendTime
,
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
,
String
enterpriseId
,
String
taskId
)
{
Date
startTime
=
DateUtil
.
addNumForSecond
(
sendTime
,-
120
)
;
Date
endTime
=
DateUtil
.
addNumForMinute
(
sendTime
,
1
)
;
TabHaobanStaff
staff
=
this
.
staffMapper
.
selectByPrimaryKey
(
staffId
)
;
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
()
;
WxEnterpriseQwDTO
qwDTO
=
this
.
wxEnterpriseService
.
getQwInfo
(
wxEnterpriseId
)
;
String
wxUserId
=
staff
.
getWxUserId
()
;
if
(
qwDTO
.
needOpenUserId3th
())
{
wxUserId
=
staff
.
getWxOpenUseId
()
;
}
// 发送到群
List
<
QywxGroupMessageInfoDTO
>
msgList
=
this
.
queryGroupMsg
(
groupMsgChatType
,
startTime
,
endTime
,
qwDTO
,
wxUserId
);
if
(
CollectionUtils
.
isNotEmpty
(
msgList
))
{
if
(
msgList
.
size
()==
0
)
{
return
msgList
.
get
(
0
).
getMsgId
()
;
}
else
{
List
<
MaterialExternalResources
>
taskList
=
this
.
getTaskList
(
taskId
,
enterpriseId
)
;
if
(
CollectionUtils
.
isEmpty
(
taskList
))
{
return
null
;
}
String
taskText
=
this
.
getTaskText
(
taskList
)
;
int
count
=
this
.
getTaskNum
(
taskList
)
;
if
(
StringUtils
.
isNotBlank
(
taskText
))
{
logger
.
info
(
"taskText={}"
,
taskText
);
int
matchNum
=
0
;
String
msgid
=
null
;
for
(
QywxGroupMessageInfoDTO
item
:
msgList
)
{
if
(
item
.
getDataStr
().
contains
(
taskText
))
{
JSONObject
j
=
JSONObject
.
parseObject
(
item
.
getDataStr
())
;
int
size
=
j
.
getJSONArray
(
"attachments"
).
size
()
;
if
(
size
==
count
)
{
msgid
=
item
.
getMsgId
();
matchNum
=
matchNum
+
1
;
}
}
}
logger
.
info
(
"matchNum="
,
matchNum
);
if
(
matchNum
==
1
)
{
return
msgid
;
}
}
DingUtils
.
send
(
"企微查询到多个群发任务,无法匹配"
,
false
);
return
null
;
}
}
return
null
;
}
private
List
<
MaterialExternalResources
>
getTaskList
(
String
taskId
,
String
enterpriseId
)
{
MarketClueTaskDTO
task
=
this
.
marketClueTaskApiService
.
getMarketClueTaskDTO
(
taskId
,
enterpriseId
);
Long
canvasId
=
task
.
getCanvasId
();
Long
nodeId
=
task
.
getNodeId
();
ServiceResponse
<
CanvasNodeDTO
<?>>
nodeResp
=
this
.
canvasApiService
.
getCanvasNodeByNodeId
(
canvasId
,
nodeId
);
logger
.
info
(
"群发节点={}"
,
JSONObject
.
toJSONString
(
nodeResp
));
ServiceResponse
<
CanvasNodeDTO
<
QWMassContactNodeDTO
>>
massNodeResp
=
this
.
canvasApiService
.
convertToQWMassContactNode
(
nodeResp
.
getResult
());
QWMassContactNodeDTO
nodeDTO
=
massNodeResp
.
getResult
().
getNodeInfo
();
List
<
MaterialExternalResources
>
canvasMaterialList
=
nodeDTO
.
getMaterialResourcesList
();
return
canvasMaterialList
;
}
private
String
getTaskText
(
List
<
MaterialExternalResources
>
canvasMaterialList
)
{
// 1:文本,2:图片,3:网页,4:视频,5:文件, 6: 小程序,7:卡券
String
s
=
""
;
for
(
MaterialExternalResources
res
:
canvasMaterialList
)
{
// 素材类型,1:文本,2:图片,3:网页,4:视频,5:文件, 6: 小程序,7:卡券
if
(
res
.
getMaterialType
()==
1
)
{
s
=
res
.
getContentText
()
;
JSONObject
json
=
new
JSONObject
()
;
json
.
put
(
"content"
,
s
)
;
return
json
.
toJSONString
()
;
}
}
return
s
;
}
private
int
getTaskNum
(
List
<
MaterialExternalResources
>
canvasMaterialList
)
{
// 1:文本,2:图片,3:网页,4:视频,5:文件, 6: 小程序,7:卡券
int
num
=
0
;
for
(
MaterialExternalResources
res
:
canvasMaterialList
)
{
// 素材类型,1:文本,2:图片,3:网页,4:视频,5:文件, 6: 小程序,7:卡券
if
(
res
.
getMaterialType
()!=
1
)
{
num
=
num
+
1
;
}
}
return
num
;
}
private
List
<
QywxGroupMessageInfoDTO
>
queryGroupMsg
(
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
,
Date
startTime
,
Date
endTime
,
WxEnterpriseQwDTO
qwDTO
,
String
qwUserId
)
{
private
List
<
QywxGroupMessageInfoDTO
>
queryGroupMsg
(
GroupMessageServiceImpl
.
GroupMsgChatType
groupMsgChatType
,
Date
startTime
,
Date
endTime
,
WxEnterpriseQwDTO
qwDTO
,
String
qwUserId
)
{
QywxGroupMessageQDTO
qdto
=
new
QywxGroupMessageQDTO
();
QywxGroupMessageQDTO
qdto
=
new
QywxGroupMessageQDTO
();
qdto
.
setCorpid
(
qwDTO
.
getThirdCorpid
());
qdto
.
setCorpid
(
qwDTO
.
getThirdCorpid
());
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MaterialApiServiceImpl.java
View file @
8d45264e
...
@@ -565,4 +565,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
...
@@ -565,4 +565,9 @@ public class MaterialApiServiceImpl implements MaterialApiService {
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"9999"
,
"获取图片失败,请稍后再试"
);
return
com
.
gic
.
api
.
base
.
commons
.
ServiceResponse
.
failure
(
"9999"
,
"获取图片失败,请稍后再试"
);
}
}
}
}
@Override
public
List
<
String
>
getImageMediaId
(
String
wxEnterpriseId
,
List
<
ContentMaterialDTO
>
imageList
,
int
mediaType
)
{
return
this
.
materialService
.
getImageMediaId
(
wxEnterpriseId
,
imageList
,
mediaType
);
}
}
}
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
8d45264e
...
@@ -265,5 +265,7 @@
...
@@ -265,5 +265,7 @@
<dubbo:reference
interface=
"com.gic.haoban.task.api.service.TelTaskApiService"
id=
"telTaskApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.api.service.TelTaskApiService"
id=
"telTaskApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.manage.api.service.IMarketTaskMemberApiService"
id=
"iMarketTaskMemberApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.manage.api.service.IMarketTaskMemberApiService"
id=
"iMarketTaskMemberApiService"
/>
<dubbo:reference
id=
"settingApiService"
interface=
"com.gic.haoban.task.api.service.SettingApiService"
timeout=
"10000"
retries=
"0"
/>
<dubbo:reference
id=
"settingApiService"
interface=
"com.gic.haoban.task.api.service.SettingApiService"
timeout=
"10000"
retries=
"0"
/>
<dubbo:reference
interface=
"com.gic.haoban.task.manage.api.service.IMarketClueTaskApiService"
id=
"iMarketClueTaskApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"canvasApiService"
interface=
"com.gic.canvas.api.service.CanvasApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
</beans>
</beans>
\ No newline at end of file
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