Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
gsc
/
gsc-agent-manage-facade
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 0e1e4a87
authored
Nov 25, 2025
by
杨卫
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat:1047089:登录/图片验证码/岗位智能体
1 parent
82510710
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
366 additions
and
687 deletions
src/main/java/com/gsc4cloud/gsc/agentmanage/GscMain.java
src/main/java/com/gsc4cloud/gsc/agentmanage/anotation/RopSession.java
src/main/java/com/gsc4cloud/gsc/agentmanage/config/GscAgentConfig.java
src/main/java/com/gsc4cloud/gsc/agentmanage/config/MvcConfig.java
src/main/java/com/gsc4cloud/gsc/agentmanage/config/RopApiConfig.java
src/main/java/com/gsc4cloud/gsc/agentmanage/config/WebConfig.java
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/EntmicroDepartmentController.java
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/JobAgentDetailController.java
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/JobAgentInfoController.java
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/LoginController.java
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/SysDictController.java
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/LoginInterceptor.java
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/RefreshTokenInterceptor.java
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/SessionInterceptor.java
src/main/java/com/gsc4cloud/gsc/agentmanage/manager/RopManager.java
src/main/java/com/gsc4cloud/gsc/agentmanage/request/sys/DetailRequest.java
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginAccountResponse.java
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginObjResponse.java
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginUserInfoResponse.java
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/RopResponse.java
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/UserInfoResponse.java
src/main/java/com/gsc4cloud/gsc/agentmanage/utils/GLRopApiUtils.java
src/main/java/com/gsc4cloud/gsc/agentmanage/utils/ThreadLocalCache.java
src/main/java/com/gsc4cloud/gsc/agentmanage/GscMain.java
View file @
0e1e4a8
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
package
com
.
gsc4cloud
.
gsc
.
agentmanage
;
package
com
.
gsc4cloud
.
gsc
.
agentmanage
;
import
com.gsc4cloud.gsc.
common.feign.annotation.EnableGscFeignClients
;
import
com.gsc4cloud.gsc.
agentmanage.api.config.FeignConfig
;
import
com.gsc4cloud.gsc.common.swagger.annotation.EnableGscDoc
;
import
com.gsc4cloud.gsc.common.swagger.annotation.EnableGscDoc
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
...
@@ -33,9 +33,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
...
@@ -33,9 +33,9 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
* @date 2025/05/30
* @date 2025/05/30
*/
*/
@EnableGscDoc
(
value
=
"gsc-agent-manage-facade"
)
@EnableGscDoc
(
value
=
"gsc-agent-manage-facade"
)
// @EnableGscFeignClients
@EnableFeignClients
(
@EnableFeignClients
(
basePackages
=
{
"com.gsc4cloud.gsc.agentmanage.api.feign"
}
basePackages
=
{
"com.gsc4cloud.gsc.agentmanage.api.feign"
},
defaultConfiguration
=
FeignConfig
.
class
)
)
@EnableDiscoveryClient
@EnableDiscoveryClient
@SpringBootApplication
@SpringBootApplication
...
...
src/main/java/com/gsc4cloud/gsc/agentmanage/anotation/RopSession.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
anotation
;
import
java.lang.annotation.*
;
/**
* 需要兼容ropsession的地方添加此注解
*/
@Target
(
ElementType
.
METHOD
)
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
public
@interface
RopSession
{
}
src/main/java/com/gsc4cloud/gsc/agentmanage/config/GscAgentConfig.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
config
;
import
com.gsc4cloud.gsc.agentmanage.api.config.LoginConfig
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
/**
* 项目通用配置
* @author yangwei
* @version 1.0
* @since 2025/11/24 19:33
*/
@Data
@Configuration
@ConfigurationProperties
(
prefix
=
"gsc.agent"
)
public
class
GscAgentConfig
{
/** 登录配置 */
private
LoginConfig
loginConfig
=
new
LoginConfig
();
}
src/main/java/com/gsc4cloud/gsc/agentmanage/config/MvcConfig.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
config
;
import
cn.hutool.core.collection.CollUtil
;
import
com.alibaba.nacos.shaded.com.google.common.collect.Lists
;
import
com.gsc4cloud.gsc.agentmanage.api.config.LoginConfig
;
import
com.gsc4cloud.gsc.agentmanage.interceptor.LoginInterceptor
;
import
com.gsc4cloud.gsc.agentmanage.interceptor.RefreshTokenInterceptor
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.List
;
import
java.util.Optional
;
/**
* <pre>
* 注册拦截器
* - refreshTokenInterceptor 刷新 token 拦截器最先执行,需要拦截所有请求(最先执行)
* - loginInterceptor 登录拦截器,拦截需要登录的请求,如果未配置排除的请求,就只放行swagger相关请求 (刷新token拦截器后执行)
* 如:
* - /swagger-ui/**:放行 Swagger 3.x UI 及所有资源
* - /v3/api-docs/**:放行 OpenAPI 3 的规范文件
* - /doc.html:放行 Knife4j 等增强UI
* - /swagger-resources/**:放行 Swagger 2.x 资源
* - /webjars/**:放行 WebJars 静态资源
* </pre>
* @author yangwei
* @version 1.0
* @since 2025/11/15 10:28
*/
@Configuration
@RequiredArgsConstructor
public
class
MvcConfig
implements
WebMvcConfigurer
{
private
final
GscAgentConfig
gscAgentConfig
;
private
final
LoginInterceptor
loginInterceptor
;
private
final
RefreshTokenInterceptor
refreshTokenInterceptor
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
LoginConfig
loginConfig
=
gscAgentConfig
.
getLoginConfig
();
List
<
String
>
excludePaths
=
Optional
.
ofNullable
(
loginConfig
.
getExcludePaths
()).
filter
(
CollUtil:
:
isNotEmpty
)
.
orElse
(
Lists
.
newArrayList
(
"/swagger-ui/**"
,
"/v3/api-docs/**"
,
"/doc.html"
,
"/swagger-resources/**"
,
"/webjars/**"
));
registry
.
addInterceptor
(
refreshTokenInterceptor
)
.
addPathPatterns
(
"/**"
)
.
order
(
0
);
registry
.
addInterceptor
(
loginInterceptor
)
.
excludePathPatterns
(
excludePaths
)
.
order
(
1
);
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/config/RopApiConfig.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
config
;
import
lombok.Data
;
import
lombok.ToString
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.context.annotation.Configuration
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-19:09
* @Version 1.0
*/
@ToString
@Data
@Configuration
@ConfigurationProperties
(
prefix
=
"rop.api"
)
public
class
RopApiConfig
{
private
String
appKey
;
private
String
secret
;
private
String
url
;
private
String
contextPath
;
private
String
method
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/config/WebConfig.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
config
;
import
com.gsc4cloud.gsc.agentmanage.interceptor.SessionInterceptor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-15:37
* @Version 1.0
*/
// @Configuration
public
class
WebConfig
implements
WebMvcConfigurer
{
@Autowired
private
SessionInterceptor
sessionInterceptor
;
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
registry
.
addInterceptor
(
sessionInterceptor
)
.
addPathPatterns
(
"/**"
)
// 拦截所有路径
/*.excludePathPatterns("/login", "/error")*/
;
// 排除不需要拦截的路径
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/EntmicroDepartmentController.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
controller
;
import
com.gsc4cloud.gsc.agentmanage.api.feign.agent.AgentManageRemote
;
import
com.gsc4cloud.gsc.agentmanage.api.vo.DepartmentVO
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>
* 企微部门
* </p>
*
* @author yangwei
* @since 2025-11-21
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/entmicroDepartment"
)
@Tag
(
description
=
"entmicroDepartment"
,
name
=
"企微部门模块"
)
public
class
EntmicroDepartmentController
{
private
final
AgentManageRemote
agentManageRemote
;
@PostMapping
(
"findDeptTree"
)
@Operation
(
summary
=
"查询部门树"
)
public
R
<
List
<
DepartmentVO
>>
findDeptTree
()
{
try
{
return
agentManageRemote
.
findDeptTree
();
}
catch
(
Exception
e
)
{
log
.
error
(
"智能体详情调用异常"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/JobAgentDetailController.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gsc4cloud.gsc.agentmanage.api.feign.agent.AgentManageRemote
;
import
com.gsc4cloud.gsc.agentmanage.api.req.JobAgentInfoDetailReq
;
import
com.gsc4cloud.gsc.agentmanage.api.vo.JobAgentDetailVO
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <p>
* 岗位智能体详情
* </p>
*
* @author yangwei
* @since 2025-11-21
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/jobAgentDetail"
)
@Tag
(
description
=
"jobAgentDetail"
,
name
=
"岗位助理详情"
)
public
class
JobAgentDetailController
{
private
final
AgentManageRemote
agentManageRemote
;
@PostMapping
(
"detailById"
)
@Operation
(
summary
=
"智能体详情"
)
public
R
<
JobAgentDetailVO
>
jobAgentDetailById
(
@RequestBody
JobAgentInfoDetailReq
req
)
{
log
.
info
(
"请求参数{}"
,
JSONObject
.
toJSONString
(
req
));
try
{
return
agentManageRemote
.
jobAgentDetailById
(
req
);
}
catch
(
Exception
e
)
{
log
.
error
(
"智能体详情调用异常"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/JobAgentInfoController.java
View file @
0e1e4a8
...
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.gsc4cloud.gsc.agentmanage.api.feign.agent.AgentManageRemote
;
import
com.gsc4cloud.gsc.agentmanage.api.feign.agent.AgentManageRemote
;
import
com.gsc4cloud.gsc.agentmanage.api.req.JobAgentInfoPageQuery
;
import
com.gsc4cloud.gsc.agentmanage.api.req.JobAgentInfoPageQuery
;
import
com.gsc4cloud.gsc.agentmanage.api.req.JobAgentInfoPutForbiddenReq
;
import
com.gsc4cloud.gsc.agentmanage.api.req.JobAgentUpdateRequest
;
import
com.gsc4cloud.gsc.agentmanage.api.req.PageRequest
;
import
com.gsc4cloud.gsc.agentmanage.api.req.PageRequest
;
import
com.gsc4cloud.gsc.agentmanage.api.vo.JobAgentQueryVO
;
import
com.gsc4cloud.gsc.agentmanage.api.vo.JobAgentQueryVO
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
com.gsc4cloud.gsc.common.core.util.R
;
...
@@ -12,10 +14,10 @@ import io.swagger.v3.oas.annotations.Operation;
...
@@ -12,10 +14,10 @@ import io.swagger.v3.oas.annotations.Operation;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* <p>
* <p>
...
@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
...
@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
* @since 2025-11-21
* @since 2025-11-21
*/
*/
@Slf4j
@Slf4j
@Controller
@
Rest
Controller
@RequiredArgsConstructor
@RequiredArgsConstructor
@RequestMapping
(
"/jobAgentInfo"
)
@RequestMapping
(
"/jobAgentInfo"
)
@Tag
(
description
=
"jobAgentDetail"
,
name
=
"岗位助理详情"
)
@Tag
(
description
=
"jobAgentDetail"
,
name
=
"岗位助理详情"
)
...
@@ -34,7 +36,6 @@ public class JobAgentInfoController {
...
@@ -34,7 +36,6 @@ public class JobAgentInfoController {
private
final
AgentManageRemote
agentManageRemote
;
private
final
AgentManageRemote
agentManageRemote
;
@PostMapping
(
"findPageAgentInfo"
)
@PostMapping
(
"findPageAgentInfo"
)
@Operation
(
summary
=
"岗位助理智能体列表分页"
)
@Operation
(
summary
=
"岗位助理智能体列表分页"
)
public
R
<
Page
<
JobAgentQueryVO
>>
findPageAgentInfo
(
@RequestBody
PageRequest
<
JobAgentInfoPageQuery
>
queryParams
)
{
public
R
<
Page
<
JobAgentQueryVO
>>
findPageAgentInfo
(
@RequestBody
PageRequest
<
JobAgentInfoPageQuery
>
queryParams
)
{
...
@@ -47,4 +48,28 @@ public class JobAgentInfoController {
...
@@ -47,4 +48,28 @@ public class JobAgentInfoController {
}
}
}
}
@PostMapping
(
"forbiddenOrEnable"
)
@Operation
(
summary
=
"智能体禁用"
)
public
R
<
Boolean
>
forbidden
(
@RequestBody
JobAgentInfoPutForbiddenReq
req
)
{
log
.
info
(
"请求参数{}"
,
JSONObject
.
toJSONString
(
req
));
try
{
return
agentManageRemote
.
forbidden
(
req
);
}
catch
(
Exception
e
)
{
log
.
error
(
"智能体禁用调用异常"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
@PostMapping
(
"update"
)
@Operation
(
summary
=
"通过id修改智能体"
)
public
R
<
Boolean
>
updateDiyId
(
@RequestBody
JobAgentUpdateRequest
req
)
{
log
.
info
(
"请求参数{}"
,
JSONObject
.
toJSONString
(
req
));
try
{
return
agentManageRemote
.
updateDiyId
(
req
);
}
catch
(
Exception
e
)
{
log
.
error
(
"智能体禁用调用异常"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/LoginController.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
controller
;
import
com.gsc4cloud.gsc.agentmanage.api.feign.agent.AgentManageRemote
;
import
com.gsc4cloud.gsc.agentmanage.api.req.LoginFormReq
;
import
com.gsc4cloud.gsc.agentmanage.api.vo.VerifyCodeVO
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* <pre>
* 登录控制器,所包含的功能如下
* - 验证码
* - 登录
* </pre>
* @author yangwei
* @version 1.0
* @since 2025/11/24 18:00
*/
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/login"
)
@Tag
(
description
=
"login"
,
name
=
"登录控制器"
)
public
class
LoginController
{
private
final
AgentManageRemote
agentManageRemote
;
@PostMapping
(
"captcha"
)
@Operation
(
summary
=
"获取验证码"
)
public
R
<
VerifyCodeVO
>
captcha
()
{
try
{
return
agentManageRemote
.
captcha
();
}
catch
(
Exception
e
)
{
log
.
error
(
"岗位助理智能体列表分页"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
@PostMapping
()
@Operation
(
summary
=
"登录"
)
public
R
<
String
>
login
(
@RequestBody
LoginFormReq
loginFormReq
)
{
try
{
return
agentManageRemote
.
login
(
loginFormReq
);
}
catch
(
Exception
e
)
{
log
.
error
(
"登录异常"
,
e
);
return
R
.
failed
(
e
.
getMessage
());
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/controller/SysDictController.java
deleted
100644 → 0
View file @
8251071
/*
*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the gsc4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*
*/
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
controller
;
import
com.gsc4cloud.gsc.agentmanage.anotation.RopSession
;
import
com.gsc4cloud.gsc.agentmanage.request.sys.DetailRequest
;
import
com.gsc4cloud.gsc.agentmanage.response.rop.LoginAccountResponse
;
import
com.gsc4cloud.gsc.agentmanage.utils.ThreadLocalCache
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
com.gsc4cloud.gsc.common.feign.annotation.NoToken
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.AllArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
/**
* 字典表前端控制器
*
* @author lengleng
* @date 2025/05/30
* @since 2019-03-19
*/
@RestController
@AllArgsConstructor
@RequestMapping
(
"/dict"
)
@Tag
(
description
=
"dict"
,
name
=
"字典管理模块"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
public
class
SysDictController
{
/**
* 通过ID查询字典信息
*
* @param id 字典ID
* @return 包含字典信息的响应对象
*/
@PostMapping
(
"/details/byId"
)
@Operation
(
summary
=
"通过ID查询字典信息"
)
public
R
getById
(
DetailRequest
detailRequest
)
{
System
.
out
.
println
(
"用户信息:"
+
ThreadLocalCache
.
getLoginInfo
());
return
R
.
ok
(
"ok"
);
}
@RopSession
// ROPsession注解,必须要rop登录信息
@PostMapping
(
"/details/user"
)
@Operation
(
summary
=
"用户信息"
)
public
R
<
LoginAccountResponse
>
getUser
(
DetailRequest
detailRequest
)
{
System
.
out
.
println
(
"用户信息:"
+
ThreadLocalCache
.
getLoginAccountInfo
());
return
R
.
ok
(
ThreadLocalCache
.
getLoginAccountInfo
());
}
@GetMapping
(
"/sign/test"
)
@Operation
(
summary
=
"验签测试"
)
public
R
<
String
>
signTest
(
DetailRequest
detailRequest
)
{
return
R
.
ok
(
"验签成功"
);
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/LoginInterceptor.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
interceptor
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.gsc4cloud.gsc.agentmanage.api.consts.ContentTypeConstants
;
import
com.gsc4cloud.gsc.agentmanage.api.dto.UserDTO
;
import
com.gsc4cloud.gsc.agentmanage.api.enums.ErrorCodeEnum
;
import
com.gsc4cloud.gsc.agentmanage.api.util.UserContext
;
import
com.gsc4cloud.gsc.common.core.util.R
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
java.io.IOException
;
import
java.io.PrintWriter
;
/**
* 登录拦截器
* @author yangwei
* @version 1.0
* @since 2025/11/25 10:17
*/
@Slf4j
@Component
public
class
LoginInterceptor
implements
HandlerInterceptor
{
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
{
UserDTO
user
=
UserContext
.
getUser
();
if
(
ObjectUtil
.
isNull
(
user
))
{
try
{
response
.
setStatus
(
401
);
response
.
setContentType
(
ContentTypeConstants
.
JSON_WITH_UTF8
);
PrintWriter
writer
=
response
.
getWriter
();
R
<?>
loginError
=
R
.
restResult
(
null
,
ErrorCodeEnum
.
LOGIN_ERROR
.
getCode
(),
ErrorCodeEnum
.
LOGIN_ERROR
.
getMessage
());
writer
.
write
(
JSONUtil
.
toJsonStr
(
loginError
));
writer
.
flush
();
}
catch
(
IOException
e
)
{
log
.
error
(
"登录错误信息写出错误"
);
}
return
false
;
}
else
{
return
true
;
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/RefreshTokenInterceptor.java
0 → 100644
View file @
0e1e4a8
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
interceptor
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.gsc4cloud.gsc.agentmanage.api.consts.CommonConstants
;
import
com.gsc4cloud.gsc.agentmanage.api.consts.RedisConstants
;
import
com.gsc4cloud.gsc.agentmanage.api.dto.UserDTO
;
import
com.gsc4cloud.gsc.agentmanage.config.GscAgentConfig
;
import
com.gsc4cloud.gsc.agentmanage.api.util.UserContext
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
java.util.concurrent.TimeUnit
;
/**
* 刷新 token 时间
* @author yangwei
* @version 1.0
* @since 2025/11/24 21:03
*/
@Component
@RequiredArgsConstructor
public
class
RefreshTokenInterceptor
implements
HandlerInterceptor
{
private
final
GscAgentConfig
gscAgentConfig
;
private
final
StringRedisTemplate
stringRedisTemplate
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
String
token
=
request
.
getHeader
(
CommonConstants
.
REQUEST_HEAD_AUTHORIZATION
);
if
(
StrUtil
.
isBlank
(
token
))
{
return
true
;
}
ValueOperations
<
String
,
String
>
valueOps
=
stringRedisTemplate
.
opsForValue
();
String
userStr
=
valueOps
.
get
(
RedisConstants
.
LOGIN_USER_KEY
+
token
);
if
(
StrUtil
.
isBlank
(
userStr
))
{
return
true
;
}
UserContext
.
saveUser
(
JSONUtil
.
toBean
(
userStr
,
UserDTO
.
class
));
// 刷新 token 有效期
Integer
expire
=
gscAgentConfig
.
getLoginConfig
().
getExpire
();
// stringRedisTemplate.expire(RedisConstants.LOGIN_USER_KEY + token, expire, TimeUnit.SECONDS);
valueOps
.
set
(
RedisConstants
.
LOGIN_USER_KEY
+
token
,
userStr
,
expire
,
TimeUnit
.
SECONDS
);
return
true
;
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
UserContext
.
removeUser
();
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/interceptor/SessionInterceptor.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
interceptor
;
import
com.gsc4cloud.gsc.agentmanage.anotation.RopSession
;
import
com.gsc4cloud.gsc.agentmanage.manager.RopManager
;
import
com.gsc4cloud.gsc.agentmanage.utils.ThreadLocalCache
;
import
lombok.extern.slf4j.Slf4j
;
import
jakarta.servlet.http.HttpServletRequest
;
import
jakarta.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.method.HandlerMethod
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
java.lang.reflect.Method
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-15:35
* @Version 1.0
*/
@Slf4j
@Component
public
class
SessionInterceptor
implements
HandlerInterceptor
{
@Autowired
private
RopManager
ropManager
;
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
String
path
=
request
.
getRequestURI
();
// 忽略swagger
if
(
path
.
startsWith
(
"/swagger-ui"
)
||
path
.
contains
(
"/v3/api-docs"
)
||
path
.
startsWith
(
"/doc.html"
))
{
return
true
;
}
if
(!(
handler
instanceof
HandlerMethod
))
{
return
true
;
}
HandlerMethod
handlerMethod
=
(
HandlerMethod
)
handler
;
Method
method
=
handlerMethod
.
getMethod
();
// 1. 检查方法上是否有特定注解
if
(!
method
.
isAnnotationPresent
(
RopSession
.
class
))
{
// 没有RopSession,则跳过token验证
return
true
;
}
// 从请求参数中获取sessionId
String
sessionId
=
request
.
getParameter
(
"sessionId"
);
if
(
sessionId
==
null
||
sessionId
.
isEmpty
())
{
// 如果没有sessionId参数,直接放行(或者可以根据需求返回错误)
throw
new
Exception
(
"sessionId参数缺失"
);
}
ropManager
.
saveLoginInfo
(
sessionId
);
// 无论是否找到用户信息,都继续执行后续流程
return
true
;
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
// 请求结束后清除ThreadLocal中的用户信息,防止内存泄漏
try
{
ThreadLocalCache
.
removeLoginInfo
();
ThreadLocalCache
.
removeLoginAccountInfo
();
log
.
info
(
"ThreadLocal用户信息已清除"
);
}
catch
(
Exception
e
)
{
log
.
warn
(
"清除ThreadLocal用户信息时发生异常"
,
e
);
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/manager/RopManager.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
manager
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gsc4cloud.gsc.agentmanage.config.RopApiConfig
;
import
com.gsc4cloud.gsc.agentmanage.response.rop.*
;
import
com.gsc4cloud.gsc.agentmanage.utils.GLRopApiUtils
;
import
com.gsc4cloud.gsc.agentmanage.utils.ThreadLocalCache
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-19:24
* @Version 1.0
*/
@Component
public
class
RopManager
{
@Autowired
private
RopApiConfig
ropApiConfig
;
public
void
saveLoginInfo
(
String
sessionId
)
throws
Exception
{
if
(
ropApiConfig
.
getContextPath
()
==
null
||
ropApiConfig
.
getContextPath
().
isEmpty
())
throw
new
Exception
(
"缺少必要的rop配置"
);
if
(
"rop-dj-car-boutique"
.
equals
(
ropApiConfig
.
getContextPath
())){
ropDjCarBoutiqueHandler
(
sessionId
);
return
;
}
if
(
"rop-dj-smartcarlife"
.
equals
(
ropApiConfig
.
getContextPath
())){
ropDjSmartCarLifeHandler
(
sessionId
);
return
;
}
}
private
void
ropDjSmartCarLifeHandler
(
String
sessionId
)
throws
Exception
{
//请求地址,区分环境
String
url
=
ropApiConfig
.
getUrl
();
String
appKey
=
ropApiConfig
.
getAppKey
();
String
secret
=
ropApiConfig
.
getSecret
();
//项目名称
String
contextPath
=
ropApiConfig
.
getContextPath
();
// 默认拼装路径
url
=
url
.
concat
(
contextPath
).
concat
(
"/router"
);
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
<
String
,
String
>(
4
);
// 版本号,必填,默认1.0.0
params
.
add
(
"v"
,
"1.0.0"
);
// 接口名称,必填
params
.
add
(
"method"
,
ropApiConfig
.
getMethod
());
// 参数,根据接口添加
params
.
add
(
"sessionId"
,
sessionId
);
// post请求
RopResponse
<
Object
>
post
=
GLRopApiUtils
.
post
(
url
,
params
,
RopResponse
.
class
,
appKey
,
secret
);
if
(
post
.
getData
()
!=
null
)
{
String
data
=
JSON
.
toJSONString
(
post
.
getData
());
// json字符串转换对象
UserInfoResponse
loginObj
=
JSONObject
.
parseObject
(
data
,
UserInfoResponse
.
class
);
if
(
loginObj
!=
null
&&
loginObj
.
getLoginAccount
()
!=
null
)
{
LoginAccountResponse
loginUserInfo
=
loginObj
.
getLoginAccount
();
// 存储到当前线程
ThreadLocalCache
.
setLoginAccountInfo
(
loginUserInfo
);
}
}
else
{
throw
new
Exception
(
"用户信息获取失败: "
+
post
.
getMessage
());
}
}
private
void
ropDjCarBoutiqueHandler
(
String
sessionId
)
throws
Exception
{
//请求地址,区分环境
String
url
=
ropApiConfig
.
getUrl
();
String
appKey
=
ropApiConfig
.
getAppKey
();
String
secret
=
ropApiConfig
.
getSecret
();
//项目名称
String
contextPath
=
ropApiConfig
.
getContextPath
();
// 默认拼装路径
url
=
url
.
concat
(
contextPath
).
concat
(
"/router"
);
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
<
String
,
String
>(
4
);
// 版本号,必填,默认1.0.0
params
.
add
(
"v"
,
"1.0.0"
);
// 接口名称,必填
params
.
add
(
"method"
,
ropApiConfig
.
getMethod
());
// 参数,根据接口添加
params
.
add
(
"sessionId"
,
sessionId
);
// post请求
RopResponse
<
Object
>
post
=
GLRopApiUtils
.
post
(
url
,
params
,
RopResponse
.
class
,
appKey
,
secret
);
if
(
post
.
getData
()
!=
null
)
{
String
data
=
JSON
.
toJSONString
(
post
.
getData
());
// json字符串转换对象
LoginObjResponse
loginObj
=
JSONObject
.
parseObject
(
data
,
LoginObjResponse
.
class
);
if
(
loginObj
!=
null
&&
loginObj
.
getLoginUserInfoList
()
!=
null
&&
!
loginObj
.
getLoginUserInfoList
().
isEmpty
())
{
LoginUserInfoResponse
loginUserInfo
=
loginObj
.
getLoginUserInfoList
().
get
(
0
);
// 存储到当前线程
ThreadLocalCache
.
setLoginInfo
(
loginUserInfo
);
}
}
else
{
throw
new
Exception
(
"用户信息获取失败: "
+
post
.
getMessage
());
}
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/request/sys/DetailRequest.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
request
.
sys
;
import
lombok.Data
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-16:18
* @Version 1.0
*/
@Data
public
class
DetailRequest
{
private
Long
id
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginAccountResponse.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
response
.
rop
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.List
;
@Data
@ToString
public
class
LoginAccountResponse
{
// (notes = "登录类型2.员工 1.商户")
private
Integer
userType
;
// (notes = "用户名")
private
String
loginAccout
;
// (notes = "姓名")
private
String
userName
;
// (notes = "商户名称")
private
String
merchantName
;
// (notes = "商户账号层级")
private
Integer
accountLevel
;
// (notes = "商户账号状态")
private
Integer
status
;
// (notes = "商户号")
private
Integer
merchantNo
;
// (notes = "渠道类型")
private
String
channelType
;
// (notes = "商户模式 1.集团版 2.门店版")
private
Integer
merchantModel
;
// (notes = "账号唯一id")
private
String
uuid
;
// (notes = "头像")
private
String
staffAvatar
;
// (notes = "是否超管(1:是否,0:否)")
private
Integer
isAdmin
;
private
String
createdTime
;
private
List
<
String
>
merchantAccountList
;
// (notes = "登录角色 3-区域运营 4-广联销售")
private
Integer
loginRole
;
// (notes = "广联数科下角色名称")
private
String
roleName
;
//notes = "手机号")
private
String
phone
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginObjResponse.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
response
.
rop
;
import
lombok.Data
;
import
lombok.ToString
;
import
java.util.List
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-16:28
* @Version 1.0
*/
@ToString
@Data
public
class
LoginObjResponse
{
private
String
sessionId
;
private
String
noSignInUuid
;
private
Boolean
needSelectAccount
;
private
List
<
LoginUserInfoResponse
>
loginUserInfoList
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/LoginUserInfoResponse.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
response
.
rop
;
import
lombok.Data
;
import
lombok.ToString
;
import
org.springframework.beans.BeanUtils
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 禁止改动(确实需要改动的与周海宝确认两边同步修改)
* @Title: LoginUserInfoResponse.java
* @Description:
* @author zhoulm
* @date 2024年8月2日 17:42:37
*/
@Data
@ToString
public
class
LoginUserInfoResponse
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
3576264570350286128L
;
// name = "accountName", notes = "登录账号", dataType = "string", required = true, example = "")
private
String
accountName
;
// name = "merchantId", notes = "商户号", dataType = "int", required = true, example = "")
private
Integer
merchantId
;
// notes = "账号类型(4门店,3片区(市级经销商),2大区(省级经销商),1总部(工厂))", dataType = "int", required = true, example = "")
private
Integer
accountLevel
;
// notes = "用户类型(1:商户,2员工)", dataType = "int", required = true, example = "")
private
Integer
userType
;
// name = "phone", notes = "手机号", dataType = "string", required = true, example = "")
private
String
phone
;
/** 员工姓名**/
// name = "name", notes = "员工姓名", dataType = "string", required = true, example = "")
private
String
name
;
// name = "duty", notes = "职务", dataType = "string", required = true, example = "")
private
String
duty
;
/** 商户名称**/
// name = "merchantName", notes = "商户名称", dataType = "string", required = true, example = "")
private
String
merchantName
;
// name="channelType", notes = "渠道类型", dataType = "int", example = "")
private
Integer
channelType
;
/**是否超级管理员**/
private
Boolean
isSuper
;
// notes = "账号ID")
private
String
uuid
;
// name="createdDate", notes = "创建时间", dataType = "Date", example = "")
private
String
createdDate
;
/**
* 用户数据权限商户ID
*/
private
List
<
Integer
>
permissionMerchantIds
;
/** 子登录信息**/
private
LoginUserInfoResponse
subLoginUser
;
private
List
<
String
>
merchantAccountList
;
/** 登录角色**/
// name="loginRole", notes = "登录角色 1-超管 2-商户管理员 3-区域督导 4-驻店人员 5-广联销售 6-飞行督导 7-技师", example = "")
private
Integer
loginRole
;
// notes = "选择的4S店商户号")
private
Integer
shopMerchantId
;
// notes = "选择的4S店商户名称")
private
String
shopMerchantName
;
// notes = "选择的业务场景")
private
Byte
sceneType
;
// notes = "在当前选择的4S下的登录角色 3-区域督导 4-驻店人员", example = "")
private
Integer
loginRoleOnSelectMerchant
;
// notes = "业务id(员工或者商户)")
private
Integer
bussinessId
;
public
LoginUserInfoResponse
clone
(){
LoginUserInfoResponse
r
=
new
LoginUserInfoResponse
();
BeanUtils
.
copyProperties
(
this
,
r
);
return
r
;
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/RopResponse.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
response
.
rop
;
import
lombok.Data
;
/**
* @Description todo
* @Author yelq
* @Date 2025/7/28-16:12
* @Version 1.0
*/
@Data
public
class
RopResponse
<
T
>
{
private
String
code
;
private
String
errId
;
private
String
message
;
private
T
data
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/response/rop/UserInfoResponse.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
response
.
rop
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @Title: UserInfoResponse.java
* @Description: 用户个人信息返回实体
* @author caiym
* @date 2020年11月11日 11:07
* @version V1.0.0
* @Company: didihu.com.cn
* @Copyright Copyright (c) 2020
*/
@Data
public
class
UserInfoResponse
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4845569468798367039L
;
// (notes = "登录信息")
private
LoginAccountResponse
loginAccount
;
}
src/main/java/com/gsc4cloud/gsc/agentmanage/utils/GLRopApiUtils.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
utils
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
java.io.IOException
;
import
java.security.GeneralSecurityException
;
import
java.security.MessageDigest
;
import
java.util.*
;
/**
* @Description 请求广联接口的工具类
* @Author
* @Date 2025/7/1-16:54
* @Version 1.0
*/
public
class
GLRopApiUtils
{
public
static
<
T
>
T
post
(
String
url
,
MultiValueMap
<
String
,
String
>
paramsMap
,
Class
<
T
>
responseType
,
String
appKey
,
String
secret
)
throws
Exception
{
MultiValueMap
<
String
,
String
>
params
=
getSysParams
(
appKey
);
params
.
putAll
(
paramsMap
);
for
(
Map
.
Entry
<
String
,
String
>
entry
:
params
.
toSingleValueMap
().
entrySet
())
{
if
(
entry
.
getValue
()
==
null
||
entry
.
getValue
().
isEmpty
())
{
params
.
remove
(
entry
.
getKey
());
}
}
String
sign
=
sign
(
params
.
toSingleValueMap
(),
secret
);
params
.
add
(
"sign"
,
sign
);
return
new
RestTemplate
().
postForObject
(
url
,
params
,
responseType
);
}
protected
static
MultiValueMap
<
String
,
String
>
getSysParams
(
String
appKey
)
{
MultiValueMap
<
String
,
String
>
params
=
new
LinkedMultiValueMap
<
String
,
String
>(
16
);
params
.
add
(
"appKey"
,
appKey
);
params
.
add
(
"format"
,
"json"
);
params
.
add
(
"locale"
,
"zh_CN"
);
return
params
;
}
public
static
String
sign
(
Map
<
String
,
String
>
paramValues
,
String
secret
)
{
try
{
StringBuilder
sb
=
new
StringBuilder
();
List
<
String
>
paramNames
=
new
ArrayList
(
paramValues
.
size
());
paramNames
.
addAll
(
paramValues
.
keySet
());
Iterator
var5
;
String
paramName
;
Collections
.
sort
(
paramNames
);
sb
.
append
(
secret
);
var5
=
paramNames
.
iterator
();
while
(
var5
.
hasNext
())
{
paramName
=
(
String
)
var5
.
next
();
sb
.
append
(
paramName
).
append
((
String
)
paramValues
.
get
(
paramName
));
}
sb
.
append
(
secret
);
byte
[]
sha1Digest
=
getSHA1Digest
(
sb
.
toString
());
return
byte2hex
(
sha1Digest
);
}
catch
(
IOException
var7
)
{
throw
new
RuntimeException
(
var7
);
}
}
private
static
byte
[]
getSHA1Digest
(
String
data
)
throws
IOException
{
byte
[]
bytes
=
null
;
try
{
MessageDigest
md
=
MessageDigest
.
getInstance
(
"SHA-1"
);
bytes
=
md
.
digest
(
data
.
getBytes
(
"UTF-8"
));
return
bytes
;
}
catch
(
GeneralSecurityException
var3
)
{
throw
new
IOException
(
var3
);
}
}
private
static
String
byte2hex
(
byte
[]
bytes
)
{
StringBuilder
sign
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
bytes
.
length
;
++
i
)
{
String
hex
=
Integer
.
toHexString
(
bytes
[
i
]
&
255
);
if
(
hex
.
length
()
==
1
)
{
sign
.
append
(
"0"
);
}
sign
.
append
(
hex
.
toUpperCase
());
}
return
sign
.
toString
();
}
}
src/main/java/com/gsc4cloud/gsc/agentmanage/utils/ThreadLocalCache.java
deleted
100644 → 0
View file @
8251071
package
com
.
gsc4cloud
.
gsc
.
agentmanage
.
utils
;
import
com.gsc4cloud.gsc.agentmanage.response.rop.LoginAccountResponse
;
import
com.gsc4cloud.gsc.agentmanage.response.rop.LoginUserInfoResponse
;
public
class
ThreadLocalCache
{
// rop-dj-car-boutique
private
static
ThreadLocal
<
LoginUserInfoResponse
>
loginInfoCache
=
new
ThreadLocal
<
LoginUserInfoResponse
>();
// rop-dj-smartcarlife
private
static
ThreadLocal
<
LoginAccountResponse
>
LoginAccountInfoCache
=
new
ThreadLocal
<
LoginAccountResponse
>();
public
static
void
setLoginAccountInfo
(
LoginAccountResponse
loginAccountInfo
)
{
LoginAccountInfoCache
.
set
(
loginAccountInfo
);
}
public
static
LoginAccountResponse
getLoginAccountInfo
()
{
return
LoginAccountInfoCache
.
get
();
}
public
static
void
removeLoginAccountInfo
()
{
LoginAccountInfoCache
.
remove
();
}
public
static
void
setLoginInfo
(
LoginUserInfoResponse
loginInfo
)
{
loginInfoCache
.
set
(
loginInfo
);
}
public
static
LoginUserInfoResponse
getLoginInfo
()
{
return
loginInfoCache
.
get
();
}
public
static
void
removeLoginInfo
()
{
loginInfoCache
.
remove
();
}
}
Write
Preview
Markdown
is supported
Attach a file
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 post a comment