|
@@ -173,32 +173,29 @@ public class MysqlWatch {
|
|
|
queryWrapper.eq("variable_address", "sys_run_current_limit");
|
|
|
queryWrapper.eq("status", 0);
|
|
|
SystemVariable systemVariable = systemVariableService.getOne(queryWrapper);
|
|
|
+
|
|
|
+ // 如果 systemVariable 为空,则不执行后续操作
|
|
|
if (systemVariable == null) {
|
|
|
log.info("{}{}", "fpg_close系统变量未配置正常状态的运行电流限制!", JSON.toJSON(data));
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- DeviceInformation deviceInformation = deviceInformationMapper.selectOne(
|
|
|
- new LambdaQueryWrapper<DeviceInformation>()
|
|
|
- .eq(DeviceInformation::getId, data.getDeviceInformationId())
|
|
|
- );
|
|
|
-
|
|
|
- // 比较大小
|
|
|
- int result = compareStringWithBigDecimal(systemVariable.getDefaultValue(), data.getRunCurrent());
|
|
|
-
|
|
|
- if (result > 0) {
|
|
|
- deviceInformation.setStatus("1");
|
|
|
-
|
|
|
- } else if (result < 0) {
|
|
|
-
|
|
|
- deviceInformation.setStatus("0");
|
|
|
-
|
|
|
} else {
|
|
|
+ DeviceInformation deviceInformation = deviceInformationMapper.selectOne(
|
|
|
+ new LambdaQueryWrapper<DeviceInformation>()
|
|
|
+ .eq(DeviceInformation::getId, data.getDeviceInformationId())
|
|
|
+ );
|
|
|
+
|
|
|
+ // 比较大小
|
|
|
+ int result = compareStringWithBigDecimal(systemVariable.getDefaultValue(), data.getRunCurrent());
|
|
|
+
|
|
|
+ if (result > 0) {
|
|
|
+ deviceInformation.setStatus("1");
|
|
|
+ } else if (result < 0) {
|
|
|
+ deviceInformation.setStatus("0");
|
|
|
+ }
|
|
|
|
|
|
+ // 只有在 systemVariable 不为空时才进行更新操作
|
|
|
+ deviceInformationMapper.updateById(deviceInformation);
|
|
|
}
|
|
|
|
|
|
- deviceInformationMapper.updateById(deviceInformation);
|
|
|
-
|
|
|
// 如果不存在则插入
|
|
|
if (existingData == null) {
|
|
|
fpgGatherDataMapper.insert(data);
|