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 b824a4d4
authored
Oct 08, 2021
by
ext.shengxiyong1
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化客户同步;增加活码标签同步到企业微信等功能;
1 parent
40acd1d6
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
126 additions
and
68 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
linkwe-admin/src/main/resources/application.yml
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeMaterial.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
View file @
b824a4d
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.wecom.domain.WeChatItem
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
import
com.linkwechat.wecom.service.IWeMaterialService
;
import
com.linkwechat.wecom.service.IWePosterService
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 聊天工具侧边栏
* 聊天工具侧边栏
...
@@ -26,6 +37,52 @@ public class WeChatItemController extends BaseController {
...
@@ -26,6 +37,52 @@ public class WeChatItemController extends BaseController {
@Autowired
@Autowired
private
IWeChatItemService
weChatItemService
;
private
IWeChatItemService
weChatItemService
;
@Autowired
private
IWeMaterialService
materialService
;
@Resource
private
IWePosterService
wePosterService
;
// @PreAuthorize("@ss.hasPermi('wecom:material:list')")
@GetMapping
(
"/mList"
)
@ApiOperation
(
"获取侧边栏选中或者未选中素材"
)
public
TableDataInfo
mList
(
@RequestParam
(
value
=
"categoryId"
,
required
=
false
)
String
categoryId
,
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
,
@RequestParam
(
value
=
"mediaType"
)
String
mediaType
)
{
startPage
();
List
<
WeMaterial
>
list
;
if
(
StringUtils
.
isNotBlank
(
mediaType
)
&&
mediaType
.
equals
(
MediaType
.
POSTER
.
getType
())){
list
=
wePosterService
.
list
(
StringUtils
.
isBlank
(
categoryId
)?
null
:
Long
.
valueOf
(
categoryId
),
search
).
stream
().
map
(
wePoster
->
{
WeMaterial
weMaterial
=
new
WeMaterial
();
weMaterial
.
setMaterialName
(
wePoster
.
getTitle
());
weMaterial
.
setMaterialUrl
(
wePoster
.
getSampleImgPath
());
weMaterial
.
setCategoryId
(
wePoster
.
getCategoryId
());
weMaterial
.
setId
(
wePoster
.
getId
());
return
weMaterial
;
}).
collect
(
Collectors
.
toList
());
}
else
{
list
=
materialService
.
findWeMaterials
(
categoryId
,
search
,
mediaType
);
}
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
List
<
WeChatItem
>
weChatItems
=
weChatItemService
.
list
(
new
LambdaQueryWrapper
<
WeChatItem
>()
.
in
(
WeChatItem:
:
getMaterialId
));
if
(
CollectionUtil
.
isNotEmpty
(
weChatItems
)){
list
.
stream
().
forEach
(
k
->{
k
.
setIsCheck
(
weChatItems
.
stream
().
filter
(
item
->
item
.
getMaterialId
()
.
equals
(
k
.
getId
())).
findFirst
().
isPresent
()?
true
:
false
);
});
}
}
return
getDataTable
(
list
);
}
/**
/**
* 侧边栏抓取素材
* 侧边栏抓取素材
...
@@ -55,4 +112,8 @@ public class WeChatItemController extends BaseController {
...
@@ -55,4 +112,8 @@ public class WeChatItemController extends BaseController {
return
getDataTable
(
weChatSideVos
);
return
getDataTable
(
weChatSideVos
);
}
}
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
View file @
b824a4d
...
@@ -64,6 +64,9 @@ public class WeMaterialController extends BaseController {
...
@@ -64,6 +64,9 @@ public class WeMaterialController extends BaseController {
list
=
materialService
.
findWeMaterials
(
categoryId
,
search
,
mediaType
);
list
=
materialService
.
findWeMaterials
(
categoryId
,
search
,
mediaType
);
}
}
return
getDataTable
(
list
);
return
getDataTable
(
list
);
}
}
...
...
linkwe-admin/src/main/resources/application.yml
View file @
b824a4d
...
@@ -107,7 +107,7 @@ spring:
...
@@ -107,7 +107,7 @@ spring:
druid
:
druid
:
# 主库数据源
# 主库数据源
master
:
master
:
url
:
jdbc:mysql://127.0.0.1:10179/l
ww?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url
:
jdbc:mysql://127.0.0.1:10179/l
ink-wechat-prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&rewriteBatchedStatements=true
username
:
root
username
:
root
password
:
root
password
:
root
# 从库数据源
# 从库数据源
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeMaterial.java
View file @
b824a4d
package
com
.
linkwechat
.
wecom
.
domain
;
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
...
@@ -61,4 +62,11 @@ public class WeMaterial extends BaseEntity {
...
@@ -61,4 +62,11 @@ public class WeMaterial extends BaseEntity {
@ApiModelProperty
(
"音频时长"
)
@ApiModelProperty
(
"音频时长"
)
private
String
audioTime
;
private
String
audioTime
;
/**
* 素材是否被选中
*/
@TableField
(
exist
=
false
)
private
Boolean
isCheck
=
false
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
View file @
b824a4d
...
@@ -7,10 +7,12 @@ import com.linkwechat.common.config.CosConfig;
...
@@ -7,10 +7,12 @@ import com.linkwechat.common.config.CosConfig;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.dto.WeEmpleCodeDto
;
import
com.linkwechat.wecom.domain.dto.WeEmpleCodeDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
import
com.linkwechat.wecom.domain.dto.customer.CutomerTagEdit
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.factory.WeEventStrategy
;
import
com.linkwechat.wecom.factory.WeEventStrategy
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.*
;
...
@@ -22,6 +24,7 @@ import java.util.ArrayList;
...
@@ -22,6 +24,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
/**
/**
* @author danmo
* @author danmo
...
@@ -56,6 +59,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -56,6 +59,10 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
private
IWeGroupCodeService
weGroupCodeService
;
private
IWeGroupCodeService
weGroupCodeService
;
@Autowired
private
WeCustomerClient
weCustomerClient
;
@Override
@Override
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
if
(
message
.
getExternalUserId
()
!=
null
)
{
if
(
message
.
getExternalUserId
()
!=
null
)
{
...
@@ -165,8 +172,16 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -165,8 +172,16 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
});
});
if
(
weFlowerCustomerTagRelService
.
saveOrUpdateBatch
(
weFlowerCustomerTagRels
)){
//标签同步到企业微信端
weCustomerClient
.
makeCustomerLabel
(
CutomerTagEdit
.
builder
()
.
external_userid
(
externalUserId
)
.
userid
(
userId
)
.
add_tag
(
weFlowerCustomerTagRels
.
stream
()
.
map
(
WeFlowerCustomerTagRel:
:
getTagId
).
toArray
(
String
[]::
new
))
.
build
());
}
weFlowerCustomerTagRelService
.
saveOrUpdateBatch
(
weFlowerCustomerTagRels
);
});
});
// 发送欢迎语
// 发送欢迎语
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
b824a4d
...
@@ -160,22 +160,25 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -160,22 +160,25 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
*/
*/
private
void
weFlowerCustomerHandle
(
String
userId
)
{
private
void
weFlowerCustomerHandle
(
String
userId
)
{
List
<
ExternalUserDetail
>
list
=
new
ArrayList
<>();
List
<
ExternalUserDetail
>
list
=
new
ArrayList
<>();
getByUser
(
userId
,
null
,
list
);
getByUser
(
userId
,
null
,
list
);
List
<
WeCustomer
>
weCustomerList
=
new
ArrayList
<>();
List
<
WeCustomer
>
weCustomerList
=
new
ArrayList
<>();
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
=
new
ArrayList
<>();
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRel
=
new
ArrayList
<>();
List
<
WeFlowerCustomerRel
>
oldWeFlowerCustomerRels
=
new
ArrayList
<>();
list
.
forEach
(
userDetail
->
{
list
.
forEach
(
userDetail
->
{
//客户入库
//客户入库
WeCustomer
weCustomer
=
new
WeCustomer
();
WeCustomer
weCustomer
=
new
WeCustomer
();
BeanUtils
.
copyPropertiesignoreOther
(
userDetail
.
getExternal_contact
(),
weCustomer
);
BeanUtils
.
copyPropertiesignoreOther
(
userDetail
.
getExternal_contact
(),
weCustomer
);
//客户与通讯录客户关系
List
<
WeTag
>
weTags
=
new
ArrayList
<>();
List
<
WeTagGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
=
new
ArrayList
<>();
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRel
=
new
ArrayList
<>();
Optional
.
ofNullable
(
userDetail
.
getFollow_info
()).
ifPresent
(
followInfo
->
{
Optional
.
ofNullable
(
userDetail
.
getFollow_info
()).
ifPresent
(
followInfo
->
{
weCustomer
.
setFirstUserId
(
userId
);
weCustomer
.
setFirstUserId
(
userId
);
...
@@ -195,35 +198,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -195,35 +198,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
List
<
String
>
tags
=
Stream
.
of
(
followInfo
.
getTag_id
()).
collect
(
Collectors
.
toList
());
List
<
String
>
tags
=
Stream
.
of
(
followInfo
.
getTag_id
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
tags
))
{
if
(
CollectionUtil
.
isNotEmpty
(
tags
))
{
//获取相关标签组
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
()
.
tag_id
(
followInfo
.
getTag_id
())
.
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
())
.
build
()
);
List
<
WeCropTagDto
>
weCropTagDtos
=
tagGroup
.
getTag
();
if
(
CollectionUtil
.
isNotEmpty
(
weCropTagDtos
))
{
Map
<
String
,
String
>
map
=
weCropTagDtos
.
stream
().
collect
(
Collectors
.
toMap
(
WeCropTagDto:
:
getId
,
WeCropTagDto:
:
getName
));
tags
.
forEach
(
tag
->
{
if
(
map
.
containsKey
(
tag
))
{
weTags
.
add
(
WeTag
.
builder
()
.
groupId
(
tagGroup
.
getGroup_id
())
.
tagId
(
tag
)
.
name
(
map
.
get
(
tag
))
.
build
()
);
tags
.
stream
().
forEach
(
tag
->{
weFlowerCustomerTagRels
.
add
(
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
WeFlowerCustomerTagRel
.
builder
()
.
userId
(
userId
)
.
userId
(
userId
)
...
@@ -232,25 +208,24 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -232,25 +208,24 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
.
tagId
(
tag
)
.
tagId
(
tag
)
.
build
()
.
build
()
);
);
}
});
});
}
}
});
});
}
oldWeFlowerCustomerRels
.
addAll
(
iWeFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
}
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
weCustomer
.
getExternalUserid
())
}
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
)));
// List<WeFlowerCustomerRel> weFlowerCustomerRels = iWeFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
// .eq(WeFlowerCustomerRel::getExternalUserid, weCustomer.getExternalUserid())
// .eq(WeFlowerCustomerRel::getUserId,userId));
});
});
List
<
WeFlowerCustomerRel
>
weFlowerCustomerRels
=
iWeFlowerCustomerRelService
.
list
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
weCustomer
.
getExternalUserid
())
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
));
if
(
CollectionUtil
.
isNotEmpty
(
weFlowerCustomerRels
))
{
List
<
Long
>
weFlowerCustomerRelIds
=
weFlowerCustomerRels
.
stream
().
map
(
WeFlowerCustomerRel:
:
getId
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
oldWeFlowerCustomerRels
))
{
List
<
Long
>
weFlowerCustomerRelIds
=
oldWeFlowerCustomerRels
.
stream
().
map
(
WeFlowerCustomerRel:
:
getId
).
collect
(
Collectors
.
toList
());
iWeFlowerCustomerTagRelService
.
remove
(
new
LambdaQueryWrapper
<
WeFlowerCustomerTagRel
>()
iWeFlowerCustomerTagRelService
.
remove
(
new
LambdaQueryWrapper
<
WeFlowerCustomerTagRel
>()
.
in
(
WeFlowerCustomerTagRel:
:
getFlowerCustomerRelId
,
weFlowerCustomerRelIds
)
.
in
(
WeFlowerCustomerTagRel:
:
getFlowerCustomerRelId
,
weFlowerCustomerRelIds
)
.
ne
(
WeFlowerCustomerTagRel:
:
getRelTagType
,
new
Integer
(
1
))
.
ne
(
WeFlowerCustomerTagRel:
:
getRelTagType
,
new
Integer
(
1
))
...
@@ -260,15 +235,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -260,15 +235,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
iWeFlowerCustomerRelService
.
saveBatch
(
weFlowerCustomerRel
);
iWeFlowerCustomerRelService
.
saveBatch
(
weFlowerCustomerRel
);
//设置标签跟客户关系,标签和标签组,saveOrUpdate,建立标签与添加人关系
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)
&&
CollectionUtil
.
isNotEmpty
(
weGroups
))
{
iWeTagService
.
saveOrUpdateBatch
(
weTags
);
iWeTagGroupService
.
saveOrUpdateBatch
(
weGroups
);
iWeFlowerCustomerTagRelService
.
saveOrUpdateBatch
(
weFlowerCustomerTagRels
);
iWeFlowerCustomerTagRelService
.
saveOrUpdateBatch
(
weFlowerCustomerTagRels
);
}
});
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerList
)){
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerList
)){
this
.
saveOrUpdateBatch
(
weCustomerList
);
this
.
saveOrUpdateBatch
(
weCustomerList
);
...
@@ -278,34 +245,31 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -278,34 +245,31 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
// List<ExternalUserDetail> list = new ArrayList<>();
// List<ExternalUserDetail> list = new ArrayList<>();
// getByUser(userId, null, list);
// getByUser(userId, null, list);
//
// List<WeCustomer> weCustomerList=new ArrayList<>();
//
// list.forEach(userDetail -> {
// list.forEach(userDetail -> {
// //客户入库
// //客户入库
// WeCustomer weCustomer = new WeCustomer();
// WeCustomer weCustomer = new WeCustomer();
// BeanUtils.copyPropertiesignoreOther(userDetail.getExternal_contact(), weCustomer);
// BeanUtils.copyPropertiesignoreOther(userDetail.getExternal_contact(), weCustomer);
//
//
//
//
//
// this.saveOrUpdate(weCustomer);
//
//
// //客户与通讯录客户关系
// //客户与通讯录客户关系
// List<WeTag> weTags = new ArrayList<>();
// List<WeTag> weTags = new ArrayList<>();
// List<WeTagGroup> weGroups = new ArrayList<>();
// List<WeTagGroup> weGroups = new ArrayList<>();
// List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = new ArrayList<>();
// List<WeFlowerCustomerTagRel> weFlowerCustomerTagRels = new ArrayList<>();
// List<WeFlowerCustomerRel> weFlowerCustomerRel = new ArrayList<>();
// List<WeFlowerCustomerRel> weFlowerCustomerRel = new ArrayList<>();
// Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> {
//
//
// weCustomer.setFirstUserId(userId);
// weCustomer.setFirstAddTime(new Date(followInfo.getCreatetime() * 1000L));
//
//
// weCustomerList.add(weCustomer);
//
//
//
//
// Optional.ofNullable(userDetail.getFollow_info()).ifPresent(followInfo -> {
// Long weFlowerCustomerRelId = SnowFlakeUtil.nextId();
// Long weFlowerCustomerRelId = SnowFlakeUtil.nextId();
// weFlowerCustomerRel.add(WeFlowerCustomerRel.builder()
// weFlowerCustomerRel.add(WeFlowerCustomerRel.builder()
// .id(weFlowerCustomerRelId)
// .id(weFlowerCustomerRelId)
// .userId(userId)
// .userId(userId)
// .description(followInfo.getDescription())
// .remarkCorpName(followInfo.getRemark_company())
// .remarkMobiles(Arrays.stream(followInfo.getRemark_mobiles()).collect(Collectors.joining(",")))
// .operUserid(followInfo.getOper_userid())
// .operUserid(followInfo.getOper_userid())
// .addWay(followInfo.getAdd_way())
// .addWay(followInfo.getAdd_way())
// .externalUserid(weCustomer.getExternalUserid())
// .externalUserid(weCustomer.getExternalUserid())
...
@@ -327,7 +291,6 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -327,7 +291,6 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
// WeTagGroup.builder()
// WeTagGroup.builder()
// .groupId(tagGroup.getGroup_id())
// .groupId(tagGroup.getGroup_id())
// .gourpName(tagGroup.getGroup_name())
// .gourpName(tagGroup.getGroup_name())
//// .createBy(SecurityUtils.getUsername())
// .build()
// .build()
// );
// );
//
//
...
@@ -346,10 +309,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -346,10 +309,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
//
//
// weFlowerCustomerTagRels.add(
// weFlowerCustomerTagRels.add(
// WeFlowerCustomerTagRel.builder()
// WeFlowerCustomerTagRel.builder()
// .userId(userId)
// .externalUserid(weCustomer.getExternalUserid())
// .externalUserid(weCustomer.getExternalUserid())
// .flowerCustomerRelId(weFlowerCustomerRelId)
// .flowerCustomerRelId(weFlowerCustomerRelId)
// .tagId(tag)
// .tagId(tag)
// .createTime(new Date())
// .build()
// .build()
// );
// );
// }
// }
...
@@ -372,7 +335,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -372,7 +335,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
// if (CollectionUtil.isNotEmpty(weFlowerCustomerRels)) {
// if (CollectionUtil.isNotEmpty(weFlowerCustomerRels)) {
// List<Long> weFlowerCustomerRelIds = weFlowerCustomerRels.stream().map(WeFlowerCustomerRel::getId).collect(Collectors.toList());
// List<Long> weFlowerCustomerRelIds = weFlowerCustomerRels.stream().map(WeFlowerCustomerRel::getId).collect(Collectors.toList());
// iWeFlowerCustomerTagRelService.remove(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
// iWeFlowerCustomerTagRelService.remove(new LambdaQueryWrapper<WeFlowerCustomerTagRel>()
// .in(WeFlowerCustomerTagRel::getFlowerCustomerRelId, weFlowerCustomerRelIds));
// .in(WeFlowerCustomerTagRel::getFlowerCustomerRelId, weFlowerCustomerRelIds)
// .ne(WeFlowerCustomerTagRel::getRelTagType,new Integer(1))
// );
// iWeFlowerCustomerRelService.removeByIds(weFlowerCustomerRelIds);
// iWeFlowerCustomerRelService.removeByIds(weFlowerCustomerRelIds);
// }
// }
//
//
...
@@ -385,7 +350,13 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -385,7 +350,13 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
// iWeTagGroupService.saveOrUpdateBatch(weGroups);
// iWeTagGroupService.saveOrUpdateBatch(weGroups);
// iWeFlowerCustomerTagRelService.saveOrUpdateBatch(weFlowerCustomerTagRels);
// iWeFlowerCustomerTagRelService.saveOrUpdateBatch(weFlowerCustomerTagRels);
// }
// }
//
// });
// });
//
// if(CollectionUtil.isNotEmpty(weCustomerList)){
// this.saveOrUpdateBatch(weCustomerList);
// }
}
}
/**
/**
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
b824a4d
...
@@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -298,7 +298,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
FROM
we_customer wc
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.external_userid=wc.external_userid AND wfctr.
rel_tag_type=1
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.external_userid=wc.external_userid AND wfctr.
user_id=wc.first_user_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
where wc.del_flag=0
where wc.del_flag=0
<if
test=
"name != null and name !=''"
>
<if
test=
"name != null and name !=''"
>
...
...
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