46 lines
1.3 KiB
Java
46 lines
1.3 KiB
Java
|
|
package com.cbsd.client.pretreatment;
|
|||
|
|
|
|||
|
|
import com.cbsd.client.pretreatment.CalculateUtils;
|
|||
|
|
import com.cbsd.client.pretreatment.IPreTreatmentInterface;
|
|||
|
|
|
|||
|
|
import java.util.Map;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 预处理脚本示例, 实现 IPreTreatmentInterface 接口
|
|||
|
|
* 累加预处理
|
|||
|
|
*/
|
|||
|
|
public class PreTreatmentTemplate implements IPreTreatmentInterface {
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 预处理
|
|||
|
|
*
|
|||
|
|
* @param command 指令内容
|
|||
|
|
* @param repeatCount 重复次数
|
|||
|
|
* @param hitCount 命中次数
|
|||
|
|
* @param latestHitTime 最后命中时间
|
|||
|
|
* @param dataMap 数据集合,key为协议字段属性名(label),value为物理值
|
|||
|
|
* @param calculateUtils 计算工具类
|
|||
|
|
* @return 结果
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public String pretreatment(String command, int repeatCount, int hitCount, String latestHitTime, Map<String, String> dataMap, CalculateUtils calculateUtils) {
|
|||
|
|
String resultCommand = "";
|
|||
|
|
if (hitCount < 10) {
|
|||
|
|
resultCommand += "0" + hitCount;
|
|||
|
|
} else {
|
|||
|
|
resultCommand = String.valueOf(hitCount);
|
|||
|
|
}
|
|||
|
|
return resultCommand;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 描述
|
|||
|
|
*
|
|||
|
|
* @return 描述内容
|
|||
|
|
*/
|
|||
|
|
@Override
|
|||
|
|
public String comment() {
|
|||
|
|
return "根据命中次数累加拼接";
|
|||
|
|
}
|
|||
|
|
}
|