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
e8e478b5
Commit
e8e478b5
authored
Mar 18, 2024
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nocommit
parent
922f4fea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
111 additions
and
0 deletions
+111
-0
C12-prediction/pps-core-prediction/src/main/java/pps/core/prediction/service/WellheadDailyProductionSituationService.java
...tion/service/WellheadDailyProductionSituationService.java
+111
-0
No files found.
C12-prediction/pps-core-prediction/src/main/java/pps/core/prediction/service/WellheadDailyProductionSituationService.java
View file @
e8e478b5
package
pps.core.prediction.service
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.github.pagehelper.PageInfo
;
import
com.github.pagehelper.page.PageMethod
;
import
org.apache.commons.lang3.StringUtils
;
import
pps.core.auth.HttpRequestClient
;
import
pps.core.common.cache.ThirdPartyConfigCache
;
import
pps.core.prediction.constant.ThirdPartyApiConstant
;
import
pps.core.prediction.entity.WellheadDailyProductionSituationEnt
;
import
pps.core.prediction.mapper.WellheadDailyProductionSituationMapper
;
import
pps.core.prediction.service.data.wellhead_daily_production_situation.QueryWellheadDailyProductionSituationInput
;
...
...
@@ -12,12 +18,20 @@ import pps.core.prediction.service.data.wellhead_daily_production_situation.Quer
import
xstartup.annotation.XService
;
import
xstartup.annotation.XText
;
import
xstartup.base.XContext
;
import
xstartup.base.XStartup
;
import
xstartup.base.util.XCopyUtils
;
import
xstartup.base.util.XHttpUtils
;
import
xstartup.data.XListResult
;
import
xstartup.data.XPageResult
;
import
xstartup.data.XServiceResult
;
import
xstartup.feature.api.annotation.XApiAnonymous
;
import
xstartup.feature.api.annotation.XApiGet
;
import
xstartup.feature.api.annotation.XApiPost
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 井口生产情况模块(测试用)
...
...
@@ -30,6 +44,7 @@ import java.util.List;
@XService
public
class
WellheadDailyProductionSituationService
{
/**
* 井口生产情况--分页列表
*
...
...
@@ -58,4 +73,100 @@ public class WellheadDailyProductionSituationService {
List
<
QueryWellheadDailyProductionSituationOutput
>
outputs
=
XCopyUtils
.
copyNewList
(
pageInfo
.
getList
(),
QueryWellheadDailyProductionSituationOutput
.
class
);
return
XPageResult
.
success
(
outputs
,
input
,
pageInfo
.
getTotal
());
}
@XText
(
"井口生产情况--t"
)
@XApiAnonymous
@XApiPost
public
XListResult
<
QueryWellheadDailyProductionSituationOutput
>
t
(
XContext
context
,
QueryWellheadDailyProductionSituationInput
input
)
{
String
cqToken
=
this
.
getCqToken
(
context
);
return
XListResult
.
success
();
}
@XApiAnonymous
@XText
(
"井口生产情况--test"
)
@XApiGet
public
XServiceResult
test
(
XContext
context
)
{
context
.
getLogger
().
info
(
"---------------------------cqToken---------------------------"
);
String
cqToken
=
""
;
String
api
=
""
;
try
{
cqToken
=
this
.
getCqToken
(
context
);
context
.
getLogger
().
info
(
"cqToken: "
+
cqToken
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
String
url
=
XStartup
.
getCurrent
().
getProperty
(
"third-party.chang-qing.url"
);
Map
<
String
,
String
>
header
=
new
HashMap
<>(
4
);
header
.
put
(
"token"
,
cqToken
);
context
.
getLogger
().
info
(
"---------------------------CQ_WELL_TECH_DAILY---------------------------"
);
HttpRequestClient
client
=
new
HttpRequestClient
(
cqToken
);
try
{
api
=
url
+
ThirdPartyApiConstant
.
CQ_WELL_TECH_DAILY
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
param
.
put
(
"Calc_Date"
,
"2024-03-15"
);
String
s
=
client
.
doPostForm
(
api
,
param
);
context
.
getLogger
().
info
(
"CQ_WELL_TECH_DAILY: "
+
s
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
context
.
getLogger
().
info
(
"---------------------------CQ_WELL_STATION_PV_DATA---------------------------"
);
try
{
api
=
url
+
ThirdPartyApiConstant
.
CQ_WELL_STATION_PV_DATA
;
String
s
=
client
.
doPostForm
(
api
,
new
HashMap
<>(
4
));
context
.
getLogger
().
info
(
"CQ_WELL_STATION_PV_DATA: "
+
s
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
context
.
getLogger
().
info
(
"---------------------------CQ_RPT_SYSTEM_START_STOP---------------------------"
);
try
{
api
=
url
+
ThirdPartyApiConstant
.
CQ_RPT_SYSTEM_START_STOP
;
Map
<
String
,
Object
>
param
=
new
HashMap
<>(
4
);
param
.
put
(
"Org_Name"
,
"第一采油厂"
);
param
.
put
(
"WELL_NAME"
,
"丹161"
);
String
s
=
client
.
doPostForm
(
api
,
param
);
context
.
getLogger
().
info
(
"CQ_RPT_SYSTEM_START_STOP: "
+
s
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
context
.
getLogger
().
info
(
"---------------------------CQ_WELL_REAL_PV_DATA---------------------------"
);
try
{
api
=
url
+
ThirdPartyApiConstant
.
CQ_WELL_REAL_PV_DATA
;
String
s
=
client
.
doPostForm
(
api
,
new
HashMap
<>(
4
));
context
.
getLogger
().
info
(
"CQ_WELL_REAL_PV_DATA: "
+
s
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
XServiceResult
.
OK
;
}
/**
* 获取长庆TOKEN
*
* @param context 上下文
* @return {@link String}
*/
private
String
getCqToken
(
XContext
context
)
{
String
token
;
ThirdPartyConfigCache
exist
=
ThirdPartyConfigCache
.
exist
(
context
,
ThirdPartyApiConstant
.
CQ_TOKEN_CACHE_KEY
);
if
(
ObjectUtil
.
isNull
(
exist
))
{
String
url
=
XStartup
.
getCurrent
().
getProperty
(
"third-party.chang-qing.url"
);
url
+=
ThirdPartyApiConstant
.
CQ_TOKEN
;
Map
<
String
,
String
>
param
=
new
HashMap
<>(
4
);
param
.
put
(
"UserAccount"
,
"PvGroup"
);
param
.
put
(
"UserPassWord"
,
"PvGroup@147369"
);
String
result
=
XHttpUtils
.
postAsForm
(
url
,
param
);
context
.
getLogger
().
info
(
"CQ_TOKEN: "
+
result
);
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
result
);
token
=
jsonObject
.
getStr
(
"token"
);
ThirdPartyConfigCache
cache
=
new
ThirdPartyConfigCache
();
cache
.
setCodeKey
(
ThirdPartyApiConstant
.
CQ_TOKEN_CACHE_KEY
);
cache
.
setCode
(
token
);
cache
.
setValidity
(
90
);
cache
.
setCurrentDate
(
new
Date
());
ThirdPartyConfigCache
.
set
(
context
,
cache
);
}
else
{
token
=
exist
.
getCode
();
}
return
token
;
}
}
\ 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