Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 b2c9c081
authored
Oct 24, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
企业群发记录群发记录功能修改
1 parent
0c4abc6c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
696 additions
and
57 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageListController.java
linkwe-common/src/main/java/com/linkwechat/common/enums/MessageType.java
linkwe-common/src/main/java/com/linkwechat/common/utils/file/FileUploadUtils.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/controller/SysJobController.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PullGroupMessageTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMediaClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageAttachments.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageSendResult.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddMsgTemplateQuery.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeGetGroupMsgListQuery.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageDetailVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageListVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageListMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageTaskMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageListService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageSendResultService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageTaskService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeMaterialService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageListServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageSendResultServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTaskServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageAttachmentsMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageListMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageListController.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
com.github.pagehelper.PageInfo
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageListVo
;
import
com.linkwechat.wecom.service.IWeGroupMessageListService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 群发消息列Controller
*
* @author ruoyi
* @date 2021-10-19
*/
@Api
(
tags
=
"群发消息管理"
)
@RestController
@RequestMapping
(
"/wecom/group/message"
)
public
class
WeGroupMessageListController
extends
BaseController
{
@Autowired
private
IWeGroupMessageListService
iWeGroupMessageListService
;
/**
* 查询群发消息列列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:group:message:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
<
WeGroupMessageListVo
>
list
(
WeGroupMessageList
weGroupMessageList
)
{
startPage
();
PageInfo
<
WeGroupMessageListVo
>
listPageInfo
=
iWeGroupMessageListService
.
queryList
(
weGroupMessageList
);
return
getDataTable
(
listPageInfo
);
}
/**
* 导出群发消息列列表
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:group:message:list:export')"
)
@Log
(
title
=
"群发消息列"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
WeGroupMessageList
weGroupMessageList
)
{
PageInfo
<
WeGroupMessageListVo
>
listPageInfo
=
iWeGroupMessageListService
.
queryList
(
weGroupMessageList
);
ExcelUtil
<
WeGroupMessageListVo
>
util
=
new
ExcelUtil
<>(
WeGroupMessageListVo
.
class
);
return
util
.
exportExcel
(
listPageInfo
.
getList
(),
"list"
);
}
/**
* 获取群发消息列详细信息
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:group:message:list:query')")
@GetMapping
(
value
=
"/{msgId}"
)
public
AjaxResult
<
WeGroupMessageDetailVo
>
getInfo
(
@PathVariable
(
"msgId"
)
String
msgId
)
{
return
AjaxResult
.
success
(
iWeGroupMessageListService
.
getGroupMsgDetail
(
msgId
));
}
/**
* 新增群发消息列
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:group:message:list:add')"
)
@Log
(
title
=
"群发消息列"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
WeGroupMessageList
weGroupMessageList
)
{
return
toAjax
(
iWeGroupMessageListService
.
save
(
weGroupMessageList
)
?
1
:
0
);
}
/**
* 修改群发消息列
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:group:message:list:edit')"
)
@Log
(
title
=
"群发消息列"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
WeGroupMessageList
weGroupMessageList
)
{
return
toAjax
(
iWeGroupMessageListService
.
updateById
(
weGroupMessageList
)
?
1
:
0
);
}
/**
* 删除群发消息列
*/
@PreAuthorize
(
"@ss.hasPermi('linkwechat:group:message:list:remove')"
)
@Log
(
title
=
"群发消息列"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
iWeGroupMessageListService
.
removeByIds
(
Arrays
.
asList
(
ids
))
?
1
:
0
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/enums/MessageType.java
View file @
b2c9c08
...
@@ -93,4 +93,8 @@ public enum MessageType {
...
@@ -93,4 +93,8 @@ public enum MessageType {
return
Stream
.
of
(
values
()).
filter
(
s
->
s
.
type
.
equals
(
type
)).
findFirst
();
return
Stream
.
of
(
values
()).
filter
(
s
->
s
.
type
.
equals
(
type
)).
findFirst
();
}
}
public
static
MessageType
messageTypeOf
(
String
messageType
)
{
return
Stream
.
of
(
values
()).
filter
(
s
->
s
.
messageType
.
equals
(
messageType
)).
findFirst
().
get
();
}
}
}
linkwe-common/src/main/java/com/linkwechat/common/utils/file/FileUploadUtils.java
View file @
b2c9c08
...
@@ -4,6 +4,7 @@ import java.io.File;
...
@@ -4,6 +4,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
cn.hutool.core.io.FileUtil
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.config.RuoYiConfig
;
...
@@ -73,6 +74,14 @@ public class FileUploadUtils {
...
@@ -73,6 +74,14 @@ public class FileUploadUtils {
}
}
}
}
public
static
final
String
upload
(
InputStream
inputStream
,
String
fileName
)
throws
IOException
{
try
{
return
upload
(
getDefaultBaseDir
(),
inputStream
,
fileName
);
}
catch
(
Exception
e
)
{
throw
new
IOException
(
e
.
getMessage
(),
e
);
}
}
/**
/**
* 以默认配置进行文件上传
* 以默认配置进行文件上传
...
@@ -135,6 +144,12 @@ public class FileUploadUtils {
...
@@ -135,6 +144,12 @@ public class FileUploadUtils {
return
pathFileName
;
return
pathFileName
;
}
}
public
static
final
String
upload
(
String
baseDir
,
InputStream
inputStream
,
String
fileName
)
throws
IOException
{
File
desc
=
getAbsoluteFile
(
baseDir
,
fileName
);
File
file
=
FileUtil
.
writeFromStream
(
inputStream
,
desc
);
return
file
.
getAbsolutePath
();
}
/**
/**
* 上传到腾讯对象云存储中
* 上传到腾讯对象云存储中
*
*
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/controller/SysJobController.java
View file @
b2c9c08
...
@@ -120,7 +120,7 @@ public class SysJobController extends BaseController
...
@@ -120,7 +120,7 @@ public class SysJobController extends BaseController
/**
/**
* 定时任务立即执行一次
* 定时任务立即执行一次
*/
*/
@PreAuthorize
(
"@ss.hasPermi('monitor:job:changeStatus')"
)
//
@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"定时任务"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/run"
)
@PutMapping
(
"/run"
)
public
AjaxResult
run
(
@RequestBody
SysJob
job
)
throws
SchedulerException
public
AjaxResult
run
(
@RequestBody
SysJob
job
)
throws
SchedulerException
...
...
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PullGroupMessageTask.java
View file @
b2c9c08
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMediaClient.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
client
;
package
com
.
linkwechat
.
wecom
.
client
;
import
com.dtflys.forest.annotation.*
;
import
com.dtflys.forest.annotation.*
;
import
com.dtflys.forest.http.ForestResponse
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor
;
import
com.linkwechat.wecom.retry.WeCommonRetryWhen
;
import
com.linkwechat.wecom.retry.WeCommonRetryWhen
;
...
@@ -35,4 +36,12 @@ public interface WeMediaClient {
...
@@ -35,4 +36,12 @@ public interface WeMediaClient {
@Post
(
url
=
"/media/upload"
)
@Post
(
url
=
"/media/upload"
)
WeMediaDto
upload
(
@DataFile
(
value
=
"media"
,
fileName
=
"${1}"
)
InputStream
file
,
String
filename
,
@Query
(
"type"
)
String
type
);
WeMediaDto
upload
(
@DataFile
(
value
=
"media"
,
fileName
=
"${1}"
)
InputStream
file
,
String
filename
,
@Query
(
"type"
)
String
type
);
/**
* 获取临时素材
*
* @param mediaId 素材id
* @return
*/
@GetRequest
(
url
=
"/media/get"
)
ForestResponse
getMediaToResponse
(
@Query
(
"media_id"
)
String
mediaId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageAttachments.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
;
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.common.annotation.Excel
;
...
@@ -12,11 +11,6 @@ import lombok.Data;
...
@@ -12,11 +11,6 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
/**
* 群发消息附件对象 we_group_message_attachments
* 群发消息附件对象 we_group_message_attachments
*
*
...
@@ -64,6 +58,11 @@ public class WeGroupMessageAttachments extends BaseEntity{
...
@@ -64,6 +58,11 @@ public class WeGroupMessageAttachments extends BaseEntity{
@Excel
(
name
=
"消息描述"
)
@Excel
(
name
=
"消息描述"
)
private
String
description
;
private
String
description
;
/** 文件路径 */
@ApiModelProperty
(
"文件路径"
)
@Excel
(
name
=
"文件路径"
)
private
String
fileUrl
;
/** 消息链接 */
/** 消息链接 */
@ApiModelProperty
(
"消息链接"
)
@ApiModelProperty
(
"消息链接"
)
@Excel
(
name
=
"消息链接"
)
@Excel
(
name
=
"消息链接"
)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageList.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
;
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
@@ -25,7 +26,7 @@ import java.util.Date;
...
@@ -25,7 +26,7 @@ import java.util.Date;
@NoArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"we_group_message_list"
)
@TableName
(
"we_group_message_list"
)
public
class
WeGroupMessageList
extends
BaseEntity
{
public
class
WeGroupMessageList
extends
BaseEntity
{
/**
/**
* 主键id
* 主键id
...
@@ -76,4 +77,18 @@ public class WeGroupMessageList extends BaseEntity {
...
@@ -76,4 +77,18 @@ public class WeGroupMessageList extends BaseEntity {
@ApiModelProperty
(
"是否定时任务 0 常规 1 定时发送"
)
@ApiModelProperty
(
"是否定时任务 0 常规 1 定时发送"
)
@Excel
(
name
=
"是否定时任务 0 常规 1 定时发送"
)
@Excel
(
name
=
"是否定时任务 0 常规 1 定时发送"
)
private
Integer
isTask
;
private
Integer
isTask
;
/**
* 是否执行 0 未执行 1 已执行
*/
@ApiModelProperty
(
"是否执行 0 未执行 1 已执行"
)
@Excel
(
name
=
"是否执行 0 未执行 1 已执行"
)
private
Integer
isExecute
;
/**
* 群发消息创建者
*/
@ApiModelProperty
(
"群发消息创建者"
)
@TableField
(
exist
=
false
)
private
String
userName
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageSendResult.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
;
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
...
@@ -25,7 +26,7 @@ import java.util.Date;
...
@@ -25,7 +26,7 @@ import java.util.Date;
@NoArgsConstructor
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"we_group_message_send_result"
)
@TableName
(
"we_group_message_send_result"
)
public
class
WeGroupMessageSendResult
extends
BaseEntity
{
public
class
WeGroupMessageSendResult
extends
BaseEntity
{
/**
/**
* 主键id
* 主键id
...
@@ -76,4 +77,25 @@ public class WeGroupMessageSendResult extends BaseEntity {
...
@@ -76,4 +77,25 @@ public class WeGroupMessageSendResult extends BaseEntity {
@Excel
(
name
=
"发送时间,发送状态为1时返回"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@Excel
(
name
=
"发送时间,发送状态为1时返回"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
sendTime
;
private
Date
sendTime
;
/**
* 企业服务人员名称
*/
@ApiModelProperty
(
"企业服务人员名称"
)
@TableField
(
exist
=
false
)
private
String
userName
;
/**
* 外部联系人姓名
*/
@ApiModelProperty
(
"外部联系人姓名"
)
@TableField
(
exist
=
false
)
private
String
customerName
;
/**
* 外部客户群名称
*/
@ApiModelProperty
(
"外部客户群名称"
)
@TableField
(
exist
=
false
)
private
String
chatName
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageTask.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
/**
* 群发消息成员发送任务表 we_group_message_task
*
* @author ruoyi
* @date 2021-10-19
*/
@ApiModel
@Data
@NoArgsConstructor
@Accessors
(
chain
=
true
)
@TableName
(
"we_group_message_task"
)
public
class
WeGroupMessageTask
extends
BaseEntity
{
/**
* 主键id
*/
@ApiModelProperty
(
"id"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 企业群发消息的id
*/
@ApiModelProperty
(
"企业群发消息的id"
)
@Excel
(
name
=
"企业群发消息的id"
)
private
String
msgId
;
/**
* 企业服务人员的userid
*/
@ApiModelProperty
(
"企业服务人员的userid"
)
@Excel
(
name
=
"企业服务人员的userid"
)
private
String
userId
;
/**
* 发送状态:0-未发送 2-已发送
*/
@ApiModelProperty
(
"发送状态:0-未发送 2-已发送"
)
@Excel
(
name
=
"发送状态:0-未发送 2-已发送"
)
private
Integer
status
;
/**
* 发送时间,发送状态为1时返回
*/
@ApiModelProperty
(
"发送时间"
)
@Excel
(
name
=
"发送时间,发送状态为1时返回"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
sendTime
;
/**
* 企业服务人员名称
*/
@ApiModelProperty
(
"企业服务人员名称"
)
@TableField
(
exist
=
false
)
private
String
userName
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddMsgTemplateQuery.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
.
query
;
package
com
.
linkwechat
.
wecom
.
domain
.
query
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.linkwechat.common.enums.MessageType
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.wecom.domain.WeMessageTemplate
;
import
com.linkwechat.wecom.domain.WeMessageTemplate
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -41,22 +42,22 @@ public class WeAddMsgTemplateQuery {
...
@@ -41,22 +42,22 @@ public class WeAddMsgTemplateQuery {
this
.
attachments
=
new
ArrayList
<>(
16
);
this
.
attachments
=
new
ArrayList
<>(
16
);
if
(
messageTemplates
!=
null
&&
messageTemplates
.
size
()
<=
size
)
{
if
(
messageTemplates
!=
null
&&
messageTemplates
.
size
()
<=
size
)
{
messageTemplates
.
forEach
(
messageTemplate
->
{
messageTemplates
.
forEach
(
messageTemplate
->
{
if
(
ObjectUtil
.
equal
(
"image"
,
messageTemplate
.
getMsgType
()))
{
if
(
ObjectUtil
.
equal
(
MessageType
.
IMAGE
.
getMessageType
()
,
messageTemplate
.
getMsgType
()))
{
Attachments
images
=
new
Images
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
(),
Attachments
images
=
new
Images
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
(),
messageTemplate
.
getPicUrl
());
messageTemplate
.
getPicUrl
());
attachments
.
add
(
images
);
attachments
.
add
(
images
);
}
else
if
(
ObjectUtil
.
equal
(
"link"
,
messageTemplate
.
getMsgType
()))
{
}
else
if
(
ObjectUtil
.
equal
(
MessageType
.
LINK
.
getMessageType
()
,
messageTemplate
.
getMsgType
()))
{
Attachments
links
=
new
Links
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getTitle
(),
Attachments
links
=
new
Links
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getTitle
(),
messageTemplate
.
getPicUrl
(),
messageTemplate
.
getDescription
(),
messageTemplate
.
getLinkUrl
());
messageTemplate
.
getPicUrl
(),
messageTemplate
.
getDescription
(),
messageTemplate
.
getLinkUrl
());
attachments
.
add
(
links
);
attachments
.
add
(
links
);
}
else
if
(
ObjectUtil
.
equal
(
"miniprogram"
,
messageTemplate
.
getMsgType
()))
{
}
else
if
(
ObjectUtil
.
equal
(
MessageType
.
MINIPROGRAM
.
getMessageType
()
,
messageTemplate
.
getMsgType
()))
{
Attachments
miniprograms
=
new
Miniprograms
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getTitle
(),
Attachments
miniprograms
=
new
Miniprograms
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getTitle
(),
messageTemplate
.
getMediaId
(),
messageTemplate
.
getAppId
(),
messageTemplate
.
getLinkUrl
());
messageTemplate
.
getMediaId
(),
messageTemplate
.
getAppId
(),
messageTemplate
.
getLinkUrl
());
attachments
.
add
(
miniprograms
);
attachments
.
add
(
miniprograms
);
}
else
if
(
ObjectUtil
.
equal
(
"video"
,
messageTemplate
.
getMsgType
()))
{
}
else
if
(
ObjectUtil
.
equal
(
MessageType
.
VIDEO
.
getMessageType
()
,
messageTemplate
.
getMsgType
()))
{
Attachments
videos
=
new
Videos
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
());
Attachments
videos
=
new
Videos
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
());
attachments
.
add
(
videos
);
attachments
.
add
(
videos
);
}
else
if
(
ObjectUtil
.
equal
(
"file"
,
messageTemplate
.
getMsgType
()))
{
}
else
if
(
ObjectUtil
.
equal
(
MessageType
.
FILE
.
getMessageType
()
,
messageTemplate
.
getMsgType
()))
{
Attachments
files
=
new
Files
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
());
Attachments
files
=
new
Files
(
messageTemplate
.
getMsgType
(),
messageTemplate
.
getMediaId
());
attachments
.
add
(
files
);
attachments
.
add
(
files
);
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeGetGroupMsgListQuery.java
View file @
b2c9c08
...
@@ -14,10 +14,10 @@ import lombok.Data;
...
@@ -14,10 +14,10 @@ import lombok.Data;
public
class
WeGetGroupMsgListQuery
{
public
class
WeGetGroupMsgListQuery
{
@ApiModelProperty
(
"群发消息的id"
)
@ApiModelProperty
(
"群发消息的id"
)
private
String
msg
I
d
;
private
String
msg
i
d
;
@ApiModelProperty
(
"发送成员userid"
)
@ApiModelProperty
(
"发送成员userid"
)
private
String
user
I
d
;
private
String
user
i
d
;
@ApiModelProperty
(
"返回的最大记录数,整型,最大值1000,默认值500"
)
@ApiModelProperty
(
"返回的最大记录数,整型,最大值1000,默认值500"
)
private
Integer
limit
;
private
Integer
limit
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageDetailVo.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author sxw
* @description 群发详情出参
* @date 2021/10/23 15:09
**/
@ApiModel
@Data
public
class
WeGroupMessageDetailVo
extends
WeGroupMessageList
{
/**
* 附件
*/
@ApiModelProperty
(
"附件"
)
private
List
<
WeGroupMessageAttachments
>
attachments
;
/**
* 发送者
*/
@ApiModelProperty
(
"发送者信息"
)
private
List
<
WeGroupMessageTask
>
senders
;
/**
* 发送客户
*/
@ApiModelProperty
(
"接收者信息"
)
private
List
<
WeGroupMessageSendResult
>
extralInfos
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageListVo.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author sxw
* @description 群发列表出参
* @date 2021/10/23 15:27
**/
@ApiModel
@Data
public
class
WeGroupMessageListVo
extends
WeGroupMessageList
{
@ApiModelProperty
(
"发送成员总数"
)
@Excel
(
name
=
"发送成员总数"
)
private
Integer
senderTotalNums
;
@ApiModelProperty
(
"待发送成员数"
)
@Excel
(
name
=
"待发送成员数"
)
private
Integer
senderNums
;
@ApiModelProperty
(
"待发送客户数"
)
@Excel
(
name
=
"待发送客户数"
)
private
Integer
serviceMember
;
@ApiModelProperty
(
"发送客户总数"
)
@Excel
(
name
=
"发送客户总数"
)
private
Integer
serviceTotalMember
;
@ApiModelProperty
(
"附件"
)
private
List
<
WeGroupMessageAttachments
>
attachments
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageListMapper.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
mapper
;
package
com
.
linkwechat
.
wecom
.
mapper
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 群发消息列Mapper接口
* 群发消息列Mapper接口
...
@@ -11,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -11,4 +15,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
*/
public
interface
WeGroupMessageListMapper
extends
BaseMapper
<
WeGroupMessageList
>
{
public
interface
WeGroupMessageListMapper
extends
BaseMapper
<
WeGroupMessageList
>
{
/**
* 查询群发消息详情
* @param msgIds
* @return
*/
List
<
WeGroupMessageDetailVo
>
getGroupMsgDetails
(
@Param
(
"msgIds"
)
List
<
String
>
msgIds
);
WeGroupMessageDetailVo
getGroupMsgDetail
(
@Param
(
"msgId"
)
String
msgId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageTaskMapper.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
/**
* 群发消息成员发送任务表Mapper接口
*
* @author ruoyi
* @date 2021-10-19
*/
public
interface
WeGroupMessageTaskMapper
extends
BaseMapper
<
WeGroupMessageTask
>
{
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageListService.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
service
;
package
com
.
linkwechat
.
wecom
.
service
;
import
com.github.pagehelper.PageInfo
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageListVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -17,7 +20,7 @@ public interface IWeGroupMessageListService extends IService<WeGroupMessageList>
...
@@ -17,7 +20,7 @@ public interface IWeGroupMessageListService extends IService<WeGroupMessageList>
/**
/**
* 查询列表
* 查询列表
*/
*/
List
<
WeGroupMessageList
>
queryList
(
WeGroupMessageList
weGroupMessageList
);
PageInfo
<
WeGroupMessageListVo
>
queryList
(
WeGroupMessageList
weGroupMessageList
);
/**
/**
* 获取群发记录列表
* 获取群发记录列表
...
@@ -31,11 +34,9 @@ public interface IWeGroupMessageListService extends IService<WeGroupMessageList>
...
@@ -31,11 +34,9 @@ public interface IWeGroupMessageListService extends IService<WeGroupMessageList>
WeGroupMsgListDto
getGroupMsgList
(
String
chatType
,
Long
startTime
,
Long
endTime
,
String
cursor
);
WeGroupMsgListDto
getGroupMsgList
(
String
chatType
,
Long
startTime
,
Long
endTime
,
String
cursor
);
/**
/**
* 获取群发成员发送任务列表
* 群发消息详情
*
* @param msgId 消息id
* @param msgId 群发消息的id
* @return 详情
* @param cursor 用于分页查询的游标
* @return WeGroupMsgListDto 群发成员发送任务列表
*/
*/
WeGroupM
sgListDto
getGroupMsgTask
(
String
msgId
,
String
cursor
);
WeGroupM
essageDetailVo
getGroupMsgDetail
(
String
msgId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageSendResultService.java
View file @
b2c9c08
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
java.util.List
;
import
java.util.List
;
...
@@ -28,4 +29,7 @@ public interface IWeGroupMessageSendResultService extends IService<WeGroupMessag
...
@@ -28,4 +29,7 @@ public interface IWeGroupMessageSendResultService extends IService<WeGroupMessag
* @return WeGroupMsgListDto 群成员发送结果列表
* @return WeGroupMsgListDto 群成员发送结果列表
*/
*/
WeGroupMsgListDto
getGroupMsgSendResult
(
String
msgId
,
String
userId
,
String
cursor
);
WeGroupMsgListDto
getGroupMsgSendResult
(
String
msgId
,
String
userId
,
String
cursor
);
void
addOrUpdateBatchByCondition
(
List
<
WeGroupMessageSendResult
>
taskList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageTaskService.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
java.util.List
;
/**
* 群发消息成员发送任务表Service接口
*
* @author ruoyi
* @date 2021-10-19
*/
public
interface
IWeGroupMessageTaskService
extends
IService
<
WeGroupMessageTask
>
{
/**
* 获取群发成员发送任务列表
*
* @param msgId 群发消息的id
* @param cursor 用于分页查询的游标
* @return WeGroupMsgListDto 群发成员发送任务列表
*/
WeGroupMsgListDto
getGroupMsgTask
(
String
msgId
,
String
cursor
);
/**
* 根据消息id和成员id批量保存更新
* @param taskList
*/
void
addOrUpdateBatchByCondition
(
List
<
WeGroupMessageTask
>
taskList
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeMaterialService.java
View file @
b2c9c08
...
@@ -100,4 +100,11 @@ public interface IWeMaterialService {
...
@@ -100,4 +100,11 @@ public interface IWeMaterialService {
* @return
* @return
*/
*/
WeMediaDto
uploadImg
(
MultipartFile
file
);
WeMediaDto
uploadImg
(
MultipartFile
file
);
/**
* 获取素材
* @param mediaId 素材id
* @return
*/
WeMediaDto
getMediaToResponse
(
String
mediaId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageListServiceImpl.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.github.pagehelper.PageInfo
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.
WeGroupMessageList
;
import
com.linkwechat.wecom.domain.
*
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgTaskDto
;
import
com.linkwechat.wecom.domain.query.WeGetGroupMsgListQuery
;
import
com.linkwechat.wecom.domain.query.WeGroupMsgListQuery
;
import
com.linkwechat.wecom.domain.query.WeGroupMsgListQuery
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageListVo
;
import
com.linkwechat.wecom.mapper.WeGroupMessageListMapper
;
import
com.linkwechat.wecom.mapper.WeGroupMessageListMapper
;
import
com.linkwechat.wecom.service.IWeGroupMessageListService
;
import
com.linkwechat.wecom.service.IWeGroupMessageListService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
/**
* 群发消息列Service业务层处理
* 群发消息列Service业务层处理
...
@@ -32,8 +36,12 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
...
@@ -32,8 +36,12 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
@Autowired
@Autowired
private
WeCustomerMessagePushClient
messagePushClient
;
private
WeCustomerMessagePushClient
messagePushClient
;
@Autowired
private
IWeUserService
weUserService
;
@Override
@Override
public
List
<
WeGroupMessageList
>
queryList
(
WeGroupMessageList
weGroupMessageList
)
{
public
PageInfo
<
WeGroupMessageListVo
>
queryList
(
WeGroupMessageList
weGroupMessageList
)
{
PageInfo
<
WeGroupMessageListVo
>
listPageInfo
=
new
PageInfo
<>();
LambdaQueryWrapper
<
WeGroupMessageList
>
lqw
=
Wrappers
.
lambdaQuery
();
LambdaQueryWrapper
<
WeGroupMessageList
>
lqw
=
Wrappers
.
lambdaQuery
();
if
(
StringUtils
.
isNotBlank
(
weGroupMessageList
.
getMsgId
()))
{
if
(
StringUtils
.
isNotBlank
(
weGroupMessageList
.
getMsgId
()))
{
lqw
.
eq
(
WeGroupMessageList:
:
getMsgId
,
weGroupMessageList
.
getMsgId
());
lqw
.
eq
(
WeGroupMessageList:
:
getMsgId
,
weGroupMessageList
.
getMsgId
());
...
@@ -45,28 +53,62 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
...
@@ -45,28 +53,62 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
lqw
.
eq
(
WeGroupMessageList:
:
getUserId
,
weGroupMessageList
.
getUserId
());
lqw
.
eq
(
WeGroupMessageList:
:
getUserId
,
weGroupMessageList
.
getUserId
());
}
}
if
(
weGroupMessageList
.
getSendTime
()
!=
null
)
{
if
(
weGroupMessageList
.
getSendTime
()
!=
null
)
{
lqw
.
eq
(
WeGroupMessageList:
:
getSendTime
,
weGroupMessageList
.
getSendTime
());
lqw
.
le
(
WeGroupMessageList:
:
getSendTime
,
weGroupMessageList
.
getBeginTime
());
lqw
.
gt
(
WeGroupMessageList:
:
getSendTime
,
weGroupMessageList
.
getEndTime
());
}
}
if
(
weGroupMessageList
.
getCreateType
()
!=
null
)
{
if
(
weGroupMessageList
.
getCreateType
()
!=
null
)
{
lqw
.
eq
(
WeGroupMessageList:
:
getCreateType
,
weGroupMessageList
.
getCreateType
());
lqw
.
eq
(
WeGroupMessageList:
:
getCreateType
,
weGroupMessageList
.
getCreateType
());
}
}
if
(
weGroupMessageList
.
getIsTask
()
!=
null
)
{
lqw
.
eq
(
WeGroupMessageList:
:
getIsTask
,
weGroupMessageList
.
getIsTask
());
List
<
WeGroupMessageList
>
list
=
this
.
list
(
lqw
);
if
(
CollectionUtil
.
isNotEmpty
(
list
))
{
List
<
String
>
msgIds
=
list
.
stream
().
map
(
WeGroupMessageList:
:
getMsgId
).
collect
(
Collectors
.
toList
());
List
<
String
>
userIds
=
list
.
stream
().
map
(
WeGroupMessageList:
:
getUserId
).
filter
(
StringUtils:
:
isNotEmpty
).
collect
(
Collectors
.
toList
());
List
<
WeUser
>
userList
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
userIds
)){
userList
.
addAll
(
weUserService
.
list
(
new
LambdaQueryWrapper
<
WeUser
>().
in
(
WeUser:
:
getUserId
,
userIds
)));
}
List
<
WeGroupMessageDetailVo
>
groupMsgDetailList
=
this
.
baseMapper
.
getGroupMsgDetails
(
msgIds
);
Map
<
String
,
WeGroupMessageDetailVo
>
groupMsgDetailMap
=
groupMsgDetailList
.
stream
().
collect
(
Collectors
.
toMap
(
WeGroupMessageDetailVo:
:
getMsgId
,
item
->
item
));
List
<
WeGroupMessageListVo
>
resultList
=
list
.
stream
().
map
(
groupMessage
->
{
WeGroupMessageDetailVo
weGroupMessageDetailVo
=
groupMsgDetailMap
.
get
(
groupMessage
.
getMsgId
());
WeGroupMessageListVo
weGroupMessageListVo
=
new
WeGroupMessageListVo
();
BeanUtil
.
copyProperties
(
groupMessage
,
weGroupMessageListVo
);
weGroupMessageListVo
.
setAttachments
(
weGroupMessageDetailVo
.
getAttachments
());
weGroupMessageListVo
.
setSenderTotalNums
(
weGroupMessageDetailVo
.
getSenders
().
size
());
List
<
WeGroupMessageTask
>
senderList
=
weGroupMessageDetailVo
.
getSenders
().
stream
().
filter
(
sender
->
ObjectUtil
.
equal
(
0
,
sender
.
getStatus
())).
collect
(
Collectors
.
toList
());
weGroupMessageListVo
.
setSenderNums
(
senderList
.
size
());
weGroupMessageListVo
.
setServiceTotalMember
(
weGroupMessageDetailVo
.
getExtralInfos
().
size
());
List
<
WeGroupMessageSendResult
>
sendResults
=
weGroupMessageDetailVo
.
getExtralInfos
().
stream
().
filter
(
item
->
ObjectUtil
.
equal
(
0
,
item
.
getStatus
())).
collect
(
Collectors
.
toList
());
weGroupMessageListVo
.
setServiceMember
(
sendResults
.
size
());
if
(
StringUtils
.
isNotEmpty
(
groupMessage
.
getUserId
())
&&
CollectionUtil
.
isNotEmpty
(
userList
))
{
userList
.
forEach
(
user
->
{
if
(
ObjectUtil
.
equal
(
user
.
getUserId
(),
groupMessage
.
getUserId
()))
{
weGroupMessageListVo
.
setUserName
(
user
.
getName
());
}
});
}
return
weGroupMessageListVo
;
}).
collect
(
Collectors
.
toList
());
listPageInfo
.
setList
(
resultList
);
}
}
return
this
.
list
(
lqw
);
listPageInfo
.
setTotal
(
new
PageInfo
<>(
list
).
getTotal
());
return
listPageInfo
;
}
}
@Override
@Override
public
WeGroupMsgListDto
getGroupMsgList
(
String
chatType
,
Long
startTime
,
Long
endTime
,
String
cursor
){
public
WeGroupMsgListDto
getGroupMsgList
(
String
chatType
,
Long
startTime
,
Long
endTime
,
String
cursor
)
{
WeGroupMsgListQuery
query
=
new
WeGroupMsgListQuery
();
WeGroupMsgListQuery
query
=
new
WeGroupMsgListQuery
();
query
.
setChat_type
(
chatType
);
query
.
setChat_type
(
chatType
);
query
.
setStart_time
(
startTime
);
query
.
setStart_time
(
startTime
);
query
.
setEnd_time
(
endTime
);
query
.
setEnd_time
(
endTime
);
query
.
setCursor
(
cursor
);
WeGroupMsgListDto
groupMsgList
=
messagePushClient
.
getGroupMsgList
(
query
);
WeGroupMsgListDto
groupMsgList
=
messagePushClient
.
getGroupMsgList
(
query
);
if
(
groupMsgList
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgList
.
getErrcode
()))
{
if
(
groupMsgList
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgList
.
getErrcode
()))
{
if
(
StringUtils
.
isNotEmpty
(
groupMsgList
.
getNextCursor
()))
{
if
(
StringUtils
.
isNotEmpty
(
groupMsgList
.
getNextCursor
()))
{
WeGroupMsgListDto
clildMsgList
=
getGroupMsgList
(
query
.
getChat_type
(),
query
.
getStart_time
(),
query
.
getEnd_time
(),
groupMsgList
.
getNextCursor
());
WeGroupMsgListDto
clildMsgList
=
getGroupMsgList
(
query
.
getChat_type
(),
query
.
getStart_time
(),
query
.
getEnd_time
(),
groupMsgList
.
getNextCursor
());
List
<
WeGroupMsgDto
>
list
=
groupMsgList
.
getGroupMsgList
();
List
<
WeGroupMsgDto
>
list
=
groupMsgList
.
getGroupMsgList
();
list
.
addAll
(
clildMsgList
.
getGroupMsgList
());
list
.
addAll
(
clildMsgList
.
getGroupMsgList
());
groupMsgList
.
setGroupMsgList
(
list
);
groupMsgList
.
setGroupMsgList
(
list
);
...
@@ -77,20 +119,18 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
...
@@ -77,20 +119,18 @@ public class WeGroupMessageListServiceImpl extends ServiceImpl<WeGroupMessageLis
}
}
@Override
@Override
public
WeGroupMsgListDto
getGroupMsgTask
(
String
msgId
,
String
cursor
)
{
public
WeGroupMessageDetailVo
getGroupMsgDetail
(
String
msgId
)
{
WeGetGroupMsgListQuery
query
=
new
WeGetGroupMsgListQuery
();
WeGroupMessageDetailVo
detailVo
=
new
WeGroupMessageDetailVo
();
query
.
setMsgId
(
msgId
);
WeGroupMessageList
weGroupMessage
=
getOne
(
new
LambdaQueryWrapper
<
WeGroupMessageList
>().
eq
(
WeGroupMessageList:
:
getMsgId
,
msgId
));
query
.
setCursor
(
cursor
);
BeanUtil
.
copyProperties
(
weGroupMessage
,
detailVo
);
WeGroupMsgListDto
groupMsgTask
=
messagePushClient
.
getGroupMsgTask
(
query
);
if
(
StringUtils
.
isNotEmpty
(
detailVo
.
getUserId
())){
if
(
groupMsgTask
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgTask
.
getErrcode
())){
WeUser
weUser
=
weUserService
.
getOne
(
new
LambdaQueryWrapper
<
WeUser
>().
eq
(
WeUser:
:
getUserId
,
detailVo
.
getUserId
()).
last
(
"limit 1"
));
if
(
StringUtils
.
isNotEmpty
(
groupMsgTask
.
getNextCursor
())){
detailVo
.
setUserName
(
weUser
.
getName
());
WeGroupMsgListDto
clildMsgList
=
getGroupMsgTask
(
msgId
,
groupMsgTask
.
getNextCursor
());
List
<
WeGroupMsgTaskDto
>
taskList
=
clildMsgList
.
getTaskList
();
taskList
.
addAll
(
clildMsgList
.
getTaskList
());
groupMsgTask
.
setTaskList
(
taskList
);
groupMsgTask
.
setNextCursor
(
clildMsgList
.
getNextCursor
());
}
}
}
return
groupMsgTask
;
WeGroupMessageDetailVo
groupMsgDetail
=
this
.
baseMapper
.
getGroupMsgDetail
(
msgId
);
detailVo
.
setAttachments
(
groupMsgDetail
.
getAttachments
());
detailVo
.
setSenders
(
groupMsgDetail
.
getSenders
());
detailVo
.
setExtralInfos
(
groupMsgDetail
.
getExtralInfos
());
return
detailVo
;
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageSendResultServiceImpl.java
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
...
@@ -9,12 +10,12 @@ import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
...
@@ -9,12 +10,12 @@ import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgSendDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgSendDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgTaskDto
;
import
com.linkwechat.wecom.domain.query.WeGetGroupMsgListQuery
;
import
com.linkwechat.wecom.domain.query.WeGetGroupMsgListQuery
;
import
com.linkwechat.wecom.mapper.WeGroupMessageSendResultMapper
;
import
com.linkwechat.wecom.mapper.WeGroupMessageSendResultMapper
;
import
com.linkwechat.wecom.service.IWeGroupMessageSendResultService
;
import
com.linkwechat.wecom.service.IWeGroupMessageSendResultService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.List
;
...
@@ -56,12 +57,12 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess
...
@@ -56,12 +57,12 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess
@Override
@Override
public
WeGroupMsgListDto
getGroupMsgSendResult
(
String
msgId
,
String
userId
,
String
cursor
)
{
public
WeGroupMsgListDto
getGroupMsgSendResult
(
String
msgId
,
String
userId
,
String
cursor
)
{
WeGetGroupMsgListQuery
query
=
new
WeGetGroupMsgListQuery
();
WeGetGroupMsgListQuery
query
=
new
WeGetGroupMsgListQuery
();
query
.
setMsg
I
d
(
msgId
);
query
.
setMsg
i
d
(
msgId
);
query
.
setUser
I
d
(
userId
);
query
.
setUser
i
d
(
userId
);
query
.
setCursor
(
cursor
);
query
.
setCursor
(
cursor
);
WeGroupMsgListDto
groupMsgSendResult
=
messagePushClient
.
getGroupMsgSendResult
(
query
);
WeGroupMsgListDto
groupMsgSendResult
=
messagePushClient
.
getGroupMsgSendResult
(
query
);
if
(
groupMsgSendResult
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgSendResult
.
getErrcode
()))
{
if
(
groupMsgSendResult
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgSendResult
.
getErrcode
()))
{
if
(
StringUtils
.
isNotEmpty
(
groupMsgSendResult
.
getNextCursor
()))
{
if
(
StringUtils
.
isNotEmpty
(
groupMsgSendResult
.
getNextCursor
()))
{
WeGroupMsgListDto
clildMsgList
=
getGroupMsgSendResult
(
msgId
,
userId
,
groupMsgSendResult
.
getNextCursor
());
WeGroupMsgListDto
clildMsgList
=
getGroupMsgSendResult
(
msgId
,
userId
,
groupMsgSendResult
.
getNextCursor
());
List
<
WeGroupMsgSendDto
>
sendList
=
clildMsgList
.
getSendList
();
List
<
WeGroupMsgSendDto
>
sendList
=
clildMsgList
.
getSendList
();
sendList
.
addAll
(
clildMsgList
.
getSendList
());
sendList
.
addAll
(
clildMsgList
.
getSendList
());
...
@@ -71,4 +72,20 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess
...
@@ -71,4 +72,20 @@ public class WeGroupMessageSendResultServiceImpl extends ServiceImpl<WeGroupMess
}
}
return
groupMsgSendResult
;
return
groupMsgSendResult
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
addOrUpdateBatchByCondition
(
List
<
WeGroupMessageSendResult
>
sendResultList
)
{
if
(
CollectionUtil
.
isNotEmpty
(
sendResultList
))
{
sendResultList
.
forEach
(
item
->
{
if
(!
this
.
update
(
item
,
new
LambdaQueryWrapper
<
WeGroupMessageSendResult
>()
.
eq
(
WeGroupMessageSendResult:
:
getMsgId
,
item
.
getMsgId
())
.
eq
(
WeGroupMessageSendResult:
:
getExternalUserid
,
item
.
getExternalUserid
())
.
eq
(
WeGroupMessageSendResult:
:
getUserId
,
item
.
getUserId
())
.
eq
(
WeGroupMessageSendResult:
:
getChatId
,
item
.
getChatId
())))
{
this
.
save
(
item
);
}
});
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTaskServiceImpl.java
0 → 100644
View file @
b2c9c08
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgTaskDto
;
import
com.linkwechat.wecom.domain.query.WeGetGroupMsgListQuery
;
import
com.linkwechat.wecom.mapper.WeGroupMessageTaskMapper
;
import
com.linkwechat.wecom.service.IWeGroupMessageTaskService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
* 群发消息成员执行结果Service业务层处理
*
* @author ruoyi
* @date 2021-10-19
*/
@Service
public
class
WeGroupMessageTaskServiceImpl
extends
ServiceImpl
<
WeGroupMessageTaskMapper
,
WeGroupMessageTask
>
implements
IWeGroupMessageTaskService
{
@Autowired
private
WeCustomerMessagePushClient
messagePushClient
;
@Override
public
WeGroupMsgListDto
getGroupMsgTask
(
String
msgId
,
String
cursor
)
{
WeGetGroupMsgListQuery
query
=
new
WeGetGroupMsgListQuery
();
query
.
setMsgid
(
msgId
);
query
.
setCursor
(
cursor
);
WeGroupMsgListDto
groupMsgTask
=
messagePushClient
.
getGroupMsgTask
(
query
);
if
(
groupMsgTask
!=
null
&&
ObjectUtil
.
equal
(
0
,
groupMsgTask
.
getErrcode
()))
{
if
(
StringUtils
.
isNotEmpty
(
groupMsgTask
.
getNextCursor
()))
{
WeGroupMsgListDto
clildMsgList
=
getGroupMsgTask
(
msgId
,
groupMsgTask
.
getNextCursor
());
List
<
WeGroupMsgTaskDto
>
taskList
=
clildMsgList
.
getTaskList
();
taskList
.
addAll
(
clildMsgList
.
getTaskList
());
groupMsgTask
.
setTaskList
(
taskList
);
groupMsgTask
.
setNextCursor
(
clildMsgList
.
getNextCursor
());
}
}
return
groupMsgTask
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
void
addOrUpdateBatchByCondition
(
List
<
WeGroupMessageTask
>
taskList
)
{
if
(
CollectionUtil
.
isNotEmpty
(
taskList
))
{
taskList
.
forEach
(
item
->
{
if
(!
this
.
update
(
item
,
new
LambdaQueryWrapper
<
WeGroupMessageTask
>()
.
eq
(
WeGroupMessageTask:
:
getMsgId
,
item
.
getMsgId
())
.
eq
(
WeGroupMessageTask:
:
getUserId
,
item
.
getUserId
())))
{
this
.
save
(
item
);
}
});
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMaterialServiceImpl.java
View file @
b2c9c08
...
@@ -2,17 +2,23 @@ package com.linkwechat.wecom.service.impl;
...
@@ -2,17 +2,23 @@ package com.linkwechat.wecom.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.dtflys.forest.http.ForestResponse
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.CosConfig
;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.config.RuoYiConfig
;
import
com.linkwechat.common.config.ServerConfig
;
import
com.linkwechat.common.config.ServerConfig
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.enums.WeErrorCodeEnum
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUploadUtils
;
import
com.linkwechat.common.utils.file.FileUploadUtils
;
import
com.linkwechat.common.utils.file.FileUtils
;
import
com.linkwechat.wecom.client.WeMediaClient
;
import
com.linkwechat.wecom.client.WeMediaClient
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.vo.WeMaterialFileVO
;
import
com.linkwechat.wecom.domain.vo.WeMaterialFileVO
;
import
com.linkwechat.wecom.mapper.WeMaterialMapper
;
import
com.linkwechat.wecom.mapper.WeMaterialMapper
;
import
com.linkwechat.wecom.service.IWeMaterialService
;
import
com.linkwechat.wecom.service.IWeMaterialService
;
...
@@ -23,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -23,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
import
java.io.File
;
import
java.io.File
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.Arrays
;
import
java.util.Arrays
;
...
@@ -157,4 +164,33 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
...
@@ -157,4 +164,33 @@ public class WeMaterialServiceImpl implements IWeMaterialService {
return
weMediaClient
.
uploadimg
(
file
);
return
weMediaClient
.
uploadimg
(
file
);
}
}
@Override
public
WeMediaDto
getMediaToResponse
(
String
mediaId
)
{
WeMediaDto
weMediaDto
=
new
WeMediaDto
();
weMediaDto
.
setErrcode
(
0
);
ForestResponse
forestResponse
=
weMediaClient
.
getMediaToResponse
(
mediaId
);
if
(
forestResponse
!=
null
)
{
try
{
String
fixedName
=
new
String
(
forestResponse
.
getFilename
().
getBytes
(
"ISO8859-1"
),
"UTF-8"
);
fixedName
=
fixedName
.
replace
(
"\""
,
""
);
weMediaDto
.
setFileName
(
fixedName
);
if
(
ruoYiConfig
.
getFile
().
isStartCosUpload
())
{
String
fileFullName
=
FileUploadUtils
.
upload2Cos
(
forestResponse
.
getInputStream
(),
FileUtil
.
getSuffix
(
fixedName
),
ruoYiConfig
.
getFile
().
getCos
());
String
imgUrlPrefix
=
ruoYiConfig
.
getFile
().
getCos
().
getCosImgUrlPrefix
();
weMediaDto
.
setUrl
(
imgUrlPrefix
+
fileFullName
);
}
else
{
String
filePath
=
FileUploadUtils
.
upload
(
forestResponse
.
getInputStream
(),
fixedName
);
weMediaDto
.
setUrl
(
filePath
);
}
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
weMediaDto
.
setErrcode
(-
1
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
WeComException
(
"文件下载异常"
);
}
}
return
weMediaDto
;
}
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageAttachmentsMapper.xml
View file @
b2c9c08
...
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"mediaId"
column=
"media_id"
/>
<result
property=
"mediaId"
column=
"media_id"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"fileUrl"
column=
"file_url"
/>
<result
property=
"linkUrl"
column=
"link_url"
/>
<result
property=
"linkUrl"
column=
"link_url"
/>
<result
property=
"picUrl"
column=
"pic_url"
/>
<result
property=
"picUrl"
column=
"pic_url"
/>
<result
property=
"appId"
column=
"app_id"
/>
<result
property=
"appId"
column=
"app_id"
/>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageListMapper.xml
View file @
b2c9c08
...
@@ -12,11 +12,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -12,11 +12,92 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"sendTime"
column=
"send_time"
/>
<result
property=
"sendTime"
column=
"send_time"
/>
<result
property=
"createType"
column=
"create_type"
/>
<result
property=
"createType"
column=
"create_type"
/>
<result
property=
"isTask"
column=
"is_task"
/>
<result
property=
"isTask"
column=
"is_task"
/>
<result
property=
"isExecute"
column=
"is_execute"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</resultMap>
<resultMap
id=
"groupMsgDetailResult"
type=
"WeGroupMessageDetailVo"
>
<result
property=
"msgId"
column=
"msg_id"
/>
<collection
property=
"attachments"
ofType=
"com.linkwechat.wecom.domain.WeGroupMessageAttachments"
>
<result
property=
"msgType"
column=
"msg_type"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"appId"
column=
"app_id"
/>
<result
property=
"mediaId"
column=
"media_id"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"linkUrl"
column=
"link_url"
/>
<result
property=
"picUrl"
column=
"pic_url"
/>
</collection>
<collection
property=
"senders"
ofType=
"com.linkwechat.wecom.domain.WeGroupMessageTask"
>
<result
property=
"userId"
column=
"sender"
/>
<result
property=
"userName"
column=
"sender_name"
/>
<result
property=
"status"
column=
"task_status"
/>
<result
property=
"sendTime"
column=
"task_send_time"
/>
</collection>
<collection
property=
"extralInfos"
ofType=
"com.linkwechat.wecom.domain.WeGroupMessageSendResult"
>
<result
property=
"userId"
column=
"res_sender"
/>
<result
property=
"userName"
column=
"res_sender_name"
/>
<result
property=
"chatId"
column=
"chat_id"
/>
<result
property=
"chatName"
column=
"chat_name"
/>
<result
property=
"externalUserid"
column=
"external_userid"
/>
<result
property=
"customerName"
column=
"customer_name"
/>
<result
property=
"status"
column=
"res_status"
/>
<result
property=
"sendTime"
column=
"res_send_time"
/>
</collection>
</resultMap>
<sql
id=
"getDetailVo"
>
select
wgml.msg_id,
wgma.msg_type,
wgma.content,
wgma.app_id ,
wgma.media_id ,
wgma.description ,
wgma.link_url ,
wgma.file_url ,
wgma.pic_url ,
wgmt.user_id as sender,
(select user_name from we_user wu where wu.user_id = wgmt.user_id limit 1) as sender_name,
wgmt.status as task_status,
wgmt.send_time as task_send_time,
wgmsr.user_id as res_sender,
(select user_name from we_user wu where wu.user_id = wgmsr.user_id limit 1) as res_sender_name,
wgmsr.chat_id ,
if(wgmsr.chat_id is null,null,(select wg.group_name from we_group wg where wg.chat_id = wgmsr.chat_id limit 1)) as chat_name,
wgmsr.external_userid,
if(wgmsr.external_userid is null,null,(select wc.name from we_customer wc where wc.external_userid = wgmsr.external_userid limit 1)) as customer_name,
wgmsr.status as res_status,
wgmsr.send_time as res_send_time
from
we_group_message_list wgml
left join we_group_message_attachments wgma on
wgma.msg_id = wgml.msg_id
left join we_group_message_task wgmt on
wgmt.msg_id = wgml.msg_id
left join we_group_message_send_result wgmsr on
wgmsr.msg_id = wgml.msg_id
where
1 = 1
</sql>
<select
id=
"getGroupMsgDetails"
resultMap=
"groupMsgDetailResult"
>
<include
refid=
"getDetailVo"
/>
<if
test=
"msgIds != null and msgIds.size > 0"
>
and wgml.msg_id in
<foreach
collection=
"msgIds"
index=
"index"
item=
"msgId"
open=
"("
separator=
","
close=
")"
>
#{msgId}
</foreach>
</if>
</select>
<select
id=
"getGroupMsgDetail"
resultMap=
"groupMsgDetailResult"
>
<include
refid=
"getDetailVo"
/>
<if
test=
"msgId != null and msgId != ''"
>
and wgml.msg_id = #{msgId}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
0 → 100644
View file @
b2c9c08
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeGroupMessageTaskMapper"
>
<resultMap
type=
"WeGroupMessageTask"
id=
"WeGroupMessageTaskResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"sendTime"
column=
"send_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ 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