Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
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
徐少华
midjourney-proxy
Commits
b231b044
Commit
b231b044
authored
Feb 21, 2020
by
章春雨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002407' into 'master'
时间管理统一回复 See merge request rays/pcloud-book!450
parents
a5b4f0d0
6cc09c88
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
202 additions
and
253 deletions
+202
-253
CreateReplyMessageDto.java
...om/pcloud/book/timecontrol/dto/CreateReplyMessageDto.java
+8
-19
ReplyMessageDto.java
...java/com/pcloud/book/timecontrol/dto/ReplyMessageDto.java
+14
-11
TaskBiz.java
...rc/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
+3
-0
TaskBizImpl.java
...ava/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
+128
-46
TaskSubscribeBizImpl.java
...cloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
+4
-123
TimeControlReplyMessage.java
...loud/book/timecontrol/entity/TimeControlReplyMessage.java
+10
-16
TimeControlReplyMessageMapper.java
...ook/timecontrol/mapper/TimeControlReplyMessageMapper.java
+3
-2
TimeControlReplyMessageMapper.xml
...rces/mapper/timecontrol/TimeControlReplyMessageMapper.xml
+32
-36
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/CreateReplyMessageDto.java
View file @
b231b044
...
...
@@ -3,7 +3,6 @@ package com.pcloud.book.timecontrol.dto;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* @date: 2020年01月31日 9:50
...
...
@@ -13,30 +12,20 @@ import java.math.BigDecimal;
@Data
public
class
CreateReplyMessageDto
implements
Serializable
{
private
String
messageType
;
private
String
text
;
private
Integer
appId
;
private
Integer
productId
;
private
String
imgUrl
;
private
Integer
replyType
;
private
String
fileName
;
private
String
content
;
private
String
file
Url
;
private
String
pic
Url
;
private
String
linkUrl
;
/**
* 回复类型 0 普通回复 1 完成任务确认回复
*/
private
Integer
replyType
;
private
String
description
;
private
Long
serveId
;
private
String
fileId
;
private
String
serveType
;
private
String
fileType
;
private
Long
resourceId
;
private
BigDecimal
size
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/timecontrol/dto/ReplyMessageDto.java
View file @
b231b044
...
...
@@ -3,7 +3,6 @@ package com.pcloud.book.timecontrol.dto;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* @date: 2020年01月31日 9:50
...
...
@@ -13,27 +12,31 @@ import java.math.BigDecimal;
@Data
public
class
ReplyMessageDto
implements
Serializable
{
private
String
message
Type
;
private
Integer
reply
Type
;
private
String
tex
t
;
private
String
conten
t
;
private
Integer
app
Id
;
private
Long
serve
Id
;
private
Integer
product
Id
;
private
Long
resource
Id
;
private
String
img
Url
;
private
String
pic
Url
;
private
String
fileNam
e
;
private
String
serveTyp
e
;
private
String
fileUrl
;
private
String
description
;
private
String
linkUrl
;
private
String
file
Id
;
private
Integer
taskItem
Id
;
private
String
fileType
;
private
BigDecimal
siz
e
;
private
String
resourceNam
e
;
private
Integer
taskItemId
;
private
String
resourceUrl
;
private
Long
fileSize
;
private
String
resourceTypeCode
;
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/TaskBiz.java
View file @
b231b044
...
...
@@ -9,6 +9,7 @@ import com.pcloud.book.timecontrol.dto.TaskDto;
import
com.pcloud.book.timecontrol.dto.TaskItemDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskDto
;
import
com.pcloud.book.timecontrol.dto.UpdateTaskItemDto
;
import
com.pcloud.book.timecontrol.entity.TimeControlReplyMessage
;
import
com.pcloud.book.timecontrol.vo.KeyWordTaskVO
;
import
com.pcloud.common.page.PageBeanNew
;
...
...
@@ -59,4 +60,6 @@ public interface TaskBiz {
void
finishTaskSend
(
Integer
taskSendId
);
TaskDto
getTaskByIdAndWxUserId
(
Integer
relSkillId
,
String
wxUserId
);
void
sendReplyMessage
(
List
<
TimeControlReplyMessage
>
replyMessages
,
String
wxUserId
,
String
robotWxId
,
String
ip
);
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskBizImpl.java
View file @
b231b044
...
...
@@ -4,10 +4,13 @@ import com.pcloud.appcenter.app.dto.AppDto;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.consumer.wechatgroup.WechatGroupConsr
;
import
com.pcloud.book.group.biz.WeixinQrcodeBiz
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.keywords.enums.ReplyTypeEnum
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
import
com.pcloud.book.skill.entity.PcloudSkill
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
...
...
@@ -50,9 +53,11 @@ import com.pcloud.common.page.PageBeanNew;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ResponseHandleUtil
;
import
com.pcloud.common.utils.ServeLinkUtils
;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtilParent
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.labelcenter.label.service.LabelService
;
import
com.pcloud.wechatgroup.base.exception.WechatGroupBizException
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
...
...
@@ -72,6 +77,7 @@ import org.springframework.stereotype.Component;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -123,6 +129,10 @@ public class TaskBizImpl implements TaskBiz {
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
TaskPrizeBizImpl
taskPrizeBiz
;
@Autowired
private
ResourceConsr
resourceConsr
;
@Autowired
private
ProductConsr
productConsr
;
@Override
public
Integer
createTask
(
CreateTaskDto
createTaskDto
)
{
...
...
@@ -276,7 +286,7 @@ public class TaskBizImpl implements TaskBiz {
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
set
Reply
Type
(
0
);
replyMessage
.
setType
(
0
);
list
.
add
(
replyMessage
);
});
//任务完成回复消息list
...
...
@@ -287,7 +297,7 @@ public class TaskBizImpl implements TaskBiz {
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
set
Reply
Type
(
1
);
replyMessage
.
setType
(
1
);
list
.
add
(
replyMessage
);
});
}
...
...
@@ -368,7 +378,7 @@ public class TaskBizImpl implements TaskBiz {
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
set
Reply
Type
(
0
);
replyMessage
.
setType
(
0
);
list
.
add
(
replyMessage
);
});
//任务完成回复消息list
...
...
@@ -379,7 +389,7 @@ public class TaskBizImpl implements TaskBiz {
BeanUtils
.
copyProperties
(
message
,
replyMessage
);
replyMessage
.
setTaskItemId
(
taskItemId
);
replyMessage
.
setTaskId
(
taskId
);
replyMessage
.
set
Reply
Type
(
1
);
replyMessage
.
setType
(
1
);
list
.
add
(
replyMessage
);
});
}
...
...
@@ -402,6 +412,18 @@ public class TaskBizImpl implements TaskBiz {
ReplyMessageDto
replyMessageDto
=
new
ReplyMessageDto
();
BeanUtils
.
copyProperties
(
message
,
replyMessageDto
);
messageDtos
.
add
(
replyMessageDto
);
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
message
.
getReplyType
()))
{
Long
resourceId
=
message
.
getResourceId
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
resourceId
));
ResourceDTO
resourceDTO
=
map
.
get
(
resourceId
);
if
(
resourceDTO
!=
null
)
{
replyMessageDto
.
setResourceName
(
resourceDTO
.
getResourceName
());
replyMessageDto
.
setResourceUrl
(
resourceDTO
.
getFileUrl
());
replyMessageDto
.
setFileType
(
resourceDTO
.
getFileType
());
replyMessageDto
.
setFileSize
(
resourceDTO
.
getFileSize
());
replyMessageDto
.
setResourceTypeCode
(
resourceDTO
.
getTypeCode
());
}
}
});
}
taskItemDto
.
setReplyMessageList
(
messageDtos
);
...
...
@@ -412,6 +434,18 @@ public class TaskBizImpl implements TaskBiz {
ReplyMessageDto
replyMessageDto
=
new
ReplyMessageDto
();
BeanUtils
.
copyProperties
(
message
,
replyMessageDto
);
completedMessageDtos
.
add
(
replyMessageDto
);
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
message
.
getReplyType
()))
{
Long
resourceId
=
message
.
getResourceId
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
resourceId
));
ResourceDTO
resourceDTO
=
map
.
get
(
resourceId
);
if
(
resourceDTO
!=
null
)
{
replyMessageDto
.
setResourceName
(
resourceDTO
.
getResourceName
());
replyMessageDto
.
setResourceUrl
(
resourceDTO
.
getFileUrl
());
replyMessageDto
.
setFileType
(
resourceDTO
.
getFileType
());
replyMessageDto
.
setFileSize
(
resourceDTO
.
getFileSize
());
replyMessageDto
.
setResourceTypeCode
(
resourceDTO
.
getTypeCode
());
}
}
});
}
taskItemDto
.
setCompletedReplyMessageList
(
completedMessageDtos
);
...
...
@@ -543,48 +577,7 @@ public class TaskBizImpl implements TaskBiz {
GroupRobotDTO
groupRobotDTO
=
wechatGroupConsr
.
getGroupRobotByWxId
(
robotWxId
);
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
List
<
TimeControlReplyMessage
>
replyMessages
=
replyMessageMapper
.
list4TaskItem
(
taskItemId
,
1
);
if
(!
ListUtils
.
isEmpty
(
replyMessages
))
{
LOGGER
.
info
(
"开始发送完成信息"
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
replyMessage
!=
null
)
{
switch
(
replyMessage
.
getMessageType
())
{
case
"text"
:
// 发送文本
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
replyMessage
.
getText
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
break
;
case
"img"
:
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setAltId
(
timeControlTaskSubscribe
.
getRobotWxId
());
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
break
;
case
"file"
:
// 发送文件
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
replyMessage
.
getFileUrl
());
sendFileVO
.
setFileName
(
replyMessage
.
getFileName
());
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
break
;
default
:
break
;
}
}
}
}
sendReplyMessage
(
replyMessages
,
wxUserId
,
robotWxId
,
ip
);
timeControlTaskSendMapper
.
updateSendState
(
taskSendId
,
TaskSendStateEnum
.
FINISH_SEND
.
getState
(),
1
);
//每次都要判断一下是否所有单项任务都完成。完成之后需要同步修改关注表里面完成状态
...
...
@@ -681,4 +674,93 @@ public class TaskBizImpl implements TaskBiz {
return
taskMapper
.
getTaskByIdAndWxUserId
(
relSkillId
,
wxUserId
);
}
@Override
public
void
sendReplyMessage
(
List
<
TimeControlReplyMessage
>
replyMessages
,
String
wxUserId
,
String
robotWxId
,
String
ip
)
{
if
(!
ListUtils
.
isEmpty
(
replyMessages
))
{
LOGGER
.
info
(
"开始发送完成信息"
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
replyMessage
!=
null
)
{
Integer
replyType
=
replyMessage
.
getReplyType
();
if
(
ReplyTypeEnum
.
TEXT
.
value
.
equals
(
replyType
))
{
// 发送文本
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
replyMessage
.
getContent
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
}
else
if
(
ReplyTypeEnum
.
IMAGE
.
value
.
equals
(
replyType
))
{
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setAltId
(
robotWxId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
}
else
if
(
ReplyTypeEnum
.
APP
.
value
.
equals
(
replyType
))
{
Long
serveId
=
replyMessage
.
getServeId
();
String
completeLink
=
null
;
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
replyMessage
.
getServeType
()))
{
AppDto
appDto
=
appConsr
.
getBaseById
(
serveId
);
if
(
appDto
!=
null
)
{
Long
channelId
=
appDto
.
getChannelId
();
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
// 处理链接地址
completeLink
=
ServeLinkUtils
.
getCompleteLink
(
replyMessage
.
getLinkUrl
(),
String
.
valueOf
(
accountSettingDto
.
getAccountSettingId
()),
accountSettingDto
.
getProtocol
(),
accountSettingDto
.
getDomain
(),
accountSettingDto
.
getFirstDomain
(),
String
.
valueOf
(
accountSettingDto
.
getRandom
()));
}
}
else
{
completeLink
=
replyMessage
.
getLinkUrl
();
}
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
replyMessage
.
getDescription
());
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
completeLink
=
completeLink
+
"&wxId="
+
wxUserId
+
"&robotWxId="
+
robotWxId
;
sendArticleMessageVO
.
setLinkUrl
(
completeLink
);
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
else
if
(
ReplyTypeEnum
.
RESOURCE
.
value
.
equals
(
replyType
))
{
SendFileVO
sendFileVO
=
new
SendFileVO
();
Map
<
Long
,
ResourceDTO
>
map
=
resourceConsr
.
mapByIds
(
Arrays
.
asList
(
replyMessage
.
getResourceId
()));
ResourceDTO
resourceDTO
=
map
.
get
(
replyMessage
.
getResourceId
());
if
(
resourceDTO
!=
null
)
{
sendFileVO
.
setFileUrl
(
resourceDTO
.
getFileUrl
());
String
fileName
=
resourceDTO
.
getResourceName
();
String
fileType
=
resourceDTO
.
getFileType
();
log
.
info
(
"fileName="
+
fileName
+
"+fileType+"
+
fileType
);
if
(
fileName
.
contains
(
fileType
))
{
//去掉后缀
fileName
=
fileName
.
substring
(
0
,
fileName
.
indexOf
(
fileType
)
-
1
);
}
log
.
info
(
"fileName="
+
fileName
);
sendFileVO
.
setFileName
(
fileName
);
}
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
sendFileVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
WxGroupSDK
.
sendFile
(
sendFileVO
);
}
else
if
(
ReplyTypeEnum
.
LINK
.
value
.
equals
(
replyType
))
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
replyMessage
.
getDescription
());
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
sendArticleMessageVO
.
setLinkUrl
(
replyMessage
.
getLinkUrl
());
sendArticleMessageVO
.
setPicUrl
(
replyMessage
.
getPicUrl
());
sendArticleMessageVO
.
setTitle
(
replyMessage
.
getContent
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/biz/impl/TaskSubscribeBizImpl.java
View file @
b231b044
package
com
.
pcloud
.
book
.
timecontrol
.
biz
.
impl
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.book.consumer.app.AppConsr
;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.content.ResourceConsr
;
...
...
@@ -19,6 +18,7 @@ import com.pcloud.book.skill.entity.PcloudSkill;
import
com.pcloud.book.skill.entity.PcloudSubReply
;
import
com.pcloud.book.skill.enums.SkillTypeEnum
;
import
com.pcloud.book.skill.enums.SubTypeEnum
;
import
com.pcloud.book.timecontrol.biz.TaskBiz
;
import
com.pcloud.book.timecontrol.biz.TaskSubscribeBiz
;
import
com.pcloud.book.timecontrol.dto.ReplyMessageBaseDto
;
import
com.pcloud.book.timecontrol.dto.TaskSendDto
;
...
...
@@ -44,7 +44,6 @@ import com.pcloud.common.utils.ListUtils;
import
com.pcloud.common.utils.httpclient.UrlUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.contentcenter.resource.dto.ResourceDTO
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
com.pcloud.wechatgroup.group.dto.GroupRobotDTO
;
import
com.sdk.wxgroup.SendArticleMessageVO
;
import
com.sdk.wxgroup.SendFileVO
;
...
...
@@ -122,7 +121,8 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
private
PcloudRobotSet
pcloudRobotSet
;
@Autowired
private
PcloudSkillRecordDao
pcloudSkillRecordDao
;
@Autowired
private
TaskBiz
taskBiz
;
@Override
@ParamLog
(
"任务订阅"
)
...
...
@@ -325,94 +325,7 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
String
ip
=
weixinQrcodeBiz
.
getRobotIpByGeneration
(
groupRobotDTO
.
getVersion
());
Integer
taskSendId
=
sendDto
.
getId
();
TimeControlTaskSend
timeControlTaskSend
=
timeControlTaskSendMapper
.
getById
(
taskSendId
);
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
replyMessage
!=
null
)
{
switch
(
replyMessage
.
getMessageType
())
{
case
"text"
:
// 发送文本
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
sendTextMessageVO
.
setContent
(
replyMessage
.
getText
());
sendTextMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendTextMessageVO
.
setWxId
(
robotWxId
);
sendTextMessageVO
.
setAltId
(
robotWxId
);
sendTextMessageVO
.
setWxGroupId
(
wxUserId
);
sendTextMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendTextMessage
(
sendTextMessageVO
);
break
;
case
"img"
:
// 发送图片
SendPicMessageVO
sendPicMessageVO
=
new
SendPicMessageVO
();
sendPicMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendPicMessageVO
.
setAltId
(
robotWxId
);
sendPicMessageVO
.
setWxGroupId
(
wxUserId
);
sendPicMessageVO
.
setPicUrl
(
replyMessage
.
getImgUrl
());
sendPicMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendPicMessage
(
sendPicMessageVO
);
break
;
case
"file"
:
// 发送文件
String
fileUrl
=
replyMessage
.
getFileUrl
();
String
fileName
=
replyMessage
.
getFileName
();
String
fileType
=
fileUrl
.
substring
(
fileUrl
.
lastIndexOf
(
"."
),
fileUrl
.
length
());
if
(!
StringUtil
.
isEmpty
(
fileType
)
&&
fileName
.
contains
(
fileType
))
{
//去掉后缀
fileName
=
fileName
.
substring
(
0
,
fileName
.
indexOf
(
fileType
)
-
1
);
}
SendFileVO
sendFileVO
=
new
SendFileVO
();
sendFileVO
.
setFileUrl
(
fileUrl
);
sendFileVO
.
setFileName
(
fileName
);
sendFileVO
.
setIp
(
ip
);
sendFileVO
.
setAltId
(
robotWxId
);
sendFileVO
.
setWxId
(
wxUserId
);
WxGroupSDK
.
sendFile
(
sendFileVO
);
break
;
case
"app"
:
//发送应用
if
(
replyMessage
.
getAppId
()
!=
null
)
{
AppDto
appDto
=
appConsr
.
getBaseById
(
replyMessage
.
getAppId
().
longValue
());
if
(
appDto
!=
null
)
{
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
sendArticleMessageVO
.
setDescription
(
appDto
.
getTypeName
());
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
// 链接地址
String
linkUrl
=
this
.
splitUrl
(
accountSettingDto
,
replyMessage
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
linkUrl
);
sendArticleMessageVO
.
setPicUrl
(
appDto
.
getSquareImg
());
sendArticleMessageVO
.
setTitle
(
appDto
.
getTitle
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
//发送作品
if
(
replyMessage
.
getProductId
()
!=
null
)
{
ProductDto
productDto
=
productConsr
.
getProBaseById
(
replyMessage
.
getProductId
().
longValue
());
Long
channelId
=
productConsr
.
getOneChannelIdByProId
(
replyMessage
.
getProductId
().
longValue
());
AccountSettingDto
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
productDto
!=
null
&&
accountSettingDto
!=
null
)
{
SendArticleMessageVO
sendArticleMessageVO
=
new
SendArticleMessageVO
();
sendArticleMessageVO
.
setCode
(
SendMessageTypeEnum
.
SELF
.
getCode
());
sendArticleMessageVO
.
setAltId
(
robotWxId
);
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
sendArticleMessageVO
.
setDescription
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
sendArticleMessageVO
.
setWxGroupId
(
wxUserId
);
// 处理链接地址
String
linkUrl
=
this
.
splitUrl
(
accountSettingDto
,
replyMessage
.
getLinkUrl
());
sendArticleMessageVO
.
setLinkUrl
(
linkUrl
);
sendArticleMessageVO
.
setPicUrl
(
productDto
.
getCoverImg
());
sendArticleMessageVO
.
setTitle
(
productDto
.
getProductName
());
sendArticleMessageVO
.
setIp
(
ip
);
WxGroupSDK
.
sendArticleMessage
(
sendArticleMessageVO
);
}
}
break
;
default
:
break
;
}
}
}
taskBiz
.
sendReplyMessage
(
replyMessages
,
wxUserId
,
robotWxId
,
ip
);
if
(
YesOrNoEnums
.
YES
.
getValue
().
equals
(
timeControlTaskItem
.
getAddSendTime
())){
//封装退订提醒
SendTextMessageVO
sendTextMessageVO
=
new
SendTextMessageVO
();
...
...
@@ -484,38 +397,6 @@ public class TaskSubscribeBizImpl implements TaskSubscribeBiz {
}
}
/**
* 补充退订提示信息
*
* @param replyMessages
*/
private
boolean
fillUnsubscribeInfo
(
List
<
TimeControlReplyMessage
>
replyMessages
,
boolean
lastOne
)
{
boolean
tmp
=
false
;
if
(
replyMessages
.
size
()
==
0
)
{
return
tmp
;
}
boolean
hasText
=
false
;
for
(
TimeControlReplyMessage
replyMessage
:
replyMessages
)
{
if
(
"text"
.
equals
(
replyMessage
.
getMessageType
()))
{
hasText
=
true
;
tmp
=
true
;
replyMessage
.
setText
(
replyMessage
.
getText
()
+
"\n如需退订,请回复 TD"
+
replyMessage
.
getTaskId
());
}
}
if
(
lastOne
&&
!
hasText
)
{
// 不存在文本消息 追加消息进行推送
TimeControlReplyMessage
text
=
TimeControlReplyMessage
.
builder
().
messageType
(
"text"
).
text
(
"如需退订,请回复 TD"
+
replyMessages
.
get
(
0
).
getTaskId
()).
build
();
replyMessages
.
add
(
text
);
}
return
tmp
;
}
@Override
public
TimeControlTaskSubscribe
getSubscribeState
(
String
wxUserId
,
Integer
taskId
)
{
TimeControlTaskSubscribe
timeControlTaskSubscribe
=
taskSubscribeMapper
.
getSubscribe
(
wxUserId
,
null
,
taskId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/entity/TimeControlReplyMessage.java
View file @
b231b044
...
...
@@ -5,7 +5,6 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.math.BigDecimal
;
import
java.util.Date
;
@Data
...
...
@@ -19,21 +18,13 @@ public class TimeControlReplyMessage {
private
Integer
taskItemId
;
private
Integer
replyType
;
private
String
messageType
;
private
String
text
;
private
Integer
appId
;
private
Integer
type
;
private
Integer
productId
;
private
String
imgUrl
;
private
Integer
replyType
;
private
String
fileName
;
private
String
content
;
private
String
file
Url
;
private
String
pic
Url
;
private
Date
createTime
;
...
...
@@ -41,10 +32,12 @@ public class TimeControlReplyMessage {
private
String
linkUrl
;
private
String
fileId
;
private
Long
serveId
;
private
String
serveType
;
private
String
fileType
;
private
Long
resourceId
;
private
BigDecimal
size
;
private
String
description
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/timecontrol/mapper/TimeControlReplyMessageMapper.java
View file @
b231b044
...
...
@@ -26,9 +26,9 @@ public interface TimeControlReplyMessageMapper {
void
deleteByItemId
(
Integer
taskItemId
);
List
<
TimeControlReplyMessage
>
list4TaskItem
(
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"
replyType"
)
Integer
replyT
ype
);
List
<
TimeControlReplyMessage
>
list4TaskItem
(
@Param
(
"taskItemId"
)
Integer
taskItemId
,
@Param
(
"
type"
)
Integer
t
ype
);
List
<
TimeControlReplyMessage
>
getByTaskItemId
(
Integer
taskItemId
);
List
<
ReplyMessageDto
>
list4TaskItemList
(
@Param
(
"taskItemIds"
)
List
<
Integer
>
taskItemIds
,
@Param
(
"
replyType"
)
Integer
replyT
ype
);
List
<
ReplyMessageDto
>
list4TaskItemList
(
@Param
(
"taskItemIds"
)
List
<
Integer
>
taskItemIds
,
@Param
(
"
type"
)
Integer
t
ype
);
}
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/timecontrol/TimeControlReplyMessageMapper.xml
View file @
b231b044
...
...
@@ -5,24 +5,21 @@
<id
column=
"id"
property=
"id"
jdbcType=
"INTEGER"
/>
<result
column=
"task_item_id"
property=
"taskItemId"
jdbcType=
"INTEGER"
/>
<result
column=
"task_id"
property=
"taskId"
jdbcType=
"INTEGER"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"reply_type"
property=
"replyType"
jdbcType=
"INTEGER"
/>
<result
column=
"message_type"
property=
"messageType"
jdbcType=
"VARCHAR"
/>
<result
column=
"text"
property=
"text"
jdbcType=
"VARCHAR"
/>
<result
column=
"app_id"
property=
"appId"
jdbcType=
"INTEGER"
/>
<result
column=
"product_id"
property=
"productId"
jdbcType=
"INTEGER"
/>
<result
column=
"img_url"
property=
"imgUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_name"
property=
"fileName"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_url"
property=
"fileUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_id"
property=
"fileId"
jdbcType=
"VARCHAR"
/>
<result
column=
"file_type"
property=
"fileType"
jdbcType=
"VARCHAR"
/>
<result
column=
"size"
property=
"size"
jdbcType=
"DECIMAL"
/>
<result
column=
"content"
property=
"content"
jdbcType=
"VARCHAR"
/>
<result
column=
"serve_id"
property=
"serveId"
jdbcType=
"INTEGER"
/>
<result
column=
"resource_id"
property=
"resourceId"
jdbcType=
"INTEGER"
/>
<result
column=
"pic_url"
property=
"picUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"serve_type"
property=
"serveType"
jdbcType=
"VARCHAR"
/>
<result
column=
"description"
property=
"description"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"link_url"
property=
"linkUrl"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, task_id, task_item_id,
reply_type, message_type, text, app_id, product_id, img_url, file_nam
e,
file_url, create_time, update_time, link_url, file_id, file_type, size
id, task_id, task_item_id,
type, reply_type, content, serve_id, resource_id, pic_url, serve_typ
e,
description, create_time, update_time, link_url
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Integer"
>
select
...
...
@@ -32,10 +29,10 @@
</select>
<select
id=
"list4TaskItem"
resultMap=
"BaseResultMap"
>
select task_id, task_item_id,
reply_type, message_type, app_id, product_id, img_url, file_nam
e,
file_url, create_time, text, link_url, file_id, file_type, size
select task_id, task_item_id,
type, reply_type, serve_id, resource_id, pic_url, serve_typ
e,
description, create_time, content, link_url
from time_control_reply_message
where task_item_id = #{taskItemId} and
reply_type = #{replyT
ype}
where task_item_id = #{taskItemId} and
type = #{t
ype}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
...
...
@@ -46,26 +43,25 @@
delete from time_control_reply_message where task_item_id = #{taskItemId}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.timecontrol.entity.TimeControlReplyMessage"
>
insert into time_control_reply_message (id, task_item_id,
reply_
type,
message_type, app_id, product
_id,
img_url, file_name, file_url
,
insert into time_control_reply_message (id, task_item_id, type,
reply_type, serve_id, resource
_id,
pic_url, serve_type, description
,
create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{taskItemId,jdbcType=INTEGER}, #{
replyT
ype,jdbcType=INTEGER},
#{
messageType,jdbcType=VARCHAR}, #{appId,jdbcType=INTEGER}, #{product
Id,jdbcType=INTEGER},
#{
imgUrl,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, #{fileUrl
,jdbcType=VARCHAR},
values (#{id,jdbcType=INTEGER}, #{taskItemId,jdbcType=INTEGER}, #{
t
ype,jdbcType=INTEGER},
#{
replyType,jdbcType=VARCHAR}, #{serveId,jdbcType=INTEGER}, #{resource
Id,jdbcType=INTEGER},
#{
picUrl,jdbcType=VARCHAR}, #{serveType,jdbcType=VARCHAR}, #{description
,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"batchInsert"
>
insert into time_control_reply_message (task_id, task_item_id,
reply_
type,
message_type, text, app_id, product
_id,
img_url, file_name, file_url
,
create_time, update_time, link_url
, file_id, file_type, size
)
insert into time_control_reply_message (task_id, task_item_id, type,
reply_type, content, serve_id, resource
_id,
pic_url, serve_type, description
,
create_time, update_time, link_url)
values
<foreach
collection=
"list"
separator=
","
item=
"item"
>
(#{item.taskId}, #{item.taskItemId}, #{item.replyType}, #{item.messageType}, #{item.text}, #{item.appId},
#{item.productId}, #{item.imgUrl}, #{item.fileName}, #{item.fileUrl}, now(), now(), #{item.linkUrl},
#{item.fileId}, #{item.fileType}, #{item.size})
(#{item.taskId}, #{item.taskItemId}, #{item.type}, #{item.replyType}, #{item.content}, #{item.serveId},
#{item.resourceId}, #{item.picUrl}, #{item.serveType}, #{item.description}, now(), now(), #{item.linkUrl})
</foreach>
</insert>
...
...
@@ -79,16 +75,16 @@
<select
id=
"list4TaskItemList"
resultType=
"com.pcloud.book.timecontrol.dto.ReplyMessageDto"
>
select
task_item_id taskItemId,
app_id app
Id,
product_id product
Id,
img_url img
Url,
file_name fileNam
e,
file_url fileUrl
,
text tex
t,
serve_id serve
Id,
resource_id resource
Id,
pic_url pic
Url,
serve_type serveTyp
e,
description description
,
content conten
t,
link_url linkUrl,
message_type message
Type, file_type fileType, size
reply_type reply
Type, file_type fileType, size
from time_control_reply_message
where
reply_type = #{replyT
ype}
where
type = #{t
ype}
<if
test=
"taskItemIds !=null and taskItemIds.size()>0"
>
AND task_item_id IN
<foreach
collection=
"taskItemIds"
open=
"("
close=
")"
separator=
","
item=
"item"
>
...
...
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