refactor(log): 修改日志级别并优化日志输出

-将 info 日志级别改为 debug 日志级别
- 在 DefaultConfigIntegrationService 中添加了获取默认配置列表和指定默认配置的日志输出- 优化了部分日志信息的描述,使其更加详细
This commit is contained in:
2025-09-06 15:46:30 +08:00
parent 6039f337cb
commit 0aa834bdfa
5 changed files with 39 additions and 34 deletions

View File

@@ -29,7 +29,7 @@ public class DeviceConfigIntegrationService {
}
public List<DeviceConfigV2DTO> getDeviceConfigsByNo(String deviceNo) {
log.info("根据设备编号获取配置列表, deviceNo: {}", deviceNo);
log.debug("根据设备编号获取配置列表, deviceNo: {}", deviceNo);
CommonResponse<List<DeviceConfigV2DTO>> response = deviceConfigV2Client.getDeviceConfigsByNo(deviceNo);
return handleResponse(response, "根据设备编号获取配置列表失败");
}
@@ -52,7 +52,7 @@ public class DeviceConfigIntegrationService {
}
public Map<String, Object> getDeviceFlatConfigByNo(String deviceNo) {
log.info("根据设备编号获取扁平化配置, deviceNo: {}", deviceNo);
log.debug("根据设备编号获取扁平化配置, deviceNo: {}", deviceNo);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"device:flat:config:no:" + deviceNo,
@@ -65,19 +65,19 @@ public class DeviceConfigIntegrationService {
}
public DeviceConfigV2DTO createDeviceConfig(Long deviceId, CreateDeviceConfigRequest request) {
log.info("创建设备配置, deviceId: {}, configKey: {}", deviceId, request.getConfigKey());
log.debug("创建设备配置, deviceId: {}, configKey: {}", deviceId, request.getConfigKey());
CommonResponse<DeviceConfigV2DTO> response = deviceConfigV2Client.createDeviceConfig(deviceId, request);
return handleResponse(response, "创建设备配置失败");
}
public void updateDeviceConfig(Long deviceId, Long configId, UpdateDeviceConfigRequest request) {
log.info("更新设备配置, deviceId: {}, configId: {}", deviceId, configId);
log.debug("更新设备配置, deviceId: {}, configId: {}", deviceId, configId);
CommonResponse<String> response = deviceConfigV2Client.updateDeviceConfig(deviceId, configId, request);
handleResponse(response, "更新设备配置失败");
}
public void deleteDeviceConfig(Long deviceId, Long configId) {
log.info("删除设备配置, deviceId: {}, configId: {}", deviceId, configId);
log.debug("删除设备配置, deviceId: {}, configId: {}", deviceId, configId);
CommonResponse<String> response = deviceConfigV2Client.deleteDeviceConfig(deviceId, configId);
handleResponse(response, "删除设备配置失败");
}
@@ -86,7 +86,7 @@ public class DeviceConfigIntegrationService {
* 批量更新设备配置
*/
public BatchUpdateResponse batchUpdateDeviceConfig(Long deviceId, BatchDeviceConfigRequest request) {
log.info("批量更新设备配置, deviceId: {}, configs count: {}", deviceId, request.getConfigs().size());
log.debug("批量更新设备配置, deviceId: {}, configs count: {}", deviceId, request.getConfigs().size());
CommonResponse<BatchUpdateResponse> response = deviceConfigV2Client.batchUpdateDeviceConfig(deviceId, request);
return handleResponse(response, "批量更新设备配置失败");
}

View File

@@ -22,7 +22,7 @@ public class DeviceIntegrationService {
private static final String SERVICE_NAME = "zt-device";
public DeviceV2DTO getDevice(Long deviceId) {
log.info("获取设备信息, deviceId: {}", deviceId);
log.debug("获取设备信息, deviceId: {}", deviceId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"device:" + deviceId,
@@ -35,7 +35,7 @@ public class DeviceIntegrationService {
}
public DeviceV2DTO getDeviceByNo(String deviceNo) {
log.info("根据设备编号获取设备信息, deviceNo: {}", deviceNo);
log.debug("根据设备编号获取设备信息, deviceNo: {}", deviceNo);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"device:no:" + deviceNo,
@@ -48,7 +48,7 @@ public class DeviceIntegrationService {
}
public DeviceV2WithConfigDTO getDeviceWithConfig(Long deviceId) {
log.info("获取设备配置信息, deviceId: {}", deviceId);
log.debug("获取设备配置信息, deviceId: {}", deviceId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"device:config:" + deviceId,
@@ -61,7 +61,7 @@ public class DeviceIntegrationService {
}
public DeviceV2WithConfigDTO getDeviceWithConfigByNo(String deviceNo) {
log.info("根据设备编号获取设备配置信息, deviceNo: {}", deviceNo);
log.debug("根据设备编号获取设备配置信息, deviceNo: {}", deviceNo);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"device:config:no:" + deviceNo,
@@ -74,26 +74,26 @@ public class DeviceIntegrationService {
}
public DeviceV2DTO createDevice(CreateDeviceRequest request) {
log.info("创建设备, name: {}, no: {}, type: {}", request.getName(), request.getNo(), request.getType());
log.debug("创建设备, name: {}, no: {}, type: {}", request.getName(), request.getNo(), request.getType());
CommonResponse<DeviceV2DTO> response = deviceV2Client.createDevice(request);
return handleResponse(response, "创建设备失败");
}
public void updateDevice(Long deviceId, UpdateDeviceRequest request) {
log.info("更新设备信息, deviceId: {}", deviceId);
log.debug("更新设备信息, deviceId: {}", deviceId);
CommonResponse<String> response = deviceV2Client.updateDevice(deviceId, request);
handleResponse(response, "更新设备信息失败");
}
public void deleteDevice(Long deviceId) {
log.info("删除设备, deviceId: {}", deviceId);
log.debug("删除设备, deviceId: {}", deviceId);
CommonResponse<String> response = deviceV2Client.deleteDevice(deviceId);
handleResponse(response, "删除设备失败");
}
public DeviceV2ListResponse listDevices(Integer page, Integer pageSize, String name, String no,
String type, Integer isActive, Long scenicId) {
log.info("分页查询设备列表, page: {}, pageSize: {}, name: {}, no: {}, type: {}, isActive: {}, scenicId: {}",
log.debug("分页查询设备列表, page: {}, pageSize: {}, name: {}, no: {}, type: {}, isActive: {}, scenicId: {}",
page, pageSize, name, no, type, isActive, scenicId);
CommonResponse<DeviceV2ListResponse> response = deviceV2Client.listDevices(
page, pageSize, name, no, type, isActive, scenicId);
@@ -102,7 +102,7 @@ public class DeviceIntegrationService {
public DeviceV2WithConfigListResponse listDevicesWithConfig(Integer page, Integer pageSize, String name, String no,
String type, Integer isActive, Long scenicId) {
log.info("分页查询设备带配置列表, page: {}, pageSize: {}, name: {}, no: {}, type: {}, isActive: {}, scenicId: {}",
log.debug("分页查询设备带配置列表, page: {}, pageSize: {}, name: {}, no: {}, type: {}, isActive: {}, scenicId: {}",
page, pageSize, name, no, type, isActive, scenicId);
CommonResponse<DeviceV2WithConfigListResponse> response = deviceV2Client.listDevicesWithConfig(
page, pageSize, name, no, type, isActive, scenicId);
@@ -187,7 +187,7 @@ public class DeviceIntegrationService {
* 更新设备排序
*/
public void updateDeviceSort(Long deviceId, Integer sort) {
log.info("更新设备排序, deviceId: {}, sort: {}", deviceId, sort);
log.debug("更新设备排序, deviceId: {}, sort: {}", deviceId, sort);
UpdateDeviceRequest request = new UpdateDeviceRequest();
request.setSort(sort);
updateDevice(deviceId, request);
@@ -211,7 +211,7 @@ public class DeviceIntegrationService {
* 根据配置条件筛选设备
*/
public FilterDevicesByConfigsResponse filterDevicesByConfigs(FilterDevicesByConfigsRequest request) {
log.info("根据配置条件筛选设备, page: {}, pageSize: {}, filterLogic: {}, configFilters: {}",
log.debug("根据配置条件筛选设备, page: {}, pageSize: {}, filterLogic: {}, configFilters: {}",
request.getPage(), request.getPageSize(), request.getFilterLogic(), request.getConfigFilters());
CommonResponse<FilterDevicesByConfigsResponse> response = deviceV2Client.filterDevicesByConfigs(request);
return handleResponse(response, "根据配置条件筛选设备失败");