|
|
@@ -1,12 +1,14 @@
|
|
|
package com.yunfeiyun.agmp.iots.warn.service;
|
|
|
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.IotWarncount;
|
|
|
+import com.yunfeiyun.agmp.iot.common.domain.IotWarnlog;
|
|
|
import com.yunfeiyun.agmp.iots.warn.mapper.IotWarnBussinessMapper;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Service
|
|
|
public class IotWarnBussinessService {
|
|
|
+
|
|
|
@Autowired
|
|
|
private IotWarnBussinessMapper iotWarncountMapper;
|
|
|
|
|
|
@@ -17,7 +19,41 @@ public class IotWarnBussinessService {
|
|
|
* @param configId
|
|
|
* @return
|
|
|
*/
|
|
|
- public IotWarncount selectIotWarnCountByDevAndConfig(String devId, String configId) {
|
|
|
- return iotWarncountMapper.selectIotWarnCountByDevAndConfig(devId, configId);
|
|
|
+ public Long selectIotWarnCountByDevAndConfig(String devId, String configId) {
|
|
|
+ IotWarncount iotWarncount = iotWarncountMapper.selectIotWarnCountByDevAndConfig(devId, configId);
|
|
|
+ if (iotWarncount == null) {
|
|
|
+
|
|
|
+ }
|
|
|
+ return iotWarncount.getWctCount();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加重复次数
|
|
|
+ *
|
|
|
+ * @param devId
|
|
|
+ * @param configId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ int incrementReCount(String devId, String configId) {
|
|
|
+ return iotWarncountMapper.incrementReCount(devId, configId);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 重置重复次数
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ int resetReCount() {
|
|
|
+ return iotWarncountMapper.resetReCount();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入预警记录
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ int insertWarnRecord(IotWarnlog iotWarnlog) {
|
|
|
+ return iotWarncountMapper.insertWarnRecord(iotWarnlog);
|
|
|
+ }
|
|
|
+
|
|
|
}
|