|
@@ -19,6 +19,8 @@ import com.steerinfo.ems.emswaihoursumtab1.mapper.EmsWAiHourSumTab1Mapper;
|
|
import com.steerinfo.ems.emswaihoursumtab1.model.EmsWAiHourSumTab1;
|
|
import com.steerinfo.ems.emswaihoursumtab1.model.EmsWAiHourSumTab1;
|
|
import com.steerinfo.ems.emswaihoursumtab1org.mapper.EmsWAiHourSumTab1OrgMapper;
|
|
import com.steerinfo.ems.emswaihoursumtab1org.mapper.EmsWAiHourSumTab1OrgMapper;
|
|
import com.steerinfo.ems.emswaihoursumtab1org.model.EmsWAiHourSumTab1Org;
|
|
import com.steerinfo.ems.emswaihoursumtab1org.model.EmsWAiHourSumTab1Org;
|
|
|
|
+import com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog;
|
|
|
|
+import com.steerinfo.ems.emswebsocketlog.service.IEmsWebsocketLogService;
|
|
import com.steerinfo.ems.formula.mapper.FormulaMapper;
|
|
import com.steerinfo.ems.formula.mapper.FormulaMapper;
|
|
import com.steerinfo.ems.trmcalpoint.mapper.TRmCalpointMapper;
|
|
import com.steerinfo.ems.trmcalpoint.mapper.TRmCalpointMapper;
|
|
import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
|
|
import com.steerinfo.ems.trmcalpoint.model.TRmCalpoint;
|
|
@@ -305,6 +307,12 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
return pageInfo;
|
|
return pageInfo;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ IEmsWebsocketLogService emsWebsocketLogService;
|
|
|
|
+ /**
|
|
|
|
+ * 每一种消息类型发送只存储一次
|
|
|
|
+ */
|
|
|
|
+ StringBuffer[] socketMessages;
|
|
@Override
|
|
@Override
|
|
/**
|
|
/**
|
|
* 动力、水小时表定时统计(自动补全24小时内的小时用量值)
|
|
* 动力、水小时表定时统计(自动补全24小时内的小时用量值)
|
|
@@ -320,6 +328,11 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
List<TRmCalpoint> l = tRmCalpointMapper.selectLikeByParameters(m);
|
|
List<TRmCalpoint> l = tRmCalpointMapper.selectLikeByParameters(m);
|
|
int size = 0;
|
|
int size = 0;
|
|
if (l != null && l.size() > 0) {
|
|
if (l != null && l.size() > 0) {
|
|
|
|
+ List<EmsWebsocketLog> websocketLogs =new ArrayList<>();
|
|
|
|
+ socketMessages = new StringBuffer[12];
|
|
|
|
+ for(int i=0;i<socketMessages.length ;i++){
|
|
|
|
+ socketMessages[i] = new StringBuffer();
|
|
|
|
+ }
|
|
size = l.size();
|
|
size = l.size();
|
|
Calendar cal = Calendar.getInstance();
|
|
Calendar cal = Calendar.getInstance();
|
|
cal.add(Calendar.HOUR_OF_DAY, -2);
|
|
cal.add(Calendar.HOUR_OF_DAY, -2);
|
|
@@ -467,8 +480,36 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("历史用量值更新失败,clock:" + clock1 + ",tag:" + tag + ",table:" + table);
|
|
tce.setBz("历史用量值更新失败,clock:" + clock1 + ",tag:" + tag + ",table:" + table);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[7].append(itemid + ",");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ for(int o =0;o<socketMessages.length; o++){
|
|
|
|
+ if(socketMessages[o] != null && socketMessages[o].length()>0
|
|
|
|
+ && !"null".equals(socketMessages[o].toString())
|
|
|
|
+ && !"".equals(socketMessages[o].toString()))
|
|
|
|
+ {
|
|
|
|
+ switch (o){
|
|
|
|
+ case 1: socketMessages[1].append("十分钟数据变小"); break;
|
|
|
|
+ case 2: socketMessages[2].append("配置不能为空"); break;
|
|
|
|
+ case 3: socketMessages[3].append("十分钟表字段配置错误"); break;
|
|
|
|
+ case 4: socketMessages[4].append("准点值读取失败"); break;
|
|
|
|
+ case 5: socketMessages[5].append("十分钟数据不足以统计"); break;
|
|
|
|
+ case 7: socketMessages[7].append("历史用量值更新失败"); break;
|
|
|
|
+ case 8: socketMessages[8].append("十分钟数据查询错误"); break;
|
|
|
|
+ case 9: socketMessages[9].append("用量数据增大超过限值"); break;
|
|
|
|
+ case 10: socketMessages[10].append("用量数据低于最小值"); break;
|
|
|
|
+ }
|
|
|
|
+ EmsWebsocketLog websocketLog = new EmsWebsocketLog();
|
|
|
|
+ websocketLog.setMessage(socketMessages[o].toString());
|
|
|
|
+ websocketLog.setTitle("计控处");
|
|
|
|
+ websocketLog.setState("0");
|
|
|
|
+ websocketLog.setTips("计量点异常数据通知");
|
|
|
|
+ websocketLogs.add(websocketLog);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (websocketLogs != null && websocketLogs.size() > 0) {
|
|
|
|
+ emsWebsocketLogService.pushMessageByDataException(websocketLogs);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " 动力、水小时表统计完毕,个数:" + size);
|
|
logger.info(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + " 动力、水小时表统计完毕,个数:" + size);
|
|
}
|
|
}
|
|
@@ -677,6 +718,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("配置不能为空");
|
|
tce.setBz("配置不能为空");
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[2].append(itemid + ",");
|
|
return "配置不能为空";
|
|
return "配置不能为空";
|
|
}
|
|
}
|
|
String[] tens = tenvs.split("\\.");
|
|
String[] tens = tenvs.split("\\.");
|
|
@@ -688,6 +730,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("十分钟表字段配置错误");
|
|
tce.setBz("十分钟表字段配置错误");
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[3].append(itemid + ",");
|
|
return "十分钟表字段配置错误";
|
|
return "十分钟表字段配置错误";
|
|
}
|
|
}
|
|
String tenTab = tens[0];
|
|
String tenTab = tens[0];
|
|
@@ -718,6 +761,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("十分钟数据查询错误,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("十分钟数据查询错误,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[8].append(itemid + ",");
|
|
return "十分钟数据查询错误";
|
|
return "十分钟数据查询错误";
|
|
}
|
|
}
|
|
if (lt == null || lt.size() < 1) {
|
|
if (lt == null || lt.size() < 1) {
|
|
@@ -728,6 +772,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("十分钟数据不足以统计,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("十分钟数据不足以统计,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[5].append(itemid + ",");
|
|
return "十分钟数据不足以统计";
|
|
return "十分钟数据不足以统计";
|
|
} else if (lt.size() == 1) {
|
|
} else if (lt.size() == 1) {
|
|
TRmCalpointExValue tce = new TRmCalpointExValue();
|
|
TRmCalpointExValue tce = new TRmCalpointExValue();
|
|
@@ -737,6 +782,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("十分钟数据不足以统计,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("十分钟数据不足以统计,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[5].append(itemid + ",");
|
|
// 当前小时准点值,水准点起始值从10分钟开始计算
|
|
// 当前小时准点值,水准点起始值从10分钟开始计算
|
|
if (tc.getEnergytypeid().equalsIgnoreCase("W")) {
|
|
if (tc.getEnergytypeid().equalsIgnoreCase("W")) {
|
|
sql = "select " + tenCol + " from " + tenTab + " where to_char(tim, 'YYYY-MM-DD HH24:mi') = '" + clock + ":10'";
|
|
sql = "select " + tenCol + " from " + tenTab + " where to_char(tim, 'YYYY-MM-DD HH24:mi') = '" + clock + ":10'";
|
|
@@ -774,6 +820,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("准点值读取失败,clock:" + clock + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("准点值读取失败,clock:" + clock + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[4].append(itemid + ",");
|
|
logger.error("准点数据查询失败,clock:" + clock);
|
|
logger.error("准点数据查询失败,clock:" + clock);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -815,6 +862,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
//tce.setBz("十分钟水数据增大超过500,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
//tce.setBz("十分钟水数据增大超过500,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("用量数据增大超过限值"+maxValue+",clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("用量数据增大超过限值"+maxValue+",clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[9].append(itemid + ",");
|
|
}else if(tenval.doubleValue() < new BigDecimal(minValue).doubleValue()){
|
|
}else if(tenval.doubleValue() < new BigDecimal(minValue).doubleValue()){
|
|
// 记录异常数据
|
|
// 记录异常数据
|
|
TRmCalpointExValue tce = new TRmCalpointExValue();
|
|
TRmCalpointExValue tce = new TRmCalpointExValue();
|
|
@@ -828,6 +876,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
//tce.setBz("十分钟水数据增大超过500,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
//tce.setBz("十分钟水数据增大超过500,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("用量数据低于最小值"+minValue+",clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("用量数据低于最小值"+minValue+",clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[10].append(itemid + ",");
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
if (tc.getEnergytypeid().equalsIgnoreCase("W")) {
|
|
if (tc.getEnergytypeid().equalsIgnoreCase("W")) {
|
|
@@ -851,6 +900,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("十分钟数据变小,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("十分钟数据变小,clock:" + clock1 + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[1].append(itemid + ",");
|
|
}
|
|
}
|
|
//} else {
|
|
//} else {
|
|
// // 大于等于0
|
|
// // 大于等于0
|
|
@@ -936,6 +986,7 @@ public class TRmCalpointServiceImpl extends BaseServiceImpl<TRmCalpoint, String>
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setCreatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
tce.setBz("准点值读取失败,clock:" + clock + ",col:" + tenCol + ",table:" + tenTab);
|
|
tce.setBz("准点值读取失败,clock:" + clock + ",col:" + tenCol + ",table:" + tenTab);
|
|
tRmCalpointExValueService.add(tce);
|
|
tRmCalpointExValueService.add(tce);
|
|
|
|
+ socketMessages[4].append(itemid + ",");
|
|
logger.error("准点数据查询失败,clock:" + clock);
|
|
logger.error("准点数据查询失败,clock:" + clock);
|
|
}
|
|
}
|
|
}
|
|
}
|