Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
b2196fef
Commit
b2196fef
authored
Mar 15, 2019
by
gary
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、fixbug
2、用户导出
parent
f3a9dcc7
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
132 additions
and
11 deletions
+132
-11
UserController.java
...main/java/pwc/taxtech/atms/controller/UserController.java
+10
-0
AbstractService.java
...n/java/pwc/taxtech/atms/service/impl/AbstractService.java
+5
-0
RoleServiceImpl.java
...n/java/pwc/taxtech/atms/service/impl/RoleServiceImpl.java
+28
-2
UserServiceImpl.java
...n/java/pwc/taxtech/atms/service/impl/UserServiceImpl.java
+28
-0
user_template.xlsx
...src/main/resources/user_excel_template/user_template.xlsx
+0
-0
UserRoleInfo.java
...-dao/src/main/java/pwc/taxtech/atms/dpo/UserRoleInfo.java
+33
-0
user-manage-list.ctrl.js
...in/infrastructure/userManageList/user-manage-list.ctrl.js
+17
-6
user-manage-list.html
...admin/infrastructure/userManageList/user-manage-list.html
+1
-2
user.svc.js
atms-web/src/main/webapp/app/common/webservices/user.svc.js
+10
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/controller/UserController.java
View file @
b2196fef
...
...
@@ -15,9 +15,11 @@ import org.springframework.web.bind.annotation.RestController;
import
pwc.taxtech.atms.dpo.UserDto
;
import
pwc.taxtech.atms.dpo.UserOrgDto
;
import
pwc.taxtech.atms.dpo.UserOrgRoleDto
;
import
pwc.taxtech.atms.dpo.UserRoleInfo
;
import
pwc.taxtech.atms.dto.LoginInputDto
;
import
pwc.taxtech.atms.dto.LoginOutputDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.analysis.AnalysisDomesticlParam
;
import
pwc.taxtech.atms.dto.organization.OrgRoleDtoList
;
import
pwc.taxtech.atms.dto.permission.UserPermissionDto
;
import
pwc.taxtech.atms.dto.permission.UserPermissionKeyDto
;
...
...
@@ -33,6 +35,7 @@ import pwc.taxtech.atms.service.impl.UserAccountServiceImpl;
import
pwc.taxtech.atms.service.impl.UserRoleServiceImpl
;
import
pwc.taxtech.atms.service.impl.UserServiceImpl
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
@RestController
...
...
@@ -251,4 +254,11 @@ public class UserController {
return
userRoleService
.
GetUserByUserName
(
userParam
);
}
@RequestMapping
(
value
=
"downloadFile/get"
,
method
=
RequestMethod
.
POST
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
void
downloadFile
(
@RequestBody
List
<
UserRoleInfo
>
data
,
HttpServletResponse
response
)
{
logger
.
debug
(
"enter downloadFile"
);
String
fileName
=
"testFile"
;
userService
.
downloadFile
(
response
,
data
,
fileName
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/AbstractService.java
View file @
b2196fef
...
...
@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
pwc.taxtech.atms.common.AtmsApiSettings
;
import
pwc.taxtech.atms.common.AuthUserHelper
;
import
pwc.taxtech.atms.common.ResponseMessageBuilder
;
import
pwc.taxtech.atms.dao.*
;
public
class
AbstractService
{
...
...
@@ -13,6 +14,10 @@ public class AbstractService {
@Autowired
protected
AuthUserHelper
authUserHelper
;
@Autowired
protected
CommonDocumentHelper
commonDocumentHelper
;
@Autowired
protected
ResponseMessageBuilder
responseMessageBuilder
;
@Autowired
protected
AtmsApiSettings
atmsApiSettings
;
@Autowired
protected
OperationLogServiceImpl
operationLogService
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/RoleServiceImpl.java
View file @
b2196fef
...
...
@@ -589,6 +589,21 @@ public class RoleServiceImpl extends AbstractService {
userRoleInfo
.
setRoleInfoList
(
roleInfoList
);
retList
.
add
(
userRoleInfo
);
}
// 这里可以一次查出来再合并
retList
.
forEach
(
l
->{
if
(
null
!=
l
.
getBusinessUnitId
()){
BusinessUnit
bu
=
businessUnitMapper
.
selectByPrimaryKey
(
l
.
getBusinessUnitId
());
if
(
bu
!=
null
){
l
.
setBusinessUnitName
(
bu
.
getName
());
}
}
if
(
null
!=
l
.
getAreaId
()){
Area
area
=
areaMapper
.
selectByPrimaryKey
(
l
.
getAreaId
());
if
(
area
!=
null
){
l
.
setAreaName
(
area
.
getName
());
}
}
});
return
retList
;
}
...
...
@@ -596,9 +611,20 @@ public class RoleServiceImpl extends AbstractService {
List
<
VMUser
>
userList
=
userService
.
findAllUsers
().
stream
().
map
(
this
::
rotateUserToVMUser
)
.
collect
(
Collectors
.
toList
());
List
<
UserRoleInfo
>
res
=
getAllUserRoleListByUserList
(
userList
,
""
);
// 这里可以一次查出来再合并
res
.
forEach
(
l
->{
l
.
setBusinessUnitName
(
businessUnitMapper
.
selectByPrimaryKey
(
l
.
getBusinessUnitId
()).
getName
());
l
.
setAreaName
(
areaMapper
.
selectByPrimaryKey
(
l
.
getAreaId
()).
getName
());
if
(
null
!=
l
.
getBusinessUnitId
()){
BusinessUnit
bu
=
businessUnitMapper
.
selectByPrimaryKey
(
l
.
getBusinessUnitId
());
if
(
bu
!=
null
){
l
.
setBusinessUnitName
(
bu
.
getName
());
}
}
if
(
null
!=
l
.
getAreaId
()){
Area
area
=
areaMapper
.
selectByPrimaryKey
(
l
.
getAreaId
());
if
(
area
!=
null
){
l
.
setAreaName
(
area
.
getName
());
}
}
});
return
res
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/UserServiceImpl.java
View file @
b2196fef
...
...
@@ -19,6 +19,7 @@ import pwc.taxtech.atms.common.OperationAction;
import
pwc.taxtech.atms.common.OperationModule
;
import
pwc.taxtech.atms.common.UserLoginType
;
import
pwc.taxtech.atms.common.UserStatus
;
import
pwc.taxtech.atms.common.message.ErrorMessage
;
import
pwc.taxtech.atms.common.message.UserMessage
;
import
pwc.taxtech.atms.common.util.HttpUtil
;
import
pwc.taxtech.atms.constant.DimensionConstant
;
...
...
@@ -38,6 +39,7 @@ import pwc.taxtech.atms.dto.LoginInputDto;
import
pwc.taxtech.atms.dto.LoginOutputDto
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.UpdateLogParams
;
import
pwc.taxtech.atms.dto.analysis.AnalysisDomesticlParam
;
import
pwc.taxtech.atms.dto.organization.DimensionRoleDto
;
import
pwc.taxtech.atms.dto.organization.SimpleRoleDto
;
import
pwc.taxtech.atms.dto.permission.OrganizationPermissionDto
;
...
...
@@ -53,8 +55,11 @@ import pwc.taxtech.atms.dto.user.WebUserDto;
import
pwc.taxtech.atms.entity.*
;
import
pwc.taxtech.atms.entity.UserRoleExample.Criteria
;
import
pwc.taxtech.atms.exception.ApplicationException
;
import
pwc.taxtech.atms.exception.ServiceException
;
import
pwc.taxtech.atms.security.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.OutputStream
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -1033,4 +1038,27 @@ public class UserServiceImpl extends AbstractService {
}
public
HttpServletResponse
downloadFile
(
HttpServletResponse
response
,
List
<
UserRoleInfo
>
data
,
String
fileName
)
{
String
excelTemplatePathInClassPath
=
"/user_excel_template/user_template.xlsx"
;
if
(
data
.
size
()<
1
){
throw
new
ServiceException
(
ErrorMessage
.
ExportFailed
);
}
data
.
forEach
(
d
->{
if
(!
d
.
getRoleInfoList
().
isEmpty
()){
List
<
String
>
rList
=
d
.
getRoleInfoList
().
stream
().
map
(
RoleInfo:
:
getName
).
collect
(
Collectors
.
toList
());
d
.
setRoleList
(
JSON
.
toJSONString
(
rList
));
}
d
.
setStatusStr
(
d
.
getStatus
());
});
OutputStream
outputStream
=
commonDocumentHelper
.
toXlsxFileUsingJxls
(
data
,
excelTemplatePathInClassPath
);
try
{
return
responseMessageBuilder
.
getDownloadTmpResponseMessage
(
response
,
outputStream
,
fileName
);
}
catch
(
Exception
e
)
{
logger
.
error
(
String
.
format
(
"导出用户信息异常:%s"
,
e
.
getMessage
()));
}
return
null
;
}
}
atms-api/src/main/resources/user_excel_template/user_template.xlsx
0 → 100644
View file @
b2196fef
File added
atms-dao/src/main/java/pwc/taxtech/atms/dpo/UserRoleInfo.java
View file @
b2196fef
package
pwc
.
taxtech
.
atms
.
dpo
;
import
com.alibaba.fastjson.JSON
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
UserRoleInfo
{
...
...
@@ -53,6 +55,10 @@ public class UserRoleInfo {
/// The role information list.
public
List
<
RoleInfo
>
roleInfoList
;
public
String
roleList
;
public
String
statusStr
;
/**
* @return the id
*/
...
...
@@ -222,4 +228,31 @@ public class UserRoleInfo {
public
void
setAreaName
(
String
areaName
)
{
this
.
areaName
=
areaName
;
}
public
String
getRoleList
()
{
if
(!
this
.
roleInfoList
.
isEmpty
()){
List
<
String
>
rList
=
this
.
roleInfoList
.
stream
().
map
(
RoleInfo:
:
getName
).
collect
(
Collectors
.
toList
());
return
JSON
.
toJSONString
(
rList
);
}
return
roleList
;
}
public
void
setRoleList
(
String
roleList
)
{
this
.
roleList
=
roleList
;
}
public
String
getStatusStr
()
{
return
statusStr
;
}
public
void
setStatusStr
(
String
statusStr
)
{
this
.
statusStr
=
statusStr
;
}
public
void
setStatusStr
(
Integer
status
)
{
if
(
status
==
0
){
this
.
statusStr
=
"禁用"
;
}
this
.
statusStr
=
"启用"
;
}
}
atms-web/src/main/webapp/app/admin/infrastructure/userManageList/user-manage-list.ctrl.js
View file @
b2196fef
infrastructureModule
.
controller
(
'UserManageListController'
,
[
'$state'
,
'$scope'
,
'$log'
,
'userService'
,
'orgService'
,
'SweetAlert'
,
'projectService'
,
'roleService'
,
'$translate'
,
'enums'
,
'businessUnitService'
,
'areaService'
,
'$timeout'
,
'loginContext'
,
function
(
$state
,
$scope
,
$log
,
userService
,
orgService
,
SweetAlert
,
projectService
,
roleService
,
$translate
,
enums
,
businessUnitService
,
areaService
,
$timeout
,
loginContext
)
{
.
controller
(
'UserManageListController'
,
[
'$state'
,
'$filter'
,
'$scope'
,
'$log'
,
'userService'
,
'orgService'
,
'SweetAlert'
,
'projectService'
,
'roleService'
,
'$translate'
,
'enums'
,
'businessUnitService'
,
'areaService'
,
'$timeout'
,
'loginContext'
,
function
(
$state
,
$filter
,
$scope
,
$log
,
userService
,
orgService
,
SweetAlert
,
projectService
,
roleService
,
$translate
,
enums
,
businessUnitService
,
areaService
,
$timeout
,
loginContext
)
{
'use strict'
;
/***********************************************************new code start*********************************************************/
...
...
@@ -74,7 +74,7 @@
// 角色单选
$scope
.
singleClickRole
=
function
(
model
)
{
if
(
!
model
.
data
.
roleCategoryI
D
)
{
if
(
!
model
.
data
.
roleCategoryI
d
)
{
// 是角色分类,不是角色
return
;
}
...
...
@@ -645,7 +645,7 @@
// 事业部筛选
if
(
$scope
.
selectBusinessUnitList
&&
$scope
.
selectBusinessUnitList
.
length
>
0
)
{
var
query
=
_
.
filter
(
$scope
.
selectBusinessUnitList
,
function
(
row
)
{
return
row
.
id
===
user
.
businessUnitID
;
return
row
.
ID
===
user
.
businessUnitID
;
});
if
(
!
query
||
query
.
length
==
0
)
{
...
...
@@ -656,7 +656,7 @@
// 区域
if
(
$scope
.
selectAreaList
&&
$scope
.
selectAreaList
.
length
>
0
)
{
var
query
=
_
.
filter
(
$scope
.
selectAreaList
,
function
(
row
)
{
return
row
.
id
===
user
.
areaID
;
return
row
.
ID
===
user
.
areaID
;
});
if
(
!
query
||
query
.
length
==
0
)
{
...
...
@@ -666,7 +666,7 @@
// 角色筛选
if
(
$scope
.
selectRoleList
&&
$scope
.
selectRoleList
.
length
>
0
)
{
var
roleIdList
=
_
.
pluck
(
user
.
roleInfoList
,
'
id
'
);
var
roleIdList
=
_
.
pluck
(
user
.
roleInfoList
,
'
ID
'
);
var
query
=
_
.
filter
(
$scope
.
selectRoleList
,
function
(
row
)
{
return
roleIdList
.
indexOf
(
row
.
data
.
id
)
>
-
1
;
...
...
@@ -900,6 +900,7 @@
$scope
.
isShowLog
=
true
;
};
var
initParams
=
function
()
{
$scope
.
doExport
=
doExport
;
// 机构默认显示
$scope
.
showMoreOrg
=
true
;
$scope
.
showMoreOrgStr
=
$translate
.
instant
(
'ShowMore'
);
...
...
@@ -966,6 +967,16 @@
});
};
var
doExport
=
function
()
{
var
localDate
=
$filter
(
'date'
)(
new
Date
(),
'yyyyMMddHHmmss'
);
var
fileName
=
'用户信息列表'
+
localDate
;
userService
.
downloadFile
(
$scope
.
originalUserRoleList
,
fileName
).
then
(
function
(
data
)
{
if
(
data
)
{
ackMessageBox
.
success
(
translate
(
'FileExportSuccess'
));
}
});
};
$scope
.
stopPropagation
=
function
(
$event
)
{
$event
.
stopPropagation
();
};
...
...
atms-web/src/main/webapp/app/admin/infrastructure/userManageList/user-manage-list.html
View file @
b2196fef
...
...
@@ -148,8 +148,7 @@
</a>
</div>
<span
style=
"display:inline-block"
>
<!--<button class="btn btn-export" type="button" ng-click="" translate="Export"></button>-->
<export-button
style=
"float: left; margin-left: 0px; margin-top: -6px"
><export-button>
<span
ng-click=
"doExport()"
><i
class=
"fa fa-download"
></i>
{{'Export' | translate}}
</span>
</span>
</div>
<div
class=
"user-body"
ng-style=
'getUserBodyHeight()'
>
...
...
atms-web/src/main/webapp/app/common/webservices/user.svc.js
View file @
b2196fef
// web service proxy for user
webservices
.
factory
(
'userService'
,
[
'$http'
,
'apiConfig'
,
'httpCacheService'
,
'loginContext'
,
function
(
$http
,
apiConfig
,
httpCacheService
,
loginContext
)
{
webservices
.
factory
(
'userService'
,
[
'$http'
,
'apiConfig'
,
'httpCacheService'
,
'loginContext'
,
'FileSaver'
,
function
(
$http
,
apiConfig
,
httpCacheService
,
loginContext
,
FileSaver
)
{
'use strict'
;
return
{
...
...
@@ -141,6 +141,14 @@ webservices.factory('userService', ['$http', 'apiConfig', 'httpCacheService', 'l
},
getUserOwnerOrganization
:
function
()
{
return
$http
.
get
(
'/user/getUserOwnerOrganization'
,
apiConfig
.
create
());
},
downloadFile
:
function
(
data
,
fileName
)
{
var
thisConfig
=
apiConfig
.
create
();
thisConfig
.
responseType
=
"arraybuffer"
;
return
$http
.
post
(
'/user/downloadFile/get'
,
data
,
thisConfig
).
then
(
function
(
response
)
{
var
data
=
new
Blob
([
response
.
data
],
{
type
:
response
.
headers
(
'Content-Type'
)});
FileSaver
.
saveAs
(
data
,
fileName
+
'.xlsx'
);
});
}
};
}]);
\ 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