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
ca4b85cb
Commit
ca4b85cb
authored
Jun 14, 2023
by
tianchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.年预测
parent
62730c67
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
172 additions
and
12 deletions
+172
-12
C09-base/pps-core-base/src/main/java/pps/core/base/entity/BaseProjectInfoPredictedDataEnt.java
...pps/core/base/entity/BaseProjectInfoPredictedDataEnt.java
+3
-3
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseDataService.java
.../src/main/java/pps/core/base/service/BaseDataService.java
+1
-1
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseProjectInfoService.java
...in/java/pps/core/base/service/BaseProjectInfoService.java
+68
-5
C09-base/pps-core-base/src/main/java/pps/core/base/service/data/base_project_info/CalcProjectInfoPredictedDataInput.java
.../base_project_info/CalcProjectInfoPredictedDataInput.java
+97
-0
C09-base/pps-core-base/src/main/java/pps/core/base/service/data/base_project_info/GetProjectInfoPredictedDataOutput.java
.../base_project_info/GetProjectInfoPredictedDataOutput.java
+3
-3
No files found.
C09-base/pps-core-base/src/main/java/pps/core/base/entity/BaseProjectInfoPredictedDataEnt.java
View file @
ca4b85cb
...
...
@@ -17,7 +17,7 @@ public class BaseProjectInfoPredictedDataEnt implements Serializable {
@XText
(
"项目名称"
)
@TableField
private
String
projectId
;
private
Integer
projectId
;
@TableField
private
String
particularYear
;
...
...
@@ -51,11 +51,11 @@ public class BaseProjectInfoPredictedDataEnt implements Serializable {
this
.
id
=
id
;
}
public
String
getProjectId
()
{
public
Integer
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
...
...
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseDataService.java
View file @
ca4b85cb
...
...
@@ -252,7 +252,7 @@ public class BaseDataService {
returnMap
=
XJsonUtils
.
toMap
(
ret
.
toString
());
return
returnMap
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
"调用预测接口失败"
);
}
}
...
...
C09-base/pps-core-base/src/main/java/pps/core/base/service/BaseProjectInfoService.java
View file @
ca4b85cb
...
...
@@ -10,9 +10,11 @@ import pps.cloud.system.service.data.QuerySysDictionaryViewInput;
import
pps.cloud.system.service.data.QuerySysDictionaryViewOutput
;
import
pps.core.base.entity.*
;
import
pps.core.base.mapper.*
;
import
pps.core.base.service.data.base_data.CalcBaseDataInput
;
import
pps.core.base.service.data.base_line.*
;
import
pps.core.base.service.data.base_line_attenuation_rate.CreateBaseLineAttenuationRateInput
;
import
pps.core.base.service.data.base_project_info.*
;
import
pps.core.base.utils.HttpUtils
;
import
pps.core.common.session.PpsUserSession
;
import
pps.core.system.entity.SysAreaEnt
;
import
pps.core.system.mapper.SysAreaMapper
;
...
...
@@ -20,7 +22,10 @@ import xstartup.annotation.XService;
import
xstartup.base.XContext
;
import
xstartup.base.data.CustomQueryInput
;
import
xstartup.base.util.XCopyUtils
;
import
xstartup.base.util.XDateUtils
;
import
xstartup.base.util.XJsonUtils
;
import
xstartup.base.util.XStringUtils
;
import
xstartup.core.base.helper.XThreadHelper
;
import
xstartup.data.XListResult
;
import
xstartup.data.XPageResult
;
import
xstartup.data.XServiceResult
;
...
...
@@ -31,9 +36,9 @@ import xstartup.feature.api.annotation.XApiGet;
import
xstartup.feature.api.annotation.XApiPost
;
import
xstartup.feature.mybatis.helper.XMapperHelper
;
import
java.
util.ArrayList
;
import
java.util.
Date
;
import
java.util.
List
;
import
java.
math.BigDecimal
;
import
java.util.
*
;
import
java.util.
stream.Collectors
;
@XService
public
class
BaseProjectInfoService
{
...
...
@@ -50,9 +55,9 @@ public class BaseProjectInfoService {
entity
.
setCreateTime
(
now
);
entity
.
setIsDeleted
(
0
);
mapper
.
insert
(
entity
);
List
<
BaseLineAttenuationRateView
>
list
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
input
.
getList
())){
BaseLineAttenuationRateViewMapper
rateMapper
=
context
.
getBean
(
BaseLineAttenuationRateViewMapper
.
class
);
List
<
BaseLineAttenuationRateView
>
list
=
new
ArrayList
<>();
for
(
CreateBaseLineAttenuationRateInput
rateInput
:
input
.
getList
()){
BaseLineAttenuationRateView
ent
=
XCopyUtils
.
copyNewObject
(
rateInput
,
BaseLineAttenuationRateView
.
class
);
ent
.
setCreateById
(
session
.
getId
());
...
...
@@ -64,6 +69,13 @@ public class BaseProjectInfoService {
}
rateMapper
.
batchInsert
(
list
);
}
//开始预测
XThreadHelper
.
async
(
new
Runnable
()
{
@Override
public
void
run
()
{
predictedData
(
context
,
entity
,
list
);
}
});
return
XServiceResult
.
OK
;
}
...
...
@@ -90,9 +102,9 @@ public class BaseProjectInfoService {
queryRateWrapper
.
lambda
().
eq
(
BaseLineAttenuationRateEnt:
:
getLineId
,
entity
.
getId
());
queryRateWrapper
.
lambda
().
eq
(
BaseLineAttenuationRateEnt:
:
getType
,
1
);
rateMapper
.
delete
(
queryRateWrapper
);
List
<
BaseLineAttenuationRateView
>
list
=
new
ArrayList
<>();
if
(!
CollectionUtils
.
isEmpty
(
input
.
getList
())){
BaseLineAttenuationRateViewMapper
rateViewMapper
=
context
.
getBean
(
BaseLineAttenuationRateViewMapper
.
class
);
List
<
BaseLineAttenuationRateView
>
list
=
new
ArrayList
<>();
for
(
CreateBaseLineAttenuationRateInput
rateInput
:
input
.
getList
()){
BaseLineAttenuationRateView
ent
=
XCopyUtils
.
copyNewObject
(
rateInput
,
BaseLineAttenuationRateView
.
class
);
ent
.
setCreateById
(
session
.
getId
());
...
...
@@ -104,6 +116,13 @@ public class BaseProjectInfoService {
}
rateViewMapper
.
batchInsert
(
list
);
}
//开始预测
XThreadHelper
.
async
(
new
Runnable
()
{
@Override
public
void
run
()
{
predictedData
(
context
,
entity
,
list
);
}
});
return
XServiceResult
.
OK
;
}
...
...
@@ -202,4 +221,48 @@ public class BaseProjectInfoService {
List
<
GetProjectInfoPredictedDataOutput
>
outputs
=
XCopyUtils
.
copyNewList
(
pageInfo
.
getList
(),
GetProjectInfoPredictedDataOutput
.
class
);
return
XListResult
.
success
(
outputs
);
}
private
void
predictedData
(
XContext
context
,
BaseProjectInfoEnt
entity
,
List
<
BaseLineAttenuationRateView
>
list
){
CalcProjectInfoPredictedDataInput
input
=
new
CalcProjectInfoPredictedDataInput
();
input
.
setLat
(
entity
.
getLatitude
());
input
.
setLon
(
entity
.
getLongitude
());
input
.
setAngle
(
entity
.
getArrayIncidence
());
input
.
setDirection
(
entity
.
getArrayToward
());
input
.
setCapacity
(
entity
.
getInstallCapacity
());
input
.
setEfficiency
(
new
BigDecimal
(
0.35
));
input
.
setWeather
(
new
BigDecimal
(
0.7
));
List
<
BaseLineAttenuationRateView
>
sortList
=
list
.
stream
().
sorted
(
Comparator
.
comparing
(
BaseLineAttenuationRateView:
:
getSort
)).
collect
(
Collectors
.
toList
());
List
<
BigDecimal
>
decimals
=
sortList
.
stream
().
map
(
BaseLineAttenuationRateView:
:
getAttenuationRate
).
collect
(
Collectors
.
toList
());
input
.
setDecline
(
decimals
);
Map
<
String
,
Object
>
map
=
getPredictedData
(
context
,
input
);
//插入数据
BaseProjectInfoPredictedDataMapper
mapper
=
context
.
getBean
(
BaseProjectInfoPredictedDataMapper
.
class
);
QueryWrapper
<
BaseProjectInfoPredictedDataEnt
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
lambda
().
eq
(
BaseProjectInfoPredictedDataEnt:
:
getProjectId
,
entity
.
getId
());
mapper
.
delete
(
queryWrapper
);
List
<
Double
>
powers
=
(
List
<
Double
>)
map
.
get
(
"power"
);
Integer
particularYear
=
Integer
.
valueOf
(
entity
.
getProductionYear
());
for
(
Double
decimal
:
powers
){
BaseProjectInfoPredictedDataEnt
ent
=
new
BaseProjectInfoPredictedDataEnt
();
ent
.
setProjectId
(
entity
.
getId
());
ent
.
setParticularYear
(
particularYear
+
""
);
ent
.
setPredictedPower
(
BigDecimal
.
valueOf
(
decimal
.
doubleValue
()));
particularYear
++;
mapper
.
insert
(
ent
);
}
}
public
Map
<
String
,
Object
>
getPredictedData
(
XContext
context
,
CalcProjectInfoPredictedDataInput
calcProjectInfoPredictedDataInput
){
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<>();
try
{
String
jsonString
=
XJsonUtils
.
toJson
(
calcProjectInfoPredictedDataInput
);
context
.
getLogger
().
info
(
jsonString
);
Object
ret
=
HttpUtils
.
send2
(
"http://121.36.43.217:8098/model/yearmodel"
,
jsonString
);
returnMap
=
XJsonUtils
.
toMap
(
ret
.
toString
());
return
returnMap
;
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"调用预测接口失败"
);
}
}
}
C09-base/pps-core-base/src/main/java/pps/core/base/service/data/base_project_info/CalcProjectInfoPredictedDataInput.java
0 → 100644
View file @
ca4b85cb
package
pps.core.base.service.data.base_project_info
;
import
java.math.BigDecimal
;
import
java.util.List
;
public
class
CalcProjectInfoPredictedDataInput
{
private
String
liner_id
;
// 组织机构
private
BigDecimal
lat
;
// 纬度
private
BigDecimal
lon
;
// 经度
private
BigDecimal
angle
;
// 光伏仰角
private
BigDecimal
direction
;
// # 朝向# pvlib uses 0=North, 90=East, 180=South, 270=West convention
private
BigDecimal
capacity
;
// 安装功率KW
private
BigDecimal
efficiency
;
//转换效率
private
List
<
BigDecimal
>
decline
;
//25年逐年衰减
private
BigDecimal
weather
;
public
String
getLiner_id
()
{
return
liner_id
;
}
public
void
setLiner_id
(
String
liner_id
)
{
this
.
liner_id
=
liner_id
;
}
public
BigDecimal
getLat
()
{
return
lat
;
}
public
void
setLat
(
BigDecimal
lat
)
{
this
.
lat
=
lat
;
}
public
BigDecimal
getLon
()
{
return
lon
;
}
public
void
setLon
(
BigDecimal
lon
)
{
this
.
lon
=
lon
;
}
public
BigDecimal
getAngle
()
{
return
angle
;
}
public
void
setAngle
(
BigDecimal
angle
)
{
this
.
angle
=
angle
;
}
public
BigDecimal
getDirection
()
{
return
direction
;
}
public
void
setDirection
(
BigDecimal
direction
)
{
this
.
direction
=
direction
;
}
public
BigDecimal
getCapacity
()
{
return
capacity
;
}
public
void
setCapacity
(
BigDecimal
capacity
)
{
this
.
capacity
=
capacity
;
}
public
BigDecimal
getEfficiency
()
{
return
efficiency
;
}
public
void
setEfficiency
(
BigDecimal
efficiency
)
{
this
.
efficiency
=
efficiency
;
}
public
List
<
BigDecimal
>
getDecline
()
{
return
decline
;
}
public
void
setDecline
(
List
<
BigDecimal
>
decline
)
{
this
.
decline
=
decline
;
}
public
BigDecimal
getWeather
()
{
return
weather
;
}
public
void
setWeather
(
BigDecimal
weather
)
{
this
.
weather
=
weather
;
}
}
C09-base/pps-core-base/src/main/java/pps/core/base/service/data/base_project_info/GetProjectInfoPredictedDataOutput.java
View file @
ca4b85cb
...
...
@@ -14,7 +14,7 @@ public class GetProjectInfoPredictedDataOutput {
private
Integer
id
;
@XText
(
"项目名称"
)
private
String
projectId
;
private
Integer
projectId
;
private
String
particularYear
;
...
...
@@ -41,11 +41,11 @@ public class GetProjectInfoPredictedDataOutput {
this
.
id
=
id
;
}
public
String
getProjectId
()
{
public
Integer
getProjectId
()
{
return
projectId
;
}
public
void
setProjectId
(
String
projectId
)
{
public
void
setProjectId
(
Integer
projectId
)
{
this
.
projectId
=
projectId
;
}
...
...
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