Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
a1045a1b
Commit
a1045a1b
authored
Dec 21, 2020
by
qwmqiuwenmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
f17a1030
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
19 deletions
+113
-19
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+11
-1
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+30
-18
StaffExportVO.java
...main/java/com/gic/haoban/manage/web/vo/StaffExportVO.java
+72
-0
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
a1045a1b
...
...
@@ -51,6 +51,7 @@ import org.springframework.stereotype.Service;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -209,11 +210,20 @@ public class StaffApiServiceImpl implements StaffApiService {
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
staffIds
.
add
(
tabHaobanStaffDepartmentRelated
.
getStaffId
());
}
Map
<
String
,
TabHaobanStaffDepartmentRelated
>
map
=
new
HashMap
<
String
,
TabHaobanStaffDepartmentRelated
>();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
map
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaffDepartmentRelated:
:
getStaffId
,
Function
.
identity
(),
(
s1
,
s2
)
->
s2
));
}
if
(
staffIds
.
isEmpty
())
{
return
new
Page
<
StaffDTO
>();
}
PageHelper
.
startPage
(
pageInfo
.
getPageNum
(),
pageInfo
.
getPageSize
());
return
PageUtil
.
changePageHelperToCurrentPage
(
staffService
.
pageStaff
(
staffIds
,
activeFlag
,
""
),
StaffDTO
.
class
);
Page
<
StaffDTO
>
page
=
PageUtil
.
changePageHelperToCurrentPage
(
staffService
.
pageStaff
(
staffIds
,
activeFlag
,
""
),
StaffDTO
.
class
);
List
<
StaffDTO
>
staffList
=
page
.
getResult
();
for
(
StaffDTO
staffDTO
:
staffList
)
{
staffDTO
.
setDepartmentIds
(
map
.
get
(
staffDTO
.
getStaffId
())
==
null
?
null
:
map
.
get
(
staffDTO
.
getStaffId
()).
getDepartmentId
());
}
return
page
;
}
@Override
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
a1045a1b
...
...
@@ -27,6 +27,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.vo.ClerkInfoVo
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.haoban.manage.web.vo.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -445,7 +446,7 @@ public class StaffController extends WebBaseController{
* @date 时间: 2020年12月18日 上午11:11:35 <pre>
*/
@RequestMapping
(
"staff-export"
)
public
HaobanResponse
staffExport
(
String
departmentId
,
Integer
activeFlag
,
String
keyWord
,
HttpServletResponse
response
,
HttpServletRequest
request
){
public
HaobanResponse
staffExport
(
String
departmentId
,
HttpServletResponse
response
,
HttpServletRequest
request
){
BasePageInfo
pageInfo
=
new
BasePageInfo
();
int
pageSize
=
1000
;
int
pageNum
=
1
;
...
...
@@ -455,23 +456,28 @@ public class StaffController extends WebBaseController{
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
List
<
String
>
departmentIdSet
=
new
ArrayList
<>();
departmentIdSet
.
add
(
departmentId
);
List
<
Department
DTO
>
sonDepartmentList
=
departmentApiService
.
listSonByDepartmentIds
(
departmentIdSet
,
wxEnterpriseId
);
// Map<String,DepartmentDTO> departmentMap = sonDepartmentList.stream().collect(Collectors.toMap(Departmen
tDTO::getDepartmentId, s -> s));
List
<
String
>
departmentIds
=
sonDepartmentList
.
stream
().
map
(
Departmen
tDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
);
List
<
Department
ShortDTO
>
relationList
=
departmentApiService
.
listAllDepartment
(
wxEnterpriseId
);
Map
<
String
,
DepartmentShortDTO
>
departmentMap
=
relationList
.
stream
().
collect
(
Collectors
.
toMap
(
DepartmentShor
tDTO:
:
getDepartmentId
,
s
->
s
));
List
<
String
>
departmentIds
=
relationList
.
stream
().
map
(
DepartmentShor
tDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
null
,
null
,
pageInfo
);
List
<
StaffDTO
>
list
=
page
.
getResult
();
// List<StaffVO> voList = new ArrayList<>();
// for (StaffDTO staffDTO : list) {
// StaffVO vo = new StaffVO();
// vo.setPhoneNumber(staffDTO.getPhoneNumber());
// vo.setStaffName(staffDTO.getStaffName());
// vo.setPosition(staffDTO.getExtendPostion());
// vo.setDepartmentName(departmentMap.get(staffDTO.getde));
// }
List
<
StaffExportVO
>
voList
=
new
ArrayList
<>();
for
(
StaffDTO
staffDTO
:
list
)
{
StaffExportVO
vo
=
new
StaffExportVO
();
vo
.
setPhoneNumber
(
staffDTO
.
getPhoneNumber
());
vo
.
setStaffName
(
staffDTO
.
getStaffName
());
vo
.
setPosition
(
staffDTO
.
getExtendPostion
());
vo
.
setDepartmentName
(
departmentMap
.
get
(
staffDTO
.
getDepartmentIds
())
==
null
?
null
:
departmentMap
.
get
(
staffDTO
.
getDepartmentIds
()).
getDepartmentName
());
String
active
=
"是"
;
if
(
staffDTO
.
getActiveFlag
()
==
null
||
staffDTO
.
getActiveFlag
()
==
0
){
active
=
"否"
;
}
vo
.
setActiveFlag
(
active
);
}
if
(
page
.
getPages
()
<
page
.
getTotalPage
()){
pageNum
++
;
pageInfo
.
setPageNum
(
pageNum
);
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
);
page
=
staffApiService
.
pageStaff
(
departmentIds
,
null
,
null
,
pageInfo
);
}
List
<
StaffDTO
>
sonList
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
sonList
)){
...
...
@@ -480,18 +486,24 @@ public class StaffController extends WebBaseController{
String
fileName
=
"会员导出"
+
DateUtil
.
dateToStr
(
new
Date
(),
DateUtil
.
FORMAT_DATETIME_14
);
List
<
String
>
fileList
=
new
ArrayList
<>();
List
<
String
>
titleList
=
new
ArrayList
<>();
titleList
.
add
(
"成员名称"
);
titleList
.
add
(
"姓名"
);
titleList
.
add
(
"职务"
);
titleList
.
add
(
"部门"
);
titleList
.
add
(
"手机号"
);
titleList
.
add
(
"
成员职位
"
);
titleList
.
add
(
"
使用状态
"
);
fileList
.
add
(
"staffName"
);
fileList
.
add
(
"phoneNumber"
);
fileList
.
add
(
"extendPostion"
);
fileList
.
add
(
"departmentName"
);
fileList
.
add
(
"position"
);
fileList
.
add
(
"activeFlag"
);
try
{
ExcelUtils
.
csv
(
response
,
request
,
fileName
,
l
ist
,
fileList
,
titleList
);
ExcelUtils
.
csv
(
response
,
request
,
fileName
,
voL
ist
,
fileList
,
titleList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"导出失败"
);
}
return
null
;
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/StaffExportVO.java
0 → 100644
View file @
a1045a1b
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
;
import
java.io.Serializable
;
public
class
StaffExportVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
staffName
;
private
String
phoneNumber
;
private
String
nationCode
;
private
String
position
;
private
String
departmentName
;
private
String
activeFlag
;
public
String
getActiveFlag
()
{
return
activeFlag
;
}
public
void
setActiveFlag
(
String
activeFlag
)
{
this
.
activeFlag
=
activeFlag
;
}
public
String
getStaffName
()
{
return
staffName
;
}
public
void
setStaffName
(
String
staffName
)
{
this
.
staffName
=
staffName
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getNationCode
()
{
return
nationCode
;
}
public
void
setNationCode
(
String
nationCode
)
{
this
.
nationCode
=
nationCode
;
}
public
String
getPosition
()
{
return
position
;
}
public
void
setPosition
(
String
position
)
{
this
.
position
=
position
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
}
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