Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
452d2327
Link Wechat
项目概览
仟微科技
/
Link Wechat
通知
48
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Link Wechat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
452d2327
编写于
12月 19, 2020
作者:
S
sunxiwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
会话存档相关接口
上级
7cf17f42
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
321 addition
and
22 deletion
+321
-22
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeConversationArchiveController.java
...web/controller/wecom/WeConversationArchiveController.java
+40
-0
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
.../main/java/com/linkwechat/common/constant/WeConstans.java
+3
-0
linkwe-common/src/main/java/com/linkwechat/common/enums/BusinessType.java
...c/main/java/com/linkwechat/common/enums/BusinessType.java
+4
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMsgAuditClient.java
...in/java/com/linkwechat/wecom/client/WeMsgAuditClient.java
+51
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMsgauditClient.java
...in/java/com/linkwechat/wecom/client/WeMsgauditClient.java
+0
-22
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/msgaudit/WeMsgAuditDto.java
...m/linkwechat/wecom/domain/dto/msgaudit/WeMsgAuditDto.java
+89
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeMsgAuditVo.java
...ain/java/com/linkwechat/wecom/domain/vo/WeMsgAuditVo.java
+37
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeConversationArchiveService.java
...nkwechat/wecom/service/IWeConversationArchiveService.java
+20
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
...ain/java/com/linkwechat/wecom/service/IWeUserService.java
+8
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeConversationArchiveServiceImpl.java
.../wecom/service/impl/WeConversationArchiveServiceImpl.java
+47
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
.../com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
+22
-0
未找到文件。
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeConversationArchiveController.java
0 → 100644
浏览文件 @
452d2327
package
com.linkwechat.web.controller.wecom
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.service.IWeConversationArchiveService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* @author sxw
* @description 会话存档controller
* @date 2020/12/19 13:51
**/
@Slf4j
@RestController
@RequestMapping
(
"/wecom/finance"
)
public
class
WeConversationArchiveController
{
@Autowired
private
IWeConversationArchiveService
weConversationArchiveService
;
/**
* 获取内部联系人列表
*
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('conversationArchive:InternalContact:list')"
)
@Log
(
title
=
"获取内部联系人列表"
,
businessType
=
BusinessType
.
SELECT
)
@GetMapping
(
"/getInternalContactList"
)
public
R
<
List
<
JSONObject
>>
getInternalContactList
(
String
userId
,
int
pageSize
,
int
pageNum
)
{
return
R
.
ok
(
weConversationArchiveService
.
getInternalContactList
(
userId
,
pageSize
,
pageNum
));
}
}
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
浏览文件 @
452d2327
...
...
@@ -269,4 +269,7 @@ public class WeConstans {
}
public
static
final
String
WECOM_FINANCE_INDEX
=
"finance"
;
/** 开启会话存档成员列表 **/
public
static
final
String
weMsgAuditKey
=
"wecom_msg_audit:user:ids"
;
}
linkwe-common/src/main/java/com/linkwechat/common/enums/BusinessType.java
浏览文件 @
452d2327
...
...
@@ -56,4 +56,8 @@ public enum BusinessType
* 清空数据
*/
CLEAN
,
/**
* 查询
*/
SELECT
,
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMsgAuditClient.java
0 → 100644
浏览文件 @
452d2327
package
com.linkwechat.wecom.client
;
import
com.dtflys.forest.annotation.DataObject
;
import
com.dtflys.forest.annotation.Request
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
/**
* @author sxw
* @description 会话存档接口
* @date 2020/12/2 16:45
**/
public
interface
WeMsgAuditClient
{
/**
* 获取会话内容存档开启成员列表
*/
@Request
(
url
=
"/msgaudit/get_permit_user_list"
,
type
=
"POST"
)
WeMsgAuditDto
getPermitUserList
(
@DataObject
WeMsgAuditDto
msgAuditDto
);
/**
* 单聊 获取会话中外部成员的同意情况
* @param msgAuditDto
* @return
*/
@Request
(
url
=
"/msgaudit/check_single_agree"
,
type
=
"POST"
)
WeMsgAuditDto
checkSingleAgree
(
@DataObject
WeMsgAuditDto
msgAuditDto
);
/**
* 群聊 获取群会话中外部成员的同意情况
* @param msgAuditDto
* @return
*/
@Request
(
url
=
"/msgaudit/check_room_agree"
,
type
=
"POST"
)
WeMsgAuditDto
checkRoomAgree
(
@DataObject
WeMsgAuditDto
msgAuditDto
);
/**
* 获取会话内容存档内部群信息
* @param msgAuditDto
* @return
*/
@Request
(
url
=
"/msgaudit/groupchat/get"
,
type
=
"POST"
)
WeMsgAuditDto
getGroupChat
(
@DataObject
WeMsgAuditDto
msgAuditDto
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeMsgauditClient.java
已删除
100644 → 0
浏览文件 @
7cf17f42
package
com.linkwechat.wecom.client
;
import
com.dtflys.forest.annotation.DataObject
;
import
com.dtflys.forest.annotation.Request
;
import
com.linkwechat.wecom.domain.dto.WeMessagePushResultDto
;
import
com.linkwechat.wecom.domain.dto.msgaudit.MsgauditDto
;
/**
* @author sxw
* @description 会话存档接口
* @date 2020/12/2 16:45
**/
public
interface
WeMsgauditClient
{
/**
* 获取会话内容存档开启成员列表
*/
@Request
(
url
=
"/msgaudit/get_permit_user_list"
,
type
=
"POST"
)
WeMessagePushResultDto
sendMessageToUser
(
@DataObject
MsgauditDto
msgauditDto
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/msgaudit/WeMsgAuditDto.java
0 → 100644
浏览文件 @
452d2327
package
com.linkwechat.wecom.domain.dto.msgaudit
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author sxw
* @description 会话存档
* @date 2020/12/2 16:47
**/
@Data
public
class
WeMsgAuditDto
extends
WeResultDto
{
/**
* 设置在开启范围内的成员的userid列表
*/
private
List
<
String
>
ids
;
/**
* 同意情况
*/
private
List
<
AgreeInfo
>
agreeInfo
;
/**
* roomid对应的群名称
*/
private
String
roomName
;
/**
* roomid对应的群创建者,userid
*/
private
String
creator
;
/**
* roomid对应的群创建时间
*/
@JSONField
(
format
=
"unixtime"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
roomCreateTime
;
/**
* roomid对应的群公告
*/
private
String
notice
;
/**
* roomid对应的群成员列表
*/
private
List
<
Member
>
members
;
private
class
Member
{
/**
* roomid群成员的id,userid
*/
private
String
memberId
;
/**
* roomid群成员的入群时间
*/
private
String
joinTime
;
}
private
class
AgreeInfo
{
/**
* 同意状态改变的具体时间,utc时间
*/
private
String
statusChangeTime
;
/**
* 成员Id
*/
private
String
userId
;
/**
* 群内外部联系人的externalopenid
*/
private
String
exteranaLopenId
;
/**
* 同意:”Agree”,不同意:”Disagree”,默认同意:”Default_Agree”
*/
private
String
agreeSagreeStatustatus
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/
dto/msgaudit/MsgauditDt
o.java
→
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/
vo/WeMsgAuditV
o.java
浏览文件 @
452d2327
package
com.linkwechat.wecom.domain.
dto.msgaudit
;
package
com.linkwechat.wecom.domain.
vo
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author sxw
* @description 会话存档
* @date 2020/12/
2 16:47
* @description 会话存档
入参实体
* @date 2020/12/
19 12:38
**/
@Data
public
class
MsgauditDt
o
{
public
class
WeMsgAuditV
o
{
/**
* 拉取对应版本的开启成员列表。1表示办公版;2表示服务版;3表示企业版。
* 非必填,不填写的时候返回全量成员列表
*/
private
Integer
type
;
/** 待查询的roomid */
private
String
roomid
;
/** 待查询的会话信息,数组 */
private
List
<
Info
>
info
;
@Data
private
class
Info
{
/**
* 内部成员的userid
*/
private
String
userid
;
/**
* 外部成员的externalopenid
*/
private
String
exteranalopenid
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeConversationArchiveService.java
0 → 100644
浏览文件 @
452d2327
package
com.linkwechat.wecom.service
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.List
;
/**
* @author sxw
* @description 会话存档业务接口
* @date 2020/12/19 13:59
**/
public
interface
IWeConversationArchiveService
{
/**
* 根据用户ID 获取对应内部联系人列表
*
* @param userId
* @return
*/
List
<
JSONObject
>
getInternalContactList
(
String
userId
,
int
pageSize
,
int
pageNum
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
浏览文件 @
452d2327
...
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo
;
import
com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
...
...
@@ -108,4 +109,11 @@ public interface IWeUserService extends IService<WeUser>
*/
List
<
WeAllocateGroupsVo
>
getAllocateGroups
(
WeAllocateGroupsVo
weAllocateGroupsVo
);
/**
* 获取会话内容存档开启成员列表
* @param msgAuditDto
* @return
*/
List
<
WeUser
>
getPermitUserList
(
WeMsgAuditDto
msgAuditDto
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeConversationArchiveServiceImpl.java
0 → 100644
浏览文件 @
452d2327
package
com.linkwechat.wecom.service.impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.elasticsearch.ElasticSearch
;
import
com.linkwechat.wecom.service.IWeConversationArchiveService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @author sxw
* @description 会话存档业务实现类
* @date 2020/12/19 14:00
**/
@Slf4j
@Service
public
class
WeConversationArchiveServiceImpl
implements
IWeConversationArchiveService
{
@Autowired
private
ElasticSearch
elasticSearch
;
/**
* 根据用户ID 获取对应内部联系人列表
*
* @param userId
* @return
*/
@Override
public
List
<
JSONObject
>
getInternalContactList
(
String
userId
,
int
pageSize
,
int
pageNum
)
{
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
size
(
pageSize
);
builder
.
from
(
pageNum
);
builder
.
sort
(
"msgtime"
,
SortOrder
.
ASC
);
BoolQueryBuilder
boolQueryBuilder
=
QueryBuilders
.
boolQuery
()
.
must
(
QueryBuilders
.
termsQuery
(
"tolist.keyword"
,
userId
))
.
must
(
QueryBuilders
.
termQuery
(
"roomid"
,
""
));
builder
.
query
(
boolQueryBuilder
);
List
<
JSONObject
>
search
=
elasticSearch
.
search
(
WeConstans
.
WECOM_FINANCE_INDEX
,
builder
,
JSONObject
.
class
);
return
search
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
浏览文件 @
452d2327
...
...
@@ -3,9 +3,12 @@ package com.linkwechat.wecom.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.wecom.client.WeMsgAuditClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.vo.WeAllocateCustomersVo
;
import
com.linkwechat.wecom.domain.vo.WeAllocateGroupsVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
...
...
@@ -22,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.concurrent.TimeUnit
;
/**
* 通讯录相关客户Service业务层处理
...
...
@@ -35,10 +40,15 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
@Autowired
private
WeUserMapper
weUserMapper
;
@Autowired
private
RedisCache
redisCache
;
@Autowired
private
WeUserClient
weUserClient
;
@Autowired
private
WeMsgAuditClient
weMsgAuditClient
;
@Autowired
private
IWeCustomerService
iWeCustomerService
;
...
...
@@ -245,5 +255,17 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
return
this
.
baseMapper
.
getAllocateGroups
(
weAllocateGroupsVo
);
}
@Override
public
List
<
WeUser
>
getPermitUserList
(
WeMsgAuditDto
msgAuditDto
)
{
List
<
String
>
userIds
=
redisCache
.
getCacheList
(
WeConstans
.
weMsgAuditKey
);
if
(
CollectionUtil
.
isNotEmpty
(
userIds
)){
WeMsgAuditDto
permitUserList
=
weMsgAuditClient
.
getPermitUserList
(
msgAuditDto
);
userIds
=
Optional
.
ofNullable
(
userIds
).
orElse
(
permitUserList
.
getIds
());
redisCache
.
setCacheList
(
WeConstans
.
weMsgAuditKey
,
userIds
);
redisCache
.
expire
(
WeConstans
.
weMsgAuditKey
,
10
,
TimeUnit
.
MILLISECONDS
);
}
return
weUserMapper
.
selectBatchIds
(
userIds
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录