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
910d1dd8
Commit
910d1dd8
authored
Sep 09, 2021
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:导出修改
parent
94d2b608
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
94 deletions
+57
-94
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+39
-79
dubbo-haoban-manage-web.xml
...3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
+18
-15
No files found.
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
910d1dd8
...
...
@@ -9,25 +9,21 @@ import com.gic.clerk.api.service.ClerkNewService;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.ExcelUtils
;
import
com.gic.enterprise.api.dto.*
;
import
com.gic.enterprise.api.dto.EnterpriseDTO
;
import
com.gic.enterprise.api.service.*
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.EnterpriseService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.PageResult
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.manage.api.dto.*
;
import
com.gic.haoban.manage.api.dto.DepartmentDTO
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.auth.AuthRequestUtil
;
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.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
...
...
@@ -40,21 +36,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@RestController
public
class
StaffController
extends
WebBaseController
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffController
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
StaffController
.
class
);
@Autowired
private
StaffApiService
staffApiService
;
...
...
@@ -112,7 +101,7 @@ public class StaffController extends WebBaseController {
}
@RequestMapping
(
"staff-sel"
)
public
HaobanResponse
staffSel
(
String
staffId
,
String
staffDepartmentRelatedId
)
{
public
HaobanResponse
staffSel
(
String
staffId
)
{
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
List
<
StaffDepartmentRelatedDTO
>
list
=
staffApiService
.
listStaffDepartmentByStaffId
(
staffId
);
List
<
DepartmentDTO
>
departmentList
=
new
ArrayList
<
DepartmentDTO
>();
...
...
@@ -346,15 +335,9 @@ public class StaffController extends WebBaseController {
if
(
enterprise
.
getExpireTime
()
==
null
)
{
if
(
enterprise
.
getEnabledState
()
==
null
)
{
return
false
;
}
else
if
(
enterprise
.
getEnabledState
()
==
1
)
{
return
false
;
}
else
{
return
true
;
}
}
else
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()
&&
enterprise
.
getEnabledState
()
==
1
)
{
return
false
;
}
return
true
;
}
else
return
enterprise
.
getEnabledState
()
!=
1
;
}
else
return
enterprise
.
getExpireTime
().
getTime
()
<=
System
.
currentTimeMillis
()
||
enterprise
.
getEnabledState
()
!=
1
;
}
...
...
@@ -412,7 +395,6 @@ public class StaffController extends WebBaseController {
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
retList
);
//todo 还没好
}
/**
...
...
@@ -483,42 +465,31 @@ public class StaffController extends WebBaseController {
* @Description 会员导出
*/
@RequestMapping
(
"staff-export"
)
public
HaobanResponse
staffExport
(
HttpServletResponse
response
,
HttpServletRequest
request
)
{
BasePageInfo
pageInfo
=
new
BasePageInfo
();
int
pageSize
=
1000
;
int
pageNum
=
1
;
pageInfo
.
setPageNum
(
pageNum
);
pageInfo
.
setPageSize
(
pageSize
);
String
departmentId
=
request
.
getParameter
(
"departmentId"
);
String
stringActiveFlag
=
request
.
getParameter
(
"activeFlag"
);
Integer
activeFlag
=
null
;
if
(
stringActiveFlag
!=
null
)
{
activeFlag
=
Integer
.
parseInt
(
stringActiveFlag
);
}
public
HaobanResponse
staffExport
(
HttpServletResponse
response
,
String
departmentId
,
Integer
activeFlag
,
String
keyWord
,
BasePageInfo
pageInfo
)
{
int
currPage
=
1
;
Page
pageSearch
=
new
Page
<>();
pageSearch
.
setPageSize
(
200
);
pageSearch
.
setCurrentPage
(
currPage
);
List
<
String
>
departmentIdSet
=
new
ArrayList
<>();
departmentIdSet
.
add
(
departmentId
);
LoginDTO
login
=
(
LoginDTO
)
AuthRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
wxEnterpriseName
=
""
;
if
(
enterprise
!=
null
)
{
wxEnterpriseName
=
enterprise
.
getCorpName
();
}
List
<
DepartmentDTO
>
relationList
=
departmentApiService
.
listSonByDepartmentIds
(
departmentIdSet
,
wxEnterpriseId
);
Map
<
String
,
DepartmentDTO
>
departmentMap
=
relationList
.
stream
().
collect
(
Collectors
.
toMap
(
DepartmentDTO:
:
getDepartmentId
,
s
->
s
));
List
<
String
>
departmentIds
=
relationList
.
stream
().
map
(
DepartmentDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
null
,
pageInfo
);
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
);
List
<
StaffDTO
>
list
=
page
.
getResult
();
logger
.
info
(
"pages={},totalPage={}"
,
page
.
getCurrentPage
(),
page
.
getTotalPage
());
while
(
page
.
getCurrentPage
()
<
page
.
getTotalPage
())
{
pageNum
++;
pageInfo
.
setPageNum
(
pageNum
);
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
null
,
pageInfo
);
List
<
StaffDTO
>
sonList
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
sonList
))
{
list
.
addAll
(
sonList
);
Integer
totalPage
=
page
.
getTotalPage
();
if
(
totalPage
>
1
)
{
while
(
totalPage
>=
currPage
)
{
currPage
++;
pageInfo
.
setPageNum
(
currPage
);
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
);
List
<
StaffDTO
>
sonList
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
sonList
))
{
list
.
addAll
(
sonList
);
}
}
logger
.
info
(
"sonList={}"
,
sonList
.
size
());
}
List
<
StaffExportVO
>
voList
=
new
ArrayList
<>();
for
(
StaffDTO
staffDTO
:
list
)
{
...
...
@@ -528,32 +499,21 @@ public class StaffController extends WebBaseController {
vo
.
setStaffName
(
staffDTO
.
getStaffName
());
vo
.
setPosition
(
staffDTO
.
getPostion
());
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
);
vo
.
setActiveFlag
((
staffDTO
.
getActiveFlag
()
==
null
||
staffDTO
.
getActiveFlag
()
==
0
)
?
"否"
:
"是"
);
voList
.
add
(
vo
);
}
//拼接导购信息
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
wxEnterpriseName
=
""
;
if
(
enterprise
!=
null
)
{
wxEnterpriseName
=
enterprise
.
getCorpName
();
}
mergeClerkInfo
(
voList
,
wxEnterpriseId
);
String
fileName
=
wxEnterpriseName
+
"通讯录"
+
DateUtil
.
dateToStr
(
new
Date
(),
DateUtil
.
FORMAT_DATE_8
);
List
<
String
>
fileList
=
new
ArrayList
<>();
List
<
String
>
titleList
=
new
ArrayList
<>();
titleList
.
add
(
"姓名"
);
titleList
.
add
(
"职务"
);
titleList
.
add
(
"部门"
);
titleList
.
add
(
"手机号"
);
titleList
.
add
(
"使用状态"
);
titleList
.
add
(
"关联导购"
);
fileList
.
add
(
"staffName"
);
fileList
.
add
(
"position"
);
fileList
.
add
(
"departmentName"
);
fileList
.
add
(
"phoneNumber"
);
fileList
.
add
(
"activeFlag"
);
fileList
.
add
(
"clerkName"
);
List
<
String
>
fileList
=
Arrays
.
asList
(
"姓名"
,
"职务"
,
"部门"
,
"手机号"
,
"使用状态"
,
"关联导购"
);
List
<
String
>
titleList
=
Arrays
.
asList
(
"staffName"
,
"position"
,
"departmentName"
,
"phoneNumber"
,
"activeFlag"
,
"clerkName"
);
try
{
ExcelUtils
.
csv
(
response
,
request
,
fileName
,
voList
,
fileList
,
titleList
);
ExcelUtils
.
csv
(
response
,
null
,
fileName
,
voList
,
fileList
,
titleList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"导出失败"
);
...
...
@@ -591,17 +551,17 @@ public class StaffController extends WebBaseController {
for
(
StaffExportVO
staffDTO
:
list
)
{
List
<
StaffClerkRelationDTO
>
relationList
=
bindMap
.
get
(
staffDTO
.
getStaffId
());
if
(
CollectionUtils
.
isNotEmpty
(
relationList
))
{
String
clerkName
=
""
;
String
Buffer
clerkName
=
new
StringBuffer
()
;
for
(
StaffClerkRelationDTO
staffClerkRelationDTO
:
relationList
)
{
ClerkDTO
clerk
=
clerkMap
.
get
(
staffClerkRelationDTO
.
getClerkId
());
if
(
clerk
!=
null
)
{
clerkName
+=
clerk
.
getClerkName
()
+
","
;
clerkName
.
append
(
clerk
.
getClerkName
()).
append
(
","
)
;
}
}
if
(
StringUtils
.
isNoneBlank
(
clerkName
))
{
clerkName
=
clerkName
.
substring
(
0
,
clerkName
.
length
()
-
1
);
if
(
StringUtils
.
isNoneBlank
(
clerkName
.
toString
()
))
{
clerkName
=
new
StringBuffer
(
clerkName
.
substring
(
0
,
clerkName
.
length
()
-
1
)
);
}
staffDTO
.
setClerkName
(
clerkName
);
staffDTO
.
setClerkName
(
clerkName
.
toString
()
);
}
}
...
...
haoban-manage3-web/src/main/webapp/WEB-INF/dubbo-haoban-manage-web.xml
View file @
910d1dd8
...
...
@@ -9,27 +9,30 @@
http://www.springframework.org/schema/context/spring-context.xsd
http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"
>
<context:component-scan
base-package=
"com.gic.haoban"
/>
<context:component-scan
base-package=
"com.gic.haoban"
/>
<!-- 应用名称 -->
<dubbo:application
name=
"haoban-manage3-web"
/>
<dubbo:application
name=
"haoban-manage3-web"
/>
<dubbo:protocol
name=
"dubbo"
port=
"30009"
/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
<dubbo:protocol
name=
"dubbo"
port=
"30009"
/>
<!-- 使用zookeeper注册中心暴露服务地址 -->
<!-- <dubbo:registry address="zookeeper://192.168.1.118:2181" protocol="dubbo" id="localAdd"/> -->
<!--<dubbo:registry address="zookeeper://115.159.182.172:2199" protocol="dubbo" id="remoteAdd"/>-->
<!--<dubbo:registry address="zookeeper://localhost:2181|zookeeper://115.159.182.172:2199" protocol="dubbo"/>-->
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.StaffApiService"
id=
"staffApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.StaffClerkRelationApiService"
id=
"staffClerkRelationApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
id=
"wxEnterpriseRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.StaffApiService"
id=
"staffApiService"
timeout=
"15000"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.StaffClerkRelationApiService"
id=
"staffClerkRelationApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService"
id=
"wxEnterpriseRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.ApplicationApiService"
id=
"applicationApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.WxEnterpriseApiService"
id=
"wxEnterpriseApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService"
id=
"clerkMainStoreRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.ClerkMainStoreRelatedApiService"
id=
"clerkMainStoreRelatedApiService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.EnterpriseService"
id=
"enterpriseService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.StoreService"
id=
"storeService"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.DepartmentService"
id=
"departmentService"
/>
<dubbo:reference
interface=
"com.gic.haoban.manage.api.service.DepartmentApiService"
id=
"departmentApiService"
>
...
...
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