Commit 724c3ae7 authored by caotao's avatar caotao

告警dto及errorCode映射问题处理。

parent 7239cae4
......@@ -176,7 +176,7 @@ public class GoodWeConstant {
public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList";
public static String inverterDetailUrl = "/v1/api/inverterDetail";
public static String alarmListUrl = "/v1/api/alarmList";
public static String alarmListUrl = "/api/OpenApi/GetPowerStationWariningInfoByMultiCondition";
public static String stationDayGenUrl ="/v1/api/stationDayEnergyList";
public static String stationMonthEnergyList ="/v1/api/stationDayEnergyList";
public static String stationYearEnergyList ="/v1/api/stationDayEnergyList";
......
......@@ -52,7 +52,8 @@ public class HouseholdTestController {
@ApiOperation(httpMethod = "POST", value = "固德威示例", notes = "固德威示例")
public void goodweDemo() throws IOException {
// goodWeDataAcquisitionService.stationList();
goodWeDataAcquisitionService.stationDetail();
// goodWeDataAcquisitionService.stationDetail();
goodWeDataAcquisitionService.inverAlramInfo();
}
/**
......
......@@ -7,7 +7,10 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoLangConstant;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.face.dto.AlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWeAlarmDto;
import com.yeejoin.amos.api.householdapi.face.dto.GoodWeStationMonitorDto;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.hygf.JpStation;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.*;
......@@ -261,9 +264,45 @@ public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionSe
String today = DateUtil.today();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 1000);
requestInfo.put("starttime", today + "00:00:00");
requestInfo.put("endtime", today + "23:59:59");
requestInfo.put("starttime", today + " 00:00:00");
requestInfo.put("endtime", today + " 23:59:59");
requestInfo.put("status",2);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeAlarmDto> alarmList = goodWeRequestUtil.getResPonse(GoodWeConstant.alarmListUrl,GoodWeConstant.requestPost,requstParam,GoodWeConstant.resovleRule_data_list,GoodWeAlarmDto.class);
alarmList.forEach(goodWeAlarmDto -> {
if (!ObjectUtils.isEmpty(goodWeAlarmDto.getDevicesn())) {
HYGFJPInverterWarn hygfjpInverterWarn = hygfjpInverterWarnMapper.selectOne(new QueryWrapper<HYGFJPInverterWarn>()
.eq("sn_code", goodWeAlarmDto.getDevicesn())
.eq("start_time", goodWeAlarmDto.getHappentime().getMillis())
.eq("third_station_id", String.valueOf(goodWeAlarmDto.getStationId()))
);
if (ObjectUtils.isEmpty(hygfjpInverterWarn)) {
hygfjpInverterWarn = new HYGFJPInverterWarn();
}
hygfjpInverterWarn.setTime(System.currentTimeMillis());
hygfjpInverterWarn.setSnCode(goodWeAlarmDto.getDevicesn());
hygfjpInverterWarn.setThirdStationId(goodWeAlarmDto.getStationId());
// hygfjpInverterWarn.setLevel(GoLangConstant.alarmLevel.get(alarmDto.getAlarmLevel()));
hygfjpInverterWarn.setContent(goodWeAlarmDto.getWarningname());
hygfjpInverterWarn.setThirdCode(PVProducerInfoEnum.GDW.getCode());
hygfjpInverterWarn.setTreatment(GoodWeConstant.errorCodeMap.get(goodWeAlarmDto.getError_code()).get(2));
hygfjpInverterWarn.setStartTime(goodWeAlarmDto.getHappentime().getMillis());
hygfjpInverterWarn.setRecoverTime(null);
if (!ObjectUtils.isEmpty(goodWeAlarmDto.getRecoverytime())) {
hygfjpInverterWarn.setRecoverTime(goodWeAlarmDto.getRecoverytime().getMillis());
}
hygfjpInverterWarn.setTimeLong(null);
if ((!ObjectUtils.isEmpty(goodWeAlarmDto.getHappentime())) && (!ObjectUtils.isEmpty(goodWeAlarmDto.getRecoverytime()))) {
hygfjpInverterWarn.setTimeLong(goodWeAlarmDto.getRecoverytime().getMillis() - goodWeAlarmDto.getHappentime().getMillis());
}
hygfjpInverterWarn.setState(GoodWeConstant.warningStaus.get(goodWeAlarmDto.getStatus().toString()));
if (org.springframework.util.ObjectUtils.isEmpty(hygfjpInverterWarn.getCreatedTime())) {
hygfjpInverterWarn.setCreatedTime(System.currentTimeMillis());
hygfjpInverterWarnMapper.insert(hygfjpInverterWarn);
} else {
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