Commit ff3dddf2 authored by caotao's avatar caotao

1.户用光伏数据采集逆变器告警增加告警时长处理。

parent 483282d3
......@@ -38,7 +38,6 @@ import java.util.concurrent.TimeUnit;
@Service
public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionService {
//定时任务执行频率 当前为10分钟一次
//锦浪云请求工具封装
......@@ -149,7 +148,7 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
jpStation.setUserName(golangStationDetail.getUsername());
jpStation.setUserPhone(String.valueOf(golangStationDetail.getUsermobile()));
jpStation.setStationContact(String.valueOf(golangStationDetail.getMobile()).toLowerCase().replace("null", ""));
jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule()))?0:Math.toIntExact(golangStationDetail.getModule()));
jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule())) ? 0 : Math.toIntExact(golangStationDetail.getModule()));
//并网类型
jpStation.setState(GoLangConstant.stationStaus.get(String.valueOf(golangStationDetail.getState())));
jpStation.setThirdStationId(String.valueOf(golangStationDetail.getId()));
......@@ -509,7 +508,6 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getAlarmDeviceSn());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationId()));
hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
......@@ -517,7 +515,14 @@ public class GoLangDataAcquisitionServiceImpl implements GoLangDataAcquisitionSe
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.JLY.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getAdvice());
hygfjpInverterWarn.setStartTime(alarmDto.getAlarmBeginTime());
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
hygfjpInverterWarn.setRecoverTime(null);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmEndTime())) {
hygfjpInverterWarn.setRecoverTime(alarmDto.getAlarmEndTime());
}
hygfjpInverterWarn.setTimeLong(null);
if (!ObjectUtils.isEmpty(alarmDto.getAlarmEndTime()) && !ObjectUtils.isEmpty(alarmDto.getAlarmEndTime())) {
hygfjpInverterWarn.setTimeLong(alarmDto.getAlarmEndTime() - alarmDto.getAlarmBeginTime());
}
hygfjpInverterWarn.setState(GoLangConstant.alarmstatus.get(alarmDto.getState()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
......
......@@ -770,7 +770,6 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(alarmDto.getEsnCode());
hygfjpInverterWarn.setThirdStationId(String.valueOf(alarmDto.getStationCode()));
hygfjpInverterWarn.setLevel(ImasterConstant.alarmLevel.get(alarmDto.getLev().toString()));
......@@ -778,6 +777,8 @@ public class ImasterDataServiceImpl implements ImasterDataService {
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.HUAWEI.getCode());
hygfjpInverterWarn.setTreatment(alarmDto.getDevName());
hygfjpInverterWarn.setStartTime(alarmDto.getRaiseTime());
hygfjpInverterWarn.setRecoverTime(null);
hygfjpInverterWarn.setTimeLong(null);
hygfjpInverterWarn.setState(ImasterConstant.alarmstatus.get(alarmDto.getStatus().toString()));
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
......
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 com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -1053,12 +1054,12 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
if (!CollectionUtils.isEmpty(result)) {
for (KsolarAlarmDto ksolarAlarmDto : result) {
if (!ObjectUtils.isEmpty(ksolarAlarmDto.getInverterId())) {
String startTime = ksolarAlarmDto.getSaveTime();
String recoverTime = ksolarAlarmDto.getRemoveTime();
String pattern = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
Date startTimeL = sdf.parse(startTime);
Date recoverTimeL = sdf.parse(recoverTime);
// String startTime = ksolarAlarmDto.getSaveTime();
// String recoverTime = ksolarAlarmDto.getRemoveTime();
// String pattern = "yyyy-MM-dd HH:mm:ss";
// SimpleDateFormat sdf = new SimpleDateFormat(pattern);
// Date startTimeL = sdf.parse(startTime);
// Date recoverTimeL = sdf.parse(recoverTime);
String snCode=null;
......@@ -1072,7 +1073,7 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code",snCode)
.eq("start_time", startTimeL.getTime())
.eq("start_time",DateUtil.parse(ksolarAlarmDto.getSaveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime())
.eq("third_code", PVProducerInfoEnum.KSOLAR.getCode())
.eq("third_station_id", ksolarAlarmDto.getStationId())
);
......@@ -1081,16 +1082,22 @@ public class KsolarDataAcquisitionServiceImpl implements KSolarDataAcquisitionSe
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setTimeLong(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(snCode);
hygfjpInverterWarn.setThirdStationId(ksolarAlarmDto.getStationId());
hygfjpInverterWarn.setLevel(KSolarConstant.alarmLevel.get(ksolarAlarmDto.getLevels()));
hygfjpInverterWarn.setContent(ksolarAlarmDto.getMessage());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.KSOLAR.getCode());
hygfjpInverterWarn.setTreatment(ksolarAlarmDto.getSolution());
hygfjpInverterWarn.setStartTime(startTimeL.getTime());
hygfjpInverterWarn.setRecoverTime(recoverTimeL.getTime());
hygfjpInverterWarn.setStartTime(DateUtil.parse(ksolarAlarmDto.getSaveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime());
hygfjpInverterWarn.setState(KSolarConstant.alarmstatus.get(ksolarAlarmDto.getStatus()));
hygfjpInverterWarn.setTimeLong(null);
hygfjpInverterWarn.setRecoverTime(null);
if(StringUtils.isNotBlank(ksolarAlarmDto.getRemoveTime())){
hygfjpInverterWarn.setRecoverTime(DateUtil.parse(ksolarAlarmDto.getRemoveTime(), DatePattern.NORM_DATETIME_PATTERN).getTime());
}
if(!ObjectUtils.isEmpty(ksolarAlarmDto.getSaveTime())&&!ObjectUtils.isEmpty(ksolarAlarmDto.getRemoveTime())){
hygfjpInverterWarn.setTimeLong(hygfjpInverterWarn.getRecoverTime()-hygfjpInverterWarn.getStartTime());
}
if (ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment