Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
70ae4164
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,发现更多精彩内容 >>
提交
70ae4164
编写于
10月 20, 2020
作者:
水
水库浪子
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改客户列表error
上级
d4197c7e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
216 addition
and
79 deletion
+216
-79
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeCropTagClient.java
...ain/java/com/linkwechat/wecom/client/WeCropTagClient.java
+11
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
...src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
+1
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
...java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
+7
-2
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
...a/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
+22
-3
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
...m/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
+15
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
...linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
+3
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerTagRelService.java
...kwechat/wecom/service/IWeFlowerCustomerTagRelService.java
+3
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
.../linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
+120
-30
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
...wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
+2
-1
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
...ecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
+32
-39
未找到文件。
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeCropTagClient.java
浏览文件 @
70ae4164
...
...
@@ -28,11 +28,21 @@ public interface WeCropTagClient {
* @return
*/
@Request
(
url
=
"/externalcontact/get_corp_tag_list"
,
type
=
"POST"
type
=
"POST"
)
WeCropGroupTagListDto
getAllCorpTagList
();
/**
* 根据指定标签的id,获取标签详情
* @return
*/
@Request
(
url
=
"/externalcontact/get_corp_tag_list"
,
type
=
"POST"
)
WeCropGroupTagListDto
getCorpTagListByTagIds
(
@DataObject
WeFindCropTagParam
weFindCropTagParam
);
/**
* 删除企业客户标签
* @param weCropDelDto
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
浏览文件 @
70ae4164
...
...
@@ -67,7 +67,7 @@ public class WeCustomer
/** 添加人员 */
@TableField
(
exist
=
false
)
private
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
;
private
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
浏览文件 @
70ae4164
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
;
...
...
@@ -28,9 +29,11 @@ public class WeFlowerCustomerRel
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
private
Long
id
=
SnowFlakeUtil
.
nextId
();
/** 添加了此外部联系人的企业成员userid */
@TableId
private
String
userId
;
/** 外部联系人名称 */
...
...
@@ -57,7 +60,7 @@ public class WeFlowerCustomerRel
private
String
state
;
/** 客户id */
private
Long
customerI
d
;
private
String
externalUseri
d
;
/** 状态(0正常 1删除) */
private
String
status
;
...
...
@@ -66,6 +69,8 @@ public class WeFlowerCustomerRel
private
Date
createTime
;
/** 微信用户添加的标签 */
@TableField
(
exist
=
false
)
private
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
浏览文件 @
70ae4164
package
com.linkwechat.wecom.domain
;
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.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
/**
...
...
@@ -11,21 +21,30 @@ import lombok.Data;
* @date 2020-09-19
*/
@Data
public
class
WeFlowerCustomerTagRel
extends
BaseEntity
@TableName
(
"we_flower_customer_tag_rel"
)
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
WeFlowerCustomerTagRel
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
;
@TableId
private
Long
id
=
SnowFlakeUtil
.
nextId
();
/** 添加客户的企业微信用户 */
private
Long
flowerCustomerRelId
;
/** 标签id */
private
Lo
ng
tagId
;
private
Stri
ng
tagId
;
/** 标签名 */
@TableField
(
exist
=
false
)
private
String
tagName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
0 → 100644
浏览文件 @
70ae4164
package
com.linkwechat.wecom.domain.dto.tag
;
import
lombok.Builder
;
import
lombok.Data
;
/**
* @description: 获取标签接口参数实体
* @author: HaoN
* @create: 2020-10-20 13:03
**/
@Data
@Builder
public
class
WeFindCropTagParam
{
private
String
[]
tag_id
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
浏览文件 @
70ae4164
package
com.linkwechat.wecom.mapper
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerTagRel
;
/**
...
...
@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
* @author ruoyi
* @date 2020-09-19
*/
public
interface
WeFlowerCustomerTagRelMapper
public
interface
WeFlowerCustomerTagRelMapper
extends
BaseMapper
<
WeFlowerCustomerTagRel
>
{
/**
* 查询客户标签关系
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerTagRelService.java
浏览文件 @
70ae4164
package
com.linkwechat.wecom.service
;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerTagRel
;
/**
...
...
@@ -9,7 +11,7 @@ import com.linkwechat.wecom.domain.WeFlowerCustomerTagRel;
* @author ruoyi
* @date 2020-09-19
*/
public
interface
IWeFlowerCustomerTagRelService
public
interface
IWeFlowerCustomerTagRelService
extends
IService
<
WeFlowerCustomerTagRel
>
{
/**
* 查询客户标签关系
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
浏览文件 @
70ae4164
...
...
@@ -2,28 +2,33 @@ package com.linkwechat.wecom.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.ArrayUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.bean.BeanUtils
;
import
com.linkwechat.framework.web.domain.server.Sys
;
import
com.linkwechat.wecom.client.WeCropTagClient
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserList
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserTag
;
import
com.linkwechat.wecom.domain.dto.customer.FollowUserList
;
import
com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagDto
;
import
com.linkwechat.wecom.domain.dto.tag.WeCropGroupTagListDto
;
import
com.linkwechat.wecom.domain.dto.tag.WeCropTagDto
;
import
com.linkwechat.wecom.domain.dto.tag.WeFindCropTagParam
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.mapper.WeCustomerMapper
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeFlowerCustomerRelService
;
import
com.linkwechat.wecom.service.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -46,6 +51,20 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper,WeCustom
@Autowired
private
IWeFlowerCustomerRelService
iWeFlowerCustomerRelService
;
@Autowired
private
WeCropTagClient
weCropTagClient
;
@Autowired
private
IWeTagService
iWeTagService
;
@Autowired
private
IWeTagGroupService
iWeTagGroupService
;
@Autowired
private
IWeFlowerCustomerTagRelService
iWeFlowerCustomerTagRelService
;
// @Autowired
// private WeUserClient weUserClient;
...
...
@@ -162,41 +181,112 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper,WeCustom
this
.
saveOrUpdate
(
weCustomer
);
//客户与通讯录客户关系
List
<
WeTag
>
weTags
=
new
ArrayList
<>();
List
<
WeTagGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
=
new
ArrayList
<>();
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRel
=
new
ArrayList
<>();
externalUserDetail
.
getFollow_user
().
stream
().
forEach
(
kk
->{
WeFlowerCustomerRel
weFlowerCustomerRelOne
=
new
WeFlowerCustomerRel
();
BeanUtils
.
copyPropertiesignoreOther
(
kk
,
weFlowerCustomerRelOne
);
Long
weFlowerCustomerRelId
=
SnowFlakeUtil
.
nextId
();
weFlowerCustomerRelOne
.
setId
(
weFlowerCustomerRelId
);
weFlowerCustomerRelOne
.
setExternalUserid
(
weCustomer
.
getExternalUserid
());
weFlowerCustomerRel
.
add
(
weFlowerCustomerRelOne
);
List
<
ExternalUserTag
>
tags
=
kk
.
getTags
();
if
(
CollectionUtil
.
isNotEmpty
(
tags
)){
//获取相关标签组
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
()
.
tag_id
(
ArrayUtil
.
toArray
(
tags
.
stream
().
map
(
ExternalUserTag:
:
getTag_id
).
collect
(
Collectors
.
toList
()),
String
.
class
))
.
build
());
if
(
weCropGroupTagListDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
List
<
WeCropGroupTagDto
>
tagGroups
=
weCropGroupTagListDto
.
getTag_group
();
if
(
CollectionUtil
.
isNotEmpty
(
tagGroups
)){
tagGroups
.
stream
().
forEach
(
tagGroup
->{
weGroups
.
add
(
WeTagGroup
.
builder
()
.
groupId
(
tagGroup
.
getGroup_id
())
.
gourpName
(
tagGroup
.
getGroup_name
())
.
createBy
(
SecurityUtils
.
getUsername
())
.
build
()
);
List
<
WeCropTagDto
>
weCropTagDtos
=
tagGroup
.
getTag
();
if
(
CollectionUtil
.
isNotEmpty
(
weCropTagDtos
)){
Set
<
String
>
tagIdsSet
=
weCropTagDtos
.
stream
().
map
(
WeCropTagDto:
:
getId
).
collect
(
Collectors
.
toSet
());
tags
.
stream
().
forEach
(
tag
->{
if
(
tagIdsSet
.
contains
(
tag
.
getTag_id
())){
weTags
.
add
(
WeTag
.
builder
()
.
groupId
(
tagGroup
.
getGroup_id
())
.
tagId
(
tag
.
getTag_id
())
.
name
(
tag
.
getTag_name
())
.
build
()
);
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
.
flowerCustomerRelId
(
weFlowerCustomerRelId
)
.
tagId
(
tag
.
getTag_id
())
.
createTime
(
new
Date
())
.
build
()
);
}
});
}
});
}
}
}
});
iWeFlowerCustomerRelService
.
saveOrUpdateBatch
(
weFlowerCustomerRel
);
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
=
iWeFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
weCustomer
.
getExternalUserid
()));
if
(
CollectionUtil
.
isNotEmpty
(
weFlowerCustomerRels
)){
List
<
Long
>
weFlowerCustomerRelIds
=
weFlowerCustomerRels
.
stream
().
map
(
WeFlowerCustomerRel:
:
getId
).
collect
(
Collectors
.
toList
());
iWeFlowerCustomerTagRelService
.
remove
(
new
LambdaQueryWrapper
<
WeFlowerCustomerTagRel
>().
in
(
WeFlowerCustomerTagRel:
:
getFlowerCustomerRelId
,
weFlowerCustomerRelIds
)
);
iWeFlowerCustomerRelService
.
removeByIds
(
weFlowerCustomerRelIds
);
}
//设置标签跟客户关系,根据标签id获取到标签组,saveOrUpdate标签,建立标签与添加人关系
iWeFlowerCustomerRelService
.
saveBatch
(
weFlowerCustomerRel
);
//设置标签跟客户关系,标签和标签组,saveOrUpdate,建立标签与添加人关系
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)&&
CollectionUtil
.
isNotEmpty
(
weGroups
)){
iWeTagService
.
saveOrUpdateBatch
(
weTags
);
iWeTagGroupService
.
saveOrUpdateBatch
(
weGroups
);
iWeFlowerCustomerTagRelService
.
saveOrUpdateBatch
(
weFlowerCustomerTagRels
);
}
}
// if(WeConstans.WE_SUCCESS_CODE.equals(externalContact.getErrcode())){
//
// WeCustomer weCustomer
// = externalContact.transformWeCustomer();
//
// if(null != weCustomer){
//
// this.insertWeCustomer(weCustomer);
//
// if(CollectionUtil.isNotEmpty(weCustomer.getWeFlowerCustomerRels())){
//
// iWeFlowerCustomerRelService.batchInsetWeFlowerCustomerRel(weCustomer.getWeFlowerCustomerRels());
//
//
//
// }
//
// }
//
//
// }
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
浏览文件 @
70ae4164
...
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import
java.util.List
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.DateUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -16,7 +17,7 @@ import com.linkwechat.wecom.service.IWeFlowerCustomerTagRelService;
* @date 2020-09-19
*/
@Service
public
class
WeFlowerCustomerTagRelServiceImpl
implements
IWeFlowerCustomerTagRelService
public
class
WeFlowerCustomerTagRelServiceImpl
extends
ServiceImpl
<
WeFlowerCustomerTagRelMapper
,
WeFlowerCustomerTagRel
>
implements
IWeFlowerCustomerTagRelService
{
@Autowired
private
WeFlowerCustomerTagRelMapper
weFlowerCustomerTagRelMapper
;
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
浏览文件 @
70ae4164
...
...
@@ -5,8 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCustomerMapper"
>
<resultMap
type=
"WeCustomer"
id=
"WeCustomerResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"externalUserid"
column=
"external_userid"
/>
<id
property=
"externalUserid"
column=
"external_userid"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"type"
column=
"type"
/>
...
...
@@ -23,14 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"description"
column=
"description"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"remarkCorpName"
column=
"remark_corp_name"
/>
<!-- <result property="remarkMobiles" column="remark_mobiles" />-->
<result
property=
"operUserid"
column=
"oper_userid"
/>
<result
property=
"addWay"
column=
"add_way"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"customerId"
column=
"customer_id"
/
>
<!-- <result property="customerId" column="customer_id" />--
>
<result
property=
"userName"
column=
"user_name"
/>
<collection
property=
"weFlowerCustomerTagRels"
ofType=
"com.linkwechat.wecom.domain.WeFlowerCustomerTagRel"
>
<result
property=
"id"
column=
"tagRelid"
/>
<result
property=
"flowerCustomerRelId"
column=
"flower_customer_rel_id"
/>
<result
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
...
...
@@ -44,41 +41,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<select
id=
"selectWeCustomerList"
parameterType=
"WeCustomer"
resultMap=
"WeCustomerResult"
>
SELECT
wc.id,
wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
wc.gender,
wc.unionid,
wc.birthday,
wc.position,
wc.corp_name,
wc.corp_full_name,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.remark_mobiles,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.customer_id,
wfcrf.id as tagRelid,
wfcrf.flower_customer_rel_id,
wfcrf.tag_id,
wfcrf.create_time,
wt.`name` as tagName,
wu.user_name
SELECT
wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
wc.gender,
wc.unionid,
wc.birthday,
wc.corp_name,
wc.corp_full_name,
wc.position,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wu.user_name,
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName
FROM
we_customer wc
INNER JOIN we_flower_customer_rel wfcr ON wc.id = wfcr.customer_
id
INNER JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.
id
INNER JOIN we_tag wt ON wt.id = wfcrf.tag_
id
INNER JOIN we_user wu ON wu.user_id=wfcr.user
_id
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_user
id
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_
id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.
id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag
_id
</select>
<select
id=
"selectWeCustomerById"
parameterType=
"Long"
resultMap=
"WeCustomerResult"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录