46 lines
1.4 KiB
Java
46 lines
1.4 KiB
Java
package com.cbsd.client.check;
|
||
|
||
import com.cbsd.client.check.ICheckInterface;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
/**
|
||
* 检查脚本示例, 实现 ICheckInterface 接口
|
||
*/
|
||
public class CheckTemplate implements ICheckInterface {
|
||
|
||
/**
|
||
* 检查
|
||
*
|
||
* @param originalCommand 原始指令数据
|
||
* @param preTreatmentCommand 预处理指令数据,若无预处理,则为原始指令数据
|
||
* @param repeatCount 重复次数
|
||
* @param hitCount 命中次数
|
||
* @param latestHitTime 最后命中时间
|
||
* @param dataMap 数据集合,key为协议字段属性名(label),value为物理值
|
||
* @return 日志信息列表
|
||
*/
|
||
@Override
|
||
public List<String> check(String originalCommand, String preTreatmentCommand, int repeatCount, int hitCount, String latestHitTime, Map<String, String> dataMap) {
|
||
List<String> list = new ArrayList<>();
|
||
String temperatureStr = dataMap.get("temperature");
|
||
if (temperatureStr != null && !temperatureStr.isEmpty()) {
|
||
double temperature = Double.parseDouble(temperatureStr);
|
||
list.add("检查温度:" + temperature + "℃");
|
||
}
|
||
return list;
|
||
}
|
||
|
||
/**
|
||
* 描述
|
||
*
|
||
* @return 描述内容
|
||
*/
|
||
@Override
|
||
public String comment() {
|
||
return "打印检查日志";
|
||
}
|
||
}
|