Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-zx-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
项目统一框架
一体化_户用光伏项目代码
amos-boot-zx-biz
Commits
11cc86f3
Commit
11cc86f3
authored
Aug 29, 2024
by
hezhuozhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交大屏平均辐照度和利用小时数
parent
bbeb4a19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
9 deletions
+83
-9
Constants.java
...om/yeejoin/amos/boot/module/jxiop/api/util/Constants.java
+1
-0
LargeScreenImpl.java
...s/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
+82
-9
No files found.
amos-boot-system-jxiop/amos-boot-module-jxiop-api/src/main/java/com/yeejoin/amos/boot/module/jxiop/api/util/Constants.java
View file @
11cc86f3
...
...
@@ -86,6 +86,7 @@ public class Constants {
public
static
final
String
get_quota_complate_info
=
"method=scene_screen.large_screen.get_quota_complate_info"
;
public
static
final
String
resovleRule_data
=
"data"
;
public
static
final
String
areaChinese
=
"区域"
;
public
static
final
String
get_big_screen_point_url
=
"http://iiet-jepcc.powerchina.cn:8088/core/datastorage/gateway/point/list?groupId=1827987484823289857&dataType=analog"
;
}
amos-boot-system-jxiop/amos-boot-module-jxiop-bigscreen-biz/src/main/java/com/yeejoin/amos/boot/module/jxiop/biz/service/impl/LargeScreenImpl.java
View file @
11cc86f3
...
...
@@ -19,6 +19,10 @@ import java.util.stream.Collectors;
import
javax.annotation.PostConstruct
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
lombok.extern.slf4j.Slf4j
;
import
org.eclipse.paho.client.mqttv3.MqttException
;
import
org.elasticsearch.search.aggregations.Aggregation
;
import
org.elasticsearch.search.aggregations.Aggregations
;
...
...
@@ -26,9 +30,11 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import
org.elasticsearch.search.aggregations.metrics.ParsedAvg
;
import
org.elasticsearch.search.aggregations.metrics.ParsedSum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.*
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.client.RestTemplate
;
import
org.typroject.tyboot.component.emq.EmqKeeper
;
import
com.alibaba.fastjson.JSON
;
...
...
@@ -50,6 +56,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import
com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData
;
import
com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper
;
import
com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
/**
* @description:
...
...
@@ -58,6 +65,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
*/
@Service
//@RequiredArgsConstructor
@Slf4j
public
class
LargeScreenImpl
{
@Autowired
CommonServiceImpl
commonServiceImpl
;
...
...
@@ -75,6 +83,10 @@ public class LargeScreenImpl {
SjglZsjZsbtzServiceImpl
SjglZsjZsbtzServiceImpl
;
@Autowired
private
HttpRequestUtil
httpRequestUtil
;
@Autowired
AmosRequestContext
amosRequestContext
;
@Autowired
RestTemplate
restTemplate
;
private
final
String
SS
=
"瞬时风速"
;
private
final
String
ZFS
=
"WTX-801_25_WTX-801_总辐射"
;
...
...
@@ -149,10 +161,13 @@ public class LargeScreenImpl {
// Constants.REQUEST_GET, "", Constants.resovleRule_data);
// }
mapdta
.
put
(
"SS"
,
data
.
getDouble
(
"average_wind_speed"
));
mapdta
.
put
(
"ZFS"
,
data
.
getDouble
(
"avg_irradiance"
));
mapdta
.
put
(
"ZFSLJ"
,
data
.
getDouble
(
"sum_irradiance"
));
//
mapdta.put("ZFS", data.getDouble("avg_irradiance"));
//
mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
}
//平均辐照度和利用小时数采用合成测点的值
Map
<
String
,
Double
>
pointValue
=
getPointValue
();
mapdta
.
put
(
"ZFS"
,
pointValue
.
get
(
"ZFS"
));
mapdta
.
put
(
"ZFSLJ"
,
pointValue
.
get
(
"ZFSLJ"
));
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
// //月发电量
...
...
@@ -242,7 +257,62 @@ public class LargeScreenImpl {
return
mapdta
;
}
/**
* 获取平均辐照度和利用小时数
* @return
*/
private
Map
<
String
,
Double
>
getPointValue
()
{
Map
<
String
,
Double
>
resultMap
=
new
HashMap
();
JSONObject
jsonObject
=
sendCoreGetRequest
(
Constants
.
get_big_screen_point_url
);
if
(!
Objects
.
isNull
(
jsonObject
))
{
if
(
jsonObject
.
getInteger
(
"status"
)
==
HttpStatus
.
OK
.
value
())
{
JSONArray
resultJsonArray
=
jsonObject
.
getJSONArray
(
"result"
);
if
(
CollectionUtil
.
isNotEmpty
(
resultJsonArray
))
{
for
(
Object
o
:
resultJsonArray
)
{
if
(
o
instanceof
Map
)
{
Map
map
=
(
Map
)
o
;
JSONObject
result
=
new
JSONObject
(
map
);
String
pointName
=
(
String
)
map
.
get
(
"pointName"
);
if
(
"大屏监控平均辐照度"
.
equals
(
pointName
))
{
resultMap
.
put
(
"ZFS"
,
result
.
getDouble
(
"value"
));
}
if
(
"大屏监控利用小时数"
.
equals
(
pointName
))
{
resultMap
.
put
(
"ZFSLJ"
,
result
.
getDouble
(
"value"
));
}
}
}
}
}
}
return
resultMap
;
}
/**
* 发送GET请求
* @param url
* @return
*/
private
JSONObject
sendCoreGetRequest
(
String
url
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
set
(
"Token"
,
amosRequestContext
.
getToken
());
headers
.
set
(
"Product"
,
amosRequestContext
.
getProduct
());
headers
.
set
(
"Appkey"
,
amosRequestContext
.
getAppKey
());
HttpEntity
entity
=
new
HttpEntity
<>(
headers
);
log
.
info
(
"发送GET请求,请求地址{}"
,
url
);
try
{
ResponseEntity
<
JSONObject
>
response
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
entity
,
JSONObject
.
class
);
if
(
HttpStatus
.
OK
==
response
.
getStatusCode
())
{
log
.
info
(
"发送请求成功,请求返回体{}"
,
response
.
getBody
());
return
response
.
getBody
();
}
else
{
throw
new
BadRequest
(
"返回接口异常,失败原因["
+
response
+
"]"
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
BadRequest
(
"发送GET请求失败,失败原因["
+
e
.
getMessage
()
+
"]"
);
}
}
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
//@PostConstruct
private
void
sendQYYXZBMqtt
()
{
...
...
@@ -440,8 +510,11 @@ public class LargeScreenImpl {
// "", Constants.resovleRule_data);
// }
mapdta
.
put
(
"SS"
,
data
.
getString
(
"average_wind_speed"
));
mapdta
.
put
(
"ZFS"
,
data
.
getString
(
"avg_irradiance"
));
mapdta
.
put
(
"ZFSLJ"
,
data
.
getString
(
"sum_irradiance"
));
// mapdta.put("ZFS", data.getString("avg_irradiance"));
// mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
Map
<
String
,
Double
>
pointValue
=
getPointValue
();
mapdta
.
put
(
"ZFS"
,
String
.
valueOf
(
pointValue
.
get
(
"ZFS"
)));
mapdta
.
put
(
"ZFSLJ"
,
String
.
valueOf
(
pointValue
.
get
(
"ZFSLJ"
)));
try
{
System
.
out
.
println
(
JSON
.
toJSONString
(
mapdta
));
...
...
@@ -634,7 +707,7 @@ public class LargeScreenImpl {
}
//全国月发电量趋势
//全国月发电量趋势
@Scheduled
(
cron
=
"0/10 * * * * ?"
)
public
Map
<
String
,
Object
>
gettimedateyfd
()
{
...
...
@@ -838,7 +911,7 @@ public class LargeScreenImpl {
}
public
Map
<
String
,
Object
>
gettimedateqyyfdqs
(
Date
date
,
List
<
String
>
gatewayId
,
String
areaCode
,
List
<
String
>
idsStationId
)
{
List
<
String
>
idsStationId
)
{
SimpleDateFormat
myFmt2
=
new
SimpleDateFormat
(
"yyyy"
);
String
monthy
=
myFmt2
.
format
(
date
);
...
...
@@ -979,7 +1052,7 @@ public class LargeScreenImpl {
// CommonConstans.kwToMv;
Double
vl
=
Double
.
valueOf
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
indicatorData
.
getValueF
()))
+
Double
.
valueOf
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
indicatorData2
.
getValueF
()
*
CommonConstans
.
kwToMv
));
indicatorData2
.
getValueF
()
*
CommonConstans
.
kwToMv
));
values
.
add
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
vl
));
}
...
...
@@ -1084,7 +1157,7 @@ public class LargeScreenImpl {
// CommonConstans.kwToMv;
Double
vl
=
Double
.
valueOf
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
indicatorData
.
getValueF
()))
+
Double
.
valueOf
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
indicatorData2
.
getValueF
()
*
CommonConstans
.
kwToMv
));
indicatorData2
.
getValueF
()
*
CommonConstans
.
kwToMv
));
values
.
add
(
String
.
format
(
CommonConstans
.
Twodecimalplaces
,
vl
));
}
...
...
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