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
e503cc05
Commit
e503cc05
authored
Dec 17, 2024
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
得到的
parent
3e4af8a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
96 deletions
+4
-96
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseLineService.java
.../src/main/java/pps/core/base/service/BaseLineService.java
+4
-96
No files found.
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseLineService.java
View file @
e503cc05
package
pps.core.base.service
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
pps.core.base.excel.ThirdApiWeatherDataListener
;
import
pps.core.base.excel.ThirdApiWeatherDataListener2
;
import
pps.core.base.excel.WindPredictionDataListener
;
import
pps.core.base.excel.WindPredictionDataListener2
;
import
pps.cloud.base.service.IWindPredictionHistoryCloudService
;
import
pps.core.base.service.data.base_data.GetBaseDataInput
;
import
pps.core.base.service.data.base_excel.WindPredictionExcel2Data
;
import
pps.core.base.service.data.base_excel.WindPredictionExcelData
;
import
pps.core.base.service.data.base_power_line.DynamicQueryBasePowerLineInput
;
import
pps.core.base.service.data.base_power_line.DynamicQueryBasePowerLineOutput
;
import
pps.core.base.service.data.third_weather_data.ThirdApiWeatherExcelData
;
import
xstartup.annotation.XService
;
import
xstartup.annotation.XText
;
import
xstartup.base.XContext
;
import
xstartup.base.XStartup
;
import
xstartup.data.XListResult
;
import
xstartup.data.XServiceResult
;
import
xstartup.feature.api.annotation.XApiGet
;
import
xstartup.feature.api.annotation.XApiPost
;
import
java.io.File
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@XService
public
class
BaseLineService
{
private
static
final
String
storeDir
=
XStartup
.
getCurrent
().
getProperty
(
"weather.file.temp.path"
);
@XText
(
"线路列表"
)
@XApiPost
public
XListResult
<
DynamicQueryBasePowerLineOutput
>
queryBaseLineList
(
XContext
context
,
DynamicQueryBasePowerLineInput
input
)
{
...
...
@@ -40,85 +23,10 @@ public class BaseLineService {
}
@XText
(
"天气"
)
@XApiGet
public
XServiceResult
test
(
XContext
context
,
GetBaseDataInput
input
)
{
// BaseWeatherCloudServiceImpl bean = context.getBean(BaseWeatherCloudServiceImpl.class);
// bean.weatherDataProcess(context, input.getKeyName());
// WindPredictionHistoryCloudServiceImpl bean = context.getBean(WindPredictionHistoryCloudServiceImpl.class);
// bean.windPredictionHistoryJob(context);
// ThirdWindPowerGenerationCloudServiceImpl bean = context.getBean(ThirdWindPowerGenerationCloudServiceImpl.class);
// bean.thirdWindPowerGenerationJob(context);
// IWeatherAttachmentCloudService service = context.getBean(IWeatherAttachmentCloudService.class);
// XSingleResult<GetWeatherAttachmentRecordOutput> result = service.getEmail(context, GetWeatherAttachmentRecordInput.builder()
// .build());
// result.throwIfFail();
// GetWeatherAttachmentRecordOutput output = result.getResult();
// if (ObjectUtil.isNotNull(output) && CharSequenceUtil.isAllNotBlank(output.getEmailName(), output.getEmailAttachmentUrl())) {
// String filePath = this.createFilePath(output.getEmailName());
// HttpUtil.downloadFile(output.getEmailAttachmentUrl(), filePath);
// context.getLogger().info(FileUtil.readUtf8String(filePath));
// }
return
XServiceResult
.
OK
;
}
/**
* 创建文件路径
*
* @param fileName 文件名
* @return {@link String }
*/
private
String
createFilePath
(
String
fileName
)
{
StringBuilder
stringBuilder
=
new
StringBuilder
(
storeDir
)
.
append
(
File
.
separator
)
.
append
(
DateTime
.
now
().
toString
(
"yyyyMMdd"
));
return
stringBuilder
.
append
(
File
.
separator
).
append
(
fileName
).
toString
();
}
@XText
(
"风资源历史数据配置导入"
)
@XApiGet
public
XServiceResult
importWindPrediction
(
XContext
context
)
{
String
fileName
=
"D:\\工作\\尚博信\\数据智能事业部\\零碳\\演示\\吉林\\新需求\\20240828\\data\\"
;
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"11.csv"
,
"0191993ac6707650bc41b04b04ce9b62"
);
map
.
put
(
"12.csv"
,
"0191993ac6707650bc41b04b04ce9b63"
);
map
.
put
(
"13.csv"
,
"0191993ac6707650bc41b04b04ce9b64"
);
map
.
put
(
"14.csv"
,
"0191993ac6707650bc41b04b04ce9b65"
);
map
.
put
(
"15.csv"
,
"0191993ac6707650bc41b04b04ce9b66"
);
map
.
put
(
"16.csv"
,
"11d04d59195746f48e14e149969940e5"
);
map
.
put
(
"17.csv"
,
"133dae9b74034bab8c0f96a2878c41aa"
);
map
.
put
(
"18.csv"
,
"8aa54645c3e34977ba3d121325881843"
);
map
.
put
(
"20.csv"
,
"c0e6e7a0163f4e75a6e5e05627c0731a"
);
map
.
forEach
((
key
,
value
)
->
{
EasyExcel
.
read
(
fileName
+
key
,
WindPredictionExcelData
.
class
,
new
WindPredictionDataListener
(
context
,
value
)).
sheet
().
doRead
();
});
return
XServiceResult
.
OK
;
}
@XText
(
"实际风资源数据"
)
@XApiGet
public
XServiceResult
importWindPrediction2
(
XContext
context
)
{
String
fileName
=
"D:\\工作\\尚博信\\数据智能事业部\\零碳\\演示\\吉林\\新需求\\20240919\\导入实际数据.xlsx"
;
EasyExcel
.
read
(
fileName
,
WindPredictionExcel2Data
.
class
,
new
WindPredictionDataListener2
(
context
)).
sheet
().
doRead
();
return
XServiceResult
.
OK
;
}
@XText
(
"风资源历史数据配置导入2"
)
@XApiGet
(
anonymous
=
true
)
public
XServiceResult
importWindPrediction3
(
XContext
context
)
{
String
fileName
=
"D:\\工作\\尚博信\\数据智能事业部\\零碳\\演示\\吉林\\新需求\\20240919\\result 3\\result 3"
;
List
<
File
>
files
=
FileUtil
.
loopFiles
(
fileName
);
for
(
File
file
:
files
)
{
EasyExcel
.
read
(
file
,
ThirdApiWeatherExcelData
.
class
,
new
ThirdApiWeatherDataListener2
(
context
)).
sheet
().
doRead
();
}
return
XServiceResult
.
OK
;
}
@XText
(
"天气历史数据导入"
)
@XApiGet
public
XServiceResult
importHistory
(
XContext
context
)
{
String
fileName
=
"D:\\home\\result_w.csv"
;
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
EasyExcel
.
read
(
fileName
,
ThirdApiWeatherExcelData
.
class
,
new
ThirdApiWeatherDataListener
(
context
)).
sheet
().
doRead
();
public
XServiceResult
test
(
XContext
context
,
GetBaseDataInput
input
)
{
IWindPredictionHistoryCloudService
service
=
context
.
getBean
(
IWindPredictionHistoryCloudService
.
class
);
service
.
windPredictionHistoryJob
(
context
);
return
XServiceResult
.
OK
;
}
}
\ 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