Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Link Wechat
Commits
0ea5a396
Commit
0ea5a396
authored
3 years ago
by
linkwechat8856@163.com
Browse files
Options
Download
Email Patches
Plain Diff
修复组织架构删除,群发所有客户的bug
parent
35e6515e
master
back_end_dev_2.0
develop
v2.0.0
v2.0.0.rc.2
v2.0.0.rc.1
v2.0.0.beta.3
v2.0.0.beta.2
v2.0.0.beta.1
v2.0.0-rc.5
v2.0.0-rc.4
v2.0.0-rc.3
v1.5.9
v1.5.8
v1.5.7
v1.5.6
No related merge requests found
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
+1
-1
...c/main/java/com/linkwechat/wecom/client/WeUserClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
+6
-1
...src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
+2
-0
...main/java/com/linkwechat/wecom/domain/WeCustomerList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/ExternalUserDetail.java
+3
-0
...kwechat/wecom/domain/dto/customer/ExternalUserDetail.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeAllocateCustomersVo.java
+31
-0
...com/linkwechat/wecom/domain/vo/WeAllocateCustomersVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
+1
-26
.../wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
+11
-3
...chat/wecom/service/impl/WeCustomerMessageServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessgaeResultServiceImpl.java
+1
-1
...ecom/service/impl/WeCustomerMessgaeResultServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
+11
-3
.../linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
+15
-10
...nkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
+6
-3
...ecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
+5
-2
.../resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
+2
-1
...n/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
+11
-2
...we-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
with
106 additions
and
53 deletions
+106
-53
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
+
1
-
1
View file @
0ea5a396
...
...
@@ -12,7 +12,7 @@ import com.linkwechat.wecom.retry.WeCommonRetryWhen;
* @author: HaoN
* @create: 2020-08-27 16:42
**/
@BaseRequest
(
baseURL
=
"${weComServerUrl}${weComePrefix}"
,
interceptor
=
WeAccessTokenInterceptor
.
class
)
@BaseRequest
(
baseURL
=
"${weComServerUrl}${weComePrefix}"
,
interceptor
=
We
Common
AccessTokenInterceptor
.
class
)
@Retry
(
maxRetryCount
=
"3"
,
maxRetryInterval
=
"1000"
,
condition
=
WeCommonRetryWhen
.
class
)
public
interface
WeUserClient
{
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
+
6
-
1
View file @
0ea5a396
...
...
@@ -171,6 +171,11 @@ public class WeCustomer extends BaseEntity {
private
String
updateBy
;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
private
String
state
;
/**
...
...
@@ -195,7 +200,7 @@ public class WeCustomer extends BaseEntity {
/**
* 0:正常;1:删除
*/
@TableLogic
//
@TableLogic
private
Integer
delFlag
;
//添加方式
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
+
2
-
0
View file @
0ea5a396
...
...
@@ -68,6 +68,8 @@ public class WeCustomerList {
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
birthday
;
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/ExternalUserDetail.java
+
3
-
0
View file @
0ea5a396
...
...
@@ -93,6 +93,9 @@ public class ExternalUserDetail extends WeResultDto {
private
String
oper_userid
;
/**标签**/
private
String
[]
tag_id
;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
private
String
state
;
}
}
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeAllocateCustomersVo.java
+
31
-
0
View file @
0ea5a396
...
...
@@ -28,4 +28,35 @@ public class WeAllocateCustomersVo extends BaseEntity {
/**原拥有着*/
private
String
handoverUserId
;
private
String
avatar
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
birthday
;
//0-未知 1-男性 2-女性
private
Integer
gender
;
//查询标签id
private
String
tagIds
;
//标签名称,使用逗号隔开
private
String
tagNames
;
//跟进人名称
private
String
userName
;
//添加时间
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
firstAddTime
;
}
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
+
1
-
26
View file @
0ea5a396
...
...
@@ -203,23 +203,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
*/
public
List
<
WeCustomerList
>
externalUserIds
(
String
pushRange
,
String
staffId
,
String
department
,
String
tag
)
{
if
(
pushRange
.
equals
(
WeConstans
.
SEND_MESSAGE_CUSTOMER_ALL
))
{
//从redis中读取数据
// List<WeCustomer> customers = redisCache.getCacheList(WeConstans.WECUSTOMERS_KEY);
// if (CollectionUtils.isEmpty(customers)) {
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setDepartmentIds(department);
// customers = weCustomerService.selectWeCustomerAllList(weCustomer);
// redisCache.setCacheList(WeConstans.WECUSTOMERS_KEY, customers);
// redisCache.expire(WeConstans.WECUSTOMERS_KEY,2 * 60L);
// }else{
// return customers;
// }
//
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setDepartmentIds(department);
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
return
weCustomerService
.
findWeCustomerList
(
WeCustomerList
.
builder
()
...
...
@@ -227,7 +211,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
.
departmentIds
(
department
)
.
build
());
}
else
{
//按条件查询客户
...
...
@@ -240,14 +223,6 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
.
departmentIds
(
department
)
.
build
());
// WeCustomer weCustomer = new WeCustomer();
// weCustomer.setUserIds(staffId);
// weCustomer.setTagIds(tag);
// weCustomer.setDepartmentIds(department);
//
//
//
// return weCustomerService.selectWeCustomerListNoRel(weCustomer);
}
}
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessageServiceImpl.java
+
11
-
3
View file @
0ea5a396
...
...
@@ -96,6 +96,7 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
@Override
public
void
sendMessgae
(
CustomerMessagePushDto
customerMessagePushDto
,
long
messageId
,
List
<
WeCustomerList
>
customers
,
List
<
WeGroup
>
groups
)
throws
JsonProcessingException
{
List
<
String
>
msgid
=
new
ArrayList
<>();
//发给客户
...
...
@@ -118,10 +119,17 @@ public class WeCustomerMessageServiceImpl extends ServiceImpl<WeCustomerMessageM
messagePushDto
.
setSender
(
customerMessagePushDto
.
getStaffId
());
childMessage
(
messagePushDto
,
customerMessagePushDto
);
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
()))
{
msgid
.
add
(
sendMessageResultDto
.
getMsgid
());
try
{
SendMessageResultDto
sendMessageResultDto
=
weCustomerMessagePushClient
.
sendCustomerMessageToUser
(
messagePushDto
);
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
sendMessageResultDto
.
getErrcode
()))
{
msgid
.
add
(
sendMessageResultDto
.
getMsgid
());
}
}
catch
(
Exception
e
){
log
.
error
(
"消息发送失败:"
+
e
.
getMessage
());
}
}
});
}
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessgaeResultServiceImpl.java
+
1
-
1
View file @
0ea5a396
...
...
@@ -57,7 +57,7 @@ public class WeCustomerMessgaeResultServiceImpl extends ServiceImpl<WeCustomerMe
customerMessgaeResult
.
setSendTime
(
null
);
customerMessgaeResult
.
setSendType
(
customerMessgaeResult
.
getSettingTime
()
==
null
?
customerMessagePushDto
.
getPushType
()
:
"2"
);
customerMessgaeResult
.
setExternalUserid
(
customer
.
getExternalUserid
());
customerMessgaeResult
.
setExternalName
(
customer
.
getName
());
customerMessgaeResult
.
setExternalName
(
customer
.
get
Customer
Name
());
customerMessgaeResult
.
setUserid
(
customer
.
getFirstUserId
());
customerMessgaeResult
.
setUserName
(
customer
.
getUserName
());
customerMessgaeResult
.
setStatus
(
"0"
);
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
+
11
-
3
View file @
0ea5a396
...
...
@@ -170,6 +170,8 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomer
.
setFirstUserId
(
followInfo
.
getUserid
());
weCustomer
.
setFirstAddTime
(
new
Date
(
followInfo
.
getCreatetime
()
*
1000L
));
weCustomer
.
setAddMethod
(
followInfo
.
getAdd_way
());
weCustomer
.
setState
(
followInfo
.
getState
());
weCustomer
.
setDelFlag
(
new
Integer
(
0
));
weCustomerList
.
add
(
weCustomer
);
List
<
String
>
tags
=
Stream
.
of
(
followInfo
.
getTag_id
()).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
tags
))
{
...
...
@@ -303,10 +305,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
);
if
(
CollectionUtil
.
isNotEmpty
(
weTagList
)){
if
(
addTag
.
size
()!=
weTagList
.
size
()){
new
WeComException
(
"部门标签不存在"
);
throw
new
WeComException
(
"部门标签不存在"
);
}
}
else
{
new
WeComException
(
"部门标签不存在"
);
throw
new
WeComException
(
"部门标签不存在"
);
}
...
...
@@ -374,6 +376,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
}
}
}
}
...
...
@@ -417,7 +423,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
if
(
null
!=
followUser
){
weCustomer
.
setFirstAddTime
(
new
Date
(
followUser
.
getCreatetime
()
*
1000L
));
weCustomer
.
setState
(
followUser
.
getState
());
weCustomer
.
setAddMethod
(
followUser
.
getAddWay
());
weCustomer
.
setDelFlag
(
new
Integer
(
0
));
this
.
baseMapper
.
batchAddOrUpdate
(
ListUtil
.
toList
(
weCustomer
)
);
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
+
15
-
10
View file @
0ea5a396
...
...
@@ -315,16 +315,21 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
});
}
}
else
{
// WeTaskFissionRecord weTaskFissionRecord = weTaskFissionRecordService
// .selectWeTaskFissionRecordByIdAndCustomerId(Long.valueOf(fissionId), unionId);
// Optional.ofNullable(weTaskFissionRecord).orElseThrow(() -> new WeComException("任务记录信息不存在"));
// List<WeFlowerCustomerRel> list = weFlowerCustomerRelService.list(new LambdaQueryWrapper<WeFlowerCustomerRel>()
// .eq(WeFlowerCustomerRel::getState, WeConstans.FISSION_PREFIX + weTaskFissionRecord.getId()));
// List<String> eidList = Optional.ofNullable(list).orElseGet(ArrayList::new).stream()
// .map(WeFlowerCustomerRel::getExternalUserid).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(eidList)) {
// customerList.addAll(weCustomerService.listByIds(eidList));
// }
WeTaskFissionRecord
weTaskFissionRecord
=
weTaskFissionRecordService
.
selectWeTaskFissionRecordByIdAndCustomerId
(
Long
.
valueOf
(
fissionId
),
unionId
);
Optional
.
ofNullable
(
weTaskFissionRecord
).
orElseThrow
(()
->
new
WeComException
(
"任务记录信息不存在"
));
List
<
WeCustomer
>
weCustomers
=
weCustomerService
.
list
(
new
LambdaQueryWrapper
<
WeCustomer
>()
.
eq
(
WeCustomer:
:
getState
,
WeConstans
.
FISSION_PREFIX
+
weTaskFissionRecord
.
getId
()));
List
<
String
>
eidList
=
Optional
.
ofNullable
(
weCustomers
).
orElseGet
(
ArrayList:
:
new
).
stream
()
.
map
(
WeCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtil
.
isNotEmpty
(
eidList
))
{
customerList
.
addAll
(
weCustomerService
.
listByIds
(
eidList
));
}
}
return
customerList
;
}
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
+
6
-
3
View file @
0ea5a396
...
...
@@ -610,12 +610,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email,
address,
phone,
add_method
add_method,
del_flag
) values
<foreach
collection=
"weCustomers"
item=
"item"
index=
"index"
separator=
","
>
(#{item.externalUserid},#{item.name},#{item.avatar},#{item.type},#{item.gender}, #{item.unionid},#{item.birthday},
#{item.corpName},#{item.corpFullName},#{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},
#{item.delFlag}
)
</foreach>
ON DUPLICATE KEY UPDATE
...
...
@@ -635,7 +637,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email=IF(we_customer.email != null, VALUES(email), we_customer.email),
address=IF(we_customer.address != null, VALUES(address), we_customer.address),
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone),
add_method=IF(we_customer.add_method != null, VALUES(add_method), we_customer.add_method);
add_method=IF(we_customer.add_method != null, VALUES(add_method), we_customer.add_method),
del_flag=IF(we_customer.del_flag != null, VALUES(del_flag), we_customer.del_flag);
</insert>
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMessgaeResultMapper.xml
+
5
-
2
View file @
0ea5a396
...
...
@@ -72,11 +72,14 @@
<select
id=
"customerMessagePushs"
resultType=
"com.linkwechat.wecom.domain.vo.WeCustomerMessageResultVo"
>
SELECT
user_name,
GROUP_CONCAT(IFNULL(external_name,chat_name)
SEPARATOR '、'
) customers
GROUP_CONCAT(IFNULL(external_name,chat_name)) customers
FROM
we_customer_messgaeResult
<where>
message_id=#{messageId}
<if
test=
"messageId !=null"
>
AND message_id=#{messageId}
</if>
<if
test=
"status!=null"
>
AND `status`=#{status}
</if>
...
...
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
+
2
-
1
View file @
0ea5a396
...
...
@@ -85,7 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ON DUPLICATE KEY UPDATE
user_id=IF(we_flower_customer_tag_rel.user_id != null, VALUES(user_id), we_flower_customer_tag_rel.user_id),
external_userid=IF(we_flower_customer_tag_rel.external_userid != null, VALUES(external_userid), we_flower_customer_tag_rel.external_userid),
tag_id=IF(we_flower_customer_tag_rel.tag_id != null, VALUES(tag_id), we_flower_customer_tag_rel.tag_id);
tag_id=IF(we_flower_customer_tag_rel.tag_id != null, VALUES(tag_id), we_flower_customer_tag_rel.tag_id),
create_time=IF(we_flower_customer_tag_rel.create_time != null, VALUES(create_time), we_flower_customer_tag_rel.create_time);
</insert>
</mapper>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
+
11
-
2
View file @
0ea5a396
...
...
@@ -156,11 +156,20 @@
wc.`name` as customerName,
wu.user_name as takeUserName,
wac.allocate_time,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id in (wu.department)) as department,
wc.avatar,
wc.birthday,
wc.gender,
GROUP_CONCAT(wt.`tag_id`) as tagIds,
GROUP_CONCAT(wt.`name`) as tagNames,
wu.user_name,
wc.first_add_time
FROM
we_allocate_customer wac
LEFT JOIN we_customer wc ON wac.external_userid=wc.external_userid
LEFT JOIN we_customer wc ON wac.external_userid=wc.external_userid
and wac.takeover_userid=wc.first_user_id
LEFT JOIN we_user wu ON wu.user_id=wac.takeover_userid
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=
"handoverUserId != null and handoverUserId !=''"
>
and wac.handover_userid=#{handoverUserId}
</if>
<if
test=
"beginTime != null and beginTime !='' and endTime != null and endTime !=''"
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment
Menu
Projects
Groups
Snippets
Help