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
9eac2ec1
Commit
9eac2ec1
authored
Oct 08, 2022
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自动登录机器人
parent
d452ff3d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
457 additions
and
195 deletions
+457
-195
pom.xml
...e/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
+15
-15
RemoteSecurityService.java
...com/yeejoin/equipmanage/remote/RemoteSecurityService.java
+55
-32
LoginController.java
...yeejoin/amos/fas/business/controller/LoginController.java
+2
-2
RemoteSecurityService.java
...eejoin/amos/fas/business/feign/RemoteSecurityService.java
+0
-0
RemoteSecurityService.java
...eejoin/amos/latentdanger/feign/RemoteSecurityService.java
+53
-28
RemoteSecurityService.java
...yeejoin/amos/maintenance/feign/RemoteSecurityService.java
+52
-28
RemoteSecurityService.java
.../com/yeejoin/amos/patrol/feign/RemoteSecurityService.java
+60
-30
UserController.java
.../amos/supervision/business/controller/UserController.java
+1
-1
RemoteSecurityService.java
...yeejoin/amos/supervision/feign/RemoteSecurityService.java
+53
-28
pom.xml
amos-boot-module/pom.xml
+8
-0
application.properties
...ot-system-equip/src/main/resources/application.properties
+7
-1
application-dev.properties
...-system-fas/src/main/resources/application-dev.properties
+30
-5
application.properties
...boot-system-jcs/src/main/resources/application.properties
+10
-1
application.properties
...m-knowledgebase/src/main/resources/application.properties
+7
-1
LatentDangerApplication.java
...c/main/java/com/yeejoin/amos/LatentDangerApplication.java
+3
-1
application-dev.properties
...atentdanger/src/main/resources/application-dev.properties
+12
-4
application.properties
...em-latentdanger/src/main/resources/application.properties
+7
-1
application-dev.properties
...maintenance/src/main/resources/application-dev.properties
+15
-4
application.properties
...tem-maintenance/src/main/resources/application.properties
+8
-2
application-dev.properties
...stem-patrol/src/main/resources/application-dev.properties
+13
-4
application.properties
...t-system-patrol/src/main/resources/application.properties
+9
-1
application-dev.properties
...supervision/src/main/resources/application-dev.properties
+12
-4
application.properties
...tem-supervision/src/main/resources/application.properties
+8
-2
application.properties
...oot-utils-jpush/src/main/resources/application.properties
+8
-0
application.properties
...oot-utils-video/src/main/resources/application.properties
+9
-0
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/pom.xml
View file @
9eac2ec1
...
...
@@ -51,21 +51,21 @@
<artifactId>
geodesy
</artifactId>
<version>
1.1.3
</version>
</dependency>
<dependency
>
<groupId>
com.yeejoin
</groupId
>
<artifactId>
amos-component-authtoken
</artifactId
>
<version>
1.7.13-SNAPSHOT
</version
>
<exclusions
>
<exclusion
>
<groupId>
org.typroject
</groupId
>
<artifactId>
*
</artifactId
>
</exclusion
>
<exclusion
>
<groupId>
io.springfox
</groupId
>
<artifactId>
*
</artifactId
>
</exclusion
>
</exclusions
>
</dependency
>
<!-- <dependency>--
>
<!-- <groupId>com.yeejoin</groupId>--
>
<!-- <artifactId>amos-component-authtoken</artifactId>--
>
<!-- <version>1.7.13-SNAPSHOT</version>--
>
<!-- <exclusions>--
>
<!-- <exclusion>--
>
<!-- <groupId>org.typroject</groupId>--
>
<!-- <artifactId>*</artifactId>--
>
<!-- </exclusion>--
>
<!-- <exclusion>--
>
<!-- <groupId>io.springfox</groupId>--
>
<!-- <artifactId>*</artifactId>--
>
<!-- </exclusion>--
>
<!-- </exclusions>--
>
<!-- </dependency>--
>
</dependencies>
</project>
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/remote/RemoteSecurityService.java
View file @
9eac2ec1
...
...
@@ -47,17 +47,28 @@ import com.yeejoin.equipmanage.common.vo.Token;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
@Autowired
AmosRequestContext
amosRequestContext
;
@Value
(
"${amos.system.user.password}"
)
private
String
password
;
// @Value("${security.password}")
// private String password;
// @Value("${security.loginId}")
// private String loginId;
//
// @Value("${security.productWeb}")
// private String productWeb;
//
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKeyApp
;
@Value
(
"${amos.system.user.user-name}"
)
private
String
userName
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
...
...
@@ -67,6 +78,9 @@ public class RemoteSecurityService {
@Autowired
private
HttpServletRequest
request
;
@Autowired
AmosRequestContext
amosRequestContext
;
// * 根据公司id查询机构用户
public
List
<
AgencyUserModel
>
listUserByCompanyId
(
String
companyId
)
{
...
...
@@ -407,23 +421,28 @@ public class RemoteSecurityService {
// }
public
Token
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
amosRequestContext
.
getUserName
());
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Token
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
this
.
redisTemplate
.
opsForValue
().
get
(
buildKey
(
amosRequestContext
.
getUserName
())),
Token
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
if
(!
redisUtils
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
}
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(loginId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// Token toke = null;
// try {
// toke = JSON.parseObject(this.redisTemplate.opsForValue().get(buildKey(loginId)), Token.class);
// if (ObjectUtils.isEmpty(toke)) {
// toke = getLogin(dPasswordAuthModel);
// } else {
// RequestContext.setProduct(productWeb);
// if (!redisUtils.refresh(toke.getToke())) {
// toke = getLogin(dPasswordAuthModel);
// }
// }
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
Token
toke
=
new
Token
();
toke
.
setAppKey
(
appKeyApp
);
toke
.
setProduct
(
product
);
toke
.
setToke
(
amosRequestContext
.
getToken
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userName
),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
...
...
@@ -432,13 +451,17 @@ public class RemoteSecurityService {
return
"system_"
+
username
;
}
private
Token
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
)
{
Token
toke
=
new
Token
();
RequestContext
.
setProduct
(
amosRequestContext
.
getProduct
());
toke
.
setToke
(
amosRequestContext
.
getToken
());
toke
.
setProduct
(
amosRequestContext
.
getProduct
());
toke
.
setAppKey
(
amosRequestContext
.
getAppKey
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
// private Token getLogin(IdPasswordAuthModel dPasswordAuthModel) {
// Token toke = new Token();
// RequestContext.setProduct(productWeb);
// FeignClientResult feignClientResult = Privilege.authClient.idpassword(dPasswordAuthModel);
// Map map = (Map) feignClientResult.getResult();
// if (map != null) {
// toke.setToke(map.get("token").toString());
// toke.setProduct(productWeb);
// toke.setAppKey(appKeyApp);
// redisTemplate.opsForValue().set(buildKey(dPasswordAuthModel.getLoginId()), JSONObject.toJSONString(toke), 28, TimeUnit.DAYS);
// }
// return toke;
// }
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/business/controller/LoginController.java
View file @
9eac2ec1
...
...
@@ -64,10 +64,10 @@ public class LoginController {
@Value
(
"${outSystem.user.password}"
)
private
String
password
;
@Value
(
"${
security.productWeb
}"
)
@Value
(
"${
amos.system.user.product
}"
)
private
String
product
;
@Value
(
"${
security.appK
ey}"
)
@Value
(
"${
amos.system.user.app-k
ey}"
)
private
String
appKey
;
@ApiOperation
(
value
=
"通过userId登录"
,
notes
=
"查询设备指标"
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-fas-biz/src/main/java/com/yeejoin/amos/fas/business/feign/RemoteSecurityService.java
View file @
9eac2ec1
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/feign/RemoteSecurityService.java
View file @
9eac2ec1
...
...
@@ -10,6 +10,7 @@ import java.util.Set;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.component.authtoken.robot.AmosRequestContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -44,17 +45,35 @@ import com.yeejoin.amos.latentdanger.common.remote.IAMOSSecurityServer;
@Service
(
"remoteSecurityService-danger"
)
public
class
RemoteSecurityService
{
@Value
(
"${security.password}"
)
private
String
password
;
@Value
(
"${security.loginId}"
)
private
String
loginId
;
@Value
(
"${security.productWeb}"
)
private
String
productWeb
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
// @Value("${security.password}")
// private String password;
// @Value("${security.loginId}")
// private String loginId;
// @Value("${security.productWeb}")
// private String productWeb;
// @Value("${security.appKey}")
// private String appKey;
// @Value("${security.productApp}")
// private String productApp;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${amos.system.user.user-name}"
)
private
String
userName
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Autowired
AmosRequestContext
amosRequestContext
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RemoteSecurityService
.
class
);
@Autowired
...
...
@@ -101,34 +120,39 @@ public class RemoteSecurityService {
}
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Toke
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
productWeb
);
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
}
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(loginId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// Toke toke = null;
// try {
// toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(loginId)), Toke.class);
// if (ObjectUtils.isEmpty(toke)) {
// toke = getLogin(dPasswordAuthModel);
// } else {
// RequestContext.setProduct(productWeb);
// if (!TokenOperation.refresh(toke.getToke())) {
// toke = getLogin(dPasswordAuthModel);
// }
// }
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
Toke
toke
=
new
Toke
();
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
toke
.
setToke
(
amosRequestContext
.
getToken
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userName
),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
)
{
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
)
{
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
product
Web
);
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
...
...
@@ -558,6 +582,7 @@ public class RemoteSecurityService {
return
null
;
}
public
boolean
loginOutFromApp
(
String
toke
,
String
product
,
String
appKey
)
{
RequestContext
.
setToken
(
toke
);
RequestContext
.
setProduct
(
product
);
...
...
@@ -628,7 +653,7 @@ public class RemoteSecurityService {
public
AgencyUserModel
getAgencyUserModel
(
String
token
)
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
try
{
AgencyUserModel
result
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
return
result
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/feign/RemoteSecurityService.java
View file @
9eac2ec1
...
...
@@ -11,6 +11,7 @@ import java.util.Set;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.component.authtoken.robot.AmosRequestContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,17 +46,35 @@ import com.yeejoin.amos.maintenance.common.remote.IAMOSSecurityServer;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
@Value
(
"${security.password}"
)
private
String
password
;
@Value
(
"${security.loginId}"
)
private
String
loginId
;
@Value
(
"${security.productWeb}"
)
private
String
productWeb
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
// @Value("${security.password}")
// private String password;
// @Value("${security.loginId}")
// private String loginId;
// @Value("${security.productWeb}")
// private String productWeb;
// @Value("${security.appKey}")
// private String appKey;
// @Value("${security.productApp}")
// private String productApp;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${amos.system.user.user-name}"
)
private
String
userName
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Autowired
AmosRequestContext
amosRequestContext
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RemoteSecurityService
.
class
);
@Autowired
...
...
@@ -102,34 +121,39 @@ public class RemoteSecurityService {
}
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Toke
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
productWeb
);
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
}
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(loginId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// Toke toke = null;
// try {
// toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(loginId)), Toke.class);
// if (ObjectUtils.isEmpty(toke)) {
// toke = getLogin(dPasswordAuthModel);
// } else {
// RequestContext.setProduct(product);
// if (!TokenOperation.refresh(toke.getToke())) {
// toke = getLogin(dPasswordAuthModel);
// }
// }
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
Toke
toke
=
new
Toke
();
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
toke
.
setToke
(
amosRequestContext
.
getToken
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userName
),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
)
{
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
)
{
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
product
Web
);
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
...
...
@@ -637,7 +661,7 @@ public class RemoteSecurityService {
public
AgencyUserModel
getAgencyUserModel
(
String
token
)
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
try
{
AgencyUserModel
result
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
return
result
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/feign/RemoteSecurityService.java
View file @
9eac2ec1
...
...
@@ -11,6 +11,7 @@ import java.util.Set;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.component.authtoken.robot.AmosRequestContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -45,17 +46,38 @@ import com.yeejoin.amos.patrol.common.remote.IAMOSSecurityServer;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
@Value
(
"${security.password}"
)
private
String
password
;
@Value
(
"${security.loginId}"
)
private
String
loginId
;
@Value
(
"${security.productWeb}"
)
private
String
productWeb
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
// @Value("${security.password}")
// private String password;
// @Value("${security.loginId}")
// private String loginId;
// @Value("${security.productWeb}")
// private String productWeb;
// @Value("${security.appKey}")
// private String appKey;
// @Value("${security.productApp}")
// private String productApp;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${amos.system.user.user-name}"
)
private
String
userName
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
@Autowired
AmosRequestContext
amosRequestContext
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RemoteSecurityService
.
class
);
@Autowired
...
...
@@ -102,36 +124,44 @@ public class RemoteSecurityService {
}
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Toke
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
productWeb
);
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
}
RequestContext
.
setAppKey
(
toke
.
getAppKey
());
RequestContext
.
setToken
(
toke
.
getToke
());
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(loginId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// Toke toke = null;
// try {
// toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(loginId)), Toke.class);
// if (ObjectUtils.isEmpty(toke)) {
// toke = getLogin(dPasswordAuthModel);
// } else {
// RequestContext.setProduct(productWeb);
// if (!TokenOperation.refresh(toke.getToke())) {
// toke = getLogin(dPasswordAuthModel);
// }
// }
// RequestContext.setAppKey(toke.getAppKey());
// RequestContext.setToken(toke.getToke());
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
// return toke;
Toke
toke
=
new
Toke
();
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
toke
.
setToke
(
amosRequestContext
.
getToken
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userName
),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
)
{
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
)
{
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
product
Web
);
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
...
...
@@ -631,7 +661,7 @@ public class RemoteSecurityService {
public
AgencyUserModel
getAgencyUserModel
(
String
token
)
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
try
{
AgencyUserModel
result
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
return
result
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/controller/UserController.java
View file @
9eac2ec1
...
...
@@ -87,7 +87,7 @@ public class UserController extends AbstractBaseController {
private
String
SecurityName
;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${
security.appK
ey}"
)
@Value
(
"${
amos.system.user.app-k
ey}"
)
private
String
appKey
;
@Autowired
private
RestTemplate
restTemplate
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/feign/RemoteSecurityService.java
View file @
9eac2ec1
...
...
@@ -11,6 +11,7 @@ import java.util.Set;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
com.yeejoin.amos.component.authtoken.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.systemctl.model.MessageModel
;
import
com.yeejoin.amos.supervision.business.feign.JCSFeignClient
;
import
com.yeejoin.amos.supervision.common.remote.IAMOSSecurityServer
;
...
...
@@ -48,17 +49,33 @@ import org.typroject.tyboot.core.foundation.context.RequestContextModel;
@Service
(
"remoteSecurityService"
)
public
class
RemoteSecurityService
{
@Value
(
"${security.password}"
)
private
String
password
;
@Value
(
"${security.loginId}"
)
private
String
loginId
;
@Value
(
"${security.productWeb}"
)
private
String
productWeb
;
@Value
(
"${security.appKey}"
)
private
String
appKey
;
// @Value("${security.password}")
// private String password;
// @Value("${security.loginId}")
// private String loginId;
// @Value("${security.productWeb}")
// private String productWeb;
// @Value("${security.appKey}")
// private String appKey;
// @Value("${security.productApp}")
// private String productApp;
@Value
(
"${security.productApp}"
)
private
String
productApp
;
@Value
(
"${amos.system.user.user-name}"
)
private
String
userName
;
@Value
(
"${amos.system.user.app-key}"
)
private
String
appKey
;
@Value
(
"${amos.system.user.product}"
)
private
String
product
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
RemoteSecurityService
.
class
);
@Autowired
...
...
@@ -70,6 +87,9 @@ public class RemoteSecurityService {
@Autowired
private
JCSFeignClient
jcsFeignClient
;
@Autowired
AmosRequestContext
amosRequestContext
;
//根据公司名称获取公司人
public
List
<
CompanyModel
>
listCompanyTree
(
String
toke
,
String
product
,
String
appKey
,
String
companyName
)
{
RequestContext
.
setToken
(
toke
);
...
...
@@ -107,34 +127,39 @@ public class RemoteSecurityService {
}
public
Toke
getServerToken
()
{
IdPasswordAuthModel
dPasswordAuthModel
=
new
IdPasswordAuthModel
();
dPasswordAuthModel
.
setLoginId
(
loginId
);
dPasswordAuthModel
.
setPassword
(
DesUtil
.
encode
(
password
,
"qaz"
));
Toke
toke
=
null
;
try
{
toke
=
JSON
.
parseObject
(
redisTemplate
.
opsForValue
().
get
(
buildKey
(
loginId
)),
Toke
.
class
);
if
(
ObjectUtils
.
isEmpty
(
toke
))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
else
{
RequestContext
.
setProduct
(
productWeb
);
if
(!
TokenOperation
.
refresh
(
toke
.
getToke
()))
{
toke
=
getLogin
(
dPasswordAuthModel
);
}
}
}
catch
(
InnerInvokException
e
)
{
e
.
printStackTrace
();
}
// IdPasswordAuthModel dPasswordAuthModel = new IdPasswordAuthModel();
// dPasswordAuthModel.setLoginId(loginId);
// dPasswordAuthModel.setPassword(DesUtil.encode(password, "qaz"));
// Toke toke = null;
// try {
// toke = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(loginId)), Toke.class);
// if (ObjectUtils.isEmpty(toke)) {
// toke = getLogin(dPasswordAuthModel);
// } else {
// RequestContext.setProduct(productWeb);
// if (!TokenOperation.refresh(toke.getToke())) {
// toke = getLogin(dPasswordAuthModel);
// }
// }
// } catch (InnerInvokException e) {
// e.printStackTrace();
// }
Toke
toke
=
new
Toke
();
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
toke
.
setToke
(
amosRequestContext
.
getToken
());
redisTemplate
.
opsForValue
().
set
(
buildKey
(
userName
),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
return
toke
;
}
private
Toke
getLogin
(
IdPasswordAuthModel
dPasswordAuthModel
)
{
Toke
toke
=
new
Toke
();
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
FeignClientResult
feignClientResult
=
Privilege
.
authClient
.
idpassword
(
dPasswordAuthModel
);
Map
map
=
(
Map
)
feignClientResult
.
getResult
();
if
(
map
!=
null
)
{
toke
.
setToke
(
map
.
get
(
"token"
).
toString
());
toke
.
setProduct
(
product
Web
);
toke
.
setProduct
(
product
);
toke
.
setAppKey
(
appKey
);
redisTemplate
.
opsForValue
().
set
(
buildKey
(
dPasswordAuthModel
.
getLoginId
()),
JSONObject
.
toJSONString
(
toke
),
28
,
TimeUnit
.
DAYS
);
}
...
...
@@ -642,7 +667,7 @@ public class RemoteSecurityService {
public
AgencyUserModel
getAgencyUserModel
(
String
token
)
{
RequestContext
.
setToken
(
token
);
RequestContext
.
setAppKey
(
appKey
);
RequestContext
.
setProduct
(
product
Web
);
RequestContext
.
setProduct
(
product
);
try
{
AgencyUserModel
result
=
Privilege
.
agencyUserClient
.
getme
().
getResult
();
return
result
;
...
...
amos-boot-module/pom.xml
View file @
9eac2ec1
...
...
@@ -33,6 +33,14 @@
<groupId>
org.apache.logging.log4j
</groupId>
<artifactId>
log4j-api
</artifactId>
</dependency>
<!--平台用户登录-->
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-authtoken
</artifactId>
<version>
1.7.13-SNAPSHOT
</version>
</dependency>
</dependencies>
<modules>
...
...
amos-boot-system-equip/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -90,7 +90,13 @@ dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
equip.enabled
=
true
management.endpoints.enabled-by-default
=
false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
# 权限标识-物联区域
auth-key-area
=
area_info
...
...
amos-boot-system-fas/src/main/resources/application-dev.properties
View file @
9eac2ec1
...
...
@@ -9,12 +9,37 @@ spring.datasource.testWhileIdle = true
spring.datasource.validationQuery
=
SELECT 1
#系统服务账号,用户后端服务调用
security.password
=
a1234560
security.loginId
=
fas_autosys
#security.password=a1234560
#security.loginId=fas_autosys
#
##应用product appkey
#security.productWeb=STUDIO_APP_WEB
#security.appKey =studio_normalapp_2681691
#security.password=a1234560
#security.loginId=fas_autosys
##应用product appkey
#security.productWeb=STUDIO_APP_WEB
#security.appKey =studio_normalapp_2681691
amos.system.user.user-name
=
fas_autosys
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
studio_normalapp_2681691
amos.system.user.product
=
AMOS_STUDIO_WEB
#应用product appkey
security.productWeb
=
STUDIO_APP_WEB
security.appKey
=
studio_normalapp_2681691
eureka.client.serviceUrl.defaultZone
=
http://172.16.10.72:10001/eureka/
eureka.client.registry-fetch-interval-seconds
=
5
...
...
amos-boot-system-jcs/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -123,7 +123,16 @@ mybatis.interceptor.enabled = false
## 消防救援保障部ID
fire-rescue
=
1432549862557130753
management.endpoints.enabled-by-default
=
false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
#阿里云实时语音识别参数
speech-config.access-key-id
=
LTAI5t62oH95jgbjRiNXPsho
speech-config.access-key-secret
=
shy9SpogYgcdDoyTB3bvP21VSRmz8n
...
...
amos-boot-system-knowledgebase/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -22,4 +22,9 @@ mybatis-plus.mapper-locations=classpath:mapper/*
## redis失效时间
redis.cache.failure.time
=
10800
management.endpoints.enabled-by-default
=
false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ No newline at end of file
amos-boot-system-latentdanger/src/main/java/com/yeejoin/amos/LatentDangerApplication.java
View file @
9eac2ec1
...
...
@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.actuate.autoconfigure.elasticsearch.ElasticSearchRestHealthContributorAutoConfiguration
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
...
...
@@ -36,7 +37,8 @@ import java.net.UnknownHostException;
* @author amos
* @version $Id: LatentDangerApplication.java, v 0.1 2018年11月26日 下午4:56:29 amos Exp $
*/
@SpringBootApplication
@SpringBootApplication
(
exclude
=
{
ElasticSearchRestHealthContributorAutoConfiguration
.
class
,
//es健康检测
})
@EnableTransactionManagement
@EnableConfigurationProperties
@ServletComponentScan
...
...
amos-boot-system-latentdanger/src/main/resources/application-dev.properties
View file @
9eac2ec1
...
...
@@ -27,11 +27,19 @@ spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
security.password
=
a1234560
security.loginId
=
jc_wjk006
security.productWeb
=
STUDIO_APP_WEB
#security.password=a1234560
#security.loginId=jc_wjk006
#security.productWeb=STUDIO_APP_WEB
#security.productApp=STUDIO_APP_MOBILE
#security.appKey=studio_normalapp_3168830
security.productApp
=
STUDIO_APP_MOBILE
security.appKey
=
studio_normalapp_3168830
amos.system.user.user-name
=
jc_wjk006
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
studio_normalapp_3168830
amos.system.user.product
=
STUDIO_APP_WEB
#redis 配置
spring.redis.database
=
1
...
...
amos-boot-system-latentdanger/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -64,4 +64,9 @@ latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name
=
AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID
fire-rescue
=
1432549862557130753
management.endpoints.enabled-by-default
=
false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ No newline at end of file
amos-boot-system-maintenance/src/main/resources/application-dev.properties
View file @
9eac2ec1
...
...
@@ -9,11 +9,22 @@ eureka.client.serviceUrl.defaultZone=http://172.16.10.211:10001/eureka/
jcs.fegin.name
=
JCS
security.password
=
a1234560
security.loginId
=
jc_wjk006
security.productWeb
=
STUDIO_APP_WEB
#security.password=a1234560
#security.loginId=jc_wjk006
#security.productWeb=STUDIO_APP_WEB
#security.productApp=STUDIO_APP_MOBILE
#security.appKey=studio_normalapp_3168830
security.productApp
=
STUDIO_APP_MOBILE
security.appKey
=
studio_normalapp_3168830
amos.system.user.user-name
=
jc_wjk006
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
studio_normalapp_3168830
amos.system.user.product
=
STUDIO_APP_WEB
#redis 配置
spring.redis.database
=
1
spring.redis.host
=
172.16.10.211
...
...
amos-boot-system-maintenance/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -67,4 +67,10 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path
=
/actuator/info
eureka.instance.metadata-map.management.api-docs
=
http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
management.endpoints.enabled-by-default
=
false
\ No newline at end of file
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ No newline at end of file
amos-boot-system-patrol/src/main/resources/application-dev.properties
View file @
9eac2ec1
...
...
@@ -27,11 +27,20 @@ spring.datasource.hikari.maximum-pool-size = 10
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQuery
=
SELECT 1
security.password
=
a1234560
security.loginId
=
jc_wjk006
security.productWeb
=
STUDIO_APP_WEB
#security.password=a1234560
#security.loginId=jc_wjk006
#security.productWeb=STUDIO_APP_WEB
#security.productApp=STUDIO_APP_MOBILE
#security.appKey=studio_normalapp_3168830
security.productApp
=
STUDIO_APP_MOBILE
security.appKey
=
studio_normalapp_3168830
amos.system.user.user-name
=
jc_wjk006
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
studio_normalapp_3168830
amos.system.user.product
=
STUDIO_APP_WEB
#redis 配置
spring.redis.database
=
1
...
...
amos-boot-system-patrol/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -58,6 +58,13 @@ rule.definition.default-agency=STATE_GRID
jcs.fegin.name
=
JCS
emergency.command.section.id
=
1418223840361709569
management.endpoints.enabled-by-default
=
false
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
equipment.hierarchy
=
1,2,4,6
\ No newline at end of file
amos-boot-system-supervision/src/main/resources/application-dev.properties
View file @
9eac2ec1
...
...
@@ -5,11 +5,19 @@ spring.datasource.password= Yeejoin@2020
## eureka properties:
eureka.client.serviceUrl.defaultZone
=
http://172.16.10.211:10001/eureka/
security.password
=
a1234560
security.loginId
=
jc_wjk006
security.productWeb
=
STUDIO_APP_WEB
#security.password=a1234560
#security.loginId=jc_wjk006
#security.productWeb=STUDIO_APP_WEB
#security.productApp=STUDIO_APP_MOBILE
#security.appKey=studio_normalapp_3168830
security.productApp
=
STUDIO_APP_MOBILE
security.appKey
=
studio_normalapp_3168830
amos.system.user.user-name
=
jc_wjk006
amos.system.user.password
=
a1234560
amos.system.user.app-key
=
studio_normalapp_3056965
amos.system.user.product
=
STUDIO_APP_WEB
#redis 配置
...
...
amos-boot-system-supervision/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -73,4 +73,10 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path
=
/actuator/info
eureka.instance.metadata-map.management.api-docs
=
http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
management.endpoints.enabled-by-default
=
false
\ No newline at end of file
#management.endpoints.enabled-by-default=false
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ No newline at end of file
amos-boot-utils/amos-boot-utils-jpush/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -5,3 +5,10 @@ spring.profiles.active=dev
spring.jackson.time-zone
=
GMT+8
spring.jackson.date-format
=
yyyy-MM-dd HH:mm:ss
spring.jackson.serialization.write-dates-as-timestamps
=
true
## ӽӿĵ֤
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ No newline at end of file
amos-boot-utils/amos-boot-utils-video/src/main/resources/application.properties
View file @
9eac2ec1
...
...
@@ -35,3 +35,11 @@ spring.redis.lettuce.pool.max-wait=-1
spring.redis.lettuce.pool.max-idle
=
10
spring.redis.lettuce.pool.min-idle
=
0
spring.redis.expire.time
=
300
## 增加接口文档验证
knife4j.enable
=
true
knife4j.basic.enable
=
true
knife4j.basic.username
=
admin
knife4j.basic.password
=
yeejoin@2020
\ 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