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
c16b1b64
Commit
c16b1b64
authored
4 years ago
by
邓实川
Committed by
chenzg
3 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户列表分页 pageNumber,pageSize
parent
8a0d7cd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
13 deletions
+53
-13
src/main/java/cn/timer/api/controller/crm/CrmController.java
+53
-13
No files found.
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
c16b1b64
...
@@ -4,7 +4,6 @@ import java.io.IOException;
...
@@ -4,7 +4,6 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Comparator
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -24,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -24,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
...
@@ -532,12 +533,20 @@ public class CrmController {
...
@@ -532,12 +533,20 @@ public class CrmController {
.
collect
(
Collectors
.
toList
());
.
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
());
}
@GetMapping
(
"getMyCilentTotal"
)
@GetMapping
(
"getMyCilentTotal"
)
@ApiOperation
(
value
=
"获取我的客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取我的客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
CrmClientData
>>
getMyCilentTotal
(
@CurrentUser
UserBean
userBean
,
public
Result
<
List
<
CrmClientData
>>
getMyCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
required
=
false
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
)
{
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
List
<
CrmClientData
>
crmClientDatas
=
null
;
List
<
CrmClientData
>
crmClientDatas
=
null
;
...
@@ -556,8 +565,16 @@ public class CrmController {
...
@@ -556,8 +565,16 @@ public class CrmController {
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
);
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
);
else
else
return
ResultUtil
.
error
(
"查询失败"
);
return
ResultUtil
.
error
(
"查询失败"
);
Collections
.
sort
(
crmClientDatas
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
// 按时间降序排序
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
return
ResultUtil
.
data
(
crmClientDatas
,
"查询成功"
);
// int pageNumber = 1;
// int pageSize = 10;
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
result
.
size
(),
"查询成功"
);
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
private
List
<
Integer
>
MyJoinGroup
(
Integer
empNum
,
Integer
orgCode
)
{
private
List
<
Integer
>
MyJoinGroup
(
Integer
empNum
,
Integer
orgCode
)
{
...
@@ -579,7 +596,9 @@ public class CrmController {
...
@@ -579,7 +596,9 @@ public class CrmController {
@ApiOperation
(
value
=
"获取公海客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取公海客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
CrmClientData
>>
getSeaCilentTotal
(
@CurrentUser
UserBean
userBean
,
public
Result
<
List
<
CrmClientData
>>
getSeaCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
)
{
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
...
@@ -603,7 +622,14 @@ public class CrmController {
...
@@ -603,7 +622,14 @@ public class CrmController {
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
return
ResultUtil
.
data
(
list
,
"查询成功"
);
// int pageNumber = 1;
// int pageSize = 5;
List
<
CrmClientData
>
result
=
getPageList
(
list
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
list
.
size
(),
"查询成功"
);
// return ResultUtil.data(list, "查询成功");
}
else
{
}
else
{
...
@@ -625,7 +651,11 @@ public class CrmController {
...
@@ -625,7 +651,11 @@ public class CrmController {
for
(
CrmClientData
data
:
datas
)
for
(
CrmClientData
data
:
datas
)
crmClientDatas
.
add
(
data
);
crmClientDatas
.
add
(
data
);
}
}
return
ResultUtil
.
data
(
crmClientDatas
,
"查询成功"
);
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
}
}
...
@@ -637,7 +667,9 @@ public class CrmController {
...
@@ -637,7 +667,9 @@ public class CrmController {
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
)
{
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
...
@@ -653,8 +685,10 @@ public class CrmController {
...
@@ -653,8 +685,10 @@ public class CrmController {
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
()
IPage
<
CrmClientData
>
page
=
new
Page
<
CrmClientData
>(
pageNumber
,
pageSize
);
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
IPage
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
().
selectPage
(
page
,
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
...
@@ -664,12 +698,13 @@ public class CrmController {
...
@@ -664,12 +698,13 @@ public class CrmController {
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getCreateTime
,
endFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getCreateTime
,
endFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
return
ResultUtil
.
data
(
datas
,
"查询成功"
);
return
ResultUtil
.
pageData
(
datas
.
getRecords
(),
datas
.
getTotal
(),
"查询成功"
);
}
else
{
}
else
{
// 当前用户管理的组
// 当前用户管理的组
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
Object
>
crmClientDatas
=
new
ArrayList
<
Object
>();
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
for
(
Integer
gid
:
gids
)
{
for
(
Integer
gid
:
gids
)
{
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientData
>()
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientData
>()
.
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
.
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
...
@@ -685,7 +720,12 @@ public class CrmController {
...
@@ -685,7 +720,12 @@ public class CrmController {
for
(
CrmClientData
data
:
datas
)
for
(
CrmClientData
data
:
datas
)
crmClientDatas
.
add
(
data
);
crmClientDatas
.
add
(
data
);
}
}
return
ResultUtil
.
data
(
crmClientDatas
,
"查询成功"
);
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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