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
eb833983
Commit
eb833983
authored
May 27, 2024
by
wujiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改采集问题
parent
aefbd010
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
46 deletions
+108
-46
ImasterUtils.java
...com/yeejoin/amos/api/householdapi/Utils/ImasterUtils.java
+10
-1
SunlightUtil.java
...com/yeejoin/amos/api/householdapi/Utils/SunlightUtil.java
+8
-1
KsolarDataAcquisitionServiceImpl.java
...i/face/service/impl/KsolarDataAcquisitionServiceImpl.java
+0
-0
SunlightServiceImpl.java
...i/householdapi/face/service/impl/SunlightServiceImpl.java
+90
-44
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/ImasterUtils.java
View file @
eb833983
...
@@ -147,7 +147,12 @@ public class ImasterUtils {
...
@@ -147,7 +147,12 @@ public class ImasterUtils {
}
else
{
}
else
{
jsonArray
=
handlerResponseByResultResolveruleOther
(
ResultResolveRule
,
respone
);
jsonArray
=
handlerResponseByResultResolveruleOther
(
ResultResolveRule
,
respone
);
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
))
{
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
))
{
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
try
{
result
=
JSONArray
.
parseArray
(
jsonArray
.
toJSONString
(),
tClass
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"华为数据解析错误(getResPonseOther):"
+
jsonArray
.
toJSONString
());
}
}
}
}
}
}
else
{
}
else
{
...
@@ -211,6 +216,10 @@ public class ImasterUtils {
...
@@ -211,6 +216,10 @@ public class ImasterUtils {
String
[]
rules
=
resultResovle
.
split
(
","
);
String
[]
rules
=
resultResovle
.
split
(
","
);
if
(
rules
.
length
>
0
)
{
if
(
rules
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
rules
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
rules
.
length
;
i
++)
{
if
(
"ACCESS_FREQUENCY_IS_TOO_HIGH"
.
equals
(
jsonObject
.
get
(
rules
[
i
])))
{
logger
.
error
(
"华为数据解析错误():请求系统次数太频繁,无法获取接口数据"
);
continue
;
}
try
{
try
{
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
if
(
jsonObject
==
null
)
{
if
(
jsonObject
==
null
)
{
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/SunlightUtil.java
View file @
eb833983
...
@@ -116,7 +116,14 @@ public class SunlightUtil {
...
@@ -116,7 +116,14 @@ public class SunlightUtil {
{
{
put
(
"1"
,
"在线"
);
put
(
"1"
,
"在线"
);
put
(
"0"
,
"离线"
);
put
(
"0"
,
"离线"
);
put
(
"2"
,
"报警"
);
}
};
public
static
final
HashMap
<
String
,
String
>
gzzt
=
new
HashMap
<
String
,
String
>()
{
{
put
(
"1"
,
"故障"
);
put
(
"2"
,
"报警"
);
put
(
"4"
,
"正常"
);
}
}
};
};
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/KsolarDataAcquisitionServiceImpl.java
View file @
eb833983
This source diff could not be displayed because it is too large. You can
view the blob
instead.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SunlightServiceImpl.java
View file @
eb833983
...
@@ -6,6 +6,8 @@ import cn.hutool.json.JSONObject;
...
@@ -6,6 +6,8 @@ import cn.hutool.json.JSONObject;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.google.gson.JsonObject
;
import
com.qiniu.util.Json
;
import
com.yeejoin.amos.api.householdapi.Utils.SunlightUtil
;
import
com.yeejoin.amos.api.householdapi.Utils.SunlightUtil
;
import
com.yeejoin.amos.api.householdapi.constant.ImasterConstant
;
import
com.yeejoin.amos.api.householdapi.constant.ImasterConstant
;
import
com.yeejoin.amos.api.householdapi.constant.KSolarConstant
;
import
com.yeejoin.amos.api.householdapi.constant.KSolarConstant
;
...
@@ -114,7 +116,6 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -114,7 +116,6 @@ public class SunlightServiceImpl implements SunlightService {
for
(
Sunlight
sunlight
:
list
)
{
for
(
Sunlight
sunlight
:
list
)
{
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
sunlightMapper
.
insert
(
sunlight
);
sunlightMapper
.
insert
(
sunlight
);
}
}
logger
.
info
(
"-------阳光同步电站/逆变器/采集器结束"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
logger
.
info
(
"-------阳光同步电站/逆变器/采集器结束"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
...
@@ -194,36 +195,68 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -194,36 +195,68 @@ public class SunlightServiceImpl implements SunlightService {
jpStation
.
setSnCode
(
sunlightDto
.
getPs_id
().
toString
());
// sncode
jpStation
.
setSnCode
(
sunlightDto
.
getPs_id
().
toString
());
// sncode
Map
<
String
,
String
>
map
=
sunlightDto
.
getTotal_capcity
();
try
{
jpStation
.
setCapacity
(
Map
<
String
,
String
>
map
=
sunlightDto
.
getTotal_capcity
();
map
!=
null
&&
map
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
zj
.
get
(
String
.
valueOf
(
map
.
get
(
"unit"
)))
if
(
map
!=
null
&&
map
.
get
(
"unit"
)
!=
null
&&
!
map
.
get
(
"unit"
).
isEmpty
()
*
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"value"
)))
:
null
);
// 装机容量
&&
!
"--"
.
equals
(
map
.
get
(
"value"
)))
{
jpStation
.
setCapacity
(
SunlightUtil
.
zj
.
get
(
String
.
valueOf
(
map
.
get
(
"unit"
)))
Map
<
String
,
String
>
map1
=
sunlightDto
.
getCurr_power
();
*
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"value"
))));
// 装机容量
jpStation
.
setRealTimePower
(
}
map1
!=
null
&&
map1
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
GL
.
get
(
String
.
valueOf
(
map1
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map1
.
get
(
"value"
)))
:
null
);
// 实时功率
Map
<
String
,
String
>
map1
=
sunlightDto
.
getCurr_power
();
if
(
map1
!=
null
&&
map1
.
get
(
"unit"
)
!=
null
&&
!
map1
.
get
(
"unit"
).
isEmpty
()
Map
<
String
,
String
>
map2
=
sunlightDto
.
getToday_energy
();
&&
!
"--"
.
equals
(
map1
.
get
(
"value"
)))
{
jpStation
.
setDayGenerate
(
jpStation
.
setRealTimePower
(
SunlightUtil
.
GL
.
get
(
String
.
valueOf
(
map1
.
get
(
"unit"
)))
map2
!=
null
&&
map2
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map2
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map1
.
get
(
"value"
))));
// 实时功率
*
Double
.
valueOf
(
String
.
valueOf
(
map2
.
get
(
"value"
)))
:
null
);
// 日发电量
}
Map
<
String
,
String
>
map3
=
sunlightDto
.
getTotal_energy
();
jpStation
.
setAccumulatedPower
(
Map
<
String
,
String
>
map2
=
sunlightDto
.
getToday_energy
();
map3
!=
null
&&
map3
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map3
.
get
(
"unit"
)))
if
(
map2
!=
null
&&
map2
.
get
(
"unit"
)
!=
null
&&
!
map2
.
get
(
"unit"
).
isEmpty
()
*
Double
.
valueOf
(
String
.
valueOf
(
map3
.
get
(
"value"
)))
:
null
);
// 累计发电量
&&
!
"--"
.
equals
(
map2
.
get
(
"value"
)))
{
Map
<
String
,
String
>
map4
=
sunlightDto
.
getToday_income
();
jpStation
.
setDayGenerate
(
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map2
.
get
(
"unit"
)))
jpStation
.
setDayIncome
(
*
Double
.
valueOf
(
String
.
valueOf
(
map2
.
get
(
"value"
))));
// 日发电量
map4
!=
null
&&
map4
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map4
.
get
(
"unit"
)))
}
*
Double
.
valueOf
(
String
.
valueOf
(
map4
.
get
(
"value"
)))
:
null
);
// 日收益
Map
<
String
,
String
>
map5
=
sunlightDto
.
getTotal_income
();
Map
<
String
,
String
>
map3
=
sunlightDto
.
getTotal_energy
();
jpStation
.
setCumulativeIncome
(
if
(
map3
!=
null
&&
map3
.
get
(
"unit"
)
!=
null
&&
!
map3
.
get
(
"unit"
).
isEmpty
()
map5
!=
null
&&
map5
.
get
(
"unit"
)
!=
null
?
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map5
.
get
(
"unit"
)))
&&
!
"--"
.
equals
(
map3
.
get
(
"value"
)))
{
*
Double
.
valueOf
(
String
.
valueOf
(
map5
.
get
(
"value"
)))
:
null
);
// 累计收益
jpStation
.
setAccumulatedPower
(
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map3
.
get
(
"unit"
)))
if
(
sunlightDto
.
getPs_fault_status
()
>
2
)
{
*
Double
.
valueOf
(
String
.
valueOf
(
map3
.
get
(
"value"
))));
// 累计发电量
jpStation
.
setState
(
SunlightUtil
.
zt
.
get
(
sunlightDto
.
getPs_status
()
+
""
));
// 电站状态
}
Map
<
String
,
String
>
map4
=
sunlightDto
.
getToday_income
();
if
(
map4
!=
null
&&
map4
.
get
(
"unit"
)
!=
null
&&
!
map4
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map4
.
get
(
"value"
)))
{
jpStation
.
setDayIncome
(
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map4
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map4
.
get
(
"value"
))));
// 日收益
}
Map
<
String
,
String
>
map5
=
sunlightDto
.
getTotal_income
();
if
(
map5
!=
null
&&
map5
.
get
(
"unit"
)
!=
null
&&
!
map5
.
get
(
"unit"
).
isEmpty
()
&&
!
"--"
.
equals
(
map5
.
get
(
"value"
)))
{
jpStation
.
setCumulativeIncome
(
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map5
.
get
(
"unit"
)))
*
Double
.
valueOf
(
String
.
valueOf
(
map5
.
get
(
"value"
))));
// 累计收益
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
error
(
"阳光数据错误:"
+
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
sunlightDto
));
}
// 0离线 1在线
// 1故障 2告警 4正常
if
(
"0"
.
equals
(
sunlightDto
.
getPs_status
().
toString
()))
{
jpStation
.
setState
(
"离线"
);
}
else
if
(
"1"
.
equals
(
sunlightDto
.
getPs_status
().
toString
()))
{
if
(
"1"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
())
||
"2"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
()))
{
jpStation
.
setState
(
"报警"
);
}
else
if
(
"4"
.
equals
(
sunlightDto
.
getPs_fault_status
().
toString
()))
{
jpStation
.
setState
(
"在线"
);
}
else
{
jpStation
.
setState
(
"在线"
);
}
}
else
{
}
else
{
jpStation
.
setState
(
"
报警"
);
// 电站状态
jpStation
.
setState
(
"
在线"
);
}
}
// 获取电站下通讯模块
// 获取电站下通讯模块
...
@@ -307,11 +340,6 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -307,11 +340,6 @@ public class SunlightServiceImpl implements SunlightService {
jpStation
.
setYearGenerate
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
jpStation
.
setYearGenerate
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
// 年收益
// 年收益
jpStation
.
setYearIncome
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
jpStation
.
setYearIncome
(
js
!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)
+
""
)
/
1000
:
null
);
if
(!
ObjectUtils
.
isEmpty
(
jpStation
.
getSequenceNbr
()))
{
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
jpStationMapper
.
insert
(
jpStation
);
}
String
today
=
DateUtil
.
today
();
String
today
=
DateUtil
.
today
();
String
hour
=
new
Date
().
getHours
()
+
":00"
;
String
hour
=
new
Date
().
getHours
()
+
":00"
;
...
@@ -373,11 +401,18 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -373,11 +401,18 @@ public class SunlightServiceImpl implements SunlightService {
// tdJpStation.setCreatedTime(System.currentTimeMillis());
// tdJpStation.setCreatedTime(System.currentTimeMillis());
// tdJpStationMapper.insert(tdJpStation);
// tdJpStationMapper.insert(tdJpStation);
// }
// }
}
this
.
setJpInverte
(
listd
,
jpStation
,
listdtx
);
this
.
collectorDetail
(
listd
,
jpStation
);
if
(!
ObjectUtils
.
isEmpty
(
jpStation
.
getSequenceNbr
()))
{
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
jpStationMapper
.
insert
(
jpStation
);
}
}
this
.
setJpInverte
(
listd
,
jpStation
,
listdtx
);
this
.
collectorDetail
(
listd
,
jpStation
);
// 电站报表
// 电站报表
// 户用场站日发电量
// 户用场站日发电量
Date
today1
=
new
Date
();
Date
today1
=
new
Date
();
...
@@ -490,7 +525,6 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -490,7 +525,6 @@ public class SunlightServiceImpl implements SunlightService {
@Override
@Override
public
void
run
()
{
public
void
run
()
{
try
{
try
{
for
(
Device
device
:
devices
)
{
for
(
Device
device
:
devices
)
{
if
(
device
!=
null
)
{
if
(
device
!=
null
)
{
// 获取逆变器信息存库
// 获取逆变器信息存库
...
@@ -505,12 +539,24 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -505,12 +539,24 @@ public class SunlightServiceImpl implements SunlightService {
jpInverter
.
setSnCode
(
device
.
getDevice_sn
());
jpInverter
.
setSnCode
(
device
.
getDevice_sn
());
jpInverter
.
setId
(
device
.
getUuid
().
toString
());
jpInverter
.
setId
(
device
.
getUuid
().
toString
());
if
(
device
.
getGetPs_fault_status
()
>
2
)
{
// 0离线 1在线
jpInverter
.
setState
(
SunlightUtil
.
zt
.
get
(
device
.
getDev_status
()
+
""
));
// 1故障 2告警 4正常
if
(
"0"
.
equals
(
device
.
getDev_status
()))
{
jpInverter
.
setState
(
"离线"
);
}
else
if
(
"1"
.
equals
(
device
.
getDev_status
()))
{
if
(
"1"
.
equals
(
device
.
getDev_fault_status
())
||
"2"
.
equals
(
device
.
getDev_fault_status
()))
{
jpInverter
.
setState
(
"报警"
);
}
else
if
(
"4"
.
equals
(
device
.
getDev_fault_status
()))
{
jpInverter
.
setState
(
"在线"
);
}
else
{
jpInverter
.
setState
(
"在线"
);
}
}
else
{
}
else
{
jpInverter
.
setState
(
"
报警"
);
// 电站状态
jpInverter
.
setState
(
"
在线"
);
}
}
// logger.error("阳光数据解析(逆变器),无法获取状态:" +
// com.alibaba.fastjson.JSONObject.toJSONString(device));
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
...
@@ -916,7 +962,7 @@ public class SunlightServiceImpl implements SunlightService {
...
@@ -916,7 +962,7 @@ public class SunlightServiceImpl implements SunlightService {
jpCollector
.
setState
(
"报警"
);
// 电站状态
jpCollector
.
setState
(
"报警"
);
// 电站状态
}
}
}
else
{
}
else
{
//如果获取不了逆变器状态 并且逆变器没状态就默认离线
// 如果获取不了逆变器状态 并且逆变器没状态就默认离线
if
(
jpCollector
.
getState
()
==
null
)
{
if
(
jpCollector
.
getState
()
==
null
)
{
jpCollector
.
setState
(
"离线"
);
jpCollector
.
setState
(
"离线"
);
}
}
...
...
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