Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
4fe26238
Commit
4fe26238
authored
Sep 06, 2021
by
maoying
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改数字换流站集成页面默认登录接口
parent
2ee7154a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
34 deletions
+53
-34
LoginController.java
...yeejoin/amos/fas/business/controller/LoginController.java
+46
-30
PermissionAspect.java
...in/java/com/yeejoin/amos/fas/config/PermissionAspect.java
+2
-1
fas-2.0.1.xml
...utoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
+5
-3
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/LoginController.java
View file @
4fe26238
...
...
@@ -2,6 +2,7 @@ package com.yeejoin.amos.fas.business.controller;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.component.feign.config.TokenOperation
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.fas.business.feign.OutTokenLoginFeign
;
import
com.yeejoin.amos.fas.business.feign.PrivilegeFeign
;
...
...
@@ -10,6 +11,7 @@ import com.yeejoin.amos.fas.business.vo.CompanyBo;
import
com.yeejoin.amos.fas.business.vo.DepartmentBo
;
import
com.yeejoin.amos.fas.business.vo.ReginParams
;
import
com.yeejoin.amos.fas.business.vo.RoleBo
;
import
com.yeejoin.amos.fas.business.vo.Toke
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.ApplicationModel
;
...
...
@@ -36,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
* @author zjw
...
...
@@ -76,42 +79,55 @@ public class LoginController {
}
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
String
token
=
(
String
)
request
.
getHeader
(
"token"
)
;
String
token
=
ObjectUtils
.
isEmpty
(
request
.
getHeader
(
"token"
))?
"szhlz"
:
request
.
getHeader
(
"token"
).
toString
()
;
ReginParams
reginParams
;
reginParams
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
userId
,
token
)),
ReginParams
.
class
);
if
(
reginParams
==
null
){
reginParams
=
new
ReginParams
();
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
userId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
if
(
ObjectUtils
.
isEmpty
(
feignClientResult
.
getResult
())){
throw
new
Exception
(
"缺失登录信息"
);
}
Map
<
String
,
String
>
re
=
(
Map
<
String
,
String
>)
feignClientResult
.
getResult
();
String
amosToken
=
re
.
get
(
"token"
);
privilegeFeign
.
warrant
(
appKey
,
product
,
amosToken
);
RequestContext
.
setToken
(
amosToken
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
AgencyUserModel
userModel
=
(
AgencyUserModel
)
Privilege
.
agencyUserClient
.
getme
().
getResult
();
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
List
<
DepartmentModel
>
deptList
=
remoteSecurityService
.
getDepartmentTreeByCompanyId
(
amosToken
,
product
,
appKey
,
companyModel
.
getSequenceNbr
().
toString
());
if
(
deptList
.
size
()
>
0
){
CompanyBo
companyBo
=
convertCompanyModelToBo
(
companyModel
);
DepartmentBo
departmentBo
=
convertDepartmentModelToBo
(
deptList
.
get
(
0
));
reginParams
.
setDepartment
(
departmentBo
);
reginParams
.
setCompany
(
companyBo
);
}
reginParams
.
setToken
(
amosToken
);
reginParams
.
setUserModel
(
userModel
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
reginParams
));
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
amosToken
),
JSONObject
.
toJSONString
(
reginParams
));
reginParams
=
getLogin
(
userId
,
token
);
}
else
{
RequestContext
.
setProduct
(
product
);
if
(!
TokenOperation
.
refresh
(
reginParams
.
getToken
()))
{
reginParams
=
getLogin
(
userId
,
token
);
}
}
return
reginParams
;
}
private
ReginParams
getLogin
(
String
userId
,
String
token
)
throws
Exception
{
ReginParams
reginParams
=
new
ReginParams
();
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
userId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
if
(
ObjectUtils
.
isEmpty
(
feignClientResult
.
getResult
())){
throw
new
Exception
(
"缺失登录信息"
);
}
Map
<
String
,
String
>
re
=
(
Map
<
String
,
String
>)
feignClientResult
.
getResult
();
String
amosToken
=
re
.
get
(
"token"
);
privilegeFeign
.
warrant
(
appKey
,
product
,
amosToken
);
RequestContext
.
setToken
(
amosToken
);
RequestContext
.
setProduct
(
product
);
RequestContext
.
setAppKey
(
appKey
);
AgencyUserModel
userModel
=
(
AgencyUserModel
)
Privilege
.
agencyUserClient
.
getme
().
getResult
();
CompanyModel
companyModel
=
userModel
.
getCompanys
().
get
(
0
);
List
<
DepartmentModel
>
deptList
=
remoteSecurityService
.
getDepartmentTreeByCompanyId
(
amosToken
,
product
,
appKey
,
companyModel
.
getSequenceNbr
().
toString
());
if
(
deptList
.
size
()
>
0
){
CompanyBo
companyBo
=
convertCompanyModelToBo
(
companyModel
);
DepartmentBo
departmentBo
=
convertDepartmentModelToBo
(
deptList
.
get
(
0
));
reginParams
.
setDepartment
(
departmentBo
);
reginParams
.
setCompany
(
companyBo
);
}
reginParams
.
setToken
(
amosToken
);
reginParams
.
setUserModel
(
userModel
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
reginParams
),
28
,
TimeUnit
.
DAYS
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
amosToken
),
JSONObject
.
toJSONString
(
reginParams
),
28
,
TimeUnit
.
DAYS
);
return
reginParams
;
}
private
DepartmentBo
convertDepartmentModelToBo
(
DepartmentModel
departmentModel
){
DepartmentBo
departmentBo
=
new
DepartmentBo
();
if
(
departmentModel
!=
null
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/config/PermissionAspect.java
View file @
4fe26238
...
...
@@ -34,6 +34,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
@Aspect
@Component
...
...
@@ -101,7 +102,7 @@ public class PermissionAspect {
if
(!
ObjectUtils
.
isEmpty
(
roleModels
)){
regionParam
.
setRole
(
convertRoleModelToBo
(
roleModels
.
get
(
0
)));
}
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
regionParam
));
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userId
,
token
),
JSONObject
.
toJSONString
(
regionParam
)
,
28
,
TimeUnit
.
DAYS
);
}
}
}
catch
(
InnerInvokException
e
)
{
...
...
YeeAmosFireAutoSysStart/src/main/resources/db/changelog/fas-2.0.1.xml
View file @
4fe26238
...
...
@@ -550,14 +550,16 @@
alter table `f_risk_source` add column `source_id` bigint(20) DEFAULT NULL AFTER `status`;
</sql>
</changeSet>
<changeSet
author=
"shg"
id=
"160922680886
6
-2"
>
<changeSet
author=
"shg"
id=
"160922680886
7
-2"
>
<preConditions
onFail=
"MARK_RAN"
>
<columnExists
tableName=
"f_risk_source"
columnName=
"source_id"
/>
<not>
<indexExists
indexName=
"unique_idx_source_id"
/>
</not>
</preConditions>
<comment>
f_risk_source add UNIQUE source_id
</comment>
<sql>
ALTER TABLE `f_risk_source` ADD UNIQUE unique_idx_source_id(source_id);
</sql>
</sql>
</changeSet>
<changeSet
author=
"gaojianqiang"
id=
"1609989898-1"
>
<preConditions
onFail=
"MARK_RAN"
>
...
...
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