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
918c9cbd
Commit
918c9cbd
authored
Apr 12, 2024
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采集首航数据添加
parent
3df46798
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
416 additions
and
221 deletions
+416
-221
SofarRequestUtil.java
...yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
+7
-0
SoFarConstant.java
...yeejoin/amos/api/householdapi/constant/SoFarConstant.java
+8
-0
Device.java
...va/com/yeejoin/amos/api/householdapi/face/dto/Device.java
+1
-1
EquipComm.java
...com/yeejoin/amos/api/householdapi/face/dto/EquipComm.java
+25
-0
SofarWarm.java
...com/yeejoin/amos/api/householdapi/face/dto/SofarWarm.java
+24
-0
SofarDataAcquisitionService.java
...ouseholdapi/face/service/SofarDataAcquisitionService.java
+4
-4
SunlightService.java
...n/amos/api/householdapi/face/service/SunlightService.java
+1
-0
SofarDataAcquisitionServiceImpl.java
...pi/face/service/impl/SofarDataAcquisitionServiceImpl.java
+180
-127
SunlightServiceImpl.java
...i/householdapi/face/service/impl/SunlightServiceImpl.java
+166
-89
No files found.
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/SofarRequestUtil.java
View file @
918c9cbd
...
...
@@ -34,7 +34,14 @@ public class SofarRequestUtil {
}
};
public
static
final
HashMap
<
String
,
String
>
alarmLevel
=
new
HashMap
<
String
,
String
>()
{
{
put
(
"2"
,
"故障"
);
put
(
"1"
,
"警告"
);
put
(
"0"
,
"提示"
);
}
};
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/constant/SoFarConstant.java
View file @
918c9cbd
...
...
@@ -34,6 +34,9 @@ public class SoFarConstant {
public
static
String
nbqlist
=
"/station/v1.0/device?language=zh"
;
public
static
String
historical
=
"/device/v1.0/historical"
;
public
static
String
alert
=
"/station/v1.0/alert"
;
public
static
String
equipComm
=
"/device/v1.0/equipComm"
;
public
static
String
alertDetail
=
"device/v1.0/alertDetail"
;
public
static
String
stationListStatusUrl
=
"/api/OpenApi/QueryPowerStationMonitor"
;
public
static
String
stationDetailUrl
=
"/api/OpenApi/GetPowerStationMonitorDetail"
;
...
...
@@ -54,6 +57,11 @@ public class SoFarConstant {
public
static
String
resovleRule_data
=
"stationList"
;
public
static
String
deviceListItems
=
"deviceListItems"
;
public
static
String
communication
=
"communication"
;
public
static
String
stationAlertItems
=
"stationAlertItems"
;
public
static
String
dataList
=
"dataList"
;
public
static
String
paramDataList
=
"paramDataList"
;
public
static
String
requestPost
=
"POST"
;
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/Device.java
View file @
918c9cbd
...
...
@@ -28,6 +28,6 @@ public class Device {
private
Integer
device_model_id
;
//设备型号 ID
private
String
communication_dev_sn
;
//设备对应的通信设备的 SN
private
String
device_model_code
;
//设备型号名称
private
Integer
getPs_fault_status
;
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/EquipComm.java
0 → 100644
View file @
918c9cbd
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
fastjson.JSONArray
;
import
lombok.Data
;
import
java.util.List
;
/**
* @description:
* @author: tw
* @createDate: 2024/4/11
*/
@Data
public
class
EquipComm
{
private
Object
childList
;
// 子设备
private
Long
deviceId
;
// 设备ID
private
String
deviceSn
;
// 设备S//
private
Integer
deviceState
;
// 设备当前状态
private
String
deviceType
;
// 设备类型
private
String
parentSn
;
// 父设备S//
private
String
timeZone
;
// 设备时区
private
Long
updateTime
;
// 设备更新时间
private
String
plantId
;
// 设备所属电站ID
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/dto/SofarWarm.java
0 → 100644
View file @
918c9cbd
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
dto
;
import
lombok.Data
;
/**
* @description:
* @author: tw
* @createDate: 2024/4/11
*/
@Data
public
class
SofarWarm
{
private
Long
deviceId
;
//254292152459468801,
private
String
deviceSn
;
//SF4ES010M1R047,
private
String
deviceType
;
//INVERTER,
private
String
addr
;
//2701_yz_97,
private
Long
alertTime
;
//1663046926,
private
String
code
;
//2701_yz_97,
private
String
level
;
//0,
private
Long
ruleId
;
//289113052832604160,
private
String
showName
;
//002电网欠压,
private
int
influence
;
//1
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/SofarDataAcquisitionService.java
View file @
918c9cbd
...
...
@@ -19,15 +19,15 @@ public interface SofarDataAcquisitionService {
/**
* @descrption 采集器列表数据入库
*/
void
collectorList
(
SofarStationList
jsonObject
);
void
collectorList
();
/**
* @descrption 采集器详情数据入库
*/
void
collectorDetail
();
void
collectorDetail
(
List
<
SofarInverter
>
sofarInverter
,
JpStation
jpStation
);
/**
* @descrption 逆变器列表数据入库
*/
void
inverterList
(
SofarInverter
sofarInverter
,
JpStation
jpStation
,
Map
<
String
,
String
>
maps
);
void
inverterList
(
List
<
SofarInverter
>
sofarInverter
,
JpStation
jpStation
,
Map
<
String
,
String
>
maps
);
/**
* @descrption 逆变器详情数据入库
*/
...
...
@@ -35,5 +35,5 @@ public interface SofarDataAcquisitionService {
/**
* @descrption 采集器告警列表数据入库
*/
void
inverAlramInfo
();
void
inverAlramInfo
(
JpStation
jpStation
);
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/SunlightService.java
View file @
918c9cbd
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.SofarStationList
;
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
;
...
...
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SofarDataAcquisitionServiceImpl.java
View file @
918c9cbd
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
face
.
service
.
impl
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.yeejoin.amos.api.householdapi.Utils.SofarRequestUtil
;
import
com.yeejoin.amos.api.householdapi.Utils.SunlightUtil
;
import
com.yeejoin.amos.api.householdapi.constant.GoLangConstant
;
import
com.yeejoin.amos.api.householdapi.constant.KSolarConstant
;
import
com.yeejoin.amos.api.householdapi.constant.SoFarConstant
;
import
com.yeejoin.amos.api.householdapi.face.dto.Device
;
import
com.yeejoin.amos.api.householdapi.face.dto.SofarInverterDto
;
import
com.yeejoin.amos.api.householdapi.face.dto.Sofarhistorical
;
import
com.yeejoin.amos.api.householdapi.face.dto.SunlightDto
;
import
com.yeejoin.amos.api.householdapi.face.dto.*
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpCollector
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverter
;
import
com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpInverterElectricity
;
...
...
@@ -29,11 +29,13 @@ 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.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
;
...
...
@@ -344,17 +346,12 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
hygfjpDayPowerMapper
.
insert
(
hygfjpDayPower
);
}
HYGFJPStationPowerHistory
hygfjpStationPowerHistory
=
new
HYGFJPStationPowerHistory
();
hygfjpStationPowerHistory
.
setCreatedTime
(
System
.
currentTimeMillis
());
hygfjpStationPowerHistory
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
hygfjpStationPowerHistory
.
setPower
(
jpStation
.
getRealTimePower
());
hygfjpStationPowerHistory
.
setThirdCode
(
jpStation
.
getThirdCode
());
hygfjpStationPowerHistory
.
setTime
(
System
.
currentTimeMillis
());
//新加
hygfjpStationPowerHistory
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
hygfjpStationPowerHistory
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
...
...
@@ -384,25 +381,23 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
// tdJpStation.setCreatedTime(System.currentTimeMillis());
// tdJpStationMapper.insert(tdJpStation);
// }
Map
<
String
,
Object
>
requestInfo3
=
new
HashMap
<>();
requestInfo3
.
put
(
"stationId"
,
sunlightDto
.
getId
());
requestInfo3
.
put
(
"deviceType"
,
"COLLECTOR"
);
String
param3
=
JSON
.
toJSONString
(
requestInfo3
);
List
<
SofarInverter
>
jsonObject3
=
requestUtil
.
getResPonse
(
SoFarConstant
.
nbqlist
,
SoFarConstant
.
requestPost
,
param3
,
SoFarConstant
.
deviceListItems
,
SofarInverter
.
class
);
//逆变器信信息
this
.
inverterList
(
jsonObject2
.
get
(
0
),
jpStation
,
maps
);
this
.
inverterList
(
jsonObject2
,
jpStation
,
maps
);
this
.
collectorDetail
(
jsonObject3
,
jpStation
);
this
.
inverAlramInfo
(
jpStation
);
}
}
//电站报表
//户用场站日发电量
Date
today1
=
new
Date
();
...
...
@@ -515,121 +510,78 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
}
@Override
public
void
collectorList
(
SofarStationList
jsonObject
)
{
//获取所电站下采集器
Map
<
String
,
Object
>
requestInfo2
=
new
HashMap
<>();
requestInfo2
.
put
(
"stationId"
,
jsonObject
.
getId
());
requestInfo2
.
put
(
"deviceType"
,
"COLLECTOR"
);
String
param2
=
JSON
.
toJSONString
(
requestInfo2
);
List
<
SofarInverter
>
jsonObject2
=
requestUtil
.
getResPonse
(
SoFarConstant
.
nbqlist
,
SoFarConstant
.
requestPost
,
param2
,
SoFarConstant
.
deviceListItems
,
SofarInverter
.
class
);
if
(
jsonObject2
!=
null
&&
jsonObject2
.
size
()>
0
)
{
//获取采集器实时数据
Map
<
String
,
Object
>
requestInfo1
=
new
HashMap
<>();
requestInfo1
.
put
(
"deviceSn"
,
jsonObject2
.
get
(
0
).
getDeviceSn
());
String
param1
=
JSON
.
toJSONString
(
requestInfo1
);
List
<
SofarInverterDto
>
jsonObject1
=
requestUtil
.
getResPonse
(
SoFarConstant
.
currentData
,
SoFarConstant
.
requestPost
,
param1
,
SoFarConstant
.
dataList
,
SofarInverterDto
.
class
);
public
void
collectorList
()
{
}
@Override
public
void
collectorDetail
(
List
<
SofarInverter
>
devices
,
JpStation
jpStation
)
{
new
Thread
(
new
Runnable
(){
@Override
public
void
run
(){
try
{
// for (KsolarStationCollectList ksolarStationCollectList : result) {
//
//
// JpCollector jpCollector = jpCollectorMapper.selectOne(new QueryWrapper<JpCollector>().
// eq("third_station_id", ksolarStationCollectList.getThirdStationId()).
// eq("sn_code", ksolarStationCollectList.getCollectId().trim()).
// eq("third_code", PVProducerInfoEnum.KSOLAR.getCode()));
// if (ObjectUtils.isEmpty(jpCollector)) {
// jpCollector = new JpCollector();
// }
//// //出场日期
//// jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
//// //生产日期
//// jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
//// //数据上传间隔
//// jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
//// //本次上电时间
//// jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
//// //累计工作时间
//// jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//
// // sn编码
// jpCollector.setSnCode(ksolarStationCollectList.getCollectId().trim());
// // 更新时间
// jpCollector.setUpdateTime(new Date());
// // 第三方电站id
// jpCollector.setThirdStationId(ksolarStationCollectList.getThirdStationId());
// // 第三方厂商标识
// jpCollector.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// //第三方厂商标识
// jpCollector.setState(KSolarConstant.collectStaus.get(ksolarStationCollectList.getStatus()));
// jpCollector.setStationName(ksolarStationCollectList.getStationName());
// jpCollector.setAddr(ksolarStationCollectList.getAddress());
// jpCollector.setName(ksolarStationCollectList.getCollectName());
// jpCollector.setVersion(ksolarStationCollectList.getCollectVersion());
// jpCollector.setType(ksolarStationCollectList.getDeviceModel());
// //信号强度
// jpCollector.setSignalStrength(String.valueOf(ksolarStationCollectList.getSignal()));
// jpCollector.setRecDate(new Date());
// if (ObjectUtils.isEmpty(jpCollector.getSequenceNbr())) {
// jpCollectorMapper.insert(jpCollector);
// } else {
// jpCollectorMapper.updateById(jpCollector);
// }
// HYGFJPCollectorHistory hygfjpCollectorHistory = new HYGFJPCollectorHistory();
// hygfjpCollectorHistory.setTime(System.currentTimeMillis());
// hygfjpCollectorHistory.setCreatedTime(System.currentTimeMillis());
// hygfjpCollectorHistory.setSnCode(ksolarStationCollectList.getCollectId().trim());
// hygfjpCollectorHistory.setSignalStrength(ksolarStationCollectList.getSignal());
// hygfjpCollectorHistory.setThirdStationId(ksolarStationCollectList.getThirdStationId());
// hygfjpCollectorHistory.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
// hygfjpCollectorHistoryMapper.insert(hygfjpCollectorHistory);
// }
for
(
SofarInverter
device
:
devices
)
{
JpCollector
jpCollector
=
jpCollectorMapper
.
selectOne
(
new
QueryWrapper
<
JpCollector
>().
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
SH
.
getCode
()).
eq
(
"sn_code"
,
device
.
getDeviceSn
()));
if
(
ObjectUtils
.
isEmpty
(
jpCollector
))
{
jpCollector
=
new
JpCollector
();
}
//sn编码
jpCollector
.
setSnCode
(
device
.
getDeviceSn
());
jpCollector
.
setAddr
(
jpStation
.
getAddress
());
jpCollector
.
setName
(
device
.
getDeviceSn
());
//类型
jpCollector
.
setType
(
"通信模块"
);
//更新时间
jpCollector
.
setUpdateTime
(
new
Date
());
//出场日期
// jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
// //生产日期
// jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
// //数据上传间隔
// jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
// //本次上电时间
// jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
// //累计工作时间
// jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//第三方电站id
jpCollector
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
//第三方厂商标识
jpCollector
.
setThirdCode
(
PVProducerInfoEnum
.
SH
.
getCode
());
@Override
public
void
collectorDetail
()
{
if
(
device
.
getConnectStatus
()!=
null
)
{
jpCollector
.
setState
(
SoFarConstant
.
stationStaus
.
get
(
device
.
getConnectStatus
()+
""
));
//电站状态
}
jpCollector
.
setStationName
(
jpStation
.
getName
());
// jpCollector.setVersion(imasterCollectorList.getSoftwareVersion());
jpCollector
.
setRecDate
(
new
Date
());
if
(
ObjectUtils
.
isEmpty
(
jpCollector
.
getSequenceNbr
()))
{
jpCollectorMapper
.
insert
(
jpCollector
);
}
else
{
jpCollectorMapper
.
updateById
(
jpCollector
);
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}).
start
();
}
@Override
public
void
inverterList
(
SofarInverter
device
,
JpStation
jpStation
,
Map
<
String
,
String
>
maps
)
{
// @Async
public
void
inverterList
(
List
<
SofarInverter
>
devices
,
JpStation
jpStation
,
Map
<
String
,
String
>
maps
)
{
//存储逆变器
new
Thread
(
new
Runnable
(){
@Override
public
void
run
(){
try
{
for
(
SofarInverter
device
:
devices
)
{
if
(
device
!=
null
){
//获取逆变器信息存库
JpInverter
jpInverter
=
jpInverterMapper
.
selectOne
(
new
QueryWrapper
<
JpInverter
>().
...
...
@@ -644,7 +596,10 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpInverter
.
setBrand
(
null
);
jpInverter
.
setSnCode
(
device
.
getDeviceSn
());
jpInverter
.
setId
(
device
.
getDeviceId
().
toString
());
jpInverter
.
setState
(
jpStation
.
getState
());
if
(
device
.
getConnectStatus
()!=
null
)
{
jpInverter
.
setState
(
SoFarConstant
.
stationStaus
.
get
(
device
.
getConnectStatus
()+
""
));
//电站状态
}
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
...
...
@@ -659,6 +614,24 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
jpInverter
.
setCapacity
(
jpStation
.
getCapacity
());
jpInverter
.
setCurrentPower
(
jpStation
.
getRealTimePower
());
//获取逆变器铜须关系
Map
<
String
,
Object
>
requestInfo3
=
new
HashMap
<>();
requestInfo3
.
put
(
"deviceSn"
,
device
.
getDeviceSn
());
String
param3
=
JSON
.
toJSONString
(
requestInfo3
);
JSONObject
jsonObject3
=
requestUtil
.
getResPonseobj
(
SoFarConstant
.
equipComm
,
SoFarConstant
.
requestPost
,
param3
,
SoFarConstant
.
communication
);
if
(
jsonObject3
!=
null
){
jpInverter
.
setCollectorId
(
jsonObject3
.
get
(
"plantId"
).
toString
());
//采集器sn编码
jpInverter
.
setCollectorSnCode
(
jsonObject3
.
get
(
"parentSn"
).
toString
());
}
// // 国标
// jpInverter.setNationalStandard(inverterDetailDto.getNationalStandards());
// // 满发小时数
...
...
@@ -973,6 +946,7 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
}
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
...
...
@@ -988,7 +962,86 @@ public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionServ
}
@Override
public
void
inverAlramInfo
()
{
public
void
inverAlramInfo
(
JpStation
jpStation
)
{
SimpleDateFormat
shortSdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
date
=
shortSdf
.
format
(
new
Date
());
Map
<
String
,
Object
>
requestInfo
=
new
HashMap
<>();
requestInfo
.
put
(
"page"
,
1
);
requestInfo
.
put
(
"size"
,
99
);
requestInfo
.
put
(
"startTime"
,
date
);
requestInfo
.
put
(
"endTime"
,
date
);
requestInfo
.
put
(
"stationId"
,
jpStation
.
getThirdStationId
());
String
param
=
JSON
.
toJSONString
(
requestInfo
);
List
<
SofarWarm
>
jsonObject2
=
requestUtil
.
getResPonse
(
SoFarConstant
.
alert
,
SoFarConstant
.
requestPost
,
param
,
SoFarConstant
.
stationAlertItems
,
SofarWarm
.
class
);
if
(
jsonObject2
!=
null
&&
jsonObject2
.
size
()>
0
){
System
.
out
.
println
(
"88888888888888888888888"
);
}
for
(
SofarWarm
sofarWarm
:
jsonObject2
)
{
if
(
sofarWarm
.
getDeviceType
().
equals
(
"INVERTER"
)||
sofarWarm
.
getDeviceType
().
equals
(
"COLLECTOR"
)){
HYGFJPInverterWarn
hygfjpInverterWarn
=
new
HYGFJPInverterWarn
();
hygfjpInverterWarn
.
setTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setSnCode
(
sofarWarm
.
getDeviceSn
());
hygfjpInverterWarn
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
hygfjpInverterWarn
.
setLevel
(
SofarRequestUtil
.
alarmLevel
.
get
(
sofarWarm
.
getLevel
().
toString
()));
hygfjpInverterWarn
.
setWarnId
(
sofarWarm
.
getRuleId
().
toString
());
hygfjpInverterWarn
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
hygfjpInverterWarn
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
hygfjpInverterWarn
.
setStationName
(
jpStation
.
getName
());
hygfjpInverterWarn
.
setStationState
(
jpStation
.
getState
());
hygfjpInverterWarn
.
setCreatedTime
(
System
.
currentTimeMillis
());
hygfjpInverterWarn
.
setThirdCode
(
PVProducerInfoEnum
.
SH
.
getCode
());
//告警詳情
Map
<
String
,
Object
>
requestInfo1
=
new
HashMap
<>();
requestInfo1
.
put
(
"alertId"
,
sofarWarm
.
getRuleId
());
requestInfo1
.
put
(
"deviceSn"
,
sofarWarm
.
getDeviceSn
());
String
param1
=
JSON
.
toJSONString
(
requestInfo1
);
JSONObject
jsonObject21
=
requestUtil
.
getResPonseobj
(
SoFarConstant
.
alertDetail
,
SoFarConstant
.
requestPost
,
param1
,
null
);
hygfjpInverterWarn
.
setContent
(
jsonObject21
.
get
(
"reason"
).
toString
());
hygfjpInverterWarn
.
setTreatment
(
jsonObject21
.
get
(
"solution"
).
toString
());
if
(
"1"
.
equals
(
jsonObject21
.
get
(
"alarmState"
).
toString
())){
hygfjpInverterWarn
.
setState
(
"已处理"
);
}
else
{
hygfjpInverterWarn
.
setState
(
"未处理"
);
}
if
(!
ObjectUtils
.
isEmpty
(
jsonObject21
.
get
(
"restoreTime"
)))
{
hygfjpInverterWarn
.
setRecoverTime
(
Long
.
valueOf
(
jsonObject21
.
get
(
"restoreTime"
).
toString
()));
}
if
(!
ObjectUtils
.
isEmpty
(
jsonObject21
.
get
(
"alertTime"
)))
{
hygfjpInverterWarn
.
setStartTime
(
Long
.
valueOf
(
jsonObject21
.
get
(
"alertTime"
).
toString
()));
}
hygfjpInverterWarn
.
setTimeLong
(
null
);
if
((!
ObjectUtils
.
isEmpty
(
jsonObject21
.
get
(
"alertTime"
)))
&&
(!
ObjectUtils
.
isEmpty
(
jsonObject21
.
get
(
"restoreTime"
))))
{
hygfjpInverterWarn
.
setTimeLong
(
this
.
convertDate
(
hygfjpInverterWarn
.
getRecoverTime
())
-
this
.
convertDate
(
hygfjpInverterWarn
.
getStartTime
()));
}
}
}
}
public
Long
convertDate
(
Long
input
){
Long
result
=
0L
;
Date
date
=
DateUtil
.
date
(
input
);
result
=
DateUtil
.
parse
(
DateUtil
.
format
(
date
,
DatePattern
.
NORM_DATETIME_PATTERN
)).
getTime
();
return
result
;
}
}
amos-boot-data/amos-boot-data-housepvapi/src/main/java/com/yeejoin/amos/api/householdapi/face/service/impl/SunlightServiceImpl.java
View file @
918c9cbd
...
...
@@ -8,11 +8,13 @@ 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.ImasterConstant
;
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.JpCollector
;
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
;
...
...
@@ -221,6 +223,21 @@ public class SunlightServiceImpl implements SunlightService {
}
//获取电站下通讯模块
Map
<
String
,
Object
>
bodyparamjp11
=
new
HashMap
<>();
List
<
String
>
lif11
=
new
ArrayList
<>();
lif11
.
add
(
"22"
);
bodyparamjp11
.
put
(
"ps_id"
,
sunlightDto
.
getPs_id
().
toString
());
bodyparamjp11
.
put
(
"size"
,
3000
);
bodyparamjp11
.
put
(
"curPage"
,
1
);
bodyparamjp11
.
put
(
"device_type_list"
,
lif11
);
JSONObject
jsonObject1data11
=
SunlightUtil
.
getdata
(
SunlightUtil
.
getDeviceList
,
bodyparamjp11
);
List
<
Device
>
listdtx
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject1data11
.
get
(
"pageList"
)),
Device
.
class
);
//获取电站下逆变器
Map
<
String
,
Object
>
bodyparamjp
=
new
HashMap
<>();
List
<
String
>
lif
=
new
ArrayList
<>();
...
...
@@ -237,6 +254,13 @@ public class SunlightServiceImpl implements SunlightService {
//获取电站,月发电量
if
(
listd
!=
null
&&
listd
.
size
()>
0
){
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
...
...
@@ -377,7 +401,8 @@ public class SunlightServiceImpl implements SunlightService {
this
.
setJpInverte
(
listd
.
get
(
0
),
jpStation
);
this
.
setJpInverte
(
listd
,
jpStation
,
listdtx
);
this
.
collectorDetail
(
listd
,
jpStation
);
}
...
...
@@ -493,14 +518,14 @@ public class SunlightServiceImpl implements SunlightService {
//逆变器数据入库,逆变器参数入库
public
void
setJpInverte
(
Device
device
,
JpStation
jpStation
){
public
void
setJpInverte
(
List
<
Device
>
devices
,
JpStation
jpStation
,
List
<
Device
>
devicestx
){
new
Thread
(
new
Runnable
(){
@Override
public
void
run
(){
try
{
if
(
device
!=
null
){
for
(
Device
device
:
devices
)
{
if
(
device
!=
null
)
{
//获取逆变器信息存库
JpInverter
jpInverter
=
jpInverterMapper
.
selectOne
(
new
QueryWrapper
<
JpInverter
>().
eq
(
"third_station_id"
,
device
.
getPs_id
().
toString
()).
...
...
@@ -514,7 +539,13 @@ public class SunlightServiceImpl implements SunlightService {
jpInverter
.
setBrand
(
device
.
getFactory_name
());
jpInverter
.
setSnCode
(
device
.
getDevice_sn
());
jpInverter
.
setId
(
device
.
getUuid
().
toString
());
jpInverter
.
setState
(
jpStation
.
getState
());
if
(
device
.
getGetPs_fault_status
()>
2
)
{
jpInverter
.
setState
(
SunlightUtil
.
zt
.
get
(
device
.
getDev_status
()+
""
));
}
else
{
jpInverter
.
setState
(
"报警"
);
//电站状态
}
jpInverter
.
setUpdateTime
(
new
Date
());
jpInverter
.
setDayPowerGeneration
(
jpStation
.
getDayGenerate
());
jpInverter
.
setMonthPowerGeneration
(
jpStation
.
getMonthGenerate
());
...
...
@@ -529,29 +560,34 @@ public class SunlightServiceImpl implements SunlightService {
jpInverter
.
setCapacity
(
jpStation
.
getCapacity
());
jpInverter
.
setCurrentPower
(
jpStation
.
getRealTimePower
());
if
(
devicestx
!=
null
){
for
(
Device
devicestx1
:
devicestx
)
{
if
(
devicestx1
.
getDevice_code
().
equals
(
device
.
getCommunication_dev_sn
())){
//采集器id
jpInverter
.
setCollectorId
(
devicestx1
.
getUuid
().
toString
());
//采集器sn编码
jpInverter
.
setCollectorSnCode
(
device
.
getCommunication_dev_sn
());
break
;
}
}
}
// // 国标
// 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
()))
{
if
(
StringUtils
.
isNotEmpty
(
jpInverter
.
getSnCode
()))
{
jpInverterMapper
.
insert
(
jpInverter
);
}
}
//逆变器指标信息
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
List
<
String
>
li
=
new
ArrayList
<>();
Map
<
String
,
Object
>
bodyparamnb
=
new
HashMap
<>();
List
<
String
>
li
=
new
ArrayList
<>();
li
.
add
(
device
.
getPs_key
());
bodyparamnb
.
put
(
"ps_key_list"
,
li
);
...
...
@@ -561,11 +597,11 @@ public class SunlightServiceImpl implements SunlightService {
);
List
<
Map
>
js
=
JSONArray
.
parseArray
(
JSON
.
toJSONString
(
jsonObject1nb
.
get
(
"device_point_list"
)),
Map
.
class
);
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
<>();
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 相电压
...
...
@@ -582,7 +618,7 @@ public class SunlightServiceImpl implements SunlightService {
for
(
int
i
=
0
;
i
<
liname
.
size
();
i
++)
{
JpInverterElectricity
jpInverterElectricity
=
jpInverterElectricityMapper
.
selectOne
(
new
QueryWrapper
<
JpInverterElectricity
>().
eq
(
"sn_code"
,
jpInverter
.
getSnCode
()).
eq
(
"sn_code"
,
jpInverter
.
getSnCode
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"name"
,
liname
.
get
(
i
))
);
...
...
@@ -594,74 +630,74 @@ public class SunlightServiceImpl implements SunlightService {
jpInverterElectricity
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
jpInverterElectricity
.
setThirdStationId
(
jpInverter
.
getThirdStationId
());
if
(
i
>
2
)
{
if
(
i
>
2
)
{
jpInverterElectricity
.
setType
(
"直流"
);
}
else
{
}
else
{
jpInverterElectricity
.
setType
(
"交流"
);
}
jpInverterElectricity
.
setName
(
liname
.
get
(
i
));
String
voltage
=
null
;
String
current
=
null
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
;
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
.
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
);
...
...
@@ -678,23 +714,23 @@ public class SunlightServiceImpl implements SunlightService {
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
.
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
.
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
.
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
.
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
);
...
...
@@ -713,16 +749,16 @@ public class SunlightServiceImpl implements SunlightService {
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
())
(
jpInverter
.
getDayPowerGeneration
()
==
null
||
jpInverter
.
getCapacity
()
==
null
)
?
null
:
(
jpInverter
.
getCapacity
()
<=
0.0
?
null
:
jpInverter
.
getDayPowerGeneration
()
/
jpInverter
.
getCapacity
())
);
//电站区域经销商,
JpStation
jpStation
=
jpStationMapper
.
selectOne
(
new
QueryWrapper
<
JpStation
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"third_station_id"
,
String
.
valueOf
(
jpInverter
.
getThirdStationId
())));
if
(
jpStation
!=
null
)
{
if
(
jpStation
!=
null
)
{
tdHYGFInverterDayGenerate
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
tdHYGFInverterDayGenerate
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
tdHYGFInverterDayGenerate
.
setStationName
(
jpStation
.
getName
());
...
...
@@ -748,12 +784,12 @@ public class SunlightServiceImpl implements SunlightService {
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
())
(
jpInverter
.
getDayPowerGeneration
()
==
null
||
jpInverter
.
getCapacity
()
==
null
)
?
null
:
(
jpInverter
.
getCapacity
()
<=
0.0
?
null
:
jpInverter
.
getDayPowerGeneration
()
/
jpInverter
.
getCapacity
())
);
//新加
if
(
jpStation
!=
null
)
{
if
(
jpStation
!=
null
)
{
tdHYGFInverterMonthGenerate
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
tdHYGFInverterMonthGenerate
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
tdHYGFInverterMonthGenerate
.
setStationName
(
jpStation
.
getName
());
...
...
@@ -784,11 +820,11 @@ public class SunlightServiceImpl implements SunlightService {
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
())
(
jpInverter
.
getMonthPowerGeneration
()
==
null
||
jpInverter
.
getCapacity
()
==
null
)
?
null
:
(
jpInverter
.
getCapacity
()
<=
0.0
?
null
:
jpInverter
.
getMonthPowerGeneration
()
/
jpInverter
.
getCapacity
())
);
//新加
if
(
jpStation
!=
null
)
{
if
(
jpStation
!=
null
)
{
tdHYGFInverterYearGenerate
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
tdHYGFInverterYearGenerate
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
tdHYGFInverterYearGenerate
.
setStationName
(
jpStation
.
getName
());
...
...
@@ -818,12 +854,12 @@ public class SunlightServiceImpl implements SunlightService {
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
())
(
jpInverter
.
getYearPowerGeneration
()
==
null
||
jpInverter
.
getCapacity
()
==
null
)
?
null
:
(
jpInverter
.
getCapacity
()
<=
0.0
?
null
:
jpInverter
.
getYearPowerGeneration
()
/
jpInverter
.
getCapacity
())
);
//新加
if
(
jpStation
!=
null
)
{
if
(
jpStation
!=
null
)
{
tdHYGFInverterTotalGenerate
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
tdHYGFInverterTotalGenerate
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
tdHYGFInverterTotalGenerate
.
setStationName
(
jpStation
.
getName
());
...
...
@@ -831,7 +867,6 @@ public class SunlightServiceImpl implements SunlightService {
}
if
(
ObjectUtils
.
isEmpty
(
tdHYGFInverterTotalGenerate
.
getCreatedTime
()))
{
tdHYGFInverterTotalGenerate
.
setCreatedTime
(
System
.
currentTimeMillis
());
tdHYGFInverterTotalGenerateMapper
.
insert
(
tdHYGFInverterTotalGenerate
);
...
...
@@ -840,15 +875,66 @@ public class SunlightServiceImpl implements SunlightService {
}
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}).
start
();
}
@Async
public
void
collectorDetail
(
List
<
Device
>
devices
,
JpStation
jpStation
){
for
(
Device
device
:
devices
)
{
JpCollector
jpCollector
=
jpCollectorMapper
.
selectOne
(
new
QueryWrapper
<
JpCollector
>().
eq
(
"third_station_id"
,
jpStation
.
getThirdStationId
()).
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"sn_code"
,
device
.
getDevice_sn
()));
if
(
ObjectUtils
.
isEmpty
(
jpCollector
))
{
jpCollector
=
new
JpCollector
();
}
//sn编码
jpCollector
.
setSnCode
(
device
.
getDevice_sn
());
jpCollector
.
setAddr
(
jpStation
.
getAddress
());
jpCollector
.
setName
(
device
.
getDevice_name
());
//类型
jpCollector
.
setType
(
"通信模块"
);
//更新时间
jpCollector
.
setUpdateTime
(
new
Date
());
//出场日期
// jpCollector.setDischargeDate(new Date(collectorDetailDto.getFactoryTime()));
// //生产日期
// jpCollector.setProductDate(new Date(collectorDetailDto.getFactoryTime()));
// //数据上传间隔
// jpCollector.setDataPeriod(collectorDetailDto.getDataUploadCycle());
// //本次上电时间
// jpCollector.setThisWorkTime(new DateTime(collectorDetailDto.getCurrentWorkingTime()));
// //累计工作时间
// jpCollector.setTotalWorkTime(new DateTime(collectorDetailDto.getTotalWorkingTime()));
//第三方电站id
jpCollector
.
setThirdStationId
(
jpStation
.
getThirdStationId
());
//第三方厂商标识
jpCollector
.
setThirdCode
(
PVProducerInfoEnum
.
YG
.
getCode
());
if
(
device
.
getGetPs_fault_status
()>
2
)
{
jpCollector
.
setState
(
SunlightUtil
.
zt
.
get
(
device
.
getDev_status
()+
""
));
}
else
{
jpCollector
.
setState
(
"报警"
);
//电站状态
}
jpCollector
.
setStationName
(
jpStation
.
getName
());
// jpCollector.setVersion(imasterCollectorList.getSoftwareVersion());
jpCollector
.
setRecDate
(
new
Date
());
if
(
ObjectUtils
.
isEmpty
(
jpCollector
.
getSequenceNbr
()))
{
jpCollectorMapper
.
insert
(
jpCollector
);
}
else
{
jpCollectorMapper
.
updateById
(
jpCollector
);
}
}
}
...
...
@@ -874,22 +960,18 @@ public class SunlightServiceImpl implements SunlightService {
.
notIn
(
"`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
()))
{
...
...
@@ -910,21 +992,16 @@ public class SunlightServiceImpl implements SunlightService {
hygfjpInverterWarn
.
setRecoverTime
(
null
);
hygfjpInverterWarn
.
setTimeLong
(
null
);
hygfjpInverterWarn
.
setWarnId
(
sunlightWarm
.
getFault_code
());
//电站区域经销商,
JpStation
jpStation
=
jpStationMapper
.
selectOne
(
new
QueryWrapper
<
JpStation
>().
eq
(
"third_code"
,
PVProducerInfoEnum
.
YG
.
getCode
()).
eq
(
"third_station_id"
,
sunlightWarm
.
getPs_id
().
toString
()));
if
(
jpStation
!=
null
){
hygfjpInverterWarn
.
setAmosCompanyCode
(
jpStation
.
getAmosCompanyCode
());
hygfjpInverterWarn
.
setRegionalCompaniesCode
(
jpStation
.
getRegionalCompaniesCode
());
hygfjpInverterWarn
.
setStationName
(
jpStation
.
getName
());
hygfjpInverterWarn
.
setStationState
(
jpStation
.
getState
());
}
try
{
TimeUnit
.
MINUTES
.
sleep
(
1
);
hygfjpInverterWarn
.
setCreatedTime
(
System
.
currentTimeMillis
());
...
...
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