|
@@ -131,18 +131,20 @@ public class AlarmHistoryService {
|
|
|
|
|
|
if(null !=tag.getTs())
|
|
|
{
|
|
|
- alarm.setTs(tag.getTs().getTime());
|
|
|
- if(StringUtils.notEmp(tag.getVal()))
|
|
|
- {
|
|
|
- alarm.setVal(tag.getVal().doubleValue());
|
|
|
- }
|
|
|
-
|
|
|
+// alarm.setTs(tag.getTs().getTime());
|
|
|
+// if(StringUtils.notEmp(tag.getVal()))
|
|
|
+// {
|
|
|
+// alarm.setVal(tag.getVal().doubleValue());
|
|
|
+// }
|
|
|
+//
|
|
|
alarm.setEndts(null!=tag.getEndts()?tag.getEndts().getTime():null);
|
|
|
alarm.setTimeLong(null!=tag.getTimelong()?tag.getTimelong():null);
|
|
|
+// alarm.setConfirmed(true);
|
|
|
+// savels.add(alarm);
|
|
|
+ }
|
|
|
+ alarm.setVal(1.0);
|
|
|
alarm.setConfirmed(true);
|
|
|
savels.add(alarm);
|
|
|
- }
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -154,50 +156,57 @@ public class AlarmHistoryService {
|
|
|
List<ProEconAlarmInfo> valuels = new ArrayList<>();
|
|
|
for (AlarmTag alarm : savels) {
|
|
|
AlarmVo vo =null;
|
|
|
- if (CacheContext.alarmWtMap.containsKey(alarm.getId())) {
|
|
|
- vo = CacheContext.alarmWtMap.get(alarm.getId());
|
|
|
- }else if (CacheContext.alarmInMap.containsKey(alarm.getId())) {
|
|
|
- vo = CacheContext.alarmInMap.get(alarm.getId());
|
|
|
- }else if (CacheContext.alarmBtMap.containsKey(alarm.getId())) {
|
|
|
- vo = CacheContext.alarmBtMap.get(alarm.getId());
|
|
|
- }else if (CacheContext.alarmCtMap.containsKey(alarm.getId())) {
|
|
|
- vo = CacheContext.alarmCtMap.get(alarm.getId());
|
|
|
+ if (CacheContext.alarmWtMap.containsKey(alarm.getId().toUpperCase())) {
|
|
|
+ vo = CacheContext.alarmWtMap.get(alarm.getId().toUpperCase());
|
|
|
+ }else if (CacheContext.alarmInMap.containsKey(alarm.getId().toUpperCase())) {
|
|
|
+ vo = CacheContext.alarmInMap.get(alarm.getId().toUpperCase());
|
|
|
+ }else if (CacheContext.alarmBtMap.containsKey(alarm.getId().toUpperCase())) {
|
|
|
+ vo = CacheContext.alarmBtMap.get(alarm.getId().toUpperCase());
|
|
|
+ }else if (CacheContext.alarmCtMap.containsKey(alarm.getId().toUpperCase())) {
|
|
|
+ vo = CacheContext.alarmCtMap.get(alarm.getId().toUpperCase());
|
|
|
}
|
|
|
|
|
|
- ProEconAlarmInfo po = new ProEconAlarmInfo();
|
|
|
- po.setTbname(vo.getTbName());
|
|
|
- po.setLastUpdateTime(new Date());
|
|
|
- po.setTagId(vo.getTagid());
|
|
|
- po.setTriggerType(vo.getTriggertype());
|
|
|
- po.setAlarmId(vo.getAlarmId());
|
|
|
- po.setDeviceId(vo.getDeviceId());
|
|
|
- po.setSubcomponents(vo.getSuffix());
|
|
|
- po.setRank(vo.getRank());
|
|
|
- po.setConfirmed(alarm.getConfirmed());
|
|
|
- po.setUniformCode(vo.getUniformcode());
|
|
|
- po.setAlarmType(vo.getAlarmType());
|
|
|
- po.setDeviceType(vo.getDeviceType());
|
|
|
- po.setComponents(vo.getComponents());
|
|
|
- po.setSubcomponents(vo.getSubcomponents());
|
|
|
- po.setDescription(vo.getDescription());
|
|
|
- po.setModelId(vo.getModelId());
|
|
|
- po.setResetTable(vo.getResettable());
|
|
|
- po.setEnable(vo.getEnabled());
|
|
|
- po.setCharacteristic(vo.getCharacteristic());
|
|
|
- po.setStationId(vo.getStationid());
|
|
|
- po.setProjectId(vo.getProjectid());
|
|
|
- po.setLineId(vo.getLineid());
|
|
|
- po.setStationName(vo.getStationname());
|
|
|
- po.setProjectiName(vo.getProjectname());
|
|
|
- po.setLineidName(vo.getLinename());
|
|
|
- po.setDeviceName(vo.getDevicename());
|
|
|
- po.setOval(alarm.getOval().intValue());
|
|
|
- po.setCloseTime(null!=alarm.getEndts()?new Date(alarm.getEndts()):null);
|
|
|
- po.setIsOpen(0);
|
|
|
- po.setVal(alarm.getVal().intValue());
|
|
|
-
|
|
|
-
|
|
|
- tempmap.put(po.getTbname(),po);
|
|
|
+ if(StringUtils.notEmp(vo) && StringUtils.notEmp(vo.getTbName()))
|
|
|
+ {
|
|
|
+ ProEconAlarmInfo po = new ProEconAlarmInfo();
|
|
|
+
|
|
|
+
|
|
|
+ po.setTbname(vo.getTbName());
|
|
|
+ po.setLastUpdateTime(new Date());
|
|
|
+ po.setTagId(vo.getTagid());
|
|
|
+ po.setTriggerType(vo.getTriggertype());
|
|
|
+ po.setAlarmId(vo.getAlarmId());
|
|
|
+ po.setDeviceId(vo.getDeviceId());
|
|
|
+ po.setSubcomponents(vo.getSuffix());
|
|
|
+ po.setRank(vo.getRank());
|
|
|
+ po.setConfirmed(alarm.getConfirmed());
|
|
|
+ po.setUniformCode(vo.getUniformcode());
|
|
|
+ po.setAlarmType(vo.getAlarmType());
|
|
|
+ po.setDeviceType(vo.getDeviceType());
|
|
|
+ po.setComponents(vo.getComponents());
|
|
|
+ po.setSubcomponents(vo.getSubcomponents());
|
|
|
+ po.setDescription(vo.getDescription());
|
|
|
+ po.setModelId(vo.getModelId());
|
|
|
+ po.setResetTable(vo.getResettable());
|
|
|
+ po.setEnable(vo.getEnabled());
|
|
|
+ po.setCharacteristic(vo.getCharacteristic());
|
|
|
+ po.setStationId(vo.getStationid());
|
|
|
+ po.setProjectId(vo.getProjectid());
|
|
|
+ po.setLineId(vo.getLineid());
|
|
|
+ po.setStationName(vo.getStationname());
|
|
|
+ po.setProjectiName(vo.getProjectname());
|
|
|
+ po.setLineidName(vo.getLinename());
|
|
|
+ po.setDeviceName(vo.getDevicename());
|
|
|
+ po.setOval(0);
|
|
|
+ po.setCloseTime(null!=alarm.getEndts()?new Date(alarm.getEndts()):null);
|
|
|
+ po.setIsOpen(0);
|
|
|
+ po.setVal(alarm.getVal().intValue());
|
|
|
+
|
|
|
+
|
|
|
+ tempmap.put(po.getTbname(),po);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|
|
@@ -509,19 +518,19 @@ public class AlarmHistoryService {
|
|
|
{
|
|
|
if(AlarmTime.H.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else if(AlarmTime.M.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else
|
|
|
{
|
|
|
- d.setTime(fs.getAvgSeconds());
|
|
|
+ d.setTime(fs.getTotalSeconds());
|
|
|
}
|
|
|
}else
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}
|
|
|
|
|
@@ -703,19 +712,19 @@ public class AlarmHistoryService {
|
|
|
{
|
|
|
if(AlarmTime.H.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else if(AlarmTime.M.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else
|
|
|
{
|
|
|
- d.setTime(fs.getAvgSeconds());
|
|
|
+ d.setTime(fs.getTotalSeconds());
|
|
|
}
|
|
|
}else
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}
|
|
|
d.setStationId(fs.getStationId());
|
|
@@ -823,19 +832,19 @@ public class AlarmHistoryService {
|
|
|
{
|
|
|
if(AlarmTime.H.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else if(AlarmTime.M.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else
|
|
|
{
|
|
|
- d.setTime(fs.getAvgSeconds());
|
|
|
+ d.setTime(fs.getTotalSeconds());
|
|
|
}
|
|
|
}else
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}
|
|
|
d.setStationId(fs.getStationId());
|
|
@@ -943,19 +952,19 @@ public class AlarmHistoryService {
|
|
|
{
|
|
|
if(AlarmTime.H.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(360), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else if(AlarmTime.M.getCode().equals(timeType))
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}else
|
|
|
{
|
|
|
- d.setTime(fs.getAvgSeconds());
|
|
|
+ d.setTime(fs.getTotalSeconds());
|
|
|
}
|
|
|
}else
|
|
|
{
|
|
|
- double times= new BigDecimal(fs.getAvgSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
+ double times= new BigDecimal(fs.getTotalSeconds()).divide(new BigDecimal(60), 2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
d.setTime(times);
|
|
|
}
|
|
|
d.setStationId(fs.getStationId());
|