Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
2a3f92a3
Commit
2a3f92a3
authored
Jul 28, 2023
by
龙于生
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
我的客户、所有客户界面接口新增筛选条件:未跟进天数、跟进总次数、行业
parent
a03ba7f1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
337 additions
and
68 deletions
+337
-68
src/main/java/cn/timer/api/controller/crm/CrmController.java
+104
-66
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
+41
-0
src/main/resources/mapping/crm/CrmClientDataMapper.xml
+192
-2
No files found.
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
2a3f92a3
...
...
@@ -522,10 +522,11 @@ public class CrmController {
// 归属我的客户
private
List
<
CrmClientData
>
getMyCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
)
{
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
,
Integer
industry
)
{
return
CrmClientData
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
CrmClientData:
:
getBelongUser
,
empNum
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
groupId
!=
null
&&
groupId
>
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
...
...
@@ -566,26 +567,37 @@ public class CrmController {
// 我的全部客户
private
List
<
CrmClientData
>
getMyTotalCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
Integer
typei
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
null
,
null
,
null
,
null
),
true
);
String
like
,
Integer
typei
,
Integer
industry
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
,
industry
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
null
,
null
,
null
,
null
),
true
);
}
// 我关注的客户
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
,
Integer
industry
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
,
industry
).
stream
()
.
filter
(
item
->
item
.
getStar
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
}
// 七天未跟进的客户
private
List
<
CrmClientData
>
getCilentFollowOvertime
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
Integer
status
,
Integer
typei
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
,
null
).
stream
()
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
-
7
)))
.
collect
(
Collectors
.
toList
());
}
private
List
<
CrmClientData
>
getCilentFollowNotDays
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
,
Integer
industry
,
Integer
unfollowedDays
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
industry
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
),
true
).
stream
()
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
0
-
unfollowedDays
)))
.
collect
(
Collectors
.
toList
());
}
private
<
T
>
List
<
T
>
getPageList
(
List
<
T
>
list
,
int
pageNumber
,
int
pageSize
,
Comparator
<
T
>
comparator
)
{
return
list
.
stream
().
sorted
(
comparator
).
skip
((
pageNumber
-
1
)
*
pageSize
).
limit
(
pageSize
)
.
collect
(
Collectors
.
toList
());
...
...
@@ -604,31 +616,39 @@ public class CrmController {
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
Integer
typei
)
{
@RequestParam
(
required
=
false
)
Integer
typei
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
@RequestParam
(
required
=
false
)
Integer
followNumber
,
@RequestParam
(
required
=
false
)
Integer
industry
)
{
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)+
" 23:59:59"
;
}
if
(
endFollowTime
!=
null
&&
!(
""
).
equals
(
endFollowTime
))
{
endFollowTime
=
endFollowTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
if
(
endFollowTime
!=
null
&&
!(
""
).
equals
(
endFollowTime
))
{
endFollowTime
=
endFollowTime
.
substring
(
0
,
10
)+
" 23:59:59"
;
}
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
List
<
CrmClientData
>
crmClientDatas
=
null
;
if
(
type
==
null
||
type
==
0
)
{
// 全部客户(去重)
List
<
CrmClientData
>
myClient
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
//List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei,industry);
List
<
CrmClientData
>
myClient
=
crmClientDataMapper
.
getCrmClientData
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
unfollowedDays
,
followNumber
,
industry
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
crmClientDatas
=
CheckUtil
.
distinct
(
myClient
,
myAsso
,
true
).
stream
()
.
filter
(
CheckUtil
.
distinctByKey
(
CrmClientData:
:
getId
)).
collect
(
Collectors
.
toList
());
// if (unfollowedDays != null){
// crmClientDatas = getCilentFollowNotDays(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei,industry,unfollowedDays);
// }
}
else
if
(
type
==
1
)
// 我负责的客户
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
industry
);
else
if
(
type
==
2
)
// 我协作的客户
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
else
if
(
type
==
3
)
// 我关注的客户
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
typei
,
industry
);
else
if
(
type
==
4
)
// 七天未跟进的客户
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
else
return
ResultUtil
.
error
(
"查询失败"
);
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
...
...
@@ -693,6 +713,7 @@ public class CrmController {
public
Result
<
List
<
CrmClientData
>>
getSeaCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
Integer
industry
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
...
...
@@ -713,6 +734,7 @@ public class CrmController {
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
...
...
@@ -741,6 +763,7 @@ public class CrmController {
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
...
...
@@ -761,14 +784,17 @@ public class CrmController {
@ApiOperation
(
value
=
"获取所有客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getAllCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
String
customerowner
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
String
customerowner
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
String
ifPhone
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
@RequestParam
(
required
=
false
)
Integer
followNumber
,
@RequestParam
(
required
=
false
)
Integer
industry
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
...
...
@@ -806,45 +832,52 @@ public class CrmController {
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
"0,1"
)
.
count
();
if
(
count
>
0
)
{
if
(
count
>
0
)
{
//qw -> qw.like(ZpglRcxx::getName, query).or().eq(ZpglRcxx::getMobile, query).or().eq(ZpglRcxx::getMail, query)
datas
=
CrmClientData
.
builder
().
build
().
selectPage
(
page
,
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
}
else
{
if
(
grouplis
.
size
()
>
0
&&
grouplis
!=
null
)
{
// datas = CrmClientData.builder().build().selectPage(page,
// new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type)
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
// .orderByDesc(CrmClientData::getCreateTime));
datas
=
crmClientDataMapper
.
getCrmClientData1
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
}
else
{
if
(
grouplis
.
size
()>
0
&&
grouplis
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
for
(
CrmBusinessGroupMember
grp
:
grouplis
)
{
for
(
CrmBusinessGroupMember
grp
:
grouplis
)
{
sb
.
append
(
grp
.
getGid
()).
append
(
","
);
}
keywordStr
=
sb
.
deleteCharAt
(
sb
.
length
()
-
1
).
toString
();
}
datas
=
CrmClientData
.
builder
().
build
().
selectPage
(
page
,
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
).
in
(
CrmClientData:
:
getBelongGroup
,
keywordStr
)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
// datas = CrmClientData.builder().build().selectPage(page,
// new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).in(CrmClientData::getBelongGroup, keywordStr)
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
// .orderByDesc(CrmClientData::getCreateTime));
datas
=
crmClientDataMapper
.
getCrmClientData2
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
}
...
...
@@ -855,19 +888,24 @@ public class CrmController {
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
for
(
Integer
gid
:
gids
)
{
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientData
>()
.
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
// List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>()
// .lambda().eq(CrmClientData::getBelongGroup, gid)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
List
<
CrmClientData
>
datas
=
crmClientDataMapper
.
getCrmClientData3
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
for
(
CrmClientData
data
:
datas
)
crmClientDatas
.
add
(
data
);
}
...
...
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
View file @
2a3f92a3
...
...
@@ -10,6 +10,9 @@ package cn.timer.api.dao.crm;
import
java.util.List
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
...
@@ -38,4 +41,41 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
@RequestParam
(
name
=
"belongGroup"
,
required
=
false
)
Integer
belongGroup
,
@RequestParam
(
name
=
"startCreateTime"
,
required
=
false
)
String
startCreateTime
,
@RequestParam
(
name
=
"endCreateTime"
,
required
=
false
)
String
endCreateTime
);
List
<
CrmClientData
>
getCrmClientData
(
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"typei"
)
Integer
typei
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
IPage
<
CrmClientData
>
getCrmClientData1
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
IPage
<
CrmClientData
>
getCrmClientData2
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
List
<
CrmClientData
>
getCrmClientData3
(
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
}
\ No newline at end of file
src/main/resources/mapping/crm/CrmClientDataMapper.xml
View file @
2a3f92a3
...
...
@@ -6,11 +6,12 @@
<select
id=
"crmCartogram"
resultType=
"cn.timer.api.dto.crm.CrmCartogramDto"
>
SELECT
province_id,
province as provinceName,count(province_id
) num
province_id,
city as provinceName,count(address
) num
FROM
crm_client_data
WHERE
org_code = #{orgCode}
and client_cellphone != ''
<if
test=
'null != belongUser and belongUser !=""'
>
AND
belong_user = #{belongUser}
</if>
...
...
@@ -24,7 +25,7 @@
create_time
<![CDATA[<=]]>
#{endCreateTime}
</if>
GROUP BY
province_id
city
</select>
<select
id=
"selectCrmCartogramCount"
resultType=
"cn.timer.api.dto.crm.CrmCartogramCountExportDto"
>
SELECT belong_user_name,
...
...
@@ -50,4 +51,192 @@
</where>
GROUP BY ccd.belong_user
</select>
<select
id=
"getCrmClientData"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId > 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"status != null and status > 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"typei != null and typei > 0"
>
AND ccd.client_type = #{typei}
</if>
<if
test=
"startCreateTime != null and endCreateTime != null"
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.belong_user_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow ccf
WHERE ccf.cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select
id=
"getCrmClientData1"
resultType=
"CrmClientData"
>
SELECT ccd.*
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select
id=
"getCrmClientData2"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"keywordStr != null and keywordStr != ''"
>
AND ccd.belong_group IN (${keywordStr})
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
<select
id=
"getCrmClientData3"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.belong_group = #{gid}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
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