Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gf_back
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianchao
gf_back
Commits
a525e8f8
Commit
a525e8f8
authored
Mar 18, 2024
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nocommit
parent
e8e478b5
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
580 additions
and
0 deletions
+580
-0
C00-common/pps-common/src/main/java/pps/core/auth/Auth.java
C00-common/pps-common/src/main/java/pps/core/auth/Auth.java
+17
-0
C00-common/pps-common/src/main/java/pps/core/auth/BasicAuth.java
...mon/pps-common/src/main/java/pps/core/auth/BasicAuth.java
+30
-0
C00-common/pps-common/src/main/java/pps/core/auth/BearerAuth.java
...on/pps-common/src/main/java/pps/core/auth/BearerAuth.java
+21
-0
C00-common/pps-common/src/main/java/pps/core/auth/HttpRequestClient.java
...common/src/main/java/pps/core/auth/HttpRequestClient.java
+403
-0
C00-common/pps-common/src/main/java/pps/core/common/cache/ThirdPartyConfigCache.java
...ain/java/pps/core/common/cache/ThirdPartyConfigCache.java
+72
-0
C12-prediction/pps-core-prediction/src/main/java/pps/core/prediction/constant/ThirdPartyApiConstant.java
...a/pps/core/prediction/constant/ThirdPartyApiConstant.java
+37
-0
No files found.
C00-common/pps-common/src/main/java/pps/core/auth/Auth.java
0 → 100644
View file @
a525e8f8
package
pps.core.auth
;
/**
* 基础认证Auth
*
* @author ZWT
* @date 2023/01/09
*/
public
interface
Auth
{
/**
* 基础认证Auth
*
* @return {@link String}
*/
String
getAuth
();
}
\ No newline at end of file
C00-common/pps-common/src/main/java/pps/core/auth/BasicAuth.java
0 → 100644
View file @
a525e8f8
package
pps.core.auth
;
import
org.apache.commons.codec.binary.Base64
;
import
java.nio.charset.StandardCharsets
;
/**
* 用户名密码认证
*
* @author ZWT
* @date 2023/01/09
*/
public
class
BasicAuth
implements
Auth
{
private
String
username
;
private
String
password
;
public
BasicAuth
(
String
username
,
String
password
)
{
this
.
username
=
username
;
this
.
password
=
password
;
}
@Override
public
String
getAuth
()
{
String
auth
=
String
.
format
(
"%s:%s"
,
this
.
username
,
this
.
password
);
byte
[]
encodedAuth
=
Base64
.
encodeBase64
(
auth
.
getBytes
(
StandardCharsets
.
ISO_8859_1
));
return
"Basic "
+
new
String
(
encodedAuth
);
}
}
\ No newline at end of file
C00-common/pps-common/src/main/java/pps/core/auth/BearerAuth.java
0 → 100644
View file @
a525e8f8
package
pps.core.auth
;
/**
* Bearer Token 认证
*
* @author ZWT
* @date 2023/01/09
*/
public
class
BearerAuth
implements
Auth
{
private
String
token
;
public
BearerAuth
(
String
token
)
{
this
.
token
=
token
;
}
@Override
public
String
getAuth
()
{
return
"Bearer "
+
this
.
token
;
}
}
\ No newline at end of file
C00-common/pps-common/src/main/java/pps/core/auth/HttpRequestClient.java
0 → 100644
View file @
a525e8f8
This diff is collapsed.
Click to expand it.
C00-common/pps-common/src/main/java/pps/core/common/cache/ThirdPartyConfigCache.java
0 → 100644
View file @
a525e8f8
package
pps.core.common.cache
;
import
lombok.Data
;
import
xstartup.base.XContext
;
import
xstartup.cache.XCacheLife
;
import
xstartup.cache.XCacheObject
;
import
xstartup.cache.XSingleCache
;
import
java.util.Date
;
/**
* 第三方Token查询缓存
*
* @author ZWT
* @date 2023/12/12
*/
@Data
public
class
ThirdPartyConfigCache
implements
XCacheObject
,
XCacheLife
{
private
String
codeKey
;
private
String
code
;
private
Integer
validity
;
private
Date
currentDate
;
@Override
public
Integer
getDuration
()
{
return
validity
*
60
;
}
@Override
public
String
getCacheKey
()
{
return
this
.
codeKey
;
}
/**
* 检查缓存是否存在指定的code
*
* @param context 上下文
* @param code 密码
* @return {@link ThirdPartyConfigCache}
*/
public
static
ThirdPartyConfigCache
exist
(
XContext
context
,
String
code
)
{
return
XSingleCache
.
get
(
Tool
.
class
).
find
(
context
,
code
,
ThirdPartyConfigCache
.
class
);
}
/**
* 删去
*
* @param context 上下文
* @param loginName 登录名
*/
public
static
void
delete
(
XContext
context
,
String
loginName
)
{
XSingleCache
.
get
(
Tool
.
class
).
delete
(
context
,
loginName
,
ThirdPartyConfigCache
.
class
);
}
/**
* 设置缓存
*
* @param context 上下文
* @param cache 隐藏物
*/
public
static
void
set
(
XContext
context
,
ThirdPartyConfigCache
cache
)
{
XSingleCache
.
get
(
Tool
.
class
).
set
(
context
,
cache
);
}
static
class
Tool
extends
XSingleCache
<
ThirdPartyConfigCache
>
{
@Override
protected
ThirdPartyConfigCache
restore
(
XContext
context
,
String
cacheKey
)
{
return
null
;
}
}
}
\ No newline at end of file
C12-prediction/pps-core-prediction/src/main/java/pps/core/prediction/constant/ThirdPartyApiConstant.java
0 → 100644
View file @
a525e8f8
package
pps.core.prediction.constant
;
/**
* 第三方接口地址
*
* @author ZWT
* @date 2024/03/18 09:25
*/
public
class
ThirdPartyApiConstant
{
/*------------------------------ 长庆 ------------------------------*/
/**
* Redis缓存key
*/
public
static
final
String
CQ_TOKEN_CACHE_KEY
=
"pps.third.cq.token"
;
/**
* 长庆Token
*/
public
static
final
String
CQ_TOKEN
=
"/Smart_Well_Data/api/v1/Auth/GetToken"
;
/**
* 获取日耗电日产液等信息
*/
public
static
final
String
CQ_WELL_TECH_DAILY
=
"/Smart_Well_Data/api/v1/PvDataManagement/GET_WELL_TECH_DAILY"
;
/**
* 获取有功功率数据
*/
public
static
final
String
CQ_WELL_STATION_PV_DATA
=
"/Smart_Well_Data/api/v1/PvDataManagement/GET_WELL_STATION_PV_DATA"
;
/**
* 获取甘特图数据
*/
public
static
final
String
CQ_RPT_SYSTEM_START_STOP
=
"/Smart_Well_Data/api/v1/SdDataManagement/Get_RPT_SYSTEM_START_STOP"
;
/**
* 本日累计数据
*/
public
static
final
String
CQ_WELL_REAL_PV_DATA
=
"/Smart_Well_Data/api/v1/PvDataManagement/GET_WELL_Real_PV_DATA"
;
}
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