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 90400195
authored
Dec 08, 2021
by
linkwechat8856@163.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
客户,客户公海,标签等相关bug修复
1 parent
2b26e802
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
223 additions
and
77 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerSeasController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerSeasService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerSeasServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
View file @
9040019
...
@@ -65,7 +65,7 @@ public class WeCustomerController extends BaseController
...
@@ -65,7 +65,7 @@ public class WeCustomerController extends BaseController
iWeSynchRecordService
.
findUpdateLatestTime
(
SynchRecordConstants
.
SYNCH_CUSTOMER
)
iWeSynchRecordService
.
findUpdateLatestTime
(
SynchRecordConstants
.
SYNCH_CUSTOMER
)
);
//最近同步时间
);
//最近同步时间
dataTable
.
setNoRepeatCustomerTotal
(
dataTable
.
setNoRepeatCustomerTotal
(
weCustomerService
.
noRepeatCountCustomer
()
weCustomerService
.
noRepeatCountCustomer
(
weCustomerList
)
);
//去重客户数
);
//去重客户数
return
dataTable
;
return
dataTable
;
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerSeasController.java
View file @
9040019
...
@@ -37,8 +37,7 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -37,8 +37,7 @@ public class WeCustomerSeasController extends BaseController {
@Autowired
private
IWeMessagePushService
iWeMessagePushService
;
/**
/**
* 客户公海模版下载
* 客户公海模版下载
...
@@ -75,26 +74,62 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -75,26 +74,62 @@ public class WeCustomerSeasController extends BaseController {
if
(
CollectionUtil
.
isEmpty
(
deduplicationSeas
)){
if
(
CollectionUtil
.
isEmpty
(
deduplicationSeas
)){
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
}
}
//
跟根据手机号去重
//
根据手机号去重(去除excel中重复的号码)
List
<
WeCustomerSeas
>
deduplicationSeasNoRepeat
=
deduplicationSeas
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
List
<
WeCustomerSeas
>
deduplicationSeasNoRepeat
=
deduplicationSeas
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
WeCustomerSeas
::
getPhone
))),
ArrayList:
:
new
));
new
TreeSet
<>(
Comparator
.
comparing
(
WeCustomerSeas
::
getPhone
))),
ArrayList:
:
new
));
Long
tabaleExcelId
=
SnowFlakeUtil
.
nextId
();
List
<
String
>
userIds
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserId
().
split
(
","
));
//根据手机号去除数据库与excel中重复号码
List
<
String
>
userNames
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserName
().
split
(
","
));
List
<
WeCustomerSeas
>
dbExist
=
iWeCustomerSeasService
.
list
(
new
LambdaQueryWrapper
<
WeCustomerSeas
>()
.
in
(
WeCustomerSeas:
:
getPhone
,
deduplicationSeasNoRepeat
.
stream
()
IntStream
.
range
(
0
,
deduplicationSeasNoRepeat
.
size
()).
forEach
(
i
->{
.
map
(
WeCustomerSeas:
:
getPhone
).
collect
(
Collectors
.
toList
())));
WeCustomerSeas
k
=
deduplicationSeasNoRepeat
.
get
(
i
);
if
(
CollectionUtil
.
isNotEmpty
(
dbExist
)){
if
(
Objects
.
nonNull
(
k
)){
List
<
WeCustomerSeas
>
noRepetWeCustomerSeas
k
.
setTagIds
(
weCustomerSea
.
getTagIds
());
=
deduplicationSeasNoRepeat
.
stream
().
filter
(
item
->
k
.
setTagNames
(
weCustomerSea
.
getTagNames
());
!
dbExist
.
stream
().
map
(
e
->
e
.
getPhone
()).
collect
(
Collectors
.
toList
())
k
.
setAddUserId
(
userIds
.
get
(
Math
.
floorMod
(
i
,
userIds
.
size
())));
.
contains
(
item
.
getPhone
())).
collect
(
Collectors
.
toList
());
k
.
setAddUserName
(
userNames
.
get
(
Math
.
floorMod
(
i
,
userNames
.
size
())));
deduplicationSeasNoRepeat
.
clear
();
k
.
setTableExcelName
(
file
.
getOriginalFilename
());
deduplicationSeasNoRepeat
.
addAll
(
k
.
setTableExcelId
(
tabaleExcelId
);
noRepetWeCustomerSeas
}
);
});
}
iWeCustomerSeasService
.
saveBatch
(
deduplicationSeasNoRepeat
);
if
(
CollectionUtil
.
isNotEmpty
(
deduplicationSeasNoRepeat
)){
Long
tabaleExcelId
=
SnowFlakeUtil
.
nextId
();
List
<
String
>
userIds
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserId
().
split
(
","
));
List
<
String
>
userNames
=
ListUtil
.
toList
(
weCustomerSea
.
getAddUserName
().
split
(
","
));
IntStream
.
range
(
0
,
deduplicationSeasNoRepeat
.
size
()).
forEach
(
i
->{
WeCustomerSeas
k
=
deduplicationSeasNoRepeat
.
get
(
i
);
if
(
Objects
.
nonNull
(
k
)){
k
.
setTagIds
(
weCustomerSea
.
getTagIds
());
k
.
setTagNames
(
weCustomerSea
.
getTagNames
());
k
.
setAddUserId
(
userIds
.
get
(
Math
.
floorMod
(
i
,
userIds
.
size
())));
k
.
setAddUserName
(
userNames
.
get
(
Math
.
floorMod
(
i
,
userNames
.
size
())));
k
.
setTableExcelName
(
file
.
getOriginalFilename
());
k
.
setTableExcelId
(
tabaleExcelId
);
}
});
if
(
iWeCustomerSeasService
.
saveBatch
(
deduplicationSeasNoRepeat
)){
//发送提醒
deduplicationSeasNoRepeat
.
stream
().
collect
(
Collectors
.
groupingBy
(
WeCustomerSeas:
:
getAddUserId
)).
forEach
((
k
,
v
)->{
iWeCustomerSeasService
.
remidUser
(
ListUtil
.
toList
(
k
),
v
.
size
());
});
}
}
}
else
{
}
else
{
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
}
}
...
@@ -114,10 +149,11 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -114,10 +149,11 @@ public class WeCustomerSeasController extends BaseController {
startPage
();
startPage
();
List
<
WeCustomerSeas
>
weCustomerSeas
=
iWeCustomerSeasService
.
list
(
List
<
WeCustomerSeas
>
weCustomerSeas
=
iWeCustomerSeasService
.
list
(
new
LambdaQueryWrapper
<
WeCustomerSeas
>()
new
LambdaQueryWrapper
<
WeCustomerSeas
>()
.
eq
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getPhone
()),
WeCustomerSeas:
:
getPhone
,
weCustomerSea
.
getPhone
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getPhone
()),
WeCustomerSeas:
:
getPhone
,
weCustomerSea
.
getPhone
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getCustomerName
()),
WeCustomerSeas:
:
getCustomerName
,
weCustomerSea
.
getCustomerName
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getCustomerName
()),
WeCustomerSeas:
:
getCustomerName
,
weCustomerSea
.
getCustomerName
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getAddUserName
()),
WeCustomerSeas:
:
getAddUserName
,
weCustomerSea
.
getAddUserName
())
.
like
(
StringUtils
.
isNotEmpty
(
weCustomerSea
.
getAddUserName
()),
WeCustomerSeas:
:
getAddUserName
,
weCustomerSea
.
getAddUserName
())
.
eq
(
weCustomerSea
.
getAddState
()
!=
null
,
WeCustomerSeas:
:
getAddState
,
weCustomerSea
.
getAddState
())
.
eq
(
weCustomerSea
.
getAddState
()
!=
null
,
WeCustomerSeas:
:
getAddState
,
weCustomerSea
.
getAddState
())
.
orderByDesc
(
WeCustomerSeas:
:
getCreateTime
)
);
);
return
getDataTable
(
weCustomerSeas
);
return
getDataTable
(
weCustomerSeas
);
...
@@ -152,9 +188,8 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -152,9 +188,8 @@ public class WeCustomerSeasController extends BaseController {
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerSeas
)){
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerSeas
)){
weCustomerSeas
.
stream
().
collect
(
Collectors
.
groupingBy
(
WeCustomerSeas:
:
getAddUserId
)).
forEach
((
k
,
v
)->{
weCustomerSeas
.
stream
().
collect
(
Collectors
.
groupingBy
(
WeCustomerSeas:
:
getAddUserId
)).
forEach
((
k
,
v
)->{
iWeCustomerSeasService
.
remidUser
(
ListUtil
.
toList
(
k
),
v
.
size
());
iWeMessagePushService
.
pushMessageSelfH5
(
ListUtil
.
toList
(
k
),
"管理员给你分配了"
+
v
.
size
()+
"个客户还未添加,快去复制电话号码添加客户吧,"
,
CommunityTaskType
.
SEAS
.
getType
());
});
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
View file @
9040019
...
@@ -21,7 +21,7 @@ public class WeCustomerList {
...
@@ -21,7 +21,7 @@ public class WeCustomerList {
//客户名称
//客户名称
private
String
customerName
;
private
String
customerName
;
//客户类型
//客户类型
1:微信用户,2:企业用户
private
Integer
customerType
;
private
Integer
customerType
;
//查询标签id(企业标签id)
//查询标签id(企业标签id)
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
View file @
9040019
...
@@ -74,7 +74,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
...
@@ -74,7 +74,7 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
* 去重复统计
* 去重复统计
* @return
* @return
*/
*/
long
noRepeatCountCustomer
();
long
noRepeatCountCustomer
(
@Param
(
"weCustomerList"
)
WeCustomerList
weCustomerList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerSeasService.java
View file @
9040019
...
@@ -14,4 +14,7 @@ public interface IWeCustomerSeasService extends IService<WeCustomerSeas> {
...
@@ -14,4 +14,7 @@ public interface IWeCustomerSeasService extends IService<WeCustomerSeas> {
List
<
CustomerSeasRecordVo
>
findSeasRecord
(
Integer
groupByType
);
List
<
CustomerSeasRecordVo
>
findSeasRecord
(
Integer
groupByType
);
void
remidUser
(
List
<
String
>
addUserIds
,
Integer
customerNum
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
View file @
9040019
...
@@ -128,7 +128,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
...
@@ -128,7 +128,7 @@ public interface IWeCustomerService extends IService<WeCustomer>
* 去重统计
* 去重统计
* @return
* @return
*/
*/
long
noRepeatCountCustomer
();
long
noRepeatCountCustomer
(
WeCustomerList
weCustomerList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerSeasServiceImpl.java
View file @
9040019
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
cn.hutool.core.collection.ListUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.enums.CommunityTaskType
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.wecom.domain.WeCustomerSeas
;
import
com.linkwechat.wecom.domain.WeCustomerSeas
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasCountVo
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasCountVo
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo
;
import
com.linkwechat.wecom.domain.vo.CustomerSeasRecordVo
;
import
com.linkwechat.wecom.mapper.WeCustomerSeasMapper
;
import
com.linkwechat.wecom.mapper.WeCustomerSeasMapper
;
import
com.linkwechat.wecom.service.IWeCustomerSeasService
;
import
com.linkwechat.wecom.service.IWeCustomerSeasService
;
import
com.linkwechat.wecom.service.IWeMessagePushService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.*
;
@Service
@Service
public
class
WeCustomerSeasServiceImpl
extends
ServiceImpl
<
WeCustomerSeasMapper
,
WeCustomerSeas
>
implements
IWeCustomerSeasService
{
public
class
WeCustomerSeasServiceImpl
extends
ServiceImpl
<
WeCustomerSeasMapper
,
WeCustomerSeas
>
implements
IWeCustomerSeasService
{
@Autowired
private
IWeMessagePushService
iWeMessagePushService
;
@Override
@Override
public
CustomerSeasCountVo
countCustomerSeas
()
{
public
CustomerSeasCountVo
countCustomerSeas
()
{
...
@@ -31,4 +33,12 @@ public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper,
...
@@ -31,4 +33,12 @@ public class WeCustomerSeasServiceImpl extends ServiceImpl<WeCustomerSeasMapper,
return
this
.
baseMapper
.
findSeasRecord
(
groupByType
);
return
this
.
baseMapper
.
findSeasRecord
(
groupByType
);
}
}
@Override
@Async
public
void
remidUser
(
List
<
String
>
addUserIds
,
Integer
customerNum
)
{
iWeMessagePushService
.
pushMessageSelfH5
(
addUserIds
,
"管理员给你分配了"
+
customerNum
+
"个客户还未添加,快去复制电话号码添加客户吧,"
,
CommunityTaskType
.
SEAS
.
getType
());
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
9040019
...
@@ -134,6 +134,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -134,6 +134,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
WeCustomer
weCustomer
=
new
WeCustomer
();
WeCustomer
weCustomer
=
new
WeCustomer
();
BeanUtils
.
copyPropertiesignoreOther
(
userDetail
.
getExternal_contact
(),
weCustomer
);
BeanUtils
.
copyPropertiesignoreOther
(
userDetail
.
getExternal_contact
(),
weCustomer
);
weCustomer
.
setCustomerType
(
userDetail
.
getExternal_contact
().
getType
());
weCustomer
.
setCustomerType
(
userDetail
.
getExternal_contact
().
getType
());
weCustomer
.
setCustomerName
(
userDetail
.
getExternal_contact
().
getName
());
Optional
.
ofNullable
(
userDetail
.
getFollow_info
()).
ifPresent
(
followInfo
->
{
Optional
.
ofNullable
(
userDetail
.
getFollow_info
()).
ifPresent
(
followInfo
->
{
weCustomer
.
setFirstUserId
(
followInfo
.
getUserid
());
weCustomer
.
setFirstUserId
(
followInfo
.
getUserid
());
...
@@ -792,9 +793,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -792,9 +793,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
* @return
* @return
*/
*/
@Override
@Override
public
long
noRepeatCountCustomer
()
{
public
long
noRepeatCountCustomer
(
WeCustomerList
weCustomerList
)
{
return
this
.
baseMapper
.
noRepeatCountCustomer
();
return
this
.
baseMapper
.
noRepeatCountCustomer
(
weCustomerList
);
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMessagePushServiceImpl.java
View file @
9040019
...
@@ -125,7 +125,7 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
...
@@ -125,7 +125,7 @@ public class WeMessagePushServiceImpl implements IWeMessagePushService {
if
(
StringUtils
.
isEmpty
(
validWeCorpAccount
.
getSeasRedirectUrl
())){
if
(
StringUtils
.
isEmpty
(
validWeCorpAccount
.
getSeasRedirectUrl
())){
throw
new
WeComException
(
"客户公海H5跳转链接不可为空"
);
throw
new
WeComException
(
"客户公海H5跳转链接不可为空"
);
}
}
URLEncoder
.
encode
(
String
.
format
(
"%s?corpId=%s&agentId=%s"
,
REDIRECT_URI
=
URLEncoder
.
encode
(
String
.
format
(
"%s?corpId=%s&agentId=%s"
,
validWeCorpAccount
.
getSeasRedirectUrl
()
validWeCorpAccount
.
getSeasRedirectUrl
()
,
corpId
,
agentId
));
,
corpId
,
agentId
));
}
else
{
//群sop与老客标签建群
}
else
{
//群sop与老客标签建群
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
View file @
9040019
...
@@ -69,24 +69,37 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
...
@@ -69,24 +69,37 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper, WeTagGr
List
<
WeTag
>
weTags
=
weTagGroup
.
getWeTags
();
List
<
WeTag
>
weTags
=
weTagGroup
.
getWeTags
();
if
(
CollectionUtil
.
isEmpty
(
weTags
))
{
if
(
this
.
save
(
weTagGroup
)){
this
.
save
(
weTagGroup
);
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
}
else
{
weTags
.
stream
().
forEach
(
k
->{
k
.
setGroupId
(
weTagGroup
.
getGroupId
());
//个人标签同步,企业微信
});
if
(
weTagGroup
.
getGroupTagType
().
equals
(
new
Integer
(
1
))){
weTagGroup
.
setAddWeTags
(
//客户标签
weTags
if
(
weTagGroup
.
getGroupTagType
().
equals
(
new
Integer
(
1
))){
);
weTagGroup
.
setAddWeTags
(
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
weTags
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
))
{
);
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
()),
false
);
WeCropGropTagDtlDto
weCropGropTagDtlDto
=
weCropTagClient
.
addCorpTag
(
WeCropGroupTagDto
.
transformAddTag
(
weTagGroup
));
if
(
weCropGropTagDtlDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
))
{
this
.
batchSaveOrUpdateTagGroupAndTag
(
ListUtil
.
toList
(
weCropGropTagDtlDto
.
getTag_group
()),
false
);
}
}
else
{
iWeTagService
.
saveBatch
(
weTags
);
}
}
}
else
{
iWeTagService
.
saveBatch
(
weTags
);
}
}
}
}
// if (CollectionUtil.isEmpty(weTags)) {
// this.save(weTagGroup);
// } else {
//
//
//
// }
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
9040019
...
@@ -32,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -32,6 +32,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND wc.gender=#{weCustomerList.gender}
AND wc.gender=#{weCustomerList.gender}
</if>
</if>
<if
test=
"weCustomerList.trackState !=null"
>
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if
test=
"weCustomerList.addMethod !=null"
>
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if
test=
"weCustomerList.customerType !=null"
>
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if
test=
"weCustomerList.externalUserid !=null"
>
<if
test=
"weCustomerList.externalUserid !=null"
>
AND wc.external_userid=#{weCustomerList.externalUserid}
AND wc.external_userid=#{weCustomerList.externalUserid}
</if>
</if>
...
@@ -69,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -69,7 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</foreach>
</if>
</if>
<if
test=
"weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"
>
<if
test=
"weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"
>
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.
beginTime.
endTime}
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if>
</if>
</where>
</where>
GROUP BY wc.external_userid,wc.first_user_id
GROUP BY wc.external_userid,wc.first_user_id
...
@@ -169,12 +181,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -169,12 +181,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
external_userid,
external_userid,
NAME,
NAME,
avatar,
avatar,
type,
customer_
type,
gender,
gender,
unionid,
unionid,
birthday,
birthday,
corp_name,
corp_name,
corp_full_name,
position,
position,
is_open_chat,
is_open_chat,
create_time,
create_time,
...
@@ -188,20 +199,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -188,20 +199,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
add_method
add_method
) values
) values
<foreach
collection=
"weCustomers"
item=
"item"
index=
"index"
separator=
","
>
<foreach
collection=
"weCustomers"
item=
"item"
index=
"index"
separator=
","
>
(#{item.externalUserid},#{item.
name},#{item.avatar},#{item.t
ype},#{item.gender}, #{item.unionid},#{item.birthday},
(#{item.externalUserid},#{item.
customerName},#{item.avatar},#{item.customerT
ype},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.
corpFullName},#{item.
position},#{item.isOpenChat}, #{item.createTime},
#{item.corpName},#{item.position},#{item.isOpenChat}, #{item.createTime},
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod}
#{item.createBy},#{item.firstUserId},#{item.firstAddTime},#{item.qq},#{item.email},#{item.address},#{item.phone},#{item.addMethod}
)
)
</foreach>
</foreach>
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null,
VALUES(NAME), we_customer.NAME
),
NAME=IF(we_customer.NAME != null,
we_customer.NAME, VALUES(NAME)
),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar),
type=IF(we_customer.type != null, VALUES(type), we_customer.
type),
customer_type=IF(we_customer.customer_type != null, VALUES(customer_type), we_customer.customer_
type),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday),
corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name),
corp_name=IF(we_customer.corp_name != null, VALUES(corp_name), we_customer.corp_name),
corp_full_name=IF(we_customer.corp_full_name != null, VALUES(corp_full_name), we_customer.corp_full_name),
position=IF(we_customer.position != null, VALUES(position), we_customer.position),
position=IF(we_customer.position != null, VALUES(position), we_customer.position),
is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat),
is_open_chat=IF(we_customer.is_open_chat != null, VALUES(is_open_chat), we_customer.is_open_chat),
first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id),
first_user_id=IF(we_customer.first_user_id != null, VALUES(first_user_id), we_customer.first_user_id),
...
@@ -215,7 +225,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -215,7 +225,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"noRepeatCountCustomer"
resultType=
"long"
>
<select
id=
"noRepeatCountCustomer"
resultType=
"long"
>
SELECT COUNT(DISTINCT external_userid) FROM we_customer where del_flag=0
SELECT
COUNT(DISTINCT wc.external_userid)
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.del_flag=0 AND 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
<where>
<if
test=
"weCustomerList.gender !=null"
>
AND wc.gender=#{weCustomerList.gender}
</if>
<if
test=
"weCustomerList.trackState !=null"
>
AND wc.track_state=#{weCustomerList.trackState}
</if>
<if
test=
"weCustomerList.addMethod !=null"
>
AND wc.add_method=#{weCustomerList.addMethod}
</if>
<if
test=
"weCustomerList.customerType !=null"
>
AND wc.customer_type=#{weCustomerList.customerType}
</if>
<if
test=
"weCustomerList.externalUserid !=null"
>
AND wc.external_userid=#{weCustomerList.externalUserid}
</if>
<if
test=
"weCustomerList.firstUserId !=null"
>
AND wc.first_user_id=#{weCustomerList.firstUserId}
</if>
<if
test=
"weCustomerList.departmentIds != null and weCustomerList.departmentIds !=''"
>
<if
test=
"weCustomerList.departmentIds.indexOf(',') != -1"
>
OR wu.department in
<foreach
item=
"item"
index=
"index"
collection=
"weCustomerList.departmentIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
</if>
<if
test=
"weCustomerList.delFlag != null"
>
AND wc.del_flag = #{weCustomerList.delFlag}
</if>
<if
test=
"weCustomerList.name != null and weCustomerList.name !=''"
>
AND wc.`name` like concat('%',#{weCustomerList.name,jdbcType=VARCHAR},'%')
</if>
<if
test=
"weCustomerList.userIds !=null and weCustomerList.userIds !=''"
>
AND wc.first_user_id in
<foreach
collection=
"weCustomerList.userIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"weCustomerList.tagIds !=null and weCustomerList.tagIds !=''"
>
AND wt.tag_id in
<foreach
collection=
"weCustomerList.tagIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"weCustomerList.beginTime !=null and weCustomerList.beginTime != '' and weCustomerList.endTime !='' and weCustomerList.endTime != null"
>
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{weCustomerList.beginTime} AND #{weCustomerList.endTime}
</if>
</where>
</select>
</select>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
View file @
9040019
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<where>
<where>
<if
test=
"delFlag !=null"
>
wg.del_flag=#{delFlag}
</if>
<if
test=
"delFlag !=null"
>
wg.del_flag=#{delFlag}
</if>
<if
test=
"groupName != null and groupName != ''"
>
and wg.group_name like concat('%', #{groupName}, '%')
</if>
<if
test=
"groupName != null and groupName != ''"
>
and wg.group_name like concat('%', #{groupName}, '%')
</if>
<if
test=
"groupLeader != null and groupLeader != ''"
>
and wu.user_name like concat('%', #{groupLeader}, '%')
</if>
<if
test=
"groupLeader != null and groupLeader != ''"
>
and wu.user_name like concat('%', #{groupLeader
Name
}, '%')
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(wg.create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
AND date_format(wg.create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
</if>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
View file @
9040019
...
@@ -3,40 +3,53 @@
...
@@ -3,40 +3,53 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeTagGroupMapper"
>
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeTagGroupMapper"
>
<sql
id=
"selectWeTagGroupVo"
>
select gourp_name, create_time from we_tag_group
</sql>
<resultMap
type=
"WeTagGroup"
id=
"WeTagGroupResult"
>
<resultMap
type=
"WeTagGroup"
id=
"WeTagGroupResult"
>
<result
property=
"gourpName"
column=
"gourp_name"
/>
<result
property=
"gourpName"
column=
"gourp_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<collection
property=
"weTags"
column=
"weTags.id"
ofType=
"com.linkwechat.wecom.domain.WeTag"
>
<collection
property=
"weTags"
<id
property=
"tagId"
column=
"tag_id"
/>
select=
"findWeTag"
<result
property=
"groupId"
column=
"tag_group_id"
/>
column=
"{groupId=group_id}"
>
<result
property=
"name"
column=
"name"
/>
</collection>
</collection>
</resultMap>
</resultMap>
<sql
id=
"selectWeTagGroupVo"
>
select gourp_name, create_time from we_tag_group
<resultMap
id=
"WeTagBaseMapper"
type=
"com.linkwechat.wecom.domain.WeTag"
>
</sql>
<id
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"groupId"
column=
"group_id"
/>
<result
property=
"name"
column=
"name"
/>
</resultMap>
<select
id=
"selectWeTagGroupList"
parameterType=
"WeTagGroup"
resultMap=
"WeTagGroupResult"
>
<select
id=
"selectWeTagGroupList"
parameterType=
"WeTagGroup"
resultMap=
"WeTagGroupResult"
>
SELECT
SELECT
wtg.*,
wtg.*
wt.tag_id ,
wt.group_id,
wt.name,
wtg.create_by,
wtg.group_id as tag_group_id
FROM
FROM
we_tag_group wtg
we_tag_group wtg
LEFT JOIN we_tag wt ON wtg.group_id = wt.group_id
where
where
wtg.del_flag=0 and wt.del_flag=0
wtg.del_flag=0
<if
test=
"gourpName != null and gourpName != ''"
>
and gourp_name like concat('%', #{gourpName}, '%')
</if>
<if
test=
"groupTagType != null"
>
and wtg.group_tag_type=#{groupTagType}
</if>
<if
test=
"groupTagType != null"
>
and wtg.group_tag_type=#{groupTagType}
</if>
ORDER BY wtg.create_time DESC
ORDER BY wtg.create_time DESC
</select>
</select>
<select
id=
"findWeTag"
resultMap=
"WeTagBaseMapper"
>
SELECT
wt.tag_id ,
wt.group_id,
wt.name
FROM
we_tag wt
where
wt.group_id = #{groupId} and wt.del_flag=0
</select>
<select
id=
"getWeTagGroupByIds"
resultMap=
"WeTagGroupResult"
>
<select
id=
"getWeTagGroupByIds"
resultMap=
"WeTagGroupResult"
>
SELECT
SELECT
...
...
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