feat: 天气系统规则引擎
This commit is contained in:
+35
@@ -105,6 +105,7 @@ public class AgeDeviceController {
|
||||
vo.setDeviceSn(deviceSn);
|
||||
vo.setLongitude(device.getLongitude());
|
||||
vo.setLatitude(device.getLatitude());
|
||||
vo.setWeatherBlockEnabled(device.getWeatherBlockEnabled());
|
||||
return Result.succeed(vo, "查询成功");
|
||||
}
|
||||
|
||||
@@ -288,4 +289,38 @@ public class AgeDeviceController {
|
||||
return excel;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新设备天气阻飞开关
|
||||
*/
|
||||
@Operation(summary = "更新设备天气阻飞开关")
|
||||
@PutMapping("/weather-block")
|
||||
public Result updateWeatherBlock(@RequestBody Map<String, Object> params) {
|
||||
try {
|
||||
String deviceSn = (String) params.get("deviceSn");
|
||||
Integer weatherBlockEnabled = (Integer) params.get("weatherBlockEnabled");
|
||||
|
||||
if (deviceSn == null || deviceSn.trim().isEmpty()) {
|
||||
return Result.failed("deviceSn参数不能为空");
|
||||
}
|
||||
if (weatherBlockEnabled == null) {
|
||||
return Result.failed("weatherBlockEnabled参数不能为空");
|
||||
}
|
||||
|
||||
log.info("更新设备天气阻飞开关,deviceSn: {}, weatherBlockEnabled: {}", deviceSn, weatherBlockEnabled);
|
||||
|
||||
AgeDevice device = ageDeviceService.getByDeviceSn(deviceSn);
|
||||
if (device == null) {
|
||||
return Result.failed("设备不存在");
|
||||
}
|
||||
|
||||
device.setWeatherBlockEnabled(weatherBlockEnabled);
|
||||
boolean result = ageDeviceService.updateById(device);
|
||||
|
||||
return result ? Result.succeed("更新成功") : Result.failed("更新失败");
|
||||
} catch (Exception e) {
|
||||
log.error("更新设备天气阻飞开关失败", e);
|
||||
return Result.failed("更新失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,4 +75,9 @@ public class AgeDevice extends SuperEntity {
|
||||
* 设备IP地址
|
||||
*/
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 是否开启天气阻飞(0:关闭,1:开启)
|
||||
*/
|
||||
private Integer weatherBlockEnabled;
|
||||
}
|
||||
|
||||
+3
@@ -18,5 +18,8 @@ public class AgeDeviceLocationVO {
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private Double latitude;
|
||||
|
||||
@Schema(description = "是否开启天气阻飞(0:关闭,1:开启)")
|
||||
private Integer weatherBlockEnabled;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user