Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
4291182c
Commit
4291182c
authored
Mar 06, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对接阳光电站
parent
6071cb0b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1060 additions
and
0 deletions
+1060
-0
Device.java
...va/com/yeejoin/amos/api/householdapi/face/dto/Device.java
+33
-0
SunlightDto.java
...m/yeejoin/amos/api/householdapi/face/dto/SunlightDto.java
+82
-0
SunlightMap.java
...m/yeejoin/amos/api/householdapi/face/dto/SunlightMap.java
+14
-0
SunlightWarm.java
.../yeejoin/amos/api/householdapi/face/dto/SunlightWarm.java
+31
-0
HYGFJPInverterWarn.java
...ace/orm/houseapi/entity/tdeingine/HYGFJPInverterWarn.java
+1
-0
Sunlight.java
...eholdapi/face/orm/houseapi/entity/tdeingine/Sunlight.java
+27
-0
SunlightMapper.java
...householdapi/face/orm/mapper/tdengine/SunlightMapper.java
+18
-0
SunlightService.java
...n/amos/api/householdapi/face/service/SunlightService.java
+30
-0
SunlightServiceImpl.java
...i/householdapi/face/service/impl/SunlightServiceImpl.java
+823
-0
PVProducerInfoEnum.java
...va/com/yeejoin/amos/openapi/enums/PVProducerInfoEnum.java
+1
-0
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/Device.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
lombok.Data
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public
class
Device
{
private
Integer
chnnl_id
;
//设备通道 ID
private
String
type_name
;
//设备类型名称
private
String
ps_key
;
//设备的 ps_key,查询设备数据需要用到
private
String
device_sn
;
//设备的 SN
private
String
dev_status
;
//设备当前在线离线状态
private
String
dev_fault_status
;
//设备当前故障状态设备故障状态:
private
Integer
device_type
;
//设备类型编码
private
String
factory_name
;
//生产厂家名
private
Integer
uuid
;
//设备 uuid
private
String
grid_connection_date
;
//电网连接日期
private
String
device_name
;
//设备名称
private
Integer
rel_state
;
//设备认领状态:
private
Integer
device_code
;
//设备地址编码
private
Integer
ps_id
;
//电站id
private
Integer
device_model_id
;
//设备型号 ID
private
String
communication_dev_sn
;
//设备对应的通信设备的 SN
private
String
device_model_code
;
//设备型号名称
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/SunlightDto.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
lombok.Data
;
import
java.util.Map
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public
class
SunlightDto
{
private
Integer
ps_id
;
// 11 电站 ID
private
String
ps_name
;
// 电站名称
private
String
share_type
;
// 1 电站的分享类型 1:分享类型(浏览权限)2:分享类型(管理权限)0:非分享电站(本人电站)
// 1:地面电站
//3:分布式光伏
//4:户用光伏
//5:户用储能
//6;村级电站
//7:分布式储能
//8:扶贫电站
//9:风能电站
private
Integer
ps_type
;
private
Integer
valid_flag
;
//电站状态1:正常,2:停用, 3:接入中
private
String
install_date
;
// 建站时间
private
String
ps_current_time_zone
;
// 电站当前时区
private
String
ps_location
;
//电站位置
private
String
description
;
//电站简介
private
Double
longitude
;
// 32 经度
private
Double
latitude
;
// Double 32 纬度
private
Integer
fault_count
;
//故障数量
private
Integer
alarm_count
;
// 告警数量
private
Integer
ps_status
;
// 电站状态
private
Integer
ps_fault_status
;
// 电站故障状态
private
Integer
build_status
;
// 电站建设状态
private
Integer
connect_type
;
// 并网类型:
private
String
total_energy_update_time
;
//电站累计发电量最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private
String
today_energy_update_time
;
//今日发电量最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private
String
cur_power_update_time
;
//当前功率最后更新时间
private
String
today_income_update_time
;
//今日收益最后更新时间
private
String
total_income_update_time
;
//累计收益最后更新时间
private
String
co2_reduce_update_time
;
//减排最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private
String
co2_reduce_total_update_time
;
//co2 减排最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private
String
total_capcity_update_time
;
//总装机量最后更新时间
private
String
equivalent_hour_update_time
;
//今日等效小时最后更新时间格式:yyyy-MM-dd'T'HH:mm:ssXXX
private
Map
<
String
,
String
>
total_energy
;
// 电站累计发电<value,unit>
private
Map
<
String
,
String
>
today_energy
;
// 电站今日发电<value,unit>
private
Map
<
String
,
String
>
curr_power
;
// 当前功率<value,unit>
private
Map
<
String
,
String
>
today_income
;
// 今日收益<value,unit>
private
Map
<
String
,
String
>
total_income
;
// 累计收益<value,unit>
private
Map
<
String
,
String
>
co2_reduce
;
// 今日 CO2 减排<value,unit>
private
Map
<
String
,
String
>
co2_reduce_total
;
// 累计 CO2 减排<value,unit>
private
Map
<
String
,
String
>
total_capcity
;
// 总装机量<value,unit>
private
Map
<
String
,
String
>
equivalent_hour
;
// 今日等效小时<value,unit>
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/SunlightMap.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
lombok.Data
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
public
class
SunlightMap
{
private
String
unit
;
// 数值单位
private
String
value
;
//数值
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/SunlightWarm.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
lombok.Data
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/6
*/
@Data
public
class
SunlightWarm
{
private
Integer
ps_id
;
//电站 id
private
String
ps_key
;
// 设备 ps_key
private
String
fault_code
;
// 故障唯一 id
private
Integer
fault_type_code
;
// 故障类型编码
private
Integer
fault_type
;
// 故障类型:
private
Integer
fault_level
;
// 故障级别:
private
Integer
process_status
;
// 故障处理状态:
private
String
fault_name
;
// 故障名称
private
String
fault_desc
;
// 故障描述
private
String
type_name
;
// 设备类型名称
private
String
ps_name
;
// 电站名称
private
String
device_name
;
// 设备名称
private
String
device_model_code
;
// 设备型号
private
Integer
uuid
;
// 设备的 uuid
private
String
create_time
;
// 故障发生时间
private
String
over_time
;
// 故障的恢复时间
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/tdeingine/HYGFJPInverterWarn.java
View file @
4291182c
...
...
@@ -21,4 +21,5 @@ public class HYGFJPInverterWarn implements Serializable {
private
String
thirdStationId
;
private
String
thirdCode
;
private
String
state
;
private
String
warnId
;
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/houseapi/entity/tdeingine/Sunlight.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
houseapi
.
entity
.
tdeingine
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
java.io.Serializable
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Data
@TableName
(
value
=
"sunlight_station_list"
,
autoResultMap
=
true
)
public
class
Sunlight
implements
Serializable
{
private
Long
createdTime
;
private
Integer
psId
;
//id
private
String
psName
;
//电站名称
private
Integer
validFlag
;
// 电站状态
private
String
psLocation
;
//电站位置
private
String
description
;
//电站简介
private
Double
longitude
;
//经度
private
Double
latitude
;
//纬度
private
Integer
psStatus
;
//电站状态
private
Integer
psFaultStatus
;
//电站故障状态
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/orm/mapper/tdengine/SunlightMapper.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
orm
.
mapper
.
tdengine
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.Sunlight
;
import
org.apache.ibatis.annotations.Select
;
import
java.util.List
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
public
interface
SunlightMapper
extends
BaseMapper
<
Sunlight
>
{
@Select
(
"select psId from sunlight_station_list group by psId"
)
List
<
String
>
getStationIds
();
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/SunlightService.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.KsolarStationMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.SunlightMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
public
interface
SunlightService
{
/**
* @descrption 场站列表数据入td库
*/
void
stationList
();
/**
* 告警信息
* */
void
inverAlramInfo
();
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SunlightServiceImpl.java
0 → 100644
View file @
4291182c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
.
impl
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.api.householdapi.Utils.SunlightUtil
;
import
com.yeejoin.amos.api.householdapi.constant.KSolarConstant
;
import
com.yeejoin.amos.api.householdapi.face.dto.Device
;
import
com.yeejoin.amos.api.householdapi.face.dto.KsolarAlarmDto
;
import
com.yeejoin.amos.api.householdapi.face.dto.SunlightDto
;
import
com.yeejoin.amos.api.householdapi.face.dto.SunlightWarm
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpCollectorMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterElectricityMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpInverterMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.hygf.JpStationMapper
;
import
com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.*
;
import
com.yeejoin.amos.api.householdapi.face.service.SunlightService
;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
import
fastjson.JSON
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @description:
* @author: tw
* @createDate: 2024/3/4
*/
@Service
public
class
SunlightServiceImpl
implements
SunlightService
{
@Autowired
SunlightMapper
sunlightMapper
;
@Autowired
private
JpStationMapper
jpStationMapper
;
@Autowired
private
JpCollectorMapper
jpCollectorMapper
;
@Autowired
private
JpInverterMapper
jpInverterMapper
;
//监盘逆变器电量mapper
@Autowired
private
JpInverterElectricityMapper
jpInverterElectricityMapper
;
@Autowired
private
TdHYGFInverterDayGenerateMapper
tdHYGFInverterDayGenerateMapper
;
@Autowired
private
TdHYGFInverterMonthGenerateMapper
tdHYGFInverterMonthGenerateMapper
;
@Autowired
private
TdHYGFInverterYearGenerateMapper
tdHYGFInverterYearGenerateMapper
;
@Autowired
private
TdHYGFStationDayGenerateMapper
tdHYGFStationDayGenerateMapper
;
@Autowired
private
TdHYGFStationMonthGenerateMapper
tdHYGFStationMonthGenerateMapper
;
@Autowired
private
TdHYGFStationYearGenerateMapper
tdHYGFStationYearGenerateMapper
;
@Autowired
private
TdHYGFInverterTotalGenerateMapper
tdHYGFInverterTotalGenerateMapper
;
@Autowired
ApplicationContext
applicationContext
;
//户用光伏逆变器告警
@Autowired
private
HYGFJPInverterWarnMapper
hygfjpInverterWarnMapper
;
@Autowired
SunlightUtil
SunlightUtil
;
//td电站信息存储
@Override
@Scheduled
(
cron
=
"${dataRequstScheduled.Sunlight}"
)
public
void
stationList
()
{
Map
<
String
,
Object
>
bodyparam
=
new
HashMap
<>();
bodyparam
.
put
(
"ps_type"
,
"1,3,4,5,6,7,8"
);
bodyparam
.
put
(
"size"
,
3000
);
bodyparam
.
put
(
"curPage"
,
1
);
JSONObject
data
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getPowerStationList
,
bodyparam
);
List
<
Sunlight
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
Sunlight
.
class
);
this
.
stationDetail
(
data
);
sunlightMapper
.
delete
(
null
);
for
(
Sunlight
sunlight
:
list
)
{
sunlight
.
setCreatedTime
(
System
.
currentTimeMillis
());
sunlightMapper
.
insert
(
sunlight
);
}
}
public
void
stationDetail
(
JSONObject
data
){
//所有场站信息
List
<
SunlightDto
>
list
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
data
.
get
(
"pageList"
)),
SunlightDto
.
class
);
//业务表场站
List
<
JpStation
>
jpStations
=
jpStationMapper
.
selectList
(
new
QueryWrapper
<
JpStation
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()));
Map
<
String
,
JpStation
>
bodyparam
=
new
HashMap
<>();
if
(
jpStations
!=
null
&&
jpStations
.
size
()>
0
){
bodyparam
=
jpStations
.
stream
().
collect
(
Collectors
.
toMap
(
JpStation:
:
getThirdStationId
,
Function
.
identity
()));
}
//封装电站数据
// for (SunlightDto sunlightDto : list) {
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
SunlightDto
sunlightDto
=
list
.
get
(
i
);
if
(
i
==
160
){
System
.
out
.
println
(
"22222"
);
}
System
.
out
.
println
(
i
+
"===================================================="
);
JpStation
jpStation
=
null
;
if
(
bodyparam
.
containsKey
(
sunlightDto
.
getPs_id
().
toString
())){
jpStation
=
bodyparam
.
get
(
sunlightDto
.
getPs_id
().
toString
());
}
else
{
jpStation
=
new
JpStation
();
}
jpStation
.
setThirdStationId
(
sunlightDto
.
getPs_id
().
toString
());
jpStation
.
setName
(
sunlightDto
.
getPs_name
());
jpStation
.
setAddress
(
sunlightDto
.
getPs_location
());
jpStation
.
setLongitude
((
"null"
.
equals
(
sunlightDto
.
getLongitude
())||(
sunlightDto
.
getLongitude
()==
null
)||
"0.0"
.
equals
(
sunlightDto
.
getLongitude
()))?
null
:
sunlightDto
.
getLongitude
().
toString
());
jpStation
.
setLatitude
((
"null"
.
equals
(
sunlightDto
.
getLatitude
())||(
sunlightDto
.
getLatitude
()==
null
)||
"0.0"
.
equals
(
sunlightDto
.
getLatitude
()))?
null
:
sunlightDto
.
getLatitude
().
toString
());
jpStation
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
// 并网类型
jpStation
.
setOnGridType
(
SunlightUtil
.
intoNetWorkStatus
.
get
(
String
.
valueOf
(
sunlightDto
.
getConnect_type
())));
//第三方厂商标识
jpStation
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
jpStation
.
setRecDate
(
new
Date
());
//获取单个电站详情
Map
<
String
,
Object
>
bodyparamf
=
new
HashMap
<>();
bodyparamf
.
put
(
"ps_id"
,
sunlightDto
.
getPs_id
().
toString
());
JSONObject
jsonObject
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getPowerStationDetail
,
bodyparamf
);
jpStation
.
setRatedPower
(
jsonObject
.
get
(
"design_capacity"
)!=
null
?
Double
.
valueOf
(
jsonObject
.
get
(
"design_capacity"
).
toString
())/
1000
:
null
);
//额定功率
jpStation
.
setUserName
(
jsonObject
.
get
(
"ps_name"
)!=
null
?
jsonObject
.
get
(
"ps_name"
).
toString
():
null
);
// 业主姓名
jpStation
.
setEmail
(
jsonObject
.
get
(
"email"
)!=
null
?
jsonObject
.
get
(
"email"
).
toString
():
null
);
// 邮箱
jpStation
.
setUserPhone
(
jsonObject
.
get
(
"user_moble_tel"
)!=
null
?
jsonObject
.
get
(
"user_moble_tel"
).
toString
():
null
);
//业主电话
jpStation
.
setCreateTime
(
jsonObject
.
get
(
"install_date"
)!=
null
?
DateUtil
.
parse
(
jsonObject
.
get
(
"install_date"
)+
""
,
"yyyy-MM-dd HH:mm:ss"
)
:
null
);
// 创建时间
jpStation
.
setType
(
"家庭户用"
);
//电站类型
// jpStation.setArea();//地区
jpStation
.
setPrice
(
1.0
);
//上网电价
// jpStation.setOnGridTime(); // 并网时间
// jpStation.setAccessTime();// 接入平台时间
// jpStation.setStationContact();// 电站联系人
// jpStation.setModuleCount(); // 组件数量
jpStation
.
setSnCode
(
sunlightDto
.
getPs_id
().
toString
());
//sncode
Map
<
String
,
String
>
map
=
sunlightDto
.
getTotal_capcity
();
jpStation
.
setCapacity
(
map
!=
null
&&
map
.
get
(
"unit"
)!=
null
?
SunlightUtil
.
zj
.
get
(
String
.
valueOf
(
map
.
get
(
"unit"
)))*
Double
.
valueOf
(
String
.
valueOf
(
map
.
get
(
"value"
))):
null
);
//装机容量
Map
<
String
,
String
>
map1
=
sunlightDto
.
getCurr_power
();
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
>
map2
=
sunlightDto
.
getToday_energy
();
jpStation
.
setDayGenerate
(
map2
!=
null
&&
map2
.
get
(
"unit"
)!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map2
.
get
(
"unit"
)))*
Double
.
valueOf
(
String
.
valueOf
(
map2
.
get
(
"value"
))):
null
);
//日发电量
Map
<
String
,
String
>
map3
=
sunlightDto
.
getTotal_energy
();
jpStation
.
setAccumulatedPower
(
map3
!=
null
&&
map3
.
get
(
"unit"
)!=
null
?
SunlightUtil
.
fd
.
get
(
String
.
valueOf
(
map3
.
get
(
"unit"
)))*
Double
.
valueOf
(
String
.
valueOf
(
map3
.
get
(
"value"
))):
null
);
//累计发电量
Map
<
String
,
String
>
map4
=
sunlightDto
.
getToday_income
();
jpStation
.
setDayIncome
(
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
();
jpStation
.
setCumulativeIncome
(
map5
!=
null
&&
map5
.
get
(
"unit"
)!=
null
?
SunlightUtil
.
sy
.
get
(
String
.
valueOf
(
map5
.
get
(
"unit"
)))*
Double
.
valueOf
(
String
.
valueOf
(
map5
.
get
(
"value"
))):
null
);
// 累计收益
if
(
sunlightDto
.
getPs_fault_status
()>
2
)
{
jpStation
.
setState
(
SunlightUtil
.
zt
.
get
(
sunlightDto
.
getPs_status
()+
""
));
//电站状态
}
else
{
jpStation
.
setState
(
"报警"
);
//电站状态
}
//获取电站下逆变器
Map
<
String
,
Object
>
bodyparamjp
=
new
HashMap
<>();
List
<
String
>
lif
=
new
ArrayList
<>();
lif
.
add
(
"1"
);
bodyparamjp
.
put
(
"ps_id"
,
sunlightDto
.
getPs_id
().
toString
());
bodyparamjp
.
put
(
"size"
,
3000
);
bodyparamjp
.
put
(
"curPage"
,
1
);
bodyparamjp
.
put
(
"device_type_list"
,
lif
);
JSONObject
jsonObject1data
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getDeviceList
,
bodyparamjp
);
List
<
Device
>
listd
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject1data
.
get
(
"pageList"
)),
Device
.
class
);
//获取电站,月发电量
if
(
listd
!=
null
&&
listd
.
size
()>
0
){
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
List
<
String
>
li
=
new
ArrayList
<>();
li
.
add
(
listd
.
get
(
0
).
getPs_key
());
Calendar
calendar
=
Calendar
.
getInstance
();
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
bodyparamnb
.
put
(
"ps_key_list"
,
li
);
bodyparamnb
.
put
(
"start_time"
,
year
+
""
+
(
month
<
10
?
"0"
+
month
:
month
)
);
bodyparamnb
.
put
(
"end_time"
,
year
+
""
+
(
month
<
10
?
"0"
+
month
:
month
));
bodyparamnb
.
put
(
"data_type"
,
"4"
);
bodyparamnb
.
put
(
"order"
,
"0"
);
bodyparamnb
.
put
(
"query_type"
,
"2"
);
bodyparamnb
.
put
(
"data_point"
,
"p1"
);
JSONObject
jsonObject1nb
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getDevicePointsDayMonthYearDataList
,
bodyparamnb
);
JSONObject
jsonObject22
=
JSONUtil
.
parseObj
(
jsonObject1nb
.
get
(
listd
.
get
(
0
).
getPs_key
()),
true
);
List
<
Map
>
js
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject22
.
get
(
"p1"
)),
Map
.
class
);
// 月发电量
jpStation
.
setMonthGenerate
(
js
.
get
(
0
).
get
(
"4"
)!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)+
""
)/
1000
:
null
);
// 月收益
jpStation
.
setMonthIncome
(
js
.
get
(
0
).
get
(
"4"
)!=
null
?
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)+
""
)/
1000
:
null
);
}
//获取电站,年发电量
if
(
listd
!=
null
&&
listd
.
size
()>
0
){
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
List
<
String
>
li
=
new
ArrayList
<>();
li
.
add
(
listd
.
get
(
0
).
getPs_key
());
Calendar
calendar
=
Calendar
.
getInstance
();
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
bodyparamnb
.
put
(
"ps_key_list"
,
li
);
bodyparamnb
.
put
(
"start_time"
,
year
+
""
);
bodyparamnb
.
put
(
"end_time"
,
year
+
""
);
bodyparamnb
.
put
(
"data_type"
,
"4"
);
bodyparamnb
.
put
(
"order"
,
"0"
);
bodyparamnb
.
put
(
"query_type"
,
"3"
);
bodyparamnb
.
put
(
"data_point"
,
"p1"
);
JSONObject
jsonObject1nb
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getDevicePointsDayMonthYearDataList
,
bodyparamnb
);
JSONObject
jsonObject23
=
JSONUtil
.
parseObj
(
jsonObject1nb
.
get
(
listd
.
get
(
0
).
getPs_key
()),
true
);
List
<
Map
>
js
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject23
.
get
(
"p1"
)),
Map
.
class
);
// 年发电量
jpStation
.
setYearGenerate
(
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)+
""
)/
1000
);
// 年收益
jpStation
.
setYearIncome
(
Double
.
valueOf
(
js
.
get
(
0
).
get
(
"4"
)+
""
)/
1000
);
if
(!
ObjectUtils
.
isEmpty
(
jpStation
.
getSequenceNbr
()))
{
jpStationMapper
.
updateById
(
jpStation
);
}
else
{
jpStationMapper
.
insert
(
jpStation
);
}
this
.
setJpInverte
(
listd
.
get
(
0
),
jpStation
);
}
//电站报表
//户用场站日发电量
Date
today1
=
new
Date
();
TdHYGFStationDayGenerate
tdHYGFStationDayGenerate
=
tdHYGFStationDayGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFStationDayGenerate
>()
.
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
()
)
.
eq
(
"day_time"
,
DateUtil
.
format
(
today1
,
"yyyy-MM-dd"
))
.
eq
(
"year_month"
,
DateUtil
.
format
(
today1
,
"yyyy-MM"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationDayGenerate
))
{
tdHYGFStationDayGenerate
=
new
TdHYGFStationDayGenerate
();
}
tdHYGFStationDayGenerate
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
tdHYGFStationDayGenerate
.
setDayTime
(
DateUtil
.
format
(
today1
,
"yyyy-MM-dd"
));
tdHYGFStationDayGenerate
.
setYearMonth
(
DateUtil
.
format
(
today1
,
"yyyy-MM"
));
tdHYGFStationDayGenerate
.
setGenerate
(
jpStation
.
getDayGenerate
());
tdHYGFStationDayGenerate
.
setFullhour
(
(
jpStation
.
getDayGenerate
()==
null
||
jpStation
.
getCapacity
()==
null
)?
null
:
(
jpStation
.
getCapacity
()<=
0.0
?
null
:
jpStation
.
getDayGenerate
()/
jpStation
.
getCapacity
())
);
tdHYGFStationDayGenerate
.
setIncome
(
jpStation
.
getDayIncome
());
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationDayGenerate
.
getCreatedTime
()))
{
tdHYGFStationDayGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFStationDayGenerateMapper
.
insert
(
tdHYGFStationDayGenerate
);
}
else
{
tdHYGFStationDayGenerateMapper
.
insert
(
tdHYGFStationDayGenerate
);
}
//户用场站月发电量
TdHYGFStationMonthGenerate
tdHYGFStationMonthGenerate
=
tdHYGFStationMonthGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFStationMonthGenerate
>()
.
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
())
.
eq
(
"month_time"
,
DateUtil
.
format
(
today1
,
"yyyy-MM"
))
.
eq
(
"year"
,
DateUtil
.
format
(
today1
,
"yyyy"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationMonthGenerate
))
{
tdHYGFStationMonthGenerate
=
new
TdHYGFStationMonthGenerate
();
}
tdHYGFStationMonthGenerate
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
tdHYGFStationMonthGenerate
.
setMonthTime
(
DateUtil
.
format
(
today1
,
"yyyy-MM"
));
tdHYGFStationMonthGenerate
.
setYear
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFStationMonthGenerate
.
setGenerate
(
jpStation
.
getMonthGenerate
());
tdHYGFStationMonthGenerate
.
setFullhour
(
// jpStation.getMonthGenerate() / jpStation.getCapacity()
(
jpStation
.
getMonthGenerate
()==
null
||
jpStation
.
getCapacity
()==
null
)?
null
:
(
jpStation
.
getCapacity
()<=
0.0
?
null
:
jpStation
.
getMonthGenerate
()/
jpStation
.
getCapacity
())
);
tdHYGFStationMonthGenerate
.
setIncome
(
jpStation
.
getMonthIncome
());
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationMonthGenerate
.
getCreatedTime
()))
{
tdHYGFStationMonthGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFStationMonthGenerateMapper
.
insert
(
tdHYGFStationMonthGenerate
);
}
else
{
tdHYGFStationMonthGenerateMapper
.
insert
(
tdHYGFStationMonthGenerate
);
}
//户用场站年发电量
TdHYGFStationYearGenerate
tdHYGFStationYearGenerate
=
tdHYGFStationYearGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFStationYearGenerate
>()
.
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
())
.
eq
(
"year_time"
,
DateUtil
.
format
(
today1
,
"yyyy"
))
.
eq
(
"year"
,
DateUtil
.
format
(
today1
,
"yyyy"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationYearGenerate
))
{
tdHYGFStationYearGenerate
=
new
TdHYGFStationYearGenerate
();
}
tdHYGFStationYearGenerate
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
tdHYGFStationYearGenerate
.
setYearTime
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFStationYearGenerate
.
setYear
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFStationYearGenerate
.
setGenerate
(
jpStation
.
getYearGenerate
());
tdHYGFStationYearGenerate
.
setFullhour
(
// jpStation.getYearGenerate() / jpStation.getCapacity()
(
jpStation
.
getYearGenerate
()==
null
||
jpStation
.
getCapacity
()==
null
)?
null
:
(
jpStation
.
getCapacity
()<=
0.0
?
null
:
jpStation
.
getYearGenerate
()/
jpStation
.
getCapacity
())
);
tdHYGFStationYearGenerate
.
setIncome
(
jpStation
.
getYearIncome
());
if
(
ObjectUtils
.
isEmpty
(
tdHYGFStationYearGenerate
.
getCreatedTime
()))
{
tdHYGFStationYearGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFStationYearGenerateMapper
.
insert
(
tdHYGFStationYearGenerate
);
}
else
{
tdHYGFStationYearGenerateMapper
.
insert
(
tdHYGFStationYearGenerate
);
}
}
}
//逆变器
public
void
setJpInverte
(
Device
device
,
JpStation
jpStation
){
new
Thread
(
new
Runnable
(){
@Override
public
void
run
(){
try
{
if
(
device
!=
null
){
//获取逆变器信息存库
JpInverter
jpInverter
=
jpInverterMapper
.
selectOne
(
new
QueryWrapper
<
JpInverter
>().
eq
(
"third_station_id"
,
device
.
getPs_id
().
toString
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"ID"
,
device
.
getUuid
().
toString
()));
if
(
ObjectUtils
.
isEmpty
(
jpInverter
))
{
jpInverter
=
new
JpInverter
();
}
// 品牌
jpInverter
.
setBrand
(
device
.
getFactory_name
());
jpInverter
.
setSnCode
(
device
.
getDevice_sn
());
jpInverter
.
setId
(
device
.
getUuid
().
toString
());
jpInverter
.
setState
(
jpStation
.
getState
());
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
jpInverter
.
setYearPowerGeneration
(
jpStation
.
getYearGenerate
());
jpInverter
.
setTotalPowerGeneration
(
jpStation
.
getAccumulatedPower
());
jpInverter
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
jpInverter
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
jpInverter
.
setName
(
device
.
getDevice_name
());
jpInverter
.
setStationName
(
jpStation
.
getName
());
jpInverter
.
setAddr
(
jpStation
.
getAddress
());
jpInverter
.
setModel
(
device
.
getDevice_model_code
());
jpInverter
.
setCapacity
(
jpStation
.
getCapacity
());
jpInverter
.
setCurrentPower
(
jpStation
.
getRealTimePower
());
// // 国标
// jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
// // 满发小时数
// jpInverter.setGenerationHours(String.valueOf(inverterDetailDto.getFullHour()));
// //版本
// jpInverter.setVersion(device.getDevice_model_code());
// //采集器id
// jpInverter.setCollectorId(ksolarStationCollectList.getCollectId().trim());
// //采集器sn编码
// jpInverter.setCollectorSnCode(ksolarStationCollectList.getCollectId().trim());
if
(!
ObjectUtils
.
isEmpty
(
jpInverter
.
getSequenceNbr
()))
{
jpInverterMapper
.
updateById
(
jpInverter
);
}
else
{
if
(
StringUtils
.
isNotEmpty
(
jpInverter
.
getSnCode
())){
jpInverterMapper
.
insert
(
jpInverter
);
}
}
//逆变器指标信息
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
List
<
String
>
li
=
new
ArrayList
<>();
li
.
add
(
device
.
getPs_key
());
bodyparamnb
.
put
(
"ps_key_list"
,
li
);
JSONObject
jsonObject1nb
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getPVInverterRealTimeData
,
bodyparamnb
);
List
<
Map
>
js
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject1nb
.
get
(
"device_point_list"
)),
Map
.
class
);
if
(
js
!=
null
&&
js
.
size
()>
0
){
Map
jsd
=
JSONUtil
.
parseObj
(
js
.
get
(
0
).
get
(
"device_point"
));
List
<
String
>
liname
=
new
ArrayList
<>();
liname
.
add
(
"AC1"
);
//A 相电压
liname
.
add
(
"AC2"
);
//B 相电压
liname
.
add
(
"AC3"
);
//C 相电压
liname
.
add
(
"PV1"
);
//直流电压 1
liname
.
add
(
"PV2"
);
//直流电压 2
liname
.
add
(
"PV3"
);
//直流电压 3
liname
.
add
(
"PV4"
);
//直流电压 4
liname
.
add
(
"PV5"
);
//直流电压 5
liname
.
add
(
"PV6"
);
//直流电压 6
liname
.
add
(
"PV7"
);
//直流电压 7
liname
.
add
(
"PV8"
);
//直流电压 8
liname
.
add
(
"PV9"
);
//直流电压 9
liname
.
add
(
"PV10"
);
//直流电压 10
for
(
int
i
=
0
;
i
<
liname
.
size
();
i
++)
{
JpInverterElectricity
jpInverterElectricity
=
jpInverterElectricityMapper
.
selectOne
(
new
QueryWrapper
<
JpInverterElectricity
>().
eq
(
"sn_code"
,
jpInverter
.
getSnCode
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"name"
,
liname
.
get
(
i
))
);
if
(
ObjectUtils
.
isEmpty
(
jpInverterElectricity
))
{
jpInverterElectricity
=
new
JpInverterElectricity
();
}
jpInverterElectricity
.
setInverterId
(
jpInverter
.
getId
());
jpInverterElectricity
.
setSnCode
(
jpInverter
.
getSnCode
());
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
jpInverterElectricity
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
if
(
i
>
2
){
jpInverterElectricity
.
setType
(
"直流"
);
}
else
{
jpInverterElectricity
.
setType
(
"交流"
);
}
jpInverterElectricity
.
setName
(
liname
.
get
(
i
));
String
voltage
=
null
;
String
current
=
null
;
switch
(
liname
.
get
(
i
))
{
case
"AC1"
:
voltage
=
jsd
.
get
(
"p18"
)!=
null
?
jsd
.
get
(
"p18"
).
toString
():
null
;
current
=
jsd
.
get
(
"p21"
)!=
null
?
jsd
.
get
(
"p21"
).
toString
():
null
;
break
;
case
"AC2"
:
voltage
=
jsd
.
get
(
"p19"
)!=
null
?
jsd
.
get
(
"p19"
).
toString
():
null
;
current
=
jsd
.
get
(
"p22"
)!=
null
?
jsd
.
get
(
"p22"
).
toString
():
null
;
break
;
case
"AC3"
:
voltage
=
jsd
.
get
(
"p20"
)!=
null
?
jsd
.
get
(
"p20"
).
toString
():
null
;
current
=
jsd
.
get
(
"p23"
)!=
null
?
jsd
.
get
(
"p23"
).
toString
():
null
;
break
;
case
"PV1"
:
voltage
=
jsd
.
get
(
"p5"
)!=
null
?
jsd
.
get
(
"p5"
).
toString
():
null
;
current
=
jsd
.
get
(
"p6"
)!=
null
?
jsd
.
get
(
"p6"
).
toString
():
null
;
break
;
case
"PV2"
:
voltage
=
jsd
.
get
(
"p7"
)!=
null
?
jsd
.
get
(
"p7"
).
toString
():
null
;
current
=
jsd
.
get
(
"p8"
)!=
null
?
jsd
.
get
(
"p8"
).
toString
():
null
;
break
;
case
"PV3"
:
voltage
=
jsd
.
get
(
"p9"
)!=
null
?
jsd
.
get
(
"p9"
).
toString
():
null
;
current
=
jsd
.
get
(
"p10"
)!=
null
?
jsd
.
get
(
"p10"
).
toString
():
null
;
break
;
case
"PV4"
:
voltage
=
jsd
.
get
(
"p45"
)!=
null
?
jsd
.
get
(
"p45"
).
toString
():
null
;
current
=
jsd
.
get
(
""
)!=
null
?
jsd
.
get
(
""
).
toString
():
null
;
break
;
case
"PV5"
:
voltage
=
jsd
.
get
(
"p47"
)!=
null
?
jsd
.
get
(
"p47"
).
toString
():
null
;
current
=
jsd
.
get
(
"p46"
)!=
null
?
jsd
.
get
(
"p46"
).
toString
():
null
;
break
;
case
"PV6"
:
voltage
=
jsd
.
get
(
"p49"
)!=
null
?
jsd
.
get
(
"p49"
).
toString
():
null
;
current
=
jsd
.
get
(
"p48"
)!=
null
?
jsd
.
get
(
"p48"
).
toString
():
null
;
break
;
case
"PV7"
:
voltage
=
jsd
.
get
(
"p51"
)!=
null
?
jsd
.
get
(
"p51"
).
toString
():
null
;
current
=
jsd
.
get
(
"p50"
)!=
null
?
jsd
.
get
(
"p50"
).
toString
():
null
;
break
;
case
"PV8"
:
voltage
=
jsd
.
get
(
"p53"
)!=
null
?
jsd
.
get
(
"p53"
).
toString
():
null
;
current
=
jsd
.
get
(
"p52"
)!=
null
?
jsd
.
get
(
"p52"
).
toString
():
null
;
break
;
case
"PV9"
:
voltage
=
jsd
.
get
(
"p55"
)!=
null
?
jsd
.
get
(
"p55"
).
toString
():
null
;
current
=
jsd
.
get
(
"p54"
)!=
null
?
jsd
.
get
(
"p54"
).
toString
():
null
;
break
;
case
"PV10"
:
voltage
=
jsd
.
get
(
"p57"
)!=
null
?
jsd
.
get
(
"p57"
).
toString
():
null
;
current
=
jsd
.
get
(
"p58"
)!=
null
?
jsd
.
get
(
"p58"
).
toString
():
null
;
break
;
default
:
}
jpInverterElectricity
.
setVoltage
(
voltage
!=
null
?
Double
.
valueOf
(
voltage
):
null
);
jpInverterElectricity
.
setCurrent
(
current
!=
null
?
Double
.
valueOf
(
current
):
null
);
jpInverterElectricity
.
setPower
(
null
);
if
(
ObjectUtils
.
isEmpty
(
jpInverterElectricity
.
getSequenceNbr
()))
{
jpInverterElectricityMapper
.
insert
(
jpInverterElectricity
);
}
else
{
jpInverterElectricityMapper
.
updateById
(
jpInverterElectricity
);
}
}
//逆变器报表
//-----------------------户用光伏日报表----------------------
TdHYGFInverterDayGenerate
tdHYGFInverterDayGenerate
=
new
TdHYGFInverterDayGenerate
();
tdHYGFInverterDayGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFInverterDayGenerate
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
tdHYGFInverterDayGenerate
.
setSnCode
(
jpInverter
.
getSnCode
());
tdHYGFInverterDayGenerate
.
setName
(
jpInverter
.
getName
());
tdHYGFInverterDayGenerate
.
setWorkStatus
(
jpInverter
.
getState
());
//交流电压
tdHYGFInverterDayGenerate
.
setDcv1
(
jsd
.
get
(
"p18"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p18"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setDcv2
(
jsd
.
get
(
"p19"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p19"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setDcv3
(
jsd
.
get
(
"p20"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p20"
).
toString
()):
null
);
//交流电流
tdHYGFInverterDayGenerate
.
setDcc1
(
jsd
.
get
(
"p21"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p21"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setDcc2
(
jsd
.
get
(
"p22"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p22"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setDcc3
(
jsd
.
get
(
"p23"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p23"
).
toString
()):
null
);
//直流电压
tdHYGFInverterDayGenerate
.
setAcv1
(
jsd
.
get
(
"p5"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p5"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcv2
(
jsd
.
get
(
"p7"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p7"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcv3
(
jsd
.
get
(
"p9"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p9"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcv4
(
jsd
.
get
(
"p45"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p45"
).
toString
()):
null
);
//直流电流
tdHYGFInverterDayGenerate
.
setAcc1
(
jsd
.
get
(
"p6"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p6"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcc2
(
jsd
.
get
(
"p8"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p8"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcc3
(
jsd
.
get
(
"p10"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p10"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setAcc4
(
jsd
.
get
(
"p46"
)!=
null
?
Double
.
valueOf
(
jsd
.
get
(
"p46"
).
toString
()):
null
);
tdHYGFInverterDayGenerate
.
setPv1
(
null
);
tdHYGFInverterDayGenerate
.
setPv2
(
null
);
tdHYGFInverterDayGenerate
.
setPv3
(
null
);
tdHYGFInverterDayGenerate
.
setPv4
(
null
);
//功率
tdHYGFInverterDayGenerate
.
setTotalPower
(
jpInverter
.
getCurrentPower
());
// //频率
tdHYGFInverterDayGenerate
.
setFrequency
(
String
.
valueOf
(
jsd
.
get
(
"p27"
)));
// //功率因数
tdHYGFInverterDayGenerate
.
setPowerFactor
(
1.0
);
tdHYGFInverterDayGenerate
.
setDayGen
(
jpInverter
.
getDayPowerGeneration
());
tdHYGFInverterDayGenerate
.
setMonthGen
(
jpInverter
.
getMonthPowerGeneration
());
tdHYGFInverterDayGenerate
.
setYearGen
(
jpInverter
.
getYearPowerGeneration
());
tdHYGFInverterDayGenerate
.
setTotalGen
(
jpInverter
.
getTotalPowerGeneration
());
tdHYGFInverterDayGenerate
.
setIgbtTemp
(
ObjectUtils
.
isEmpty
(
jpInverter
.
getIgbtTemperature
())
?
null
:
Double
.
valueOf
(
jpInverter
.
getIgbtTemperature
()));
tdHYGFInverterDayGenerate
.
setIncome
(
null
);
tdHYGFInverterDayGenerate
.
setFullhour
(
(
jpInverter
.
getDayPowerGeneration
()==
null
||
jpInverter
.
getCapacity
()==
null
)?
null
:
(
jpInverter
.
getCapacity
()<=
0.0
?
null
:
jpInverter
.
getDayPowerGeneration
()/
jpInverter
.
getCapacity
())
);
tdHYGFInverterDayGenerateMapper
.
insert
(
tdHYGFInverterDayGenerate
);
//户用场站月发电量
Date
today1
=
new
Date
();
TdHYGFInverterMonthGenerate
tdHYGFInverterMonthGenerate
=
tdHYGFInverterMonthGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFInverterMonthGenerate
>()
.
eq
(
"third_station_id"
,
jpInverter
.
getThirdStationId
())
.
eq
(
"sn_code"
,
jpInverter
.
getSnCode
())
.
eq
(
"day_time"
,
DateUtil
.
format
(
today1
,
"yyyy-MM-dd"
))
.
eq
(
"year_month"
,
DateUtil
.
format
(
today1
,
"yyyy-MM"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterMonthGenerate
))
{
tdHYGFInverterMonthGenerate
=
new
TdHYGFInverterMonthGenerate
();
}
tdHYGFInverterMonthGenerate
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
tdHYGFInverterMonthGenerate
.
setSnCode
(
jpInverter
.
getSnCode
().
trim
());
tdHYGFInverterMonthGenerate
.
setDayTime
(
DateUtil
.
format
(
today1
,
"yyyy-MM-dd"
));
tdHYGFInverterMonthGenerate
.
setYearMonth
(
DateUtil
.
format
(
today1
,
"yyyy-MM"
));
tdHYGFInverterMonthGenerate
.
setGenerate
(
jpInverter
.
getDayPowerGeneration
());
tdHYGFInverterMonthGenerate
.
setName
(
jpInverter
.
getName
());
tdHYGFInverterMonthGenerate
.
setFullhour
(
(
jpInverter
.
getDayPowerGeneration
()==
null
||
jpInverter
.
getCapacity
()==
null
)?
null
:
(
jpInverter
.
getCapacity
()<=
0.0
?
null
:
jpInverter
.
getDayPowerGeneration
()/
jpInverter
.
getCapacity
())
);
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterMonthGenerate
.
getCreatedTime
()))
{
tdHYGFInverterMonthGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFInverterMonthGenerateMapper
.
insert
(
tdHYGFInverterMonthGenerate
);
}
else
{
tdHYGFInverterMonthGenerateMapper
.
insert
(
tdHYGFInverterMonthGenerate
);
}
//户用场站年发电量
TdHYGFInverterYearGenerate
tdHYGFInverterYearGenerate
=
tdHYGFInverterYearGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFInverterYearGenerate
>()
.
eq
(
"third_station_id"
,
jpInverter
.
getThirdStationId
())
.
eq
(
"sn_code"
,
jpInverter
.
getSnCode
())
.
eq
(
"month_time"
,
DateUtil
.
format
(
today1
,
"yyyy-MM"
))
.
eq
(
"year"
,
DateUtil
.
format
(
today1
,
"yyyy"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterYearGenerate
))
{
tdHYGFInverterYearGenerate
=
new
TdHYGFInverterYearGenerate
();
}
tdHYGFInverterYearGenerate
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
tdHYGFInverterYearGenerate
.
setSnCode
(
jpInverter
.
getSnCode
().
trim
());
tdHYGFInverterYearGenerate
.
setMonthTime
(
DateUtil
.
format
(
today1
,
"yyyy-MM"
));
tdHYGFInverterYearGenerate
.
setYear
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFInverterYearGenerate
.
setGenerate
(
jpInverter
.
getMonthPowerGeneration
());
tdHYGFInverterYearGenerate
.
setName
(
jpInverter
.
getName
());
tdHYGFInverterYearGenerate
.
setFullhour
(
(
jpInverter
.
getMonthPowerGeneration
()==
null
||
jpInverter
.
getCapacity
()==
null
)?
null
:
(
jpInverter
.
getCapacity
()<=
0.0
?
null
:
jpInverter
.
getMonthPowerGeneration
()/
jpInverter
.
getCapacity
())
);
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterYearGenerate
.
getCreatedTime
()))
{
tdHYGFInverterYearGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFInverterYearGenerateMapper
.
insert
(
tdHYGFInverterYearGenerate
);
}
else
{
tdHYGFInverterYearGenerateMapper
.
insert
(
tdHYGFInverterYearGenerate
);
}
//户用场站年发电量
TdHYGFInverterTotalGenerate
tdHYGFInverterTotalGenerate
=
tdHYGFInverterTotalGenerateMapper
.
selectOne
(
new
QueryWrapper
<
TdHYGFInverterTotalGenerate
>()
.
eq
(
"third_station_id"
,
jpInverter
.
getThirdStationId
())
.
eq
(
"sn_code"
,
jpInverter
.
getSnCode
())
.
eq
(
"year_time"
,
DateUtil
.
format
(
today1
,
"yyyy"
))
.
eq
(
"year"
,
DateUtil
.
format
(
today1
,
"yyyy"
)));
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterTotalGenerate
))
{
tdHYGFInverterTotalGenerate
=
new
TdHYGFInverterTotalGenerate
();
}
tdHYGFInverterTotalGenerate
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
tdHYGFInverterTotalGenerate
.
setSnCode
(
jpInverter
.
getSnCode
().
trim
());
tdHYGFInverterTotalGenerate
.
setYearTime
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFInverterTotalGenerate
.
setYear
(
DateUtil
.
format
(
today1
,
"yyyy"
));
tdHYGFInverterTotalGenerate
.
setGenerate
(
jpInverter
.
getYearPowerGeneration
());
tdHYGFInverterTotalGenerate
.
setFullhour
(
0.0d
);
tdHYGFInverterTotalGenerate
.
setName
(
jpInverter
.
getName
());
tdHYGFInverterTotalGenerate
.
setFullhour
(
(
jpInverter
.
getYearPowerGeneration
()==
null
||
jpInverter
.
getCapacity
()==
null
)?
null
:
(
jpInverter
.
getCapacity
()<=
0.0
?
null
:
jpInverter
.
getYearPowerGeneration
()/
jpInverter
.
getCapacity
())
);
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterTotalGenerate
.
getCreatedTime
()))
{
tdHYGFInverterTotalGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFInverterTotalGenerateMapper
.
insert
(
tdHYGFInverterTotalGenerate
);
}
else
{
tdHYGFInverterTotalGenerateMapper
.
insert
(
tdHYGFInverterTotalGenerate
);
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}).
start
();
}
@Scheduled
(
cron
=
"${dataRequstScheduled.Sunlight}"
)
@Override
public
void
inverAlramInfo
()
{
//获取所有未处理告警
Map
<
String
,
Object
>
bodyparamf
=
new
HashMap
<>();
bodyparamf
.
put
(
"size"
,
1000
);
bodyparamf
.
put
(
"curPage"
,
1
);
JSONObject
jsonObject
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getFaultAlarmInfo
,
bodyparamf
);
List
<
SunlightWarm
>
listd
=
jsonObject
.
get
(
"pageList"
)!=
null
?
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject
.
get
(
"pageList"
)),
SunlightWarm
.
class
):
null
;
//获取系统未处理的告警
List
<
String
>
li
=
new
ArrayList
<>();
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"4"
));
li
.
add
(
SunlightUtil
.
alarmstatus
.
get
(
"5"
));
List
<
HYGFJPInverterWarn
>
hygfjpInverterWarnlist
=
hygfjpInverterWarnMapper
.
selectList
(
new
QueryWrapper
<
HYGFJPInverterWarn
>()
.
in
(
"state"
,
li
)
.
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
())
);
Map
<
String
,
HYGFJPInverterWarn
>
bodyparam
=
new
HashMap
<>();
if
(
hygfjpInverterWarnlist
!=
null
&&
hygfjpInverterWarnlist
.
size
()>
0
){
bodyparam
=
hygfjpInverterWarnlist
.
stream
().
collect
(
Collectors
.
toMap
(
HYGFJPInverterWarn:
:
getWarnId
,
Function
.
identity
()));
}
//获取所有逆变器
List
<
JpInverter
>
jpInverter
=
jpInverterMapper
.
selectList
(
new
QueryWrapper
<
JpInverter
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()));
Map
<
String
,
String
>
jpInverterbodyparam
=
new
HashMap
<>();
if
(
jpInverter
!=
null
&&
jpInverter
.
size
()>
0
){
jpInverterbodyparam
=
jpInverter
.
stream
().
collect
(
Collectors
.
toMap
(
JpInverter:
:
getId
,
JpInverter:
:
getSnCode
));
}
if
(
listd
!=
null
&&!
listd
.
isEmpty
()){
for
(
SunlightWarm
sunlightWarm
:
listd
)
{
//告警已存在
if
(!
bodyparam
.
isEmpty
()&&
bodyparam
.
containsKey
(
sunlightWarm
.
getFault_code
()))
{
bodyparam
.
remove
(
sunlightWarm
.
getFault_code
());
}
else
{
//告警不存在,新增
HYGFJPInverterWarn
hygfjpInverterWarn
=
new
HYGFJPInverterWarn
();
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setSnCode
(!
jpInverterbodyparam
.
isEmpty
()&&
jpInverterbodyparam
.
containsKey
(
sunlightWarm
.
getUuid
())?
jpInverterbodyparam
.
get
(
sunlightWarm
.
getUuid
()):
null
);
hygfjpInverterWarn
.
setThirdStationId
(
sunlightWarm
.
getPs_id
().
toString
());
hygfjpInverterWarn
.
setLevel
(
SunlightUtil
.
alarmLevel
.
get
(
sunlightWarm
.
getFault_level
()));
hygfjpInverterWarn
.
setContent
(
sunlightWarm
.
getFault_name
());
hygfjpInverterWarn
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
hygfjpInverterWarn
.
setTreatment
(
sunlightWarm
.
getFault_desc
());
hygfjpInverterWarn
.
setStartTime
(
DateUtil
.
parse
(
sunlightWarm
.
getCreate_time
(),
DatePattern
.
NORM_DATETIME_PATTERN
).
getTime
());
hygfjpInverterWarn
.
setState
(
SunlightUtil
.
alarmstatus
.
get
(
sunlightWarm
.
getProcess_status
()));
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setRecoverTime
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setWarnId
(
sunlightWarm
.
getFault_code
());
try
{
TimeUnit
.
MINUTES
.
sleep
(
1
);
hygfjpInverterWarn
.
setCreatedTime
(
System
.
currentTimeMillis
());
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
hygfjpInverterWarnMapper
.
insert
(
hygfjpInverterWarn
);
}
}
}
//更新td已消除告警
if
(!
bodyparam
.
isEmpty
()){
Object
[]
ids
=
bodyparam
.
keySet
().
toArray
();
for
(
Object
id
:
ids
)
{
// Map<String, Object> bodyparamfx=new HashMap<>();
// bodyparamfx.put("size", 1000);
// bodyparamfx.put("curPage",1);
// bodyparamfx.put("process_status",9);
// bodyparamfx.put("fault_code",id);
// JSONObject jsonObjectx = SunlightUtil.getdata(
// SunlightUtil.getFaultAlarmInfo,
// bodyparamfx
// );
// List<SunlightWarm> listx = JSONArray.parseArray(JSON.toJSONString(jsonObjectx.get("pageList")), SunlightWarm.class );
// if(listx!=null&&!listx.isEmpty()){
// SunlightWarm sunlightWarm=listx.get(0);
HYGFJPInverterWarn
hygfjpInverterWarn
=
bodyparam
.
get
(
id
);
//
// if (StringUtils.isNotBlank(sunlightWarm.getOver_time())) {
// hygfjpInverterWarn.setRecoverTime(DateUtil.parse(sunlightWarm.getOver_time(), DatePattern.NORM_DATETIME_PATTERN).getTime());
// }
// if (!ObjectUtils.isEmpty(hygfjpInverterWarn.getStartTime()) && !ObjectUtils.isEmpty(hygfjpInverterWarn.getRecoverTime())) {
// hygfjpInverterWarn.setTimeLong(hygfjpInverterWarn.getRecoverTime() - hygfjpInverterWarn.getStartTime());
// }
//hygfjpInverterWarn.setState(SunlightUtil.alarmstatus.get(sunlightWarm.getProcess_status()));
hygfjpInverterWarn
.
setState
(
SunlightUtil
.
alarmstatus
.
get
(
"5"
));
hygfjpInverterWarnMapper
.
insert
(
hygfjpInverterWarn
);
// }
}
}
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/openapi/enums/PVProducerInfoEnum.java
View file @
4291182c
...
...
@@ -8,6 +8,7 @@ public enum PVProducerInfoEnum {
SH
(
"首航"
,
"SH"
),
JLY
(
"锦浪云"
,
"JLY"
),
KSOLAR
(
"科士达"
,
"KSD"
),
YG
(
"阳光"
,
"YG"
),
HUAWEI
(
"华为"
,
"HW"
);
private
String
name
;
...
...
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