Commit 386d197e authored by wujiang's avatar wujiang

修改告警

parent b05d0084
...@@ -6,6 +6,7 @@ import java.util.Arrays; ...@@ -6,6 +6,7 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -109,7 +110,8 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -109,7 +110,8 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
calendar.add(Calendar.DAY_OF_MONTH, -2); calendar.add(Calendar.DAY_OF_MONTH, -2);
List<AlarmEvent> alarmEventList = this.baseMapper.getEventList(gatewayId, calendar.getTime()); List<AlarmEvent> alarmEventList = this.baseMapper.getEventList(gatewayId, calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar car = Calendar.getInstance();
alarmEventList.forEach(i -> { alarmEventList.forEach(i -> {
if ("true".equals(i.getValue())) { if ("true".equals(i.getValue())) {
i.setValue("合"); i.setValue("合");
...@@ -117,7 +119,10 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -117,7 +119,10 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分"); i.setValue("分");
} }
i.setStationName("升压站"); i.setStationName("升压站");
i.setTime(sdf.format(new Date(i.getCreatedTime()))); long mills = i.getCreatedTime()/1000000;
car.setTimeInMillis(mills);
//System.out.println(sdf.format(car.getTime()));
i.setTime(sdf.format(car.getTime()));
}); });
PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList); PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList);
// 构建平台数据 // 构建平台数据
......
...@@ -5,6 +5,7 @@ import java.util.Arrays; ...@@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -42,7 +43,7 @@ public class EquipAlarmEventServiceImpl ...@@ -42,7 +43,7 @@ public class EquipAlarmEventServiceImpl
equipName = s[0] + "子阵/逆变器" + s[1]; equipName = s[0] + "子阵/逆变器" + s[1];
} else if ("汇流箱".equals(frontModule)) { } else if ("汇流箱".equals(frontModule)) {
String[] s = equipIndex.split("-"); String[] s = equipIndex.split("-");
if ("0".equals(s[2].indexOf(0))) { if (s[2].indexOf("0")==0) {
s[2] = s[2].substring(1); s[2] = s[2].substring(1);
} }
equipName = s[0] + "子阵/逆变器" + s[1] + "/#" + s[2] + "汇流箱"; equipName = s[0] + "子阵/逆变器" + s[1] + "/#" + s[2] + "汇流箱";
...@@ -55,14 +56,20 @@ public class EquipAlarmEventServiceImpl ...@@ -55,14 +56,20 @@ public class EquipAlarmEventServiceImpl
List<EquipAlarmEvent> alarmEventList = this.baseMapper.getEventList(gatewayId, equipName, null, List<EquipAlarmEvent> alarmEventList = this.baseMapper.getEventList(gatewayId, equipName, null,
calendar.getTime()); calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar car = Calendar.getInstance();
alarmEventList.forEach(i -> { alarmEventList.forEach(i -> {
if ("true".equals(i.getValue())) { if ("true".equals(i.getValue())) {
i.setValue("合"); i.setValue("合");
} else if ("false".equals(i.getValue())) { } else if ("false".equals(i.getValue())) {
i.setValue("分"); i.setValue("分");
} }
i.setTime(sdf.format(new Date(i.getCreatedTime()))); long mills = i.getCreatedTime()/1000000;
car.setTimeInMillis(mills);
//System.out.println(sdf.format(car.getTime()));
i.setTime(sdf.format(car.getTime()));
//car.add(Calendar.HOUR, 12);
//System.out.println(sdf.format(car.getTime()));
}); });
PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList); PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList);
......
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