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 5b686d57
authored
Oct 29, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
企业群发记录功能重构
1 parent
b4cc912c
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
639 additions
and
229 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageListController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageTemplateController.java
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
linkwe-common/src/main/java/com/linkwechat/common/core/redis/RedisCache.java
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PullGroupMessageTask.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.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/WeGroupMessageTemplate.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddGroupMessageQuery.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddMsgTemplateQuery.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/domain/vo/WeGroupMessageTaskVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageListMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageTemplateMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageListService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageTemplateService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageListServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTemplateServiceImpl.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/WeGroupMessageSendResultMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTemplateMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageListController.java
deleted
100644 → 0
View file @
b4cc912
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-admin/src/main/java/com/linkwechat/web/controller/wecom/WeGroupMessageTemplateController.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
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.wecom.domain.WeGroupMessageTemplate
;
import
com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageListVo
;
import
com.linkwechat.wecom.service.IWeGroupMessageTemplateService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Arrays
;
import
java.util.List
;
/**
* 群发消息模板Controller
*
* @author ruoyi
* @date 2021-10-27
*/
@Api
(
tags
=
"群发消息管理"
)
@RestController
@RequestMapping
(
"/wecom/groupmsg/template"
)
public
class
WeGroupMessageTemplateController
extends
BaseController
{
@Autowired
private
IWeGroupMessageTemplateService
iWeGroupMessageTemplateService
;
/**
* 查询群发消息模板列表
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:list')")
@ApiOperation
(
value
=
"查询群发消息模板列表"
,
httpMethod
=
"GET"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
<
WeGroupMessageTemplate
>
list
(
WeGroupMessageTemplate
weGroupMessageTemplate
)
{
startPage
();
List
<
WeGroupMessageTemplate
>
list
=
iWeGroupMessageTemplateService
.
queryList
(
weGroupMessageTemplate
);
return
getDataTable
(
list
);
}
/**
* 获取群发消息模板详细信息
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:query')")
@ApiOperation
(
value
=
"获取群发消息模板详细信息"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
<
WeGroupMessageDetailVo
>
getGroupMsgTemplateDetail
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
iWeGroupMessageTemplateService
.
getGroupMsgTemplateDetail
(
id
));
}
/**
* 新增群发消息模板
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:add')")
@ApiOperation
(
value
=
"新增群发消息模板"
,
httpMethod
=
"POST"
)
@Log
(
title
=
"群发消息模板"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
addGroupMsgTemplate
(
@RequestBody
WeAddGroupMessageQuery
query
)
{
iWeGroupMessageTemplateService
.
addGroupMsgTemplate
(
query
);
return
AjaxResult
.
success
();
}
/**
* 删除群发消息模板
*/
//@PreAuthorize("@ss.hasPermi('linkwechat:template:remove')")
@ApiOperation
(
value
=
"删除群发消息模板"
,
httpMethod
=
"DELETE"
)
@Log
(
title
=
"群发消息模板"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
iWeGroupMessageTemplateService
.
removeByIds
(
Arrays
.
asList
(
ids
))
?
1
:
0
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
View file @
5b686d5
...
@@ -408,4 +408,7 @@ public class WeConstans {
...
@@ -408,4 +408,7 @@ public class WeConstans {
* 会话消息订阅的频道
* 会话消息订阅的频道
*/
*/
public
static
final
String
CONVERSATION_MSG_CHANNEL
=
"CONVERSATION_MSG_CHANNEL"
;
public
static
final
String
CONVERSATION_MSG_CHANNEL
=
"CONVERSATION_MSG_CHANNEL"
;
public
static
final
String
WEGROUPMSGTIMEDTASK_KEY
=
"weGroupMessageTimedTask"
;
}
}
linkwe-common/src/main/java/com/linkwechat/common/core/redis/RedisCache.java
View file @
5b686d5
package
com
.
linkwechat
.
common
.
core
.
redis
;
package
com
.
linkwechat
.
common
.
core
.
redis
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
com.alibaba.fastjson.JSON
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.data.redis.core.ZSetOperations
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.StringUtils
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* spring redis 工具类
* spring redis 工具类
*
*
* @author ruoyi
* @author ruoyi
**/
**/
@SuppressWarnings
(
value
=
{
"unchecked"
,
"rawtypes"
})
@SuppressWarnings
(
value
=
{
"unchecked"
,
"rawtypes"
})
@Component
@Component
public
class
RedisCache
public
class
RedisCache
{
{
@Autowired
@Autowired
public
RedisTemplate
redisTemplate
;
public
RedisTemplate
redisTemplate
;
...
@@ -32,8 +30,7 @@ public class RedisCache
...
@@ -32,8 +30,7 @@ public class RedisCache
* @param key 缓存的键值
* @param key 缓存的键值
* @param value 缓存的值
* @param value 缓存的值
*/
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
{
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
}
}
...
@@ -45,8 +42,7 @@ public class RedisCache
...
@@ -45,8 +42,7 @@ public class RedisCache
* @param timeout 时间
* @param timeout 时间
* @param timeUnit 时间颗粒度
* @param timeUnit 时间颗粒度
*/
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
{
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
}
}
...
@@ -57,8 +53,7 @@ public class RedisCache
...
@@ -57,8 +53,7 @@ public class RedisCache
* @param timeout 超时时间
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
* @return true=设置成功;false=设置失败
*/
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
)
public
boolean
expire
(
final
String
key
,
final
long
timeout
)
{
{
return
expire
(
key
,
timeout
,
TimeUnit
.
SECONDS
);
return
expire
(
key
,
timeout
,
TimeUnit
.
SECONDS
);
}
}
...
@@ -70,8 +65,7 @@ public class RedisCache
...
@@ -70,8 +65,7 @@ public class RedisCache
* @param unit 时间单位
* @param unit 时间单位
* @return true=设置成功;false=设置失败
* @return true=设置成功;false=设置失败
*/
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
,
final
TimeUnit
unit
)
public
boolean
expire
(
final
String
key
,
final
long
timeout
,
final
TimeUnit
unit
)
{
{
return
redisTemplate
.
expire
(
key
,
timeout
,
unit
);
return
redisTemplate
.
expire
(
key
,
timeout
,
unit
);
}
}
...
@@ -81,8 +75,7 @@ public class RedisCache
...
@@ -81,8 +75,7 @@ public class RedisCache
* @param key 缓存键值
* @param key 缓存键值
* @return 缓存键值对应的数据
* @return 缓存键值对应的数据
*/
*/
public
<
T
>
T
getCacheObject
(
final
String
key
)
public
<
T
>
T
getCacheObject
(
final
String
key
)
{
{
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
return
operation
.
get
(
key
);
return
operation
.
get
(
key
);
}
}
...
@@ -92,8 +85,7 @@ public class RedisCache
...
@@ -92,8 +85,7 @@ public class RedisCache
*
*
* @param key
* @param key
*/
*/
public
boolean
deleteObject
(
final
String
key
)
public
boolean
deleteObject
(
final
String
key
)
{
{
return
redisTemplate
.
delete
(
key
);
return
redisTemplate
.
delete
(
key
);
}
}
...
@@ -103,8 +95,7 @@ public class RedisCache
...
@@ -103,8 +95,7 @@ public class RedisCache
* @param collection 多个对象
* @param collection 多个对象
* @return
* @return
*/
*/
public
long
deleteObject
(
final
Collection
collection
)
public
long
deleteObject
(
final
Collection
collection
)
{
{
return
redisTemplate
.
delete
(
collection
);
return
redisTemplate
.
delete
(
collection
);
}
}
...
@@ -115,8 +106,7 @@ public class RedisCache
...
@@ -115,8 +106,7 @@ public class RedisCache
* @param dataList 待缓存的List数据
* @param dataList 待缓存的List数据
* @return 缓存的对象
* @return 缓存的对象
*/
*/
public
<
T
>
long
setCacheList
(
final
String
key
,
final
List
<
T
>
dataList
)
public
<
T
>
long
setCacheList
(
final
String
key
,
final
List
<
T
>
dataList
)
{
{
Long
count
=
redisTemplate
.
opsForList
().
rightPushAll
(
key
,
dataList
);
Long
count
=
redisTemplate
.
opsForList
().
rightPushAll
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
return
count
==
null
?
0
:
count
;
}
}
...
@@ -127,8 +117,7 @@ public class RedisCache
...
@@ -127,8 +117,7 @@ public class RedisCache
* @param key 缓存的键值
* @param key 缓存的键值
* @return 缓存键值对应的数据
* @return 缓存键值对应的数据
*/
*/
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
{
{
return
redisTemplate
.
opsForList
().
range
(
key
,
0
,
-
1
);
return
redisTemplate
.
opsForList
().
range
(
key
,
0
,
-
1
);
}
}
...
@@ -139,8 +128,7 @@ public class RedisCache
...
@@ -139,8 +128,7 @@ public class RedisCache
* @param dataSet 缓存的数据
* @param dataSet 缓存的数据
* @return 缓存数据的对象
* @return 缓存数据的对象
*/
*/
public
<
T
>
long
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
public
<
T
>
long
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
{
{
Long
count
=
redisTemplate
.
opsForSet
().
add
(
key
,
dataSet
);
Long
count
=
redisTemplate
.
opsForSet
().
add
(
key
,
dataSet
);
return
count
==
null
?
0
:
count
;
return
count
==
null
?
0
:
count
;
}
}
...
@@ -151,8 +139,7 @@ public class RedisCache
...
@@ -151,8 +139,7 @@ public class RedisCache
* @param key
* @param key
* @return
* @return
*/
*/
public
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
public
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
{
{
return
redisTemplate
.
opsForSet
().
members
(
key
);
return
redisTemplate
.
opsForSet
().
members
(
key
);
}
}
...
@@ -162,8 +149,7 @@ public class RedisCache
...
@@ -162,8 +149,7 @@ public class RedisCache
* @param key
* @param key
* @param dataMap
* @param dataMap
*/
*/
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
{
if
(
dataMap
!=
null
)
{
if
(
dataMap
!=
null
)
{
redisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
redisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
}
}
...
@@ -175,8 +161,7 @@ public class RedisCache
...
@@ -175,8 +161,7 @@ public class RedisCache
* @param key
* @param key
* @return
* @return
*/
*/
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
{
{
return
redisTemplate
.
opsForHash
().
entries
(
key
);
return
redisTemplate
.
opsForHash
().
entries
(
key
);
}
}
...
@@ -187,8 +172,7 @@ public class RedisCache
...
@@ -187,8 +172,7 @@ public class RedisCache
* @param hKey Hash键
* @param hKey Hash键
* @param value 值
* @param value 值
*/
*/
public
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
public
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
{
{
redisTemplate
.
opsForHash
().
put
(
key
,
hKey
,
value
);
redisTemplate
.
opsForHash
().
put
(
key
,
hKey
,
value
);
}
}
...
@@ -199,8 +183,7 @@ public class RedisCache
...
@@ -199,8 +183,7 @@ public class RedisCache
* @param hKey Hash键
* @param hKey Hash键
* @return Hash中的对象
* @return Hash中的对象
*/
*/
public
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
public
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
{
HashOperations
<
String
,
String
,
T
>
opsForHash
=
redisTemplate
.
opsForHash
();
HashOperations
<
String
,
String
,
T
>
opsForHash
=
redisTemplate
.
opsForHash
();
return
opsForHash
.
get
(
key
,
hKey
);
return
opsForHash
.
get
(
key
,
hKey
);
}
}
...
@@ -212,8 +195,7 @@ public class RedisCache
...
@@ -212,8 +195,7 @@ public class RedisCache
* @param hKeys Hash键集合
* @param hKeys Hash键集合
* @return Hash对象集合
* @return Hash对象集合
*/
*/
public
<
T
>
List
<
T
>
getMultiCacheMapValue
(
final
String
key
,
final
Collection
<
Object
>
hKeys
)
public
<
T
>
List
<
T
>
getMultiCacheMapValue
(
final
String
key
,
final
Collection
<
Object
>
hKeys
)
{
{
return
redisTemplate
.
opsForHash
().
multiGet
(
key
,
hKeys
);
return
redisTemplate
.
opsForHash
().
multiGet
(
key
,
hKeys
);
}
}
...
@@ -223,8 +205,7 @@ public class RedisCache
...
@@ -223,8 +205,7 @@ public class RedisCache
* @param pattern 字符串前缀
* @param pattern 字符串前缀
* @return 对象列表
* @return 对象列表
*/
*/
public
Collection
<
String
>
keys
(
final
String
pattern
)
public
Collection
<
String
>
keys
(
final
String
pattern
)
{
{
return
redisTemplate
.
keys
(
pattern
);
return
redisTemplate
.
keys
(
pattern
);
}
}
...
@@ -235,8 +216,129 @@ public class RedisCache
...
@@ -235,8 +216,129 @@ public class RedisCache
* @param channel 要发布到的频道
* @param channel 要发布到的频道
* @param message 消息内容
* @param message 消息内容
*/
*/
public
void
convertAndSend
(
String
channel
,
Object
message
)
public
void
convertAndSend
(
String
channel
,
Object
message
)
{
{
redisTemplate
.
convertAndSend
(
channel
,
message
);
redisTemplate
.
convertAndSend
(
channel
,
message
);
}
/**
* 添加一个元素, zset与set最大的区别就是每个元素都有一个score,因此有个排序的辅助功能;
*
* @param key
* @param value
* @param score
*/
public
Boolean
setCacheZSet
(
String
key
,
String
value
,
double
score
)
{
return
redisTemplate
.
opsForZSet
().
add
(
key
,
value
,
score
);
}
/**
* 删除元素 zrem
*
* @param key
* @param value
*/
public
long
removeCacheZSet
(
String
key
,
String
value
)
{
return
redisTemplate
.
opsForZSet
().
remove
(
key
,
value
);
}
/**
* score的增加or减少 zincrby
*
* @param key
* @param value
* @param score
*/
public
Double
incrScoreCacheZSet
(
String
key
,
String
value
,
double
score
)
{
return
redisTemplate
.
opsForZSet
().
incrementScore
(
key
,
value
,
score
);
}
/**
* 查询value对应的score zscore
*
* @param key
* @param value
* @return
*/
public
Double
getCacheZSetScore
(
String
key
,
String
value
)
{
return
redisTemplate
.
opsForZSet
().
score
(
key
,
value
);
}
}
/**
* 判断value在zset中的排名 zrank
*
* @param key
* @param value
* @return
*/
public
Long
rankCacheZSet
(
String
key
,
String
value
)
{
return
redisTemplate
.
opsForZSet
().
rank
(
key
,
value
);
}
/**
* 返回集合的长度
*
* @param key
* @return
*/
public
Long
getCacheZSetSize
(
String
key
)
{
return
redisTemplate
.
opsForZSet
().
zCard
(
key
);
}
/**
* 查询集合中指定顺序的值, 0 -1 表示获取全部的集合内容 zrange
*
* 返回有序的集合,score小的在前面
*
* @param key
* @param start
* @param end
* @return
*/
public
Set
<
String
>
rangeCacheZSet
(
String
key
,
int
start
,
int
end
)
{
return
redisTemplate
.
opsForZSet
().
range
(
key
,
start
,
end
);
}
/**
* 查询集合中指定顺序的值和score,0, -1 表示获取全部的集合内容
*
* @param key
* @param start
* @param end
* @return
*/
public
Set
<
ZSetOperations
.
TypedTuple
<
String
>>
rangeWithScore
(
String
key
,
int
start
,
int
end
)
{
return
redisTemplate
.
opsForZSet
().
rangeWithScores
(
key
,
start
,
end
);
}
/**
* 查询集合中指定顺序的值 zrevrange
*
* 返回有序的集合中,score大的在前面
*
* @param key
* @param start
* @param end
* @return
*/
public
Set
<
String
>
revRangeCacheZSet
(
String
key
,
int
start
,
int
end
)
{
return
redisTemplate
.
opsForZSet
().
reverseRange
(
key
,
start
,
end
);
}
/**
* 根据score的值,来获取满足条件的集合 zrangebyscore
*
* @param key
* @param min
* @param max
* @return
*/
public
Set
<
String
>
sortRangeCacheZSet
(
String
key
,
int
min
,
int
max
)
{
return
redisTemplate
.
opsForZSet
().
rangeByScore
(
key
,
min
,
max
);
}
}
}
linkwe-quartz/src/main/java/com/linkwechat/quartz/task/PullGroupMessageTask.java
View file @
5b686d5
...
@@ -5,24 +5,28 @@ import cn.hutool.core.thread.ThreadUtil;
...
@@ -5,24 +5,28 @@ import cn.hutool.core.thread.ThreadUtil;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.enums.MessageType
;
import
com.linkwechat.common.enums.MessageType
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerMessagePushClient
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.message.SendMessageResultDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.dto.message.WeGroupMsgListDto
;
import
com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery
;
import
com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery
;
import
com.linkwechat.wecom.domain.query.WeAddMsgTemplateQuery
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.*
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.ZSetOperations
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Date
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.List
;
import
java.util.Optional
;
/**
/**
* @author danmo
* @author danmo
...
@@ -48,6 +52,12 @@ public class PullGroupMessageTask {
...
@@ -48,6 +52,12 @@ public class PullGroupMessageTask {
@Autowired
@Autowired
private
IWeMaterialService
weMaterialService
;
private
IWeMaterialService
weMaterialService
;
@Autowired
private
WeCustomerMessagePushClient
customerMessagePushClient
;
@Autowired
private
RedisCache
redisCache
;
/**
/**
* 同步开始时间
* 同步开始时间
*/
*/
...
@@ -245,4 +255,48 @@ public class PullGroupMessageTask {
...
@@ -245,4 +255,48 @@ public class PullGroupMessageTask {
groupMessageTaskService
.
addOrUpdateBatchByCondition
(
taskList
);
groupMessageTaskService
.
addOrUpdateBatchByCondition
(
taskList
);
sendResultService
.
addOrUpdateBatchByCondition
(
sendResultlist
);
sendResultService
.
addOrUpdateBatchByCondition
(
sendResultlist
);
}
}
public
void
groupMessageTaskHandler
(){
Long
cacheZSetSize
=
redisCache
.
getCacheZSetSize
(
WeConstans
.
WEGROUPMSGTIMEDTASK_KEY
);
if
(
cacheZSetSize
>
0
){
Set
<
ZSetOperations
.
TypedTuple
<
String
>>
typedTuples
=
redisCache
.
rangeWithScore
(
WeConstans
.
WEGROUPMSGTIMEDTASK_KEY
,
0
,
0
);
typedTuples
.
forEach
(
item
->
{
long
score
=
Objects
.
requireNonNull
(
item
.
getScore
()).
longValue
();
if
(
score
<
System
.
currentTimeMillis
()){
//当时间小于当前时间时删除第一个记录,并发送群发消息
log
.
info
(
"获取到消息,执行群发任务: {}"
,
item
.
getValue
());
redisCache
.
removeCacheZSet
(
WeConstans
.
WEGROUPMSGTIMEDTASK_KEY
,
item
.
getValue
());
WeAddGroupMessageQuery
query
=
JSONObject
.
parseObject
(
item
.
getValue
(),
WeAddGroupMessageQuery
.
class
);
List
<
WeAddGroupMessageQuery
.
SenderInfo
>
senderList
=
query
.
getSenderList
();
List
<
WeGroupMessageList
>
weGroupMessageLists
=
new
ArrayList
<>();
senderList
.
forEach
(
sender
->{
WeAddMsgTemplateQuery
templateQuery
=
new
WeAddMsgTemplateQuery
();
templateQuery
.
setChat_type
(
query
.
getChatType
());
templateQuery
.
setSender
(
sender
.
getUserId
());
if
(
ObjectUtil
.
equal
(
1
,
query
.
getChatType
())){
templateQuery
.
setExternal_userid
(
sender
.
getCustomerList
());
}
templateQuery
.
setAttachments
(
query
.
getAttachmentsList
());
if
(
StringUtils
.
isNotEmpty
(
query
.
getContent
())){
WeAddMsgTemplateQuery
.
Text
text
=
new
WeAddMsgTemplateQuery
.
Text
();
text
.
setContent
(
query
.
getContent
());
templateQuery
.
setText
(
text
);
}
SendMessageResultDto
resultDto
=
customerMessagePushClient
.
addMsgTemplate
(
templateQuery
);
if
(
resultDto
!=
null
&&
ObjectUtil
.
equal
(
WeConstans
.
WE_SUCCESS_CODE
,
resultDto
.
getErrcode
())){
String
msgid
=
resultDto
.
getMsgid
();
Long
msgTemplateId
=
query
.
getId
();
WeGroupMessageList
messageList
=
new
WeGroupMessageList
();
messageList
.
setMsgId
(
msgid
);
weGroupMessageLists
.
add
(
messageList
);
groupMessageListService
.
update
(
messageList
,
new
LambdaQueryWrapper
<
WeGroupMessageList
>()
.
eq
(
WeGroupMessageList:
:
getMsgTemplateId
,
msgTemplateId
)
.
eq
(
WeGroupMessageList:
:
getUserId
,
sender
.
getUserId
()));
}
});
}
});
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
View file @
5b686d5
...
@@ -57,6 +57,15 @@ public interface WeUserClient {
...
@@ -57,6 +57,15 @@ public interface WeUserClient {
* @param fetchChild
* @param fetchChild
* @return
* @return
*/
*/
@Request
(
url
=
"/user/simplelist"
)
WeUserListDto
simpleList
(
@Query
(
"department_id"
)
Long
departmentId
,
@Query
(
"fetch_child"
)
Integer
fetchChild
);
/**
* 获取部门成员
* @param departmentId
* @param fetchChild
* @return
*/
@Request
(
url
=
"/user/list"
)
@Request
(
url
=
"/user/list"
)
WeUserListDto
list
(
@Query
(
"department_id"
)
Long
departmentId
,
@Query
(
"fetch_child"
)
Integer
fetchChild
);
WeUserListDto
list
(
@Query
(
"department_id"
)
Long
departmentId
,
@Query
(
"fetch_child"
)
Integer
fetchChild
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageAttachments.java
View file @
5b686d5
...
@@ -28,6 +28,13 @@ public class WeGroupMessageAttachments extends BaseEntity{
...
@@ -28,6 +28,13 @@ public class WeGroupMessageAttachments extends BaseEntity{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Long
id
;
/**
* 群发消息模板id
*/
@ApiModelProperty
(
"群发消息模板id"
)
@Excel
(
name
=
"群发消息模板id"
)
private
Long
msgTemplateId
;
/** 企业群发消息的id */
/** 企业群发消息的id */
@ApiModelProperty
(
"企业群发消息的id"
)
@ApiModelProperty
(
"企业群发消息的id"
)
@Excel
(
name
=
"企业群发消息的id"
)
@Excel
(
name
=
"企业群发消息的id"
)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageList.java
View file @
5b686d5
...
@@ -35,6 +35,14 @@ public class WeGroupMessageList extends BaseEntity{
...
@@ -35,6 +35,14 @@ public class WeGroupMessageList extends BaseEntity{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Long
id
;
/**
* 群发消息模板id
*/
@ApiModelProperty
(
"群发消息模板id"
)
@Excel
(
name
=
"群发消息模板id"
)
private
Long
msgTemplateId
;
/**
/**
* 企业群发消息的id
* 企业群发消息的id
*/
*/
...
@@ -52,7 +60,7 @@ public class WeGroupMessageList extends BaseEntity{
...
@@ -52,7 +60,7 @@ public class WeGroupMessageList extends BaseEntity{
/**
/**
* 群发消息创建者userid
* 群发消息创建者userid
*/
*/
@ApiModelProperty
(
"群发消息创建者userid"
)
@ApiModelProperty
(
value
=
"群发消息创建者userid"
,
hidden
=
true
)
@Excel
(
name
=
"群发消息创建者userid"
)
@Excel
(
name
=
"群发消息创建者userid"
)
private
String
userId
;
private
String
userId
;
...
@@ -67,28 +75,14 @@ public class WeGroupMessageList extends BaseEntity{
...
@@ -67,28 +75,14 @@ public class WeGroupMessageList extends BaseEntity{
/**
/**
* 群发消息创建来源。0:企业 1:个人
* 群发消息创建来源。0:企业 1:个人
*/
*/
@ApiModelProperty
(
"群发消息创建来源。0:企业 1:个人"
)
@ApiModelProperty
(
value
=
"群发消息创建来源。0:企业 1:个人"
,
hidden
=
true
)
@Excel
(
name
=
"群发消息创建来源。0:企业 1:个人"
)
@Excel
(
name
=
"群发消息创建来源。0:企业 1:个人"
)
private
Integer
createType
;
private
Integer
createType
=
0
;
/**
* 是否定时任务 0 常规 1 定时发送
*/
@ApiModelProperty
(
"是否定时任务 0 常规 1 定时发送"
)
@Excel
(
name
=
"是否定时任务 0 常规 1 定时发送"
)
private
Integer
isTask
;
/**
* 是否执行 0 未执行 1 已执行
*/
@ApiModelProperty
(
"是否执行 0 未执行 1 已执行"
)
@Excel
(
name
=
"是否执行 0 未执行 1 已执行"
)
private
Integer
isExecute
;
/**
/**
* 群发消息创建者
* 群发消息创建者
*/
*/
@ApiModelProperty
(
"群发消息创建者"
)
@ApiModelProperty
(
value
=
"群发消息创建者"
,
hidden
=
true
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
userName
;
private
String
userName
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageSendResult.java
View file @
5b686d5
...
@@ -35,6 +35,14 @@ public class WeGroupMessageSendResult extends BaseEntity{
...
@@ -35,6 +35,14 @@ public class WeGroupMessageSendResult extends BaseEntity{
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Long
id
;
/**
* 群发消息模板id
*/
@ApiModelProperty
(
"群发消息模板id"
)
@Excel
(
name
=
"群发消息模板id"
)
private
Long
msgTemplateId
;
/**
/**
* 企业群发消息的id
* 企业群发消息的id
*/
*/
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageTask.java
View file @
5b686d5
...
@@ -36,6 +36,13 @@ public class WeGroupMessageTask extends BaseEntity{
...
@@ -36,6 +36,13 @@ public class WeGroupMessageTask extends BaseEntity{
private
Long
id
;
private
Long
id
;
/**
/**
* 群发消息模板id
*/
@ApiModelProperty
(
"群发消息模板id"
)
@Excel
(
name
=
"群发消息模板id"
)
private
Long
msgTemplateId
;
/**
* 企业群发消息的id
* 企业群发消息的id
*/
*/
@ApiModelProperty
(
"企业群发消息的id"
)
@ApiModelProperty
(
"企业群发消息的id"
)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeGroupMessageTemplate.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
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
java.util.Date
;
/**
* 群发消息模板对象 we_group_message_template
*
* @author ruoyi
* @date 2021-10-27
*/
@ApiModel
@Data
@TableName
(
"we_group_message_template"
)
public
class
WeGroupMessageTemplate
extends
BaseEntity
{
/**
* 主键id
*/
@ApiModelProperty
(
"id"
)
@TableId
(
value
=
"id"
,
type
=
IdType
.
AUTO
)
private
Long
id
;
/**
* 群发任务的类,1:表示发送给客户,2:表示发送给客户群
*/
@ApiModelProperty
(
"群发任务的类,1:表示发送给客户,2:表示发送给客户群"
)
@Excel
(
name
=
"群发任务的类,1:表示发送给客户,2:表示发送给客户群"
)
private
Integer
chatType
;
/**
* 群发内容
*/
@ApiModelProperty
(
"群发内容"
)
@Excel
(
name
=
"群发内容"
)
private
String
content
;
/**
* 发送时间
*/
@ApiModelProperty
(
"发送时间"
)
@Excel
(
name
=
"发送时间"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
sendTime
;
/**
* 条件筛选
*/
@ApiModelProperty
(
"条件筛选"
)
@Excel
(
name
=
"条件筛选"
)
private
String
filterCondition
;
/**
* 是否定时任务 0 立即发送 1 定时发送
*/
@ApiModelProperty
(
"是否定时任务 0 立即发送 1 定时发送"
)
@Excel
(
name
=
"是否定时任务 0 立即发送 1 定时发送"
)
private
Integer
isTask
;
/**
* 状态 -1:失败 0:未执行 1:完成 2:取消
*/
@ApiModelProperty
(
"状态 -1:失败 0:未执行 1:完成 2:取消"
)
@Excel
(
name
=
"是否执行 -1:失败 0:未执行 1:完成 2:取消"
)
private
Integer
status
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddGroupMessageQuery.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
domain
.
query
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.wecom.domain.WeGroupMessageTemplate
;
import
com.linkwechat.wecom.domain.WeMessageTemplate
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author sxw
* @description 添加群发消息入参
* @date 2021/10/24 12:14
**/
@ApiModel
@Data
public
class
WeAddGroupMessageQuery
extends
WeGroupMessageTemplate
{
/**
* 指定接收消息的成员及对应客户列表
*/
@ApiModelProperty
(
"指定接收消息的成员及对应客户列表"
)
private
List
<
SenderInfo
>
senderList
;
@ApiModelProperty
(
"附件列表"
)
private
List
<
WeMessageTemplate
>
attachmentsList
;
@ApiModel
@Data
public
static
class
SenderInfo
{
@ApiModelProperty
(
"成员id"
)
private
String
userId
;
@ApiModelProperty
(
"客户列表"
)
private
List
<
String
>
customerList
;
@ApiModelProperty
(
"群组列表"
)
private
List
<
String
>
chatList
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/query/WeAddMsgTemplateQuery.java
View file @
5b686d5
...
@@ -36,6 +36,17 @@ public class WeAddMsgTemplateQuery {
...
@@ -36,6 +36,17 @@ public class WeAddMsgTemplateQuery {
@ApiModelProperty
(
"附件,最多支持添加9个附件 ru"
)
@ApiModelProperty
(
"附件,最多支持添加9个附件 ru"
)
private
List
<
Attachments
>
attachments
;
private
List
<
Attachments
>
attachments
;
public
void
setChat_type
(
String
chat_type
)
{
this
.
chat_type
=
chat_type
;
}
public
void
setChat_type
(
Integer
chatType
)
{
if
(
ObjectUtil
.
equal
(
2
,
chatType
)){
this
.
chat_type
=
"group"
;
}
else
{
this
.
chat_type
=
"single"
;
}
}
public
void
setAttachments
(
List
<
WeMessageTemplate
>
messageTemplates
)
{
public
void
setAttachments
(
List
<
WeMessageTemplate
>
messageTemplates
)
{
final
int
size
=
9
;
final
int
size
=
9
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageDetailVo.java
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
import
com.linkwechat.wecom.domain.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageSendResult
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
com.linkwechat.wecom.domain.WeGroupMessageTask
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -17,7 +16,7 @@ import java.util.List;
...
@@ -17,7 +16,7 @@ import java.util.List;
**/
**/
@ApiModel
@ApiModel
@Data
@Data
public
class
WeGroupMessageDetailVo
extends
WeGroupMessageList
{
public
class
WeGroupMessageDetailVo
{
/**
/**
* 附件
* 附件
*/
*/
...
@@ -25,14 +24,14 @@ public class WeGroupMessageDetailVo extends WeGroupMessageList {
...
@@ -25,14 +24,14 @@ public class WeGroupMessageDetailVo extends WeGroupMessageList {
private
List
<
WeGroupMessageAttachments
>
attachments
;
private
List
<
WeGroupMessageAttachments
>
attachments
;
/**
/**
*
发送者
*
待发送者列表
*/
*/
@ApiModelProperty
(
"
发送者信息
"
)
@ApiModelProperty
(
"
待发送者列表
"
)
private
List
<
WeGroupMessageTask
>
senders
;
private
List
<
WeGroupMessageTask
Vo
>
toBeSentList
;
/**
/**
*
发送客户
*
已发送者列表
*/
*/
@ApiModelProperty
(
"
接收者信息
"
)
@ApiModelProperty
(
"
已发送者列表
"
)
private
List
<
WeGroupMessage
SendResult
>
extralInfos
;
private
List
<
WeGroupMessage
TaskVo
>
alreadySentList
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageListVo.java
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
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.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -11,28 +11,31 @@ import java.util.List;
...
@@ -11,28 +11,31 @@ import java.util.List;
/**
/**
* @author sxw
* @author sxw
* @description 群发
列表
出参
* @description 群发
详情
出参
* @date 2021/10/23 15:
27
* @date 2021/10/23 15:
09
**/
**/
@ApiModel
@ApiModel
@Data
@Data
public
class
WeGroupMessageListVo
extends
WeGroupMessageList
{
public
class
WeGroupMessageListVo
{
@ApiModelProperty
(
"发送成员总数"
)
@Excel
(
name
=
"发送成员总数"
)
private
Integer
senderTotalNums
;
@ApiModelProperty
(
"待发送成员数"
)
private
String
msgTemplateId
;
@Excel
(
name
=
"待发送成员数"
)
private
Integer
senderNums
;
@ApiModelProperty
(
"待发送客户数"
)
@Excel
(
name
=
"待发送客户数"
)
private
Integer
serviceMember
;
@ApiModelProperty
(
"发送客户总数"
)
@Excel
(
name
=
"发送客户总数"
)
private
Integer
serviceTotalMember
;
/**
* 附件
*/
@ApiModelProperty
(
"附件"
)
@ApiModelProperty
(
"附件"
)
private
List
<
WeGroupMessageAttachments
>
attachments
;
private
List
<
WeGroupMessageAttachments
>
attachments
;
/**
* 发送者
*/
@ApiModelProperty
(
"发送者信息"
)
private
List
<
WeGroupMessageTask
>
senders
;
/**
* 发送客户
*/
@ApiModelProperty
(
"接收者信息"
)
private
List
<
WeGroupMessageSendResult
>
extralInfos
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeGroupMessageTaskVo.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.wecom.domain.WeGroupMessageAttachments
;
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.Date
;
import
java.util.List
;
/**
* @author sxw
* @description 群发成员任务出参
* @date 2021/10/23 15:09
**/
@ApiModel
@Data
public
class
WeGroupMessageTaskVo
{
/**
* 企业服务人员的userid
*/
@ApiModelProperty
(
"企业服务人员的userid"
)
private
String
userId
;
/**
* 企业服务人员的名称
*/
@ApiModelProperty
(
"企业服务人员的名称"
)
private
String
userName
;
/**
* 发送时间
*/
@ApiModelProperty
(
"发送时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
sendTime
;
/**
* 发送客户列表
*/
@ApiModelProperty
(
"发送客户列表"
)
private
List
<
String
>
customerList
;
/**
* 发送群列表
*/
@ApiModelProperty
(
"发送群列表"
)
private
List
<
String
>
groupList
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageListMapper.java
View file @
5b686d5
...
@@ -2,7 +2,7 @@ package com.linkwechat.wecom.mapper;
...
@@ -2,7 +2,7 @@ package com.linkwechat.wecom.mapper;
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.WeGroupMessageList
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessage
Detail
Vo
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessage
List
Vo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -18,10 +18,8 @@ public interface WeGroupMessageListMapper extends BaseMapper<WeGroupMessageList>
...
@@ -18,10 +18,8 @@ public interface WeGroupMessageListMapper extends BaseMapper<WeGroupMessageList>
/**
/**
* 查询群发消息详情
* 查询群发消息详情
* @param msg
Ids
* @param msg
TemplateIds 消息模板id列表
* @return
* @return
*/
*/
List
<
WeGroupMessageDetailVo
>
getGroupMsgDetails
(
@Param
(
"msgIds"
)
List
<
String
>
msgIds
);
List
<
WeGroupMessageListVo
>
getGroupMsgDetails
(
@Param
(
"msgTemplateIds"
)
List
<
Long
>
msgTemplateIds
);
WeGroupMessageDetailVo
getGroupMsgDetail
(
@Param
(
"msgId"
)
String
msgId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeGroupMessageTemplateMapper.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeGroupMessageTemplate
;
/**
* 群发消息模板Mapper接口
*
* @author ruoyi
* @date 2021-10-27
*/
public
interface
WeGroupMessageTemplateMapper
extends
BaseMapper
<
WeGroupMessageTemplate
>
{
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageListService.java
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
service
;
package
com
.
linkwechat
.
wecom
.
service
;
import
com.github.pagehelper.PageInfo
;
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.WeGroupMessageList
;
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
com.linkwechat.wecom.domain.vo.WeGroupMessageListVo
;
import
java.util.List
;
import
java.util.List
;
...
@@ -16,12 +14,6 @@ import java.util.List;
...
@@ -16,12 +14,6 @@ import java.util.List;
* @date 2021-10-19
* @date 2021-10-19
*/
*/
public
interface
IWeGroupMessageListService
extends
IService
<
WeGroupMessageList
>
{
public
interface
IWeGroupMessageListService
extends
IService
<
WeGroupMessageList
>
{
/**
* 查询列表
*/
PageInfo
<
WeGroupMessageListVo
>
queryList
(
WeGroupMessageList
weGroupMessageList
);
/**
/**
* 获取群发记录列表
* 获取群发记录列表
*
*
...
@@ -34,9 +26,9 @@ public interface IWeGroupMessageListService extends IService<WeGroupMessageList>
...
@@ -34,9 +26,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 msg
Id 消息
id
* @param msg
TemplateId 模板
id
* @return
详情
* @return
*/
*/
WeGroupMessageDetailVo
getGroupMsgDetail
(
String
msg
Id
);
List
<
WeGroupMessageListVo
>
getGroupMsgDetail
(
Long
msgTemplate
Id
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeGroupMessageTemplateService.java
0 → 100644
View file @
5b686d5
package
com
.
linkwechat
.
wecom
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeGroupMessageTemplate
;
import
com.linkwechat.wecom.domain.query.WeAddGroupMessageQuery
;
import
com.linkwechat.wecom.domain.vo.WeGroupMessageDetailVo
;
import
java.util.List
;
/**
* 群发消息模板Service接口
*
* @author ruoyi
* @date 2021-10-27
*/
public
interface
IWeGroupMessageTemplateService
extends
IService
<
WeGroupMessageTemplate
>
{
/**
* 查询列表
*/
List
<
WeGroupMessageTemplate
>
queryList
(
WeGroupMessageTemplate
weGroupMessageTemplate
);
/**
* 获取群发消息详情
* @param id 模板id
* @return
*/
WeGroupMessageDetailVo
getGroupMsgTemplateDetail
(
Long
id
);
/**
* 创建群发消息
* @param query
*/
void
addGroupMsgTemplate
(
WeAddGroupMessageQuery
query
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageListServiceImpl.java
View file @
5b686d5
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupMessageTemplateServiceImpl.java
0 → 100644
View file @
5b686d5
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageAttachmentsMapper.xml
View file @
5b686d5
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap
type=
"WeGroupMessageAttachments"
id=
"WeGroupMessageAttachmentsResult"
>
<resultMap
type=
"WeGroupMessageAttachments"
id=
"WeGroupMessageAttachmentsResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"msgTemplateId"
column=
"msg_template_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"msgType"
column=
"msg_type"
/>
<result
property=
"msgType"
column=
"msg_type"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"content"
column=
"content"
/>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageListMapper.xml
View file @
5b686d5
...
@@ -6,21 +6,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -6,21 +6,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap
type=
"WeGroupMessageList"
id=
"WeGroupMessageListResult"
>
<resultMap
type=
"WeGroupMessageList"
id=
"WeGroupMessageListResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"msgTemplateId"
column=
"msg_template_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"chatType"
column=
"chat_type"
/>
<result
property=
"chatType"
column=
"chat_type"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<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=
"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=
"WeGroupMessage
Detail
Vo"
>
<resultMap
id=
"groupMsgDetailResult"
type=
"WeGroupMessage
List
Vo"
>
<result
property=
"msg
Id"
column=
"msg
_id"
/>
<result
property=
"msg
TemplateId"
column=
"msg_template
_id"
/>
<collection
property=
"attachments"
ofType=
"com.linkwechat.wecom.domain.WeGroupMessageAttachments"
>
<collection
property=
"attachments"
ofType=
"com.linkwechat.wecom.domain.WeGroupMessageAttachments"
>
<result
property=
"msgType"
column=
"msg_type"
/>
<result
property=
"msgType"
column=
"msg_type"
/>
<result
property=
"content"
column=
"content"
/>
<result
property=
"content"
column=
"content"
/>
...
@@ -50,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -50,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql
id=
"getDetailVo"
>
<sql
id=
"getDetailVo"
>
select
select
wgml.msg_id,
wgml.msg_
template_
id,
wgma.msg_type,
wgma.msg_type,
wgma.content,
wgma.content,
wgma.app_id ,
wgma.app_id ,
...
@@ -74,11 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -74,11 +73,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from
from
we_group_message_list wgml
we_group_message_list wgml
left join we_group_message_attachments wgma on
left join we_group_message_attachments wgma on
wgma.msg_
id = wgml.msg
_id
wgma.msg_
template_id = wgml.msg_template
_id
left join we_group_message_task wgmt on
left join we_group_message_task wgmt on
wgmt.msg_
id = wgml.msg
_id
wgmt.msg_
template_id = wgml.msg_template
_id
left join we_group_message_send_result wgmsr on
left join we_group_message_send_result wgmsr on
wgmsr.msg_
id = wgml.msg
_id
wgmsr.msg_
template_id = wgml.msg_template
_id
where
where
1 = 1
1 = 1
</sql>
</sql>
...
@@ -86,18 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -86,18 +85,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"getGroupMsgDetails"
resultMap=
"groupMsgDetailResult"
>
<select
id=
"getGroupMsgDetails"
resultMap=
"groupMsgDetailResult"
>
<include
refid=
"getDetailVo"
/>
<include
refid=
"getDetailVo"
/>
<if
test=
"msgIds != null and msgIds.size > 0"
>
<if
test=
"msgIds != null and msgIds.size > 0"
>
and wgml.msg_id in
and wgml.msg_
template_
id in
<foreach
collection=
"msg
Ids"
index=
"index"
item=
"msg
Id"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"msg
TemplateIds"
index=
"index"
item=
"msgTemplate
Id"
open=
"("
separator=
","
close=
")"
>
#{msgId}
#{msg
Template
Id}
</foreach>
</foreach>
</if>
</if>
</select>
</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/WeGroupMessageSendResultMapper.xml
View file @
5b686d5
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap
type=
"WeGroupMessageSendResult"
id=
"WeGroupMessageSendResultResult"
>
<resultMap
type=
"WeGroupMessageSendResult"
id=
"WeGroupMessageSendResultResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"msgTemplateId"
column=
"msg_template_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"externalUserid"
column=
"external_userid"
/>
<result
property=
"externalUserid"
column=
"external_userid"
/>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTaskMapper.xml
View file @
5b686d5
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap
type=
"WeGroupMessageTask"
id=
"WeGroupMessageTaskResult"
>
<resultMap
type=
"WeGroupMessageTask"
id=
"WeGroupMessageTaskResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"msgTemplateId"
column=
"msg_template_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"msgId"
column=
"msg_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"status"
column=
"status"
/>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMessageTemplateMapper.xml
0 → 100644
View file @
5b686d5
<?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.WeGroupMessageTemplateMapper"
>
<resultMap
type=
"WeGroupMessageTemplate"
id=
"WeGroupMessageTemplateResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"chatType"
column=
"chat_type"
/>
<result
property=
"content"
column=
"context"
/>
<result
property=
"sendTime"
column=
"send_time"
/>
<result
property=
"filterCondition"
column=
"filter_condition"
/>
<result
property=
"isTask"
column=
"is_task"
/>
<result
property=
"status"
column=
"status"
/>
<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