|
@@ -70,6 +70,7 @@ public class ReceiveDataService {
|
|
|
@Value("${receive.path}")
|
|
|
private String path;
|
|
|
|
|
|
+ private String Active = "activePower";
|
|
|
public void receive() {
|
|
|
List<ElectricField> electricFieldList = electricFieldService.getAll();
|
|
|
//每个场站请求一次
|
|
@@ -141,8 +142,6 @@ public class ReceiveDataService {
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
if (jsonRows.size()>0){
|
|
|
values = jsonRows.getJSONObject(0);
|
|
|
- //设备id
|
|
|
- //String deviceId = jsonObj.getString("deviceId");
|
|
|
//时间戳
|
|
|
String time = values.getString("timestamp");
|
|
|
//所有数据
|
|
@@ -163,29 +162,34 @@ public class ReceiveDataService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- switch (map.get("status")) {
|
|
|
+ String STATUS = "status";
|
|
|
+ switch (map.get(STATUS)) {
|
|
|
case "1.00":
|
|
|
case "true":
|
|
|
//运行
|
|
|
- map.put("status", "1");
|
|
|
+ map.put(STATUS, "1");
|
|
|
break;
|
|
|
case "2.00":
|
|
|
//待机
|
|
|
- map.put("status", "2");
|
|
|
+ map.put(STATUS, "2");
|
|
|
break;
|
|
|
case "3.00":
|
|
|
//停用
|
|
|
- map.put("status", "3");
|
|
|
+ map.put(STATUS, "3");
|
|
|
break;
|
|
|
case "4.00":
|
|
|
case "false":
|
|
|
//故障
|
|
|
- map.put("status", "4");
|
|
|
+ map.put(STATUS, "4");
|
|
|
break;
|
|
|
case "-99":
|
|
|
- map.put("status", "5");
|
|
|
+ map.put(STATUS, "5");
|
|
|
+ break;
|
|
|
+ default:
|
|
|
break;
|
|
|
}
|
|
|
+
|
|
|
+ String ap = map.get(Active);
|
|
|
switch(equipmentType.getCode()){
|
|
|
case 1:
|
|
|
//气象站
|
|
@@ -196,9 +200,9 @@ public class ReceiveDataService {
|
|
|
break;
|
|
|
case 2:
|
|
|
//逆变器
|
|
|
- if (map.get("activePower") != null && map.get("electricalCurrent") != null) {
|
|
|
+ if (ap != null && map.get("electricalCurrent") != null) {
|
|
|
//有功
|
|
|
- BigDecimal activePower = new BigDecimal(map.get("activePower"));
|
|
|
+ BigDecimal activePower = new BigDecimal(ap);
|
|
|
//电流
|
|
|
BigDecimal electricalCurrent = new BigDecimal(map.get("electricalCurrent"));
|
|
|
//有功/电流=电压
|
|
@@ -222,6 +226,8 @@ public class ReceiveDataService {
|
|
|
windTowerStatusDataRepository.save(windTowerStatusData);
|
|
|
log.info("cft-" + electricField.getStationCode() + "-" + equipmentId+"已存入");
|
|
|
break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
}else {
|
|
|
log.info(electricField.getStationCode()+ "-" +equipmentType.getMessage() + "-" + equipmentId+"无数据,不进行任何操作");
|
|
@@ -263,16 +269,18 @@ public class ReceiveDataService {
|
|
|
List<InverterInfo> inverterInfoList = inverterInfoService.getByStationCode(electricField.getStationCode());
|
|
|
for (InverterInfo inverterInfo : inverterInfoList) {
|
|
|
Map<String, String> getMap = redisUtils.hgetall("nbq-" + electricField.getStationCode() + "-" + inverterInfo.getId());
|
|
|
- if (getMap.get("activePower") != null) {
|
|
|
- pssd = pssd.add(new BigDecimal(getMap.get("activePower")));
|
|
|
+ String activePower = getMap.get(Active);
|
|
|
+ if (activePower != null) {
|
|
|
+ pssd = pssd.add(new BigDecimal(activePower));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
List<WindTurbineInfo> windTurbineInfoList = windTurbineInfoService.getByStationCode(electricField.getStationCode());
|
|
|
for (WindTurbineInfo windTurbineInfo : windTurbineInfoList) {
|
|
|
Map<String, String> getMap = redisUtils.hgetall("fj-" + electricField.getStationCode() + "-" + windTurbineInfo.getId());
|
|
|
- if (getMap.get("activePower") != null) {
|
|
|
- pssd = pssd.add(new BigDecimal(getMap.get("activePower")));
|
|
|
+ String activePower = getMap.get(Active);
|
|
|
+ if (activePower != null) {
|
|
|
+ pssd = pssd.add(new BigDecimal(activePower));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -290,5 +298,4 @@ public class ReceiveDataService {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|