Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
414f84bc
Commit
414f84bc
authored
Nov 19, 2021
by
helinlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加巡检消息推送类别
parent
39c48d75
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
370 additions
and
372 deletions
+370
-372
UserController.java
...ejoin/amos/patrol/business/controller/UserController.java
+364
-371
MsgRo.java
...main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
+4
-1
RulePlanService.java
...in/amos/patrol/business/service/impl/RulePlanService.java
+2
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/controller/UserController.java
View file @
414f84bc
...
@@ -11,6 +11,8 @@ import java.util.TreeSet;
...
@@ -11,6 +11,8 @@ import java.util.TreeSet;
import
java.util.UUID
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.feign.PushFeignServer
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -51,7 +53,8 @@ import com.yeejoin.amos.patrol.business.util.DepartmentUserTreeAppVo;
...
@@ -51,7 +53,8 @@ import com.yeejoin.amos.patrol.business.util.DepartmentUserTreeAppVo;
import
com.yeejoin.amos.patrol.business.util.DepartmentUserTreeWebVo
;
import
com.yeejoin.amos.patrol.business.util.DepartmentUserTreeWebVo
;
import
com.yeejoin.amos.patrol.business.util.DesUtil
;
import
com.yeejoin.amos.patrol.business.util.DesUtil
;
import
com.yeejoin.amos.patrol.business.util.StringUtil
;
import
com.yeejoin.amos.patrol.business.util.StringUtil
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.feign.RemoteSecurityService
;
import
com.yeejoin.amos.patrol.jpush.AppMessagePushService
;
import
com.yeejoin.amos.patrol.jpush.AppMessagePushService
;
...
@@ -70,7 +73,7 @@ import io.swagger.annotations.ApiParam;
...
@@ -70,7 +73,7 @@ import io.swagger.annotations.ApiParam;
public
class
UserController
extends
AbstractBaseController
{
public
class
UserController
extends
AbstractBaseController
{
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserController
.
class
);
private
final
Logger
logger
=
LoggerFactory
.
getLogger
(
UserController
.
class
);
@Autowired
@Autowired
private
IAppService
iAppService
;
private
IAppService
iAppService
;
@Autowired
@Autowired
...
@@ -102,55 +105,55 @@ public class UserController extends AbstractBaseController {
...
@@ -102,55 +105,55 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryDeptUser"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/queryDeptUser"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryDeptUser
(
@RequestParam
(
value
=
"deptId"
,
required
=
false
)
String
deptId
)
{
public
CommonResponse
queryDeptUser
(
@RequestParam
(
value
=
"deptId"
,
required
=
false
)
String
deptId
)
{
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
deptId
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
deptId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
if
(
"-1"
.
equals
(
deptId
))
{
if
(
"-1"
.
equals
(
deptId
))
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
dep
=
reginParams
.
getCompany
().
getSequenceNbr
().
toString
();
String
dep
=
reginParams
.
getCompany
().
getSequenceNbr
().
toString
();
//查询没有部门的人员信息
//查询没有部门的人员信息
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
dep
);
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
dep
);
List
children
=
(
List
)
companyModel
.
getChildren
();
List
children
=
(
List
)
companyModel
.
getChildren
();
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
if
(
"其他"
.
equals
((
map
.
get
(
"departmentName"
).
toString
())))
{
if
(
"其他"
.
equals
((
map
.
get
(
"departmentName"
).
toString
())))
{
List
<
LinkedHashMap
<
String
,
Object
>>
user1
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
map
.
get
(
"userModelList"
);
List
<
LinkedHashMap
<
String
,
Object
>>
user1
=
(
List
<
LinkedHashMap
<
String
,
Object
>>)
map
.
get
(
"userModelList"
);
for
(
int
j
=
0
;
j
<
user1
.
size
();
j
++)
{
for
(
int
j
=
0
;
j
<
user1
.
size
();
j
++)
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"id"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"key"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"key"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"value"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"value"
,
user1
.
get
(
j
).
get
(
"userId"
).
toString
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"name"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
user
.
put
(
"name"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
user
.
put
(
"userName"
,
user1
.
get
(
j
).
get
(
"realName"
).
toString
());
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"mobile"
)))
{
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"mobile"
)))
{
user
.
put
(
"mobile"
,
user1
.
get
(
j
).
get
(
"mobile"
).
toString
());
user
.
put
(
"mobile"
,
user1
.
get
(
j
).
get
(
"mobile"
).
toString
());
}
else
{
}
else
{
user
.
put
(
"mobile"
,
""
);
user
.
put
(
"mobile"
,
""
);
}
}
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"landlinePhone"
)))
{
if
(
StringUtil
.
isNotEmpty
(
user1
.
get
(
j
).
get
(
"landlinePhone"
)))
{
user
.
put
(
"telephone"
,
user1
.
get
(
j
).
get
(
"landlinePhone"
).
toString
());
user
.
put
(
"telephone"
,
user1
.
get
(
j
).
get
(
"landlinePhone"
).
toString
());
}
else
{
}
else
{
user
.
put
(
"telephone"
,
""
);
user
.
put
(
"telephone"
,
""
);
}
}
user
.
put
(
"departmentName"
,
"其他"
);
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
userList
.
add
(
user
);
}
}
}
}
}
}
}
else
{
}
else
{
userList
=
paraseData
(
userModels
,
null
).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
userList
=
paraseData
(
userModels
,
null
).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
return
CommonResponseUtil
.
success
(
userList
);
}
}
return
CommonResponseUtil
.
success
(
userList
);
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData
(
List
<
AgencyUserModel
>
list
,
String
userNmae
)
{
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData
(
List
<
AgencyUserModel
>
list
,
String
userNmae
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
new
ArrayList
<>();
...
@@ -169,7 +172,7 @@ public class UserController extends AbstractBaseController {
...
@@ -169,7 +172,7 @@ public class UserController extends AbstractBaseController {
user
.
put
(
"mobile"
,
userModel
.
getMobile
());
user
.
put
(
"mobile"
,
userModel
.
getMobile
());
user
.
put
(
"telephone"
,
userModel
.
getLandlinePhone
());
user
.
put
(
"telephone"
,
userModel
.
getLandlinePhone
());
user
.
put
(
"departmentName"
,
"其他"
);
user
.
put
(
"departmentName"
,
"其他"
);
userList
.
add
(
user
);
userList
.
add
(
user
);
}
}
}
}
...
@@ -185,7 +188,7 @@ public class UserController extends AbstractBaseController {
...
@@ -185,7 +188,7 @@ public class UserController extends AbstractBaseController {
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
.
getCompany
().
getSequenceNbr
().
toString
());
CompanyModel
companyModel
=
remoteSecurityService
.
listUserByCompanyId1
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
.
getCompany
().
getSequenceNbr
().
toString
());
List
children
=
(
List
)
companyModel
.
getChildren
();
List
children
=
(
List
)
companyModel
.
getChildren
();
List
<
DepartmentUserTreeWebVo
>
list
=
Lists
.
newArrayList
();
List
<
DepartmentUserTreeWebVo
>
list
=
Lists
.
newArrayList
();
String
loginOrgCode
=
getOrgCode
(
reginParams
);
String
loginOrgCode
=
getOrgCode
(
reginParams
);
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
children
.
size
();
i
++)
{
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
Map
<
String
,
Object
>
map
=
(
LinkedHashMap
)
children
.
get
(
i
);
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
));
JSONObject
json
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
));
...
@@ -198,7 +201,7 @@ public class UserController extends AbstractBaseController {
...
@@ -198,7 +201,7 @@ public class UserController extends AbstractBaseController {
deptTreeWeb
.
setTitle
(
map
.
get
(
"departmentName"
).
toString
());
deptTreeWeb
.
setTitle
(
map
.
get
(
"departmentName"
).
toString
());
deptTreeWeb
.
setValue
(
map
.
get
(
"sequenceNbr"
).
toString
());
deptTreeWeb
.
setValue
(
map
.
get
(
"sequenceNbr"
).
toString
());
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"userModelList"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
get
(
"userModelList"
)))
{
List
userModalList
=
(
List
)
((
List
)
map
.
get
(
"userModelList"
)).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
List
userModalList
=
(
List
)
((
List
)
map
.
get
(
"userModelList"
)).
stream
().
distinct
().
collect
(
Collectors
.
toList
());
deptTreeWeb
.
setUserModelList
(
userModalList
);
deptTreeWeb
.
setUserModelList
(
userModalList
);
}
}
...
@@ -206,9 +209,9 @@ public class UserController extends AbstractBaseController {
...
@@ -206,9 +209,9 @@ public class UserController extends AbstractBaseController {
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
if
(
childrens
!=
null
&&
childrens
.
size
()
>
0
)
{
buildUserDeptTreeForWebBefore
(
list
,
childrens
);
buildUserDeptTreeForWebBefore
(
list
,
childrens
);
}
}
list
=
buildUserDeptTreeForWeb
(
list
);
list
=
buildUserDeptTreeForWeb
(
list
);
}
}
return
CommonResponseUtil
.
success
(
list
);
return
CommonResponseUtil
.
success
(
list
);
}
}
...
@@ -220,34 +223,35 @@ public class UserController extends AbstractBaseController {
...
@@ -220,34 +223,35 @@ public class UserController extends AbstractBaseController {
*/
*/
private
List
<
DepartmentUserTreeWebVo
>
buildUserDeptTreeForWeb
(
List
<
DepartmentUserTreeWebVo
>
list
)
{
private
List
<
DepartmentUserTreeWebVo
>
buildUserDeptTreeForWeb
(
List
<
DepartmentUserTreeWebVo
>
list
)
{
list
.
forEach
(
list
.
forEach
(
x
->
{
x
->
{
List
<
DepartmentUserTreeWebVo
>
users
=
Lists
.
newArrayList
();
List
<
DepartmentUserTreeWebVo
>
users
=
Lists
.
newArrayList
();
if
(!
ObjectUtils
.
isEmpty
(
x
.
getUserModelList
()))
{
if
(!
ObjectUtils
.
isEmpty
(
x
.
getUserModelList
()))
{
List
<
DepartmentUserTreeWebVo
>
collects
=
x
.
getUserModelList
().
stream
().
collect
(
Collectors
.
toList
());
List
<
DepartmentUserTreeWebVo
>
collects
=
x
.
getUserModelList
().
stream
().
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
userModelList
=
(
List
)
collects
;
List
<
Map
<
String
,
Object
>>
userModelList
=
(
List
)
collects
;
userModelList
.
forEach
(
userModelList
.
forEach
(
userModel
->
{
userModel
->
{
DepartmentUserTreeWebVo
userTreeWeb
=
new
DepartmentUserTreeWebVo
();
DepartmentUserTreeWebVo
userTreeWeb
=
new
DepartmentUserTreeWebVo
();
userTreeWeb
.
setType
(
"user"
);
userTreeWeb
.
setType
(
"user"
);
userTreeWeb
.
setKey
(
userModel
.
get
(
"userId"
).
toString
()+
"*"
+
x
.
getValue
()+
"*"
+
UUID
.
randomUUID
().
toString
());
userTreeWeb
.
setKey
(
userModel
.
get
(
"userId"
).
toString
()
+
"*"
+
x
.
getValue
()
+
"*"
+
UUID
.
randomUUID
().
toString
());
userTreeWeb
.
setLabel
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setLabel
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setTitle
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setTitle
(
userModel
.
get
(
"realName"
).
toString
());
userTreeWeb
.
setValue
(
userModel
.
get
(
"userId"
).
toString
()+
"*"
+
x
.
getValue
()+
"*"
+
UUID
.
randomUUID
().
toString
());
userTreeWeb
.
setValue
(
userModel
.
get
(
"userId"
).
toString
()
+
"*"
+
x
.
getValue
()
+
"*"
+
UUID
.
randomUUID
().
toString
());
users
.
add
(
userTreeWeb
);
users
.
add
(
userTreeWeb
);
}
);
x
.
setChildren
(
users
);
collects
.
clear
();
x
.
setUserModelList
(
collects
);
}
}
);
}
x
.
setChildren
(
users
);
collects
.
clear
();
x
.
setUserModelList
(
collects
);
}
}
);
);
return
list
;
return
list
;
}
}
/**
/**
* 部门数据预处理(获取所有子节点)
* 部门数据预处理(获取所有子节点)
*
*
...
@@ -286,9 +290,6 @@ public class UserController extends AbstractBaseController {
...
@@ -286,9 +290,6 @@ public class UserController extends AbstractBaseController {
}
}
/**
/**
* 查询用户权限人员
* 查询用户权限人员
*
*
...
@@ -317,11 +318,11 @@ public class UserController extends AbstractBaseController {
...
@@ -317,11 +318,11 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryDeptUserTree"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/queryDeptUserTree"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryDeptUserTree
()
{
public
CommonResponse
queryDeptUserTree
()
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
String
departmentId
=
getDepartmentId
(
reginParams
);
String
departmentId
=
getDepartmentId
(
reginParams
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentId
);
List
<
AgencyUserModel
>
userModels
=
remoteSecurityService
.
listUserByDepartmentId
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentId
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
paraseData
(
userModels
,
null
);
List
<
LinkedHashMap
<
String
,
Object
>>
userList
=
paraseData
(
userModels
,
null
);
return
CommonResponseUtil
.
success
(
userList
);
return
CommonResponseUtil
.
success
(
userList
);
}
}
/**
/**
...
@@ -335,123 +336,120 @@ public class UserController extends AbstractBaseController {
...
@@ -335,123 +336,120 @@ public class UserController extends AbstractBaseController {
@RequestMapping
(
value
=
"/queryUserAddressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/queryUserAddressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
queryUserAddressListTree
(
public
CommonResponse
queryUserAddressListTree
(
@ApiParam
(
value
=
"用户名"
,
required
=
false
)
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
@ApiParam
(
value
=
"用户名"
,
required
=
false
)
@RequestParam
(
value
=
"userName"
,
required
=
false
)
String
userName
)
{
try
{
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
DepartmentUserTreeAppVo
departmentUserTreeDto
=
new
DepartmentUserTreeAppVo
();
DepartmentUserTreeAppVo
departmentUserTreeDto
=
new
DepartmentUserTreeAppVo
();
if
(
arr
!=
null
&&
arr
.
size
()
>
0
)
{
if
(
arr
!=
null
&&
arr
.
size
()
>
0
)
{
buildUserDeptTree
(
departmentUserTreeDto
,
arr
);
buildUserDeptTree
(
departmentUserTreeDto
,
arr
);
}
}
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
//数据重新封装
List
<
DepartmentUserTreeAppVo
>
list
=
departmentUserTreeDto
.
getChildren
();
LinkedHashMap
<
String
,
Object
>
otherDept1
=
new
LinkedHashMap
<>();
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
list
)
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
if
(
"其他"
.
equals
(
departmentUserTreeAppVo
.
getName
())){
otherDept1
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
"其他"
,
"-1"
,
userName
));
otherDept1
.
put
(
"id"
,
-
1
);
otherDept1
.
put
(
"key"
,
-
1
);
otherDept1
.
put
(
"value"
,
-
1
);
otherDept1
.
put
(
"state"
,
"open"
);
otherDept1
.
put
(
"type"
,
"department"
);
otherDept1
.
put
(
"label"
,
"其他"
);
otherDept1
.
put
(
"title"
,
"其他"
);
otherDept1
.
put
(
"name"
,
"其他"
);
otherDept1
.
put
(
"desc"
,
"其他"
);
otherDept1
.
put
(
"writeable"
,
0
);
otherDept1
.
put
(
"attributes"
,
""
);
}
else
{
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
userName
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
}
if
(
otherDept1
!=
null
){
content
.
add
(
otherDept1
);
}
return
CommonResponseUtil
.
success
(
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"通讯录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
//数据重新封装
List
<
DepartmentUserTreeAppVo
>
list
=
departmentUserTreeDto
.
getChildren
();
LinkedHashMap
<
String
,
Object
>
otherDept1
=
new
LinkedHashMap
<>();
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
list
)
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
if
(
"其他"
.
equals
(
departmentUserTreeAppVo
.
getName
()))
{
otherDept1
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
"其他"
,
"-1"
,
userName
));
otherDept1
.
put
(
"id"
,
-
1
);
otherDept1
.
put
(
"key"
,
-
1
);
otherDept1
.
put
(
"value"
,
-
1
);
otherDept1
.
put
(
"state"
,
"open"
);
otherDept1
.
put
(
"type"
,
"department"
);
otherDept1
.
put
(
"label"
,
"其他"
);
otherDept1
.
put
(
"title"
,
"其他"
);
otherDept1
.
put
(
"name"
,
"其他"
);
otherDept1
.
put
(
"desc"
,
"其他"
);
otherDept1
.
put
(
"writeable"
,
0
);
otherDept1
.
put
(
"attributes"
,
""
);
}
else
{
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
userName
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
}
}
}
if
(
otherDept1
!=
null
)
{
content
.
add
(
otherDept1
);
}
return
CommonResponseUtil
.
success
(
content
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"通讯录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData1
(
String
toke
,
String
product
,
String
appKey
,
List
<
DepartmentUserTreeAppVo
>
map
,
String
name
,
String
depid
,
String
username
)
{
private
List
<
LinkedHashMap
<
String
,
Object
>>
paraseData1
(
String
toke
,
String
product
,
String
appKey
,
List
<
DepartmentUserTreeAppVo
>
map
,
String
name
,
String
depid
,
String
username
)
{
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
List
<
LinkedHashMap
<
String
,
Object
>>
content
=
new
ArrayList
<>();
if
(
map
!=
null
&&
map
.
size
()>
0
)
{
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
map
)
{
for
(
DepartmentUserTreeAppVo
departmentUserTreeAppVo
:
map
)
{
if
(
"dept"
.
equals
(
departmentUserTreeAppVo
.
getType
()))
{
if
(
"dept"
.
equals
(
departmentUserTreeAppVo
.
getType
()))
{
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
Object
>
otherDept
=
new
LinkedHashMap
<>();
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
username
));
otherDept
.
put
(
"children"
,
paraseData1
(
getToken
(),
getProduct
(),
getAppKey
(),
departmentUserTreeAppVo
.
getChildren
(),
departmentUserTreeAppVo
.
getName
(),
departmentUserTreeAppVo
.
getId
(),
username
));
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"state"
,
"open"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"type"
,
"department"
);
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"desc"
,
null
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"writeable"
,
0
);
otherDept
.
put
(
"attributes"
,
""
);
otherDept
.
put
(
"attributes"
,
""
);
content
.
add
(
otherDept
);
content
.
add
(
otherDept
);
}
else
{
}
else
{
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
LinkedHashMap
<
String
,
Object
>
user
=
new
LinkedHashMap
<>();
user
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"id"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"key"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"value"
,
departmentUserTreeAppVo
.
getId
());
user
.
put
(
"checked"
,
false
);
user
.
put
(
"checked"
,
false
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"state"
,
"open"
);
user
.
put
(
"type"
,
"user"
);
user
.
put
(
"type"
,
"user"
);
user
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"label"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"title"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"name"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"desc"
,
null
);
user
.
put
(
"desc"
,
null
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"writeable"
,
0
);
user
.
put
(
"userName"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"userName"
,
departmentUserTreeAppVo
.
getName
());
user
.
put
(
"depid"
,
depid
);
user
.
put
(
"depid"
,
depid
);
//获取电话邮箱
//获取电话邮箱
Map
<
String
,
String
>
userObj
=
departmentUserTreeAppVo
.
getObject
();
Map
<
String
,
String
>
userObj
=
departmentUserTreeAppVo
.
getObject
();
if
(
userObj
!=
null
&&
userObj
.
get
(
"telephone"
)
!=
null
)
{
if
(
userObj
!=
null
&&
userObj
.
get
(
"telephone"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"telephone"
));
user
.
put
(
"mobile"
,
userObj
.
get
(
"telephone"
));
}
else
{
}
else
{
user
.
put
(
"mobile"
,
""
);
user
.
put
(
"mobile"
,
""
);
}
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"email"
)
!=
null
)
{
if
(
userObj
!=
null
&&
userObj
.
get
(
"email"
)
!=
null
)
{
user
.
put
(
"email"
,
userObj
.
get
(
"email"
));
user
.
put
(
"email"
,
userObj
.
get
(
"email"
));
}
else
{
}
else
{
user
.
put
(
"email"
,
""
);
user
.
put
(
"email"
,
""
);
}
}
if
(
userObj
!=
null
&&
userObj
.
get
(
"mobile"
)
!=
null
)
{
if
(
userObj
!=
null
&&
userObj
.
get
(
"mobile"
)
!=
null
)
{
user
.
put
(
"mobile"
,
userObj
.
get
(
"mobile"
));
user
.
put
(
"mobile"
,
userObj
.
get
(
"mobile"
));
}
else
{
}
else
{
user
.
put
(
"mobile"
,
""
);
user
.
put
(
"mobile"
,
""
);
}
}
// AgencyUserModel userdate=remoteSecurityService.getUserById( toke, product, appKey, departmentUserTreeAppVo.getId());
// AgencyUserModel userdate=remoteSecurityService.getUserById( toke, product, appKey, departmentUserTreeAppVo.getId());
// if(userdate!=null){
// if(userdate!=null){
// user.put("telephone", userdate.getLandlinePhone());
// user.put("telephone", userdate.getLandlinePhone());
...
@@ -460,19 +458,19 @@ public class UserController extends AbstractBaseController {
...
@@ -460,19 +458,19 @@ public class UserController extends AbstractBaseController {
// }else{
// }else{
// user.put("mobile", "");
// user.put("mobile", "");
// }
// }
user
.
put
(
"departmentName"
,
name
);
user
.
put
(
"departmentName"
,
name
);
if
(
username
!=
null
&&!
""
.
equals
(
username
))
{
if
(
username
!=
null
&&
!
""
.
equals
(
username
))
{
if
(!
ObjectUtils
.
isEmpty
(
departmentUserTreeAppVo
.
getName
())
&&
departmentUserTreeAppVo
.
getName
().
indexOf
(
username
)
!=
-
1
)
{
if
(!
ObjectUtils
.
isEmpty
(
departmentUserTreeAppVo
.
getName
())
&&
departmentUserTreeAppVo
.
getName
().
indexOf
(
username
)
!=
-
1
)
{
content
.
add
(
user
);
content
.
add
(
user
);
}
}
}
else
{
}
else
{
content
.
add
(
user
);
content
.
add
(
user
);
}
}
}
}
}
}
return
content
;
return
content
;
}
}
return
null
;
return
null
;
}
}
...
@@ -494,19 +492,19 @@ public class UserController extends AbstractBaseController {
...
@@ -494,19 +492,19 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"用户登录成功之后数据初始化(<font color='blue'>手机app</font>)"
,
notes
=
"用户登录成功之后数据初始化"
)
@ApiOperation
(
value
=
"用户登录成功之后数据初始化(<font color='blue'>手机app</font>)"
,
notes
=
"用户登录成功之后数据初始化"
)
@RequestMapping
(
value
=
"/initData"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/initData"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
initUserApp
()
{
public
CommonResponse
initUserApp
()
{
try
{
try
{
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
getToken
(),
getProduct
(),
getAppKey
(),
appType
);
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
getToken
(),
getProduct
(),
getAppKey
(),
appType
);
if
(!
secResponse
.
isSuccess
())
{
if
(!
secResponse
.
isSuccess
())
{
return
CommonResponseUtil
.
failure
(
"权限获取失败"
);
return
CommonResponseUtil
.
failure
(
"权限获取失败"
);
}
}
List
<
LinkedHashMap
<
String
,
Object
>>
response
=
new
ArrayList
<>();
List
<
LinkedHashMap
<
String
,
Object
>>
response
=
new
ArrayList
<>();
HashMap
<
String
,
Object
>
resp
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
resp
=
new
HashMap
<>();
resp
.
put
(
"permissionitems"
,
secResponse
.
getDataList
());
resp
.
put
(
"permissionitems"
,
secResponse
.
getDataList
());
resp
.
put
(
"companys"
,
response
);
resp
.
put
(
"companys"
,
response
);
return
CommonResponseUtil
.
success
(
resp
);
return
CommonResponseUtil
.
success
(
resp
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
return
CommonResponseUtil
.
failure
(
"数据初始化失败"
);
return
CommonResponseUtil
.
failure
(
"数据初始化失败"
);
}
}
}
}
/**
/**
...
@@ -533,7 +531,7 @@ public class UserController extends AbstractBaseController {
...
@@ -533,7 +531,7 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"通讯录"
,
notes
=
"通讯录"
)
@ApiOperation
(
value
=
"通讯录"
,
notes
=
"通讯录"
)
@RequestMapping
(
value
=
"/mobile/addressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/mobile/addressList"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
public
CommonResponse
addressList
()
{
public
CommonResponse
addressList
()
{
try
{
try
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
ReginParams
reginParams
=
getSelectedOrgInfo
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
CompanyBo
companyBo
=
reginParams
.
getCompany
();
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
JSONArray
arr
=
remoteSecurityService
.
listDepartmentUserTree
(
getToken
(),
getProduct
(),
getAppKey
(),
companyBo
.
getSequenceNbr
().
toString
());
...
@@ -551,14 +549,6 @@ public class UserController extends AbstractBaseController {
...
@@ -551,14 +549,6 @@ public class UserController extends AbstractBaseController {
}
}
private
void
buildUserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
private
void
buildUserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
JSONObject
json
=
childs
.
getJSONObject
(
i
);
JSONObject
json
=
childs
.
getJSONObject
(
i
);
...
@@ -571,33 +561,33 @@ public class UserController extends AbstractBaseController {
...
@@ -571,33 +561,33 @@ public class UserController extends AbstractBaseController {
buildUserDeptTree
(
treeDto
,
childrens
);
buildUserDeptTree
(
treeDto
,
childrens
);
}
}
JSONArray
userModelList
=
json
.
getJSONArray
(
"userModelList"
);
JSONArray
userModelList
=
json
.
getJSONArray
(
"userModelList"
);
if
(
userModelList
!=
null
&&
userModelList
.
size
()
>
0
)
{
if
(
userModelList
!=
null
&&
userModelList
.
size
()
>
0
)
{
List
<
HashMap
>
modelList
=
JSONObject
.
parseArray
(
userModelList
.
toJSONString
(),
HashMap
.
class
);
List
<
HashMap
>
modelList
=
JSONObject
.
parseArray
(
userModelList
.
toJSONString
(),
HashMap
.
class
);
modelList
=
modelList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
modelList
=
modelList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
userModelList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
modelList
));
userModelList
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
modelList
));
UserDeptTree
(
treeDto
,
userModelList
);
UserDeptTree
(
treeDto
,
userModelList
);
}
}
deptUser
.
getChildren
().
add
(
treeDto
);
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
}
}
//部门下用户
//部门下用户
private
void
UserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
private
void
UserDeptTree
(
DepartmentUserTreeAppVo
deptUser
,
JSONArray
childs
)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
childs
.
size
();
i
++)
{
JSONObject
json
=
childs
.
getJSONObject
(
i
);
JSONObject
json
=
childs
.
getJSONObject
(
i
);
DepartmentUserTreeAppVo
treeDto
=
new
DepartmentUserTreeAppVo
();
DepartmentUserTreeAppVo
treeDto
=
new
DepartmentUserTreeAppVo
();
treeDto
.
setName
(
json
.
getString
(
"realName"
));
treeDto
.
setName
(
json
.
getString
(
"realName"
));
treeDto
.
setId
(
json
.
getString
(
"userId"
));
treeDto
.
setId
(
json
.
getString
(
"userId"
));
//treeDto.setType(json.getString("level"));
//treeDto.setType(json.getString("level"));
treeDto
.
setType
(
"user"
);
treeDto
.
setType
(
"user"
);
// JSONObject object = json.getJSONObject("object");
// JSONObject object = json.getJSONObject("object");
Map
<
String
,
String
>
user
=
Maps
.
newHashMap
();
Map
<
String
,
String
>
user
=
Maps
.
newHashMap
();
user
.
put
(
"mobile"
,
json
.
getString
(
"mobile"
));
user
.
put
(
"mobile"
,
json
.
getString
(
"mobile"
));
user
.
put
(
"telephone"
,
json
.
getString
(
"landlinePhone"
));
user
.
put
(
"telephone"
,
json
.
getString
(
"landlinePhone"
));
user
.
put
(
"email"
,
json
.
getString
(
"email"
));
user
.
put
(
"email"
,
json
.
getString
(
"email"
));
treeDto
.
setObject
(
user
);
treeDto
.
setObject
(
user
);
deptUser
.
getChildren
().
add
(
treeDto
);
deptUser
.
getChildren
().
add
(
treeDto
);
}
}
}
}
...
@@ -609,42 +599,42 @@ public class UserController extends AbstractBaseController {
...
@@ -609,42 +599,42 @@ public class UserController extends AbstractBaseController {
@PostMapping
(
value
=
"/mobile/login"
)
@PostMapping
(
value
=
"/mobile/login"
)
public
CommonResponse
mobileLogin
(
@ApiParam
(
value
=
"账号"
,
required
=
true
)
@RequestBody
AppLoginUserParam
param
)
{
public
CommonResponse
mobileLogin
(
@ApiParam
(
value
=
"账号"
,
required
=
true
)
@RequestBody
AppLoginUserParam
param
)
{
try
{
try
{
JSONObject
jsonObject
=
null
;
JSONObject
jsonObject
=
null
;
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
param
.
getUserName
());
dPasswordAuthModel
.
setLoginId
(
param
.
getUserName
());
dPasswordAuthModel
.
setPassword
(
DesUtil
.
decode
(
param
.
getPassword
(),
"yeejoin"
));
dPasswordAuthModel
.
setPassword
(
DesUtil
.
decode
(
param
.
getPassword
(),
"yeejoin"
));
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
productApp
);
headers
.
set
(
"product"
,
productApp
);
HttpEntity
httpEntity
=
new
HttpEntity
<>(
dPasswordAuthModel
,
headers
);
HttpEntity
httpEntity
=
new
HttpEntity
<>(
dPasswordAuthModel
,
headers
);
FeignClientResult
feignClientResult
=
restTemplate
.
postForObject
(
"http://"
+
SecurityName
+
"/privilege/v1/auth/idpassword"
,
httpEntity
,
FeignClientResult
.
class
);
FeignClientResult
feignClientResult
=
restTemplate
.
postForObject
(
"http://"
+
SecurityName
+
"/privilege/v1/auth/idpassword"
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getStatus
()
==
200
)
{
if
(
feignClientResult
.
getStatus
()
==
200
)
{
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"appKey"
,
appKey
);
map
.
put
(
"product"
,
productApp
);
map
.
put
(
"product"
,
productApp
);
String
jsonStr
=
JSON
.
toJSONString
(
map
);
String
jsonStr
=
JSON
.
toJSONString
(
map
);
jsonObject
=
JSONObject
.
parseObject
(
jsonStr
);
jsonObject
=
JSONObject
.
parseObject
(
jsonStr
);
}
else
{
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getMessage
());
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getMessage
());
}
}
if
(
jsonObject
!=
null
)
{
if
(
jsonObject
!=
null
)
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"token"
,
jsonObject
.
getString
(
"token"
));
result
.
put
(
"token"
,
jsonObject
.
getString
(
"token"
));
result
.
put
(
"userId"
,
jsonObject
.
getString
(
"userId"
));
result
.
put
(
"userId"
,
jsonObject
.
getString
(
"userId"
));
result
.
put
(
"appKey"
,
jsonObject
.
getString
(
"appKey"
));
result
.
put
(
"appKey"
,
jsonObject
.
getString
(
"appKey"
));
result
.
put
(
"product"
,
jsonObject
.
getString
(
"product"
));
result
.
put
(
"product"
,
jsonObject
.
getString
(
"product"
));
result
.
put
(
"jpushUserKey"
,
param
.
getUserName
());
result
.
put
(
"jpushUserKey"
,
param
.
getUserName
());
// //删除别名关联设备
// //删除别名关联设备
// CommonResponse commonResponse=PushFeign.PushDevice(appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
// CommonResponse commonResponse=PushFeign.PushDevice(appMessagePushService.buildJpushUserKey(jsonObject.getString("userId")));
return
CommonResponseUtil
.
success
(
result
);
return
CommonResponseUtil
.
success
(
result
);
}
}
return
CommonResponseUtil
.
failure
(
"登录失败"
);
return
CommonResponseUtil
.
failure
(
"登录失败"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
logger
.
error
(
"APP登录异常"
,
e
);
logger
.
error
(
"APP登录异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
}
}
/**
/**
...
@@ -654,17 +644,17 @@ public class UserController extends AbstractBaseController {
...
@@ -654,17 +644,17 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"APP登出"
,
notes
=
"APP登出"
)
@ApiOperation
(
value
=
"APP登出"
,
notes
=
"APP登出"
)
@PostMapping
(
value
=
"/mobile/loginOut"
)
@PostMapping
(
value
=
"/mobile/loginOut"
)
public
CommonResponse
mobileLoginOut
()
{
public
CommonResponse
mobileLoginOut
()
{
try
{
try
{
// if (remoteSecurityService.loginOutFromApp(getToken(), getProduct(), getAppKey())) {
// if (remoteSecurityService.loginOutFromApp(getToken(), getProduct(), getAppKey())) {
// return CommonResponseUtil.success();
// return CommonResponseUtil.success();
// } else {
// } else {
// return CommonResponseUtil.failure("APP登出失败");
// return CommonResponseUtil.failure("APP登出失败");
// }
// }
return
CommonResponseUtil
.
success
();
return
CommonResponseUtil
.
success
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"APP登出异常"
,
e
);
logger
.
error
(
"APP登出异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
}
}
/**
/**
...
@@ -673,70 +663,72 @@ public class UserController extends AbstractBaseController {
...
@@ -673,70 +663,72 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"获取公司选择信息"
,
notes
=
"获取公司选择信息"
)
@ApiOperation
(
value
=
"获取公司选择信息"
,
notes
=
"获取公司选择信息"
)
@GetMapping
(
value
=
"/selectInfo"
)
@GetMapping
(
value
=
"/selectInfo"
)
public
CommonResponse
selectInfo
()
{
public
CommonResponse
selectInfo
()
{
try
{
try
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
AgencyUserModel
user
=
getUserInfo
();
AgencyUserModel
user
=
getUserInfo
();
if
(
user
!=
null
)
{
if
(
user
!=
null
)
{
List
<
CompanyModel
>
list
=
user
.
getCompanys
().
stream
().
collect
(
List
<
CompanyModel
>
list
=
user
.
getCompanys
().
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CompanyModel:
:
getSequenceNbr
))),
ArrayList:
:
new
));
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
CompanyModel:
:
getSequenceNbr
))),
ArrayList:
:
new
));
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
Map
<
Long
,
List
<
DepartmentModel
>>
mapDepartments
=
user
.
getCompanyDepartments
();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapdate
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
mapdate
=
new
HashMap
<
String
,
List
<
Map
<
String
,
Object
>>>();
List
<
Map
>
listCompanyModel
=
new
ArrayList
();
List
<
Map
>
listCompanyModel
=
new
ArrayList
();
if
(
list
!=
null
&&
list
.
size
()>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
for
(
CompanyModel
article
:
list
)
{
for
(
CompanyModel
article
:
list
)
{
Map
<
String
,
Object
>
map
=
objectToMap
(
article
);
Map
<
String
,
Object
>
map
=
objectToMap
(
article
);
map
.
put
(
"companySeq"
,
map
.
get
(
"companySeq"
)+
""
);
map
.
put
(
"companySeq"
,
map
.
get
(
"companySeq"
)
+
""
);
map
.
put
(
"parentId"
,
map
.
get
(
"parentId"
)+
""
);
map
.
put
(
"parentId"
,
map
.
get
(
"parentId"
)
+
""
);
listCompanyModel
.
add
(
map
);
listCompanyModel
.
add
(
map
);
long
key
=
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
());
long
key
=
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
());
List
<
DepartmentModel
>
listdep
=
mapDepartments
.
get
(
key
);
List
<
DepartmentModel
>
listdep
=
mapDepartments
.
get
(
key
);
List
<
Map
<
String
,
Object
>>
dep
=
new
ArrayList
();
List
<
Map
<
String
,
Object
>>
dep
=
new
ArrayList
();
for
(
DepartmentModel
departmentModel
:
listdep
)
{
for
(
DepartmentModel
departmentModel
:
listdep
)
{
if
(
departmentModel
!=
null
)
{
if
(
departmentModel
!=
null
)
{
Map
<
String
,
Object
>
mapo
=
objectToMap
(
departmentModel
);
Map
<
String
,
Object
>
mapo
=
objectToMap
(
departmentModel
);
mapo
.
put
(
"sequenceNbr"
,
mapo
.
get
(
"sequenceNbr"
).
toString
());
mapo
.
put
(
"sequenceNbr"
,
mapo
.
get
(
"sequenceNbr"
).
toString
());
dep
.
add
(
mapo
);
dep
.
add
(
mapo
);
}
}
}
}
mapdate
.
put
(
map
.
get
(
"sequenceNbr"
).
toString
(),
dep
);
mapdate
.
put
(
map
.
get
(
"sequenceNbr"
).
toString
(),
dep
);
}
}
}
}
result
.
put
(
"companys"
,
listCompanyModel
);
result
.
put
(
"companys"
,
listCompanyModel
);
result
.
put
(
"orgRoles"
,
user
.
getOrgRoles
());
result
.
put
(
"orgRoles"
,
user
.
getOrgRoles
());
result
.
put
(
"companyDepartments"
,
mapdate
);
result
.
put
(
"companyDepartments"
,
mapdate
);
return
CommonResponseUtil
.
success
(
result
);
return
CommonResponseUtil
.
success
(
result
);
}
}
return
CommonResponseUtil
.
failure
(
"请重新登录"
);
return
CommonResponseUtil
.
failure
(
"请重新登录"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"获取公司选择信息异常"
,
e
);
logger
.
error
(
"获取公司选择信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
}
}
//对象转map
//对象转map
public
static
Map
<
String
,
Object
>
objectToMap
(
Object
obj
)
throws
IllegalAccessException
{
public
static
Map
<
String
,
Object
>
objectToMap
(
Object
obj
)
throws
IllegalAccessException
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
if
(
obj
!=
null
)
{
if
(
obj
!=
null
)
{
Class
<?>
clazz
=
obj
.
getClass
();
Class
<?>
clazz
=
obj
.
getClass
();
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
for
(
Field
field
:
clazz
.
getDeclaredFields
())
{
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
String
fieldName
=
field
.
getName
();
String
fieldName
=
field
.
getName
();
Object
value
=
nvl
(
field
.
get
(
obj
));
Object
value
=
nvl
(
field
.
get
(
obj
));
map
.
put
(
fieldName
,
value
);
map
.
put
(
fieldName
,
value
);
}
}
return
map
;
return
map
;
}
}
return
map
;
return
map
;
}
}
public
static
Object
nvl
(
Object
param
)
{
public
static
Object
nvl
(
Object
param
)
{
return
param
!=
null
?
param
:
""
;
return
param
!=
null
?
param
:
""
;
}
}
/**
/**
* 保存登陆用户选择公司信息
* 保存登陆用户选择公司信息
*/
*/
...
@@ -744,24 +736,24 @@ public class UserController extends AbstractBaseController {
...
@@ -744,24 +736,24 @@ public class UserController extends AbstractBaseController {
@ApiOperation
(
value
=
"保存登陆用户选择公司信息"
,
notes
=
"保存登陆用户选择公司信息"
)
@ApiOperation
(
value
=
"保存登陆用户选择公司信息"
,
notes
=
"保存登陆用户选择公司信息"
)
@PostMapping
(
value
=
"/save/curCompany"
)
@PostMapping
(
value
=
"/save/curCompany"
)
public
CommonResponse
saveCurCompany
(
@ApiParam
(
value
=
"当前登陆用户所选单位机构编号"
,
required
=
true
)
@RequestBody
ReginParams
reginParams
)
{
public
CommonResponse
saveCurCompany
(
@ApiParam
(
value
=
"当前登陆用户所选单位机构编号"
,
required
=
true
)
@RequestBody
ReginParams
reginParams
)
{
try
{
try
{
AgencyUserModel
user
=
getUserInfo
();
AgencyUserModel
user
=
getUserInfo
();
// saveSelectedOrgInfo(reginParams);
// saveSelectedOrgInfo(reginParams);
return
CommonResponseUtil
.
success
(
buildCurCompany
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
,
user
));
return
CommonResponseUtil
.
success
(
buildCurCompany
(
getToken
(),
getProduct
(),
getAppKey
(),
reginParams
,
user
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"保存登陆用户选择公司信息异常"
,
e
);
logger
.
error
(
"保存登陆用户选择公司信息异常"
,
e
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
return
CommonResponseUtil
.
failure
(
"系统繁忙,请稍后再试"
);
}
}
}
}
private
JSONObject
buildCurCompany
(
String
toke
,
String
product
,
String
appKey
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
private
JSONObject
buildCurCompany
(
String
toke
,
String
product
,
String
appKey
,
ReginParams
reginParams
,
AgencyUserModel
user
)
{
JSONObject
result
=
new
JSONObject
();
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"userId"
,
user
.
getUserId
());
result
.
put
(
"userId"
,
user
.
getUserId
());
result
.
put
(
"realName"
,
user
.
getRealName
());
result
.
put
(
"realName"
,
user
.
getRealName
());
result
.
put
(
"userMobile"
,
user
.
getMobile
());
result
.
put
(
"userMobile"
,
user
.
getMobile
());
result
.
put
(
"userName"
,
user
.
getUserName
());
result
.
put
(
"userName"
,
user
.
getUserName
());
result
.
put
(
"email"
,
user
.
getEmail
());
result
.
put
(
"email"
,
user
.
getEmail
());
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
Long
.
valueOf
(
reginParams
.
getRole
().
getSequenceNbr
()),
toke
,
product
,
appKey
,
appType
);
CommonResponse
secResponse
=
remoteSecurityService
.
searchPermissionTree
(
Long
.
valueOf
(
reginParams
.
getRole
().
getSequenceNbr
()),
toke
,
product
,
appKey
,
appType
);
if
(
secResponse
.
isSuccess
()
&&
secResponse
.
getDataList
()
!=
null
)
{
if
(
secResponse
.
isSuccess
()
&&
secResponse
.
getDataList
()
!=
null
)
{
JSONArray
arr
=
JSON
.
parseArray
(
JSONArray
.
toJSONString
(
secResponse
.
getDataList
()));
JSONArray
arr
=
JSON
.
parseArray
(
JSONArray
.
toJSONString
(
secResponse
.
getDataList
()));
Map
<
String
,
JSONObject
>
map
=
Maps
.
newHashMap
();
Map
<
String
,
JSONObject
>
map
=
Maps
.
newHashMap
();
...
@@ -813,36 +805,37 @@ public class UserController extends AbstractBaseController {
...
@@ -813,36 +805,37 @@ public class UserController extends AbstractBaseController {
@GetMapping
(
value
=
"/editPassword"
)
@GetMapping
(
value
=
"/editPassword"
)
public
CommonResponse
editPassword
(
@ApiParam
(
value
=
"旧密码"
,
required
=
true
)
@RequestParam
String
password
,
public
CommonResponse
editPassword
(
@ApiParam
(
value
=
"旧密码"
,
required
=
true
)
@RequestParam
String
password
,
@ApiParam
(
value
=
"新密码"
,
required
=
true
)
@RequestParam
String
newPassword
)
{
@ApiParam
(
value
=
"新密码"
,
required
=
true
)
@RequestParam
String
newPassword
)
{
AgencyUserModel
userModel
=
getUserInfo
();
AgencyUserModel
userModel
=
getUserInfo
();
boolean
flag
=
false
;
boolean
flag
=
false
;
if
(
password
.
equals
(
newPassword
))
{
if
(
password
.
equals
(
newPassword
))
{
return
CommonResponseUtil
.
failure
(
"新密码不能跟旧密码相同!"
);
return
CommonResponseUtil
.
failure
(
"新密码不能跟旧密码相同!"
);
}
}
try
{
try
{
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
//flag=remoteSecurityService.editPassword(getToken(), getProduct(), getAppKey(), userModel.getUserId(), password, newPassword);
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
AgencyUserModel
agencyUserModel
=
new
AgencyUserModel
();
agencyUserModel
.
setPassword
(
newPassword
);
agencyUserModel
.
setPassword
(
newPassword
);
agencyUserModel
.
setRePassword
(
newPassword
);
agencyUserModel
.
setRePassword
(
newPassword
);
agencyUserModel
.
setOriginalPassword
(
password
);
agencyUserModel
.
setOriginalPassword
(
password
);
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"Content-Type"
,
"application/json"
);
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"product"
,
getProduct
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"token"
,
getToken
());
headers
.
set
(
"appKey"
,
getAppKey
());
headers
.
set
(
"appKey"
,
getAppKey
());
HttpEntity
httpEntity
=
new
HttpEntity
<>(
agencyUserModel
,
headers
);
HttpEntity
httpEntity
=
new
HttpEntity
<>(
agencyUserModel
,
headers
);
ResponseEntity
<
FeignClientResult
>
feignClientResult
=
restTemplate
.
exchange
(
"http://"
+
SecurityName
+
"/privilege/v1/agencyuser/"
+
userModel
.
getUserId
()+
"/password"
,
HttpMethod
.
PUT
,
httpEntity
,
FeignClientResult
.
class
);
ResponseEntity
<
FeignClientResult
>
feignClientResult
=
restTemplate
.
exchange
(
"http://"
+
SecurityName
+
"/privilege/v1/agencyuser/"
+
userModel
.
getUserId
()
+
"/password"
,
HttpMethod
.
PUT
,
httpEntity
,
FeignClientResult
.
class
);
if
(
feignClientResult
.
getBody
().
getStatus
()
==
200
)
{
if
(
feignClientResult
.
getBody
().
getStatus
()
==
200
)
{
CommonResponse
dates
=
CommonResponseUtil
.
success
();
CommonResponse
dates
=
CommonResponseUtil
.
success
();
dates
.
setMessage
(
"修改成功!"
);
dates
.
setMessage
(
"修改成功!"
);
return
dates
;
return
dates
;
}
else
{
}
else
{
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getBody
().
getMessage
());
return
CommonResponseUtil
.
failure
(
feignClientResult
.
getBody
().
getMessage
());
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
logger
.
error
(
"修改密码异常"
,
e
);
logger
.
error
(
"修改密码异常"
,
e
);
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
return
CommonResponseUtil
.
failure
(
e
.
getMessage
());
}
}
}
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/MsgRo.java
View file @
414f84bc
...
@@ -15,7 +15,7 @@ import java.util.Map;
...
@@ -15,7 +15,7 @@ import java.util.Map;
@RuleFact
(
value
=
"消防巡查"
,
project
=
"消息规则"
)
@RuleFact
(
value
=
"消防巡查"
,
project
=
"消息规则"
)
public
class
MsgRo
implements
Serializable
{
public
class
MsgRo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4210693601552557441
L
;
private
static
final
long
serialVersionUID
=
-
2766051871044757100
L
;
@Label
(
"名称"
)
@Label
(
"名称"
)
private
String
name
;
private
String
name
;
...
@@ -47,4 +47,7 @@ public class MsgRo implements Serializable {
...
@@ -47,4 +47,7 @@ public class MsgRo implements Serializable {
@Label
(
value
=
"扩展参数"
)
@Label
(
value
=
"扩展参数"
)
private
Map
<
String
,
String
>
extras
;
private
Map
<
String
,
String
>
extras
;
@Label
(
value
=
"类别"
)
private
Integer
category
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/RulePlanService.java
View file @
414f84bc
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
import
com.yeejoin.amos.patrol.business.param.PushMsgParam
;
...
@@ -38,6 +39,7 @@ public class RulePlanService {
...
@@ -38,6 +39,7 @@ public class RulePlanService {
msgRo
.
setExtras
(
pushMsgParam
.
getExtras
());
msgRo
.
setExtras
(
pushMsgParam
.
getExtras
());
msgRo
.
setIsSendApp
(
true
);
msgRo
.
setIsSendApp
(
true
);
msgRo
.
setIsSendWeb
(
true
);
msgRo
.
setIsSendWeb
(
true
);
msgRo
.
setCategory
(
RuleConstant
.
NOTIFY
);
//触发规则
//触发规则
try
{
try
{
ruleTrigger
.
publish
(
msgRo
,
packageId
,
new
String
[
0
]);
ruleTrigger
.
publish
(
msgRo
,
packageId
,
new
String
[
0
]);
...
...
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