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 ae1d1a26
authored
Dec 14, 2021
by
linkwechat8856@163.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
升级log4j版本防止漏洞;修复在职继承bug;修复通讯录列表查询bug;
1 parent
857f9129
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
273 additions
and
66 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-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
linkwe-admin/src/main/resources/bootstrap.properties
linkwe-common/src/main/java/com/linkwechat/common/enums/AllocateCustomerStatus.java
linkwe-common/src/main/java/com/linkwechat/common/utils/DateUtils.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/aspectj/SynchRecordAop.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerDetail.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerTrajectory.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/AllocateWeCustomerDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/JobExtendsCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeOnTheJobCustomerVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
pom.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
View file @
ae1d1a2
...
@@ -14,6 +14,7 @@ import com.linkwechat.wecom.constants.SynchRecordConstants;
...
@@ -14,6 +14,7 @@ import com.linkwechat.wecom.constants.SynchRecordConstants;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeOnTheJobCustomerVo
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeCustomerTrajectoryService
;
import
com.linkwechat.wecom.service.IWeCustomerTrajectoryService
;
import
com.linkwechat.wecom.service.IWeSynchRecordService
;
import
com.linkwechat.wecom.service.IWeSynchRecordService
;
...
@@ -124,17 +125,21 @@ public class WeCustomerController extends BaseController
...
@@ -124,17 +125,21 @@ public class WeCustomerController extends BaseController
/**
/**
* 在职继承
* 在职继承
* @param we
LeaveUserInfoAllocate
Vo
* @param we
OnTheJobCustomer
Vo
* @return
* @return
*/
*/
@Log
(
title
=
"在职继承"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"在职继承"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/jobExtends"
)
@PostMapping
(
"/jobExtends"
)
public
AjaxResult
jobExtends
(
@RequestBody
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
){
public
AjaxResult
jobExtends
(
@RequestBody
WeOnTheJobCustomerVo
weOnTheJobCustomerVo
){
try
{
weCustomerService
.
allocateOnTheJobCustomer
(
weOnTheJobCustomerVo
);
}
catch
(
Exception
e
){
return
AjaxResult
.
error
(
e
.
getMessage
());
}
weLeaveUserInfoAllocateVo
.
setExtentType
(
new
Integer
(
1
));
weCustomerService
.
allocateWeCustomer
(
weLeaveUserInfoAllocateVo
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
}
}
...
@@ -198,14 +203,17 @@ public class WeCustomerController extends BaseController
...
@@ -198,14 +203,17 @@ public class WeCustomerController extends BaseController
* @return
* @return
*/
*/
@GetMapping
(
"/followUpRecord"
)
@GetMapping
(
"/followUpRecord"
)
public
TableDataInfo
followUpRecord
(
String
externalUserid
,
String
userId
){
public
TableDataInfo
followUpRecord
(
String
externalUserid
,
String
userId
,
Integer
trajectoryType
){
startPage
();
startPage
();
List
<
WeCustomerTrajectory
>
weCustomerTrajectories
=
iWeCustomerTrajectoryService
List
<
WeCustomerTrajectory
>
weCustomerTrajectories
=
iWeCustomerTrajectoryService
.
list
(
new
LambdaQueryWrapper
<
WeCustomerTrajectory
>()
.
list
(
new
LambdaQueryWrapper
<
WeCustomerTrajectory
>()
.
eq
(
trajectoryType
!=
null
,
WeCustomerTrajectory:
:
getTrajectoryType
,
trajectoryType
)
.
eq
(
StringUtils
.
isNotEmpty
(
externalUserid
),
WeCustomerTrajectory:
:
getExternalUserid
,
externalUserid
)
.
eq
(
StringUtils
.
isNotEmpty
(
externalUserid
),
WeCustomerTrajectory:
:
getExternalUserid
,
externalUserid
)
.
eq
(
StringUtils
.
isNotEmpty
(
userId
),
WeCustomerTrajectory:
:
getUserId
,
userId
));
.
eq
(
StringUtils
.
isNotEmpty
(
userId
),
WeCustomerTrajectory:
:
getUserId
,
userId
)
.
orderByDesc
(
WeCustomerTrajectory:
:
getTrackTime
)
);
return
getDataTable
(
weCustomerTrajectories
);
return
getDataTable
(
weCustomerTrajectories
);
}
}
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerSeasController.java
View file @
ae1d1a2
...
@@ -20,6 +20,8 @@ import com.linkwechat.wecom.service.IWeMessagePushService;
...
@@ -20,6 +20,8 @@ import com.linkwechat.wecom.service.IWeMessagePushService;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.text.MessageFormat
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
import
java.util.stream.IntStream
;
...
@@ -63,6 +65,7 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -63,6 +65,7 @@ public class WeCustomerSeasController extends BaseController {
public
AjaxResult
importData
(
MultipartFile
file
,
WeCustomerSeas
weCustomerSea
)
throws
Exception
{
public
AjaxResult
importData
(
MultipartFile
file
,
WeCustomerSeas
weCustomerSea
)
throws
Exception
{
ExcelUtil
<
WeCustomerSeas
>
util
=
new
ExcelUtil
<
WeCustomerSeas
>(
WeCustomerSeas
.
class
);
ExcelUtil
<
WeCustomerSeas
>
util
=
new
ExcelUtil
<
WeCustomerSeas
>(
WeCustomerSeas
.
class
);
List
<
WeCustomerSeas
>
weCustomerSeas
=
util
.
importExcel
(
file
.
getInputStream
());
List
<
WeCustomerSeas
>
weCustomerSeas
=
util
.
importExcel
(
file
.
getInputStream
());
String
tip
=
new
String
(
"成功导入{0}条,去重复{1}条"
);
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerSeas
)){
if
(
CollectionUtil
.
isNotEmpty
(
weCustomerSeas
)){
if
(
StringUtils
.
isEmpty
(
weCustomerSea
.
getAddUserName
())&&
StringUtils
.
isEmpty
(
weCustomerSea
.
getAddUserId
())){
if
(
StringUtils
.
isEmpty
(
weCustomerSea
.
getAddUserName
())&&
StringUtils
.
isEmpty
(
weCustomerSea
.
getAddUserId
())){
...
@@ -124,17 +127,20 @@ public class WeCustomerSeasController extends BaseController {
...
@@ -124,17 +127,20 @@ public class WeCustomerSeasController extends BaseController {
}
}
}
tip
=
MessageFormat
.
format
(
tip
,
new
Object
[]{
new
Integer
(
deduplicationSeasNoRepeat
.
size
()).
toString
(),
new
Integer
(
weCustomerSeas
.
size
()-
deduplicationSeasNoRepeat
.
size
()).
toString
()});
}
else
{
tip
=
MessageFormat
.
format
(
tip
,
new
Object
[]
{
"0"
,
weCustomerSeas
.
size
()
});
}
;
}
else
{
}
else
{
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
return
AjaxResult
.
error
(
"导入用户数据不能为空!"
);
}
}
return
AjaxResult
.
success
();
return
AjaxResult
.
success
(
tip
);
}
}
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
View file @
ae1d1a2
...
@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
...
@@ -6,6 +6,7 @@ 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.exception.CustomException
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.vo.*
;
import
com.linkwechat.wecom.domain.vo.*
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
com.linkwechat.wecom.service.IWeUserService
;
...
@@ -173,8 +174,12 @@ public class WeUserController extends BaseController {
...
@@ -173,8 +174,12 @@ public class WeUserController extends BaseController {
@Log
(
title
=
"同步成员"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"同步成员"
,
businessType
=
BusinessType
.
OTHER
)
@GetMapping
({
"/synchWeUser"
})
@GetMapping
({
"/synchWeUser"
})
public
AjaxResult
synchWeUser
()
{
public
AjaxResult
synchWeUser
()
{
try
{
weUserService
.
synchWeUser
();
}
catch
(
CustomException
e
){
return
AjaxResult
.
error
(
e
.
getMessage
());
}
weUserService
.
synchWeUser
();
return
AjaxResult
.
success
(
WeConstans
.
SYNCH_TIP
);
return
AjaxResult
.
success
(
WeConstans
.
SYNCH_TIP
);
}
}
...
...
linkwe-admin/src/main/resources/bootstrap.properties
View file @
ae1d1a2
linkwechat.nacos.host
=
linkwechat.nacos.port
=
linkwechat.nacos.namespace
=
linkwechat.nacos.username
=
linkwechat.nacos.password
=
\ No newline at end of file
\ No newline at end of file
linkwechat.nacos.host
=
119.45.28.29
linkwechat.nacos.port
=
10848
linkwechat.nacos.namespace
=
627a666a-76b2-42ad-a1b0-70a12d2c73fd
linkwechat.nacos.username
=
nacos
linkwechat.nacos.password
=
jerryjin666
\ No newline at end of file
\ No newline at end of file
linkwe-common/src/main/java/com/linkwechat/common/enums/AllocateCustomerStatus.java
0 → 100644
View file @
ae1d1a2
package
com
.
linkwechat
.
common
.
enums
;
import
java.util.stream.Stream
;
/**
* 客户分配的状态
*/
public
enum
AllocateCustomerStatus
{
JOB_EXTENDS_SUCCESS
(
0
,
"成功发起转接"
),
JOB_EXTENDS_JTWB
(
1
,
"接替完毕"
),
JOB_EXTENDS_DDJT
(
2
,
"等待接替"
),
JOB_EXTENDS_KHJJ
(
3
,
"客户拒绝"
),
JOB_EXTENDS_DDSX
(
4
,
"接替成员客户达到上限"
),
JOB_EXTENDS_WJTJL
(
5
,
"无接替记录"
),
JOB_EXTENDS_BKJC
(
6
,
"当前客户已被继承"
);
private
final
Integer
code
;
private
final
String
info
;
AllocateCustomerStatus
(
Integer
code
,
String
info
)
{
this
.
code
=
code
;
this
.
info
=
info
;
}
public
Integer
getCode
()
{
return
code
;
}
public
String
getInfo
()
{
return
info
;
}
public
static
AllocateCustomerStatus
of
(
Integer
type
){
return
Stream
.
of
(
values
()).
filter
(
s
->
s
.
getCode
().
equals
(
type
)).
findFirst
().
orElseGet
(
null
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/utils/DateUtils.java
View file @
ae1d1a2
...
@@ -3,6 +3,8 @@ package com.linkwechat.common.utils;
...
@@ -3,6 +3,8 @@ package com.linkwechat.common.utils;
import
java.lang.management.ManagementFactory
;
import
java.lang.management.ManagementFactory
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDateTime
;
import
java.time.temporal.ChronoUnit
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -388,5 +390,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
...
@@ -388,5 +390,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
}
}
/**
* 当前时间向推N天
* @param day 小时
* @return String
*/
public
static
String
getBeforeByDayTime
(
int
day
){
LocalDateTime
now
=
LocalDateTime
.
now
();
now
=
now
.
minus
(-
day
,
ChronoUnit
.
DAYS
);
return
now
.
toString
();
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/aspectj/SynchRecordAop.java
View file @
ae1d1a2
...
@@ -44,7 +44,7 @@ public class SynchRecordAop {
...
@@ -44,7 +44,7 @@ public class SynchRecordAop {
.
eq
(
WeSynchRecord:
:
getSynchType
,
annotationLog
.
synchType
())
.
eq
(
WeSynchRecord:
:
getSynchType
,
annotationLog
.
synchType
())
.
between
(
WeSynchRecord:
:
getSynchTime
,
DateUtils
.
getBeforeByHourTime
(
2
)
.
between
(
WeSynchRecord:
:
getSynchTime
,
DateUtils
.
getBeforeByHourTime
(
2
)
,
DateUtils
.
getBeforeByHourTime
(
0
)));
,
DateUtils
.
getBeforeByHourTime
(
0
)));
if
(
CollectionUtil
.
isEmpty
(
weSynchRecords
)||
weSynchRecords
.
size
()<
=
1
){
if
(
CollectionUtil
.
isEmpty
(
weSynchRecords
)||
weSynchRecords
.
size
()<
1
){
joinPoint
.
proceed
();
joinPoint
.
proceed
();
}
else
{
}
else
{
throw
new
CustomException
(
"由于企业微信开放平台的限制,两小时内不得重复同步操作"
);
throw
new
CustomException
(
"由于企业微信开放平台的限制,两小时内不得重复同步操作"
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
View file @
ae1d1a2
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client;
import
com.dtflys.forest.annotation.*
;
import
com.dtflys.forest.annotation.*
;
import
com.linkwechat.wecom.domain.dto.*
;
import
com.linkwechat.wecom.domain.dto.*
;
import
com.linkwechat.wecom.domain.dto.customer.JobExtendsCustomer
;
import
com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor
;
import
com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor
;
...
@@ -86,7 +87,16 @@ public interface WeUserClient {
...
@@ -86,7 +87,16 @@ public interface WeUserClient {
* @return
* @return
*/
*/
@Request
(
url
=
"/externalcontact/transfer_customer"
,
type
=
"POST"
)
@Request
(
url
=
"/externalcontact/transfer_customer"
,
type
=
"POST"
)
WeResultDto
transferCustomer
(
@JSONBody
AllocateWeCustomerDto
allocateWeCustomerDto
);
JobExtendsCustomer
transferCustomer
(
@JSONBody
AllocateWeCustomerDto
allocateWeCustomerDto
);
/**
* 查询客户接替状态
* @param jobExtendsParam
* @return
*/
@Post
(
url
=
"externalcontact/transfer_result"
)
JobExtendsCustomer
transferResult
(
@JSONBody
JobExtendsCustomer
.
JobExtendsParam
jobExtendsParam
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
View file @
ae1d1a2
...
@@ -99,6 +99,9 @@ public class WeCustomer extends BaseEntity {
...
@@ -99,6 +99,9 @@ public class WeCustomer extends BaseEntity {
private
String
state
;
private
String
state
;
private
String
takeoverUserId
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerDetail.java
View file @
ae1d1a2
...
@@ -59,6 +59,9 @@ public class WeCustomerDetail {
...
@@ -59,6 +59,9 @@ public class WeCustomerDetail {
private
List
<
CompanyOrPersonTag
>
personTags
;
private
List
<
CompanyOrPersonTag
>
personTags
;
private
List
<
TrackStates
>
trackStates
;
@Data
@Data
...
@@ -99,6 +102,12 @@ public class WeCustomerDetail {
...
@@ -99,6 +102,12 @@ public class WeCustomerDetail {
//群主
//群主
private
String
leaderName
;
private
String
leaderName
;
//入群方式入群方式。
//1 - 由群成员邀请入群(直接邀请入群)
//2 - 由群成员邀请入群(通过邀请链接入群)
//3 - 通过扫描群二维码入群
private
Integer
joinScene
;
}
}
...
@@ -120,6 +129,7 @@ public class WeCustomerDetail {
...
@@ -120,6 +129,7 @@ public class WeCustomerDetail {
}
}
@Data
@Data
@Builder
public
static
class
TrackStates
{
public
static
class
TrackStates
{
//跟进人
//跟进人
private
String
userName
;
private
String
userName
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerTrajectory.java
View file @
ae1d1a2
...
@@ -23,7 +23,7 @@ import java.util.Date;
...
@@ -23,7 +23,7 @@ import java.util.Date;
public
class
WeCustomerTrajectory
extends
BaseEntity
{
public
class
WeCustomerTrajectory
extends
BaseEntity
{
@TableId
@TableId
private
String
id
;
private
String
id
;
//轨迹类型(1:信息动态;2:社交动态;3:
活动规则
;4:待办动态)
//轨迹类型(1:信息动态;2:社交动态;3:
跟进动态
;4:待办动态)
private
Integer
trajectoryType
;
private
Integer
trajectoryType
;
//外部联系人id
//外部联系人id
private
String
externalUserid
;
private
String
externalUserid
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/AllocateWeCustomerDto.java
View file @
ae1d1a2
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.experimental.SuperBuilder
;
import
lombok.experimental.SuperBuilder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
...
@@ -28,4 +29,6 @@ public class AllocateWeCustomerDto{
...
@@ -28,4 +29,6 @@ public class AllocateWeCustomerDto{
/**转移成功后发给客户的消息,最多200个字符,不填则使用默认文案,目前只对在职成员分配客户的情况生效*/
/**转移成功后发给客户的消息,最多200个字符,不填则使用默认文案,目前只对在职成员分配客户的情况生效*/
private
String
transfer_success_msg
;
private
String
transfer_success_msg
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/JobExtendsCustomer.java
0 → 100644
View file @
ae1d1a2
package
com
.
linkwechat
.
wecom
.
domain
.
dto
.
customer
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.util.List
;
/**
* 在职继承客户
*/
@Data
public
class
JobExtendsCustomer
extends
WeResultDto
{
private
List
<
ExtendsCustomer
>
customer
;
private
String
next_cursor
;
@Data
public
static
class
ExtendsCustomer
{
//客户id
private
String
external_userid
;
//接替状态, 1-接替完毕 2-等待接替 3-客户拒绝 4-接替成员客户达到上限 5-无接替记录
private
Integer
status
;
//接替客户的时间,如果是等待接替状态,则为未来的自动接替时间
private
Long
takeover_time
;
private
Integer
errcode
;
}
@Data
@Builder
public
static
class
JobExtendsParam
{
private
String
handover_userid
;
private
String
takeover_userid
;
private
String
cursor
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeOnTheJobCustomerVo.java
0 → 100644
View file @
ae1d1a2
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
lombok.Data
;
/**
* 在职员工客户分配
*/
@Data
public
class
WeOnTheJobCustomerVo
{
//客户id
private
String
externalUserid
;
//原有人id
private
String
handoverUserId
;
//接手人id
private
String
takeoverUserId
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
View file @
ae1d1a2
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
import
com.linkwechat.wecom.domain.vo.WeCustomerDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeCustomerDetailVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeOnTheJobCustomerVo
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -34,6 +36,15 @@ public interface IWeCustomerService extends IService<WeCustomer>
...
@@ -34,6 +36,15 @@ public interface IWeCustomerService extends IService<WeCustomer>
/**
/**
* 在职员工客户分配
* @param weOnTheJobCustomerVo
*/
void
allocateOnTheJobCustomer
(
WeOnTheJobCustomerVo
weOnTheJobCustomerVo
);
/**
* 客户打标签
* 客户打标签
* @param weMakeCustomerTag
* @param weMakeCustomerTag
*/
*/
...
@@ -42,12 +53,6 @@ public interface IWeCustomerService extends IService<WeCustomer>
...
@@ -42,12 +53,6 @@ public interface IWeCustomerService extends IService<WeCustomer>
// /**
// * 根据员工ID获取客户
// * @param externalUserid
// * @return
// */
// List<WeUser> getCustomersByUserId(String externalUserid);
/**
/**
* 获取客户详情并同步客户数据
* 获取客户详情并同步客户数据
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
ae1d1a2
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
View file @
ae1d1a2
...
@@ -14,13 +14,17 @@ import com.linkwechat.common.core.redis.RedisCache;
...
@@ -14,13 +14,17 @@ import com.linkwechat.common.core.redis.RedisCache;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.Threads
;
import
com.linkwechat.common.utils.spring.SpringUtils
;
import
com.linkwechat.common.utils.spring.SpringUtils
;
import
com.linkwechat.wecom.annotation.SynchRecord
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeMsgAuditClient
;
import
com.linkwechat.wecom.client.WeMsgAuditClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.constants.SynchRecordConstants
;
import
com.linkwechat.wecom.domain.WeCustomerAddUser
;
import
com.linkwechat.wecom.domain.WeCustomerAddUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.WeUserInfoDto
;
import
com.linkwechat.wecom.domain.dto.WeUserInfoDto
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail
;
import
com.linkwechat.wecom.domain.dto.customer.FollowUserList
;
import
com.linkwechat.wecom.domain.dto.customer.FollowUserList
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.vo.*
;
import
com.linkwechat.wecom.domain.vo.*
;
...
@@ -31,6 +35,8 @@ import com.linkwechat.wecom.service.IWeGroupService;
...
@@ -31,6 +35,8 @@ import com.linkwechat.wecom.service.IWeGroupService;
import
com.linkwechat.wecom.service.IWeUserService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -88,6 +94,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -88,6 +94,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
.
like
(
StringUtils
.
isNotEmpty
(
weUser
.
getName
()),
WeUser:
:
getName
,
weUser
.
getName
())
.
like
(
StringUtils
.
isNotEmpty
(
weUser
.
getName
()),
WeUser:
:
getName
,
weUser
.
getName
())
.
eq
(
weUser
.
getIsActivate
()
!=
null
,
WeUser:
:
getIsActivate
,
weUser
.
getIsActivate
())
.
eq
(
weUser
.
getIsActivate
()
!=
null
,
WeUser:
:
getIsActivate
,
weUser
.
getIsActivate
())
.
eq
(
weUser
.
getIsConfigCustomerContact
()
!=
null
,
WeUser:
:
getIsConfigCustomerContact
,
weUser
.
getIsConfigCustomerContact
())
.
eq
(
weUser
.
getIsConfigCustomerContact
()
!=
null
,
WeUser:
:
getIsConfigCustomerContact
,
weUser
.
getIsConfigCustomerContact
())
.
apply
(
StringUtils
.
isNotEmpty
(
weUser
.
getDepartment
()),
"FIND_IN_SET('"
+
weUser
.
getDepartment
()+
"',department)"
)
.
apply
(
StringUtils
.
isNotBlank
(
weUser
.
getBeginTime
()),
.
apply
(
StringUtils
.
isNotBlank
(
weUser
.
getBeginTime
()),
"date_format (create_time,'%Y-%m-%d') >= date_format('"
+
weUser
.
getBeginTime
()
+
"','%Y-%m-%d')"
)
"date_format (create_time,'%Y-%m-%d') >= date_format('"
+
weUser
.
getBeginTime
()
+
"','%Y-%m-%d')"
)
.
apply
(
StringUtils
.
isNotBlank
(
weUser
.
getEndTime
()),
.
apply
(
StringUtils
.
isNotBlank
(
weUser
.
getEndTime
()),
...
@@ -209,51 +216,61 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -209,51 +216,61 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@
Async
@
SynchRecord
(
synchType
=
SynchRecordConstants
.
SYNCH_MAIL_LIST
)
public
void
synchWeUser
()
{
public
void
synchWeUser
()
{
//同步部门
SecurityContext
securityContext
=
SecurityContextHolder
.
getContext
();
SpringUtils
.
getBean
(
IWeDepartmentService
.
class
).
synchWeDepartment
();
//获取通讯录成员列表
//异步同步一下标签库,解决标签不同步问题
List
<
WeUser
>
weUsers
=
weUserClient
.
list
(
WeConstans
.
WE_ROOT_DEPARMENT_ID
,
Threads
.
SINGLE_THREAD_POOL
.
execute
(
new
Runnable
()
{
WeConstans
.
DEPARTMENT_SUB_WEUSER
).
getWeUsers
();
@Override
if
(
CollectionUtil
.
isNotEmpty
(
weUsers
))
{
public
void
run
()
{
//不存在的客户设置为离职未分配状态
SecurityContextHolder
.
setContext
(
securityContext
);
this
.
update
(
WeUser
.
builder
()
//同步部门
SpringUtils
.
getBean
(
IWeDepartmentService
.
class
).
synchWeDepartment
();
//获取通讯录成员列表
List
<
WeUser
>
weUsers
=
weUserClient
.
list
(
WeConstans
.
WE_ROOT_DEPARMENT_ID
,
WeConstans
.
DEPARTMENT_SUB_WEUSER
).
getWeUsers
();
if
(
CollectionUtil
.
isNotEmpty
(
weUsers
))
{
//不存在的客户设置为离职未分配状态
update
(
WeUser
.
builder
()
.
isActivate
(
WeConstans
.
WE_USER_IS_LEAVE
)
.
isActivate
(
WeConstans
.
WE_USER_IS_LEAVE
)
.
isAllocate
(
WeConstans
.
LEAVE_NO_ALLOCATE_STATE
)
.
isAllocate
(
WeConstans
.
LEAVE_NO_ALLOCATE_STATE
)
.
dimissionTime
(
new
Date
())
.
dimissionTime
(
new
Date
())
.
build
(),
new
LambdaQueryWrapper
<
WeUser
>()
.
build
(),
new
LambdaQueryWrapper
<
WeUser
>()
.
notIn
(
WeUser:
:
getUserId
,
weUsers
.
stream
().
map
(
WeUser:
:
getUserId
).
collect
(
Collectors
.
toList
())));
.
notIn
(
WeUser:
:
getUserId
,
weUsers
.
stream
().
map
(
WeUser:
:
getUserId
).
collect
(
Collectors
.
toList
())));
String
[]
noSyncWeUser
=
ruoYiConfig
.
getNoSyncWeUser
();
List
<
List
<
WeUser
>>
lists
=
Lists
.
partition
(
weUsers
,
500
);
if
(
ArrayUtil
.
isNotEmpty
(
noSyncWeUser
)){
for
(
List
<
WeUser
>
list
:
lists
){
weUsers
=
weUsers
.
stream
().
filter
(
o
->
!
ListUtil
.
toList
(
noSyncWeUser
).
contains
(
o
.
getUserId
())).
collect
(
Collectors
.
toList
());
weUserMapper
.
insertBatch
(
list
);
}
}
List
<
List
<
WeUser
>>
lists
=
Lists
.
partition
(
weUsers
,
500
);
for
(
List
<
WeUser
>
list
:
lists
){
this
.
weUserMapper
.
insertBatch
(
list
);
}
//获取外部联系人列表
//获取外部联系人列表
FollowUserList
followUserList
=
weCustomerClient
.
getFollowUserList
();
FollowUserList
followUserList
=
weCustomerClient
.
getFollowUserList
();
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
followUserList
.
getErrcode
())
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
followUserList
.
getErrcode
())
&&
ArrayUtil
.
isNotEmpty
(
followUserList
.
getFollow_user
()))
{
&&
ArrayUtil
.
isNotEmpty
(
followUserList
.
getFollow_user
()))
{
//设置员工是否开启外部联系人功能
//设置员工是否开启外部联系人功能
this
.
update
(
WeUser
.
builder
()
update
(
WeUser
.
builder
()
.
isConfigCustomerContact
(
new
Integer
(
1
))
.
isConfigCustomerContact
(
new
Integer
(
1
))
.
build
(),
new
LambdaQueryWrapper
<
WeUser
>()
.
build
(),
new
LambdaQueryWrapper
<
WeUser
>()
.
eq
(
WeUser:
:
getUserId
,
ListUtil
.
toList
(
followUserList
.
getFollow_user
())));
.
eq
(
WeUser:
:
getUserId
,
ListUtil
.
toList
(
followUserList
.
getFollow_user
())));
}
}
}
}
});
}
}
}
...
@@ -267,13 +284,27 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -267,13 +284,27 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteUser
(
String
[]
userIds
)
{
public
void
deleteUser
(
String
[]
userIds
)
{
List
<
WeUser
>
weUsers
=
new
ArrayList
<>();
List
<
WeUser
>
weUsers
=
new
ArrayList
<>();
CollectionUtil
.
newArrayList
(
userIds
).
forEach
(
userId
->
weUsers
.
add
(
CollectionUtil
.
newArrayList
(
userIds
).
forEach
(
userId
->
{
WeUser
.
builder
()
.
userId
(
userId
)
String
[]
noSyncWeUser
=
ruoYiConfig
.
getNoSyncWeUser
();
.
isActivate
(
WeConstans
.
corpUserEnum
.
ACTIVE_STATE_FIVE
.
getKey
())
.
dimissionTime
(
new
Date
())
if
(
ArrayUtil
.
isNotEmpty
(
noSyncWeUser
)){
.
build
()
if
(
CollectionUtil
.
toList
(
noSyncWeUser
).
contains
(
userId
)){
));
throw
new
WeComException
(
"当前员工不可删除"
);
}
}
weUsers
.
add
(
WeUser
.
builder
()
.
userId
(
userId
)
.
isActivate
(
WeConstans
.
corpUserEnum
.
ACTIVE_STATE_FIVE
.
getKey
())
.
dimissionTime
(
new
Date
())
.
build
()
);
}
);
if
(
this
.
updateBatchById
(
weUsers
)){
if
(
this
.
updateBatchById
(
weUsers
)){
weUsers
.
forEach
(
k
->
weUserClient
.
deleteUserByUserId
(
k
.
getUserId
()));
weUsers
.
forEach
(
k
->
weUserClient
.
deleteUserByUserId
(
k
.
getUserId
()));
}
}
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
ae1d1a2
...
@@ -207,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -207,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null,we_customer.NAME, VALUES(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),
customer_type=IF(we_customer.customer_type != null,
VALUES(customer_type), we_customer.customer_type
),
customer_type=IF(we_customer.customer_type != null,
we_customer.customer_type,VALUES(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),
...
@@ -220,7 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -220,7 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email=IF(we_customer.email != null, VALUES(email), we_customer.email),
email=IF(we_customer.email != null, VALUES(email), we_customer.email),
address=IF(we_customer.address != null, VALUES(address), we_customer.address),
address=IF(we_customer.address != null, VALUES(address), we_customer.address),
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone),
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,
we_customer.add_method, VALUES(add_method)
);
</insert>
</insert>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeGroupMapper.xml
View file @
ae1d1a2
...
@@ -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('%', #{groupLeaderName}, '%')
</if>
<if
test=
"groupLeader
Name != null and groupLeaderName
!= ''"
>
and wu.user_name like concat('%', #{groupLeaderName}, '%')
</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>
...
...
pom.xml
View file @
ae1d1a2
...
@@ -43,6 +43,7 @@
...
@@ -43,6 +43,7 @@
<jsqlparser.version>
4.0
</jsqlparser.version>
<jsqlparser.version>
4.0
</jsqlparser.version>
<nacos.starter.version>
1.0.2
</nacos.starter.version>
<nacos.starter.version>
1.0.2
</nacos.starter.version>
<protobuf.vaersion>
3.18.0
</protobuf.vaersion>
<protobuf.vaersion>
3.18.0
</protobuf.vaersion>
<log4j2.version>
2.16.0
</log4j2.version>
</properties>
</properties>
<!-- 依赖声明 -->
<!-- 依赖声明 -->
...
@@ -308,6 +309,21 @@
...
@@ -308,6 +309,21 @@
</dependency>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-to-slf4j
</artifactId>
<version>
${log4j2.version}
</version>
</dependency>
<dependency>
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j
</artifactId>
<version>
${log4j2.version}
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
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