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
01a42939
Commit
01a42939
authored
Dec 10, 2024
by
chenzhao
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer_bw' into developer_bw
parents
612187c7
f8deeeb6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
16 deletions
+46
-16
GoodWeConstant.java
...eejoin/amos/api/householdapi/constant/GoodWeConstant.java
+1
-0
GoodWeDataAcquisitionServiceImpl.java
...i/face/service/impl/GoodWeDataAcquisitionServiceImpl.java
+45
-16
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/GoodWeConstant.java
View file @
01a42939
...
...
@@ -208,6 +208,7 @@ public class GoodWeConstant {
public
static
String
inverterDayURL
=
"/v1/api/inverterDay"
;
public
static
String
inverterMonthURL
=
"/v1/api/inverterMonth"
;
public
static
String
inverterYearURL
=
"/v1/api/inverterYear"
;
public
static
String
snStatusURL
=
"/api/OpenApi/GetPowerStationMonitorDetailBySn"
;
public
static
String
resovleRule_data_page_records
=
"data,page,records"
;
public
static
String
resovleRule_data_list
=
"data,list"
;
public
static
String
resovleRule_data_records
=
"data,records"
;
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/GoodWeDataAcquisitionServiceImpl.java
View file @
01a42939
...
...
@@ -112,7 +112,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
List
<
GoodWeStationMonitorDto
>
goodWeStationLists
=
goodWeRequestUtil
.
getResPonseList
(
GoodWeConstant
.
stationListStatusUrl
,
GoodWeConstant
.
requestPost
,
requestInfo
,
GoodWeConstant
.
resovleRule_data_list
,
GoodWeStationMonitorDto
.
class
);
//删除多余的场站
//
删除多余的场站
deleteBDWStation
(
goodWeStationLists
);
if
(
goodWeStationLists
.
size
()
>
0
)
{
goodWeStationLists
.
forEach
(
goodWeStationMonitorDto
->
{
...
...
@@ -203,8 +203,9 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
hygfjpStationPowerHistory
.
setStationState
(
jpStation
.
getState
());
hygfjpStationPowerHistoryMapper
.
insert
(
hygfjpStationPowerHistory
);
HYGFJPDayPower
hygfjpDayPower
=
hygfjpDayPowerMapper
.
selectOne
(
new
QueryWrapper
<
HYGFJPDayPower
>()
.
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
()).
eq
(
"year_month_day"
,
today
).
eq
(
"hour"
,
hour
));
HYGFJPDayPower
hygfjpDayPower
=
hygfjpDayPowerMapper
.
selectOne
(
new
QueryWrapper
<
HYGFJPDayPower
>().
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
())
.
eq
(
"year_month_day"
,
today
).
eq
(
"hour"
,
hour
));
if
(
org
.
springframework
.
util
.
ObjectUtils
.
isEmpty
(
hygfjpDayPower
))
{
hygfjpDayPower
=
new
HYGFJPDayPower
();
}
...
...
@@ -318,20 +319,22 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/**
* 删除多余的场站
*
* @param goodWeStationLists
*/
private
void
deleteBDWStation
(
List
<
GoodWeStationMonitorDto
>
goodWeStationLists
)
{
if
(
CollectionUtil
.
isNotEmpty
(
goodWeStationLists
))
{
if
(
CollectionUtil
.
isNotEmpty
(
goodWeStationLists
))
{
List
<
String
>
stationIds
=
new
ArrayList
<>();
for
(
GoodWeStationMonitorDto
goodWeStationMonitorDto
:
goodWeStationLists
)
{
stationIds
.
add
(
goodWeStationMonitorDto
.
getPowerstation_id
());
}
QueryWrapper
<
JpStation
>
wrapper
=
new
QueryWrapper
<
JpStation
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
GDW
.
getCode
());
QueryWrapper
<
JpStation
>
wrapper
=
new
QueryWrapper
<
JpStation
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
GDW
.
getCode
());
List
<
JpStation
>
jpStations
=
jpStationMapper
.
selectList
(
wrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
jpStations
))
{
if
(
CollectionUtil
.
isNotEmpty
(
jpStations
))
{
for
(
JpStation
jpStation
:
jpStations
)
{
if
(!
stationIds
.
contains
(
jpStation
.
getThirdStationId
()))
{
//删除多余数据
if
(!
stationIds
.
contains
(
jpStation
.
getThirdStationId
()))
{
//
删除多余数据
jpStationMapper
.
deleteById
(
jpStation
.
getSequenceNbr
());
}
}
...
...
@@ -379,6 +382,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/**
* 获取场站id
*
* @return
*/
private
List
<
String
>
getStationIds
()
{
...
...
@@ -389,7 +393,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
GoodWeConstant
.
stationListStatusUrl
,
GoodWeConstant
.
requestPost
,
requestInfo
,
GoodWeConstant
.
resovleRule_data_list
,
GoodWeStationMonitorDto
.
class
);
List
<
String
>
stationIds
=
new
ArrayList
<>();
if
(
CollectionUtil
.
isNotEmpty
(
goodWeStationLists
))
{
if
(
CollectionUtil
.
isNotEmpty
(
goodWeStationLists
))
{
for
(
GoodWeStationMonitorDto
goodWeStationMonitorDto
:
goodWeStationLists
)
{
stationIds
.
add
(
goodWeStationMonitorDto
.
getPowerstation_id
());
}
...
...
@@ -404,7 +408,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
long
ts
=
System
.
currentTimeMillis
();
logger
.
info
(
"-------固德威同步场站月发电量开始"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List
<
String
>
stationIds
=
getStationIds
();
List
<
String
>
stationIds
=
getStationIds
();
stationIds
.
forEach
(
stationId
->
{
String
currentMonth
=
DateUtil
.
format
(
new
Date
(),
"yyyyMM"
);
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
...
...
@@ -442,7 +446,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
long
ts
=
System
.
currentTimeMillis
();
logger
.
info
(
"-------固德威同步场站年发电量开始"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List
<
String
>
stationIds
=
getStationIds
();
List
<
String
>
stationIds
=
getStationIds
();
stationIds
.
forEach
(
stationId
->
{
String
currentYear
=
DateUtil
.
format
(
new
Date
(),
"yyyy"
);
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
...
...
@@ -487,7 +491,7 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
logger
.
info
(
"-------固德威同步逆变器开始"
+
ts
+
"------- "
+
sdf
.
format
(
new
Date
()));
// List<String> stationIds = goodWeStationMonitorListMapper.getStationIds();
List
<
String
>
stationIds
=
getStationIds
();
//删除多余的逆变器
//
删除多余的逆变器
deleteGDWInverter
(
stationIds
);
stationIds
.
stream
().
forEach
(
stationId
->
{
HashMap
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
...
...
@@ -519,6 +523,29 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
jpInverter
.
setStationName
(
jpStation
.
getName
());
}
jpInverter
.
setRecDate
(
new
Date
());
HashMap
<
String
,
Object
>
requestInfo2
=
new
HashMap
<>();
requestInfo2
.
put
(
"page_index"
,
1
);
requestInfo2
.
put
(
"page_size"
,
1
);
requestInfo2
.
put
(
"sn"
,
jpInverter
.
getSnCode
());
String
requstParam2
=
JSON
.
toJSONString
(
requestInfo2
);
List
<
GoodWeStationDetail
>
goodWeStationDetails
=
goodWeRequestUtil
.
getResPonse
(
GoodWeConstant
.
snStatusURL
,
GoodWeConstant
.
requestPost
,
requstParam2
,
GoodWeConstant
.
resovleRule_data_list
,
GoodWeStationDetail
.
class
);
if
(
goodWeStationDetails
!=
null
&&
!
goodWeStationDetails
.
isEmpty
())
{
Integer
s
=
goodWeStationDetails
.
get
(
0
).
getStatus
();
// (“” or null:全部,-1:离线 0:待机 1:发电中 2:停机 -2:无设备)
if
(
s
==
0
||
s
==
1
)
{
jpInverter
.
setState
(
"在线"
);
}
else
if
(
s
==
null
||
s
==
-
1
||
s
==
2
|
s
==
-
2
)
{
jpInverter
.
setState
(
"离线"
);
}
else
{
jpInverter
.
setState
(
"离线"
);
}
}
else
{
jpInverter
.
setState
(
"离线"
);
}
if
(!
org
.
springframework
.
util
.
ObjectUtils
.
isEmpty
(
jpInverter
.
getSequenceNbr
()))
{
jpInverterMapper
.
updateById
(
jpInverter
);
}
else
{
...
...
@@ -531,15 +558,17 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
/**
* 删除多余的逆变器
*
* @param stationIds
*/
private
void
deleteGDWInverter
(
List
<
String
>
stationIds
)
{
QueryWrapper
<
JpInverter
>
wrapper
=
new
QueryWrapper
<
JpInverter
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
GDW
.
getCode
());
QueryWrapper
<
JpInverter
>
wrapper
=
new
QueryWrapper
<
JpInverter
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
GDW
.
getCode
());
List
<
JpInverter
>
jpInverters
=
jpInverterMapper
.
selectList
(
wrapper
);
if
(
CollectionUtil
.
isNotEmpty
(
jpInverters
))
{
if
(
CollectionUtil
.
isNotEmpty
(
jpInverters
))
{
for
(
JpInverter
jpInverter
:
jpInverters
)
{
if
(!
stationIds
.
contains
(
jpInverter
.
getThirdStationId
()))
{
//删除多余数据
if
(!
stationIds
.
contains
(
jpInverter
.
getThirdStationId
()))
{
//
删除多余数据
jpInverterMapper
.
deleteById
(
jpInverter
.
getSequenceNbr
());
}
}
...
...
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