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, "根据配置条件筛选设备失败");

View File

@@ -18,26 +18,31 @@ public class DefaultConfigIntegrationService {
private final DefaultConfigClient defaultConfigClient;
public List<DefaultConfigDTO> listDefaultConfigs() {
log.debug("获取默认配置列表");
CommonResponse<List<DefaultConfigDTO>> response = defaultConfigClient.listDefaultConfigs();
return handleResponse(response, "获取默认配置列表失败");
}
public DefaultConfigDTO getDefaultConfig(String configKey) {
log.debug("获取指定默认配置, configKey: {}", configKey);
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.getDefaultConfig(configKey);
return handleResponse(response, "获取指定默认配置失败");
}
public DefaultConfigDTO createDefaultConfig(DefaultConfigDTO request) {
log.debug("创建默认配置, configKey: {}", request.getConfigKey());
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.createDefaultConfig(request);
return handleResponse(response, "创建默认配置失败");
}
public DefaultConfigDTO updateDefaultConfig(String configKey, DefaultConfigDTO request) {
log.debug("更新默认配置, configKey: {}", configKey);
CommonResponse<DefaultConfigDTO> response = defaultConfigClient.updateDefaultConfig(configKey, request);
return handleResponse(response, "更新默认配置失败");
}
public void deleteDefaultConfig(String configKey) {
log.debug("删除默认配置, configKey: {}", configKey);
CommonResponse<Void> response = defaultConfigClient.deleteDefaultConfig(configKey);
handleResponse(response, "删除默认配置失败");
}

View File

@@ -23,19 +23,19 @@ public class ScenicConfigIntegrationService {
private static final String SERVICE_NAME = "zt-scenic";
public List<ScenicConfigV2DTO> listConfigs(Long scenicId) {
log.info("获取景区配置列表, scenicId: {}", scenicId);
log.debug("获取景区配置列表, scenicId: {}", scenicId);
CommonResponse<List<ScenicConfigV2DTO>> response = scenicConfigV2Client.listConfigs(scenicId);
return handleResponse(response, "获取景区配置列表失败");
}
public ScenicConfigV2DTO getConfigByKey(Long scenicId, String configKey) {
log.info("根据键获取景区配置, scenicId: {}, configKey: {}", scenicId, configKey);
log.debug("根据键获取景区配置, scenicId: {}, configKey: {}", scenicId, configKey);
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.getConfigByKey(scenicId, configKey);
return handleResponse(response, "根据键获取景区配置失败");
}
public Map<String, Object> getFlatConfigs(Long scenicId) {
log.info("获取景区扁平化配置, scenicId: {}", scenicId);
log.debug("获取景区扁平化配置, scenicId: {}", scenicId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"scenic:flat:configs:" + scenicId,
@@ -48,31 +48,31 @@ public class ScenicConfigIntegrationService {
}
public ScenicConfigV2DTO createConfig(Long scenicId, CreateConfigRequest request) {
log.info("创建景区配置, scenicId: {}, configKey: {}", scenicId, request.getConfigKey());
log.debug("创建景区配置, scenicId: {}, configKey: {}", scenicId, request.getConfigKey());
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.createConfig(scenicId, request);
return handleResponse(response, "创建景区配置失败");
}
public ScenicConfigV2DTO updateConfig(Long scenicId, String id, UpdateConfigRequest request) {
log.info("更新景区配置, scenicId: {}, id: {}", scenicId, id);
log.debug("更新景区配置, scenicId: {}, id: {}", scenicId, id);
CommonResponse<ScenicConfigV2DTO> response = scenicConfigV2Client.updateConfig(scenicId, id, request);
return handleResponse(response, "更新景区配置失败");
}
public void deleteConfig(Long scenicId, String id) {
log.info("删除景区配置, scenicId: {}, id: {}", scenicId, id);
log.debug("删除景区配置, scenicId: {}, id: {}", scenicId, id);
CommonResponse<Void> response = scenicConfigV2Client.deleteConfig(scenicId, id);
handleResponse(response, "删除景区配置失败");
}
public BatchUpdateResponse batchUpdateConfigs(Long scenicId, BatchConfigRequest request) {
log.info("批量更新景区配置, scenicId: {}, configs count: {}", scenicId, request.getConfigs().size());
log.debug("批量更新景区配置, scenicId: {}, configs count: {}", scenicId, request.getConfigs().size());
CommonResponse<BatchUpdateResponse> response = scenicConfigV2Client.batchUpdateConfigs(scenicId, request);
return handleResponse(response, "批量更新景区配置失败");
}
public BatchUpdateResponse batchFlatUpdateConfigs(Long scenicId, Map<String, Object> configs) {
log.info("扁平化批量更新景区配置, scenicId: {}, configs count: {}", scenicId, configs.size());
log.debug("扁平化批量更新景区配置, scenicId: {}, configs count: {}", scenicId, configs.size());
CommonResponse<BatchUpdateResponse> response = scenicConfigV2Client.batchFlatUpdateConfigs(scenicId, configs);
return handleResponse(response, "扁平化批量更新景区配置失败");
}

View File

@@ -31,7 +31,7 @@ public class ScenicIntegrationService {
private static final String SERVICE_NAME = "zt-scenic";
public ScenicV2DTO getScenic(Long scenicId) {
log.info("获取景区信息, scenicId: {}", scenicId);
log.debug("获取景区信息, scenicId: {}", scenicId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"scenic:" + scenicId,
@@ -44,7 +44,7 @@ public class ScenicIntegrationService {
}
public ScenicV2WithConfigDTO getScenicWithConfig(Long scenicId) {
log.info("获取景区配置信息, scenicId: {}", scenicId);
log.debug("获取景区配置信息, scenicId: {}", scenicId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"scenic:config:" + scenicId,
@@ -57,7 +57,7 @@ public class ScenicIntegrationService {
}
public Map<String, Object> getScenicFlatConfig(Long scenicId) {
log.info("获取景区扁平化配置, scenicId: {}", scenicId);
log.debug("获取景区扁平化配置, scenicId: {}", scenicId);
return fallbackService.executeWithFallback(
SERVICE_NAME,
"scenic:flat:config:" + scenicId,
@@ -70,37 +70,37 @@ public class ScenicIntegrationService {
}
public ScenicV2DTO createScenic(CreateScenicRequest request) {
log.info("创建景区, name: {}", request.getName());
log.debug("创建景区, name: {}", request.getName());
CommonResponse<ScenicV2DTO> response = scenicV2Client.createScenic(request);
return handleResponse(response, "创建景区失败");
}
public ScenicV2DTO updateScenic(Long scenicId, UpdateScenicRequest request) {
log.info("更新景区信息, scenicId: {}", scenicId);
log.debug("更新景区信息, scenicId: {}", scenicId);
CommonResponse<ScenicV2DTO> response = scenicV2Client.updateScenic(scenicId, request);
return handleResponse(response, "更新景区信息失败");
}
public void deleteScenic(Long scenicId) {
log.info("删除景区, scenicId: {}", scenicId);
log.debug("删除景区, scenicId: {}", scenicId);
CommonResponse<Void> response = scenicV2Client.deleteScenic(scenicId);
handleResponse(response, "删除景区失败");
}
public ScenicFilterPageResponse filterScenics(ScenicFilterRequest request) {
log.info("筛选景区, filters: {}", request.getFilters().size());
log.debug("筛选景区, filters: {}", request.getFilters().size());
CommonResponse<ScenicFilterPageResponse> response = scenicV2Client.filterScenics(request);
return handleResponse(response, "筛选景区失败");
}
public ScenicV2ListResponse listScenics(Integer page, Integer pageSize, Integer status, String name) {
log.info("分页查询景区列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
log.debug("分页查询景区列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
CommonResponse<ScenicV2ListResponse> response = scenicV2Client.listScenics(page, pageSize, status, name);
return handleResponse(response, "分页查询景区列表失败");
}
public ScenicV2WithConfigListResponse listScenicsWithConfig(Integer page, Integer pageSize, Integer status, String name) {
log.info("分页查询景区带配置列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
log.debug("分页查询景区带配置列表, page: {}, pageSize: {}, status: {}, name: {}", page, pageSize, status, name);
CommonResponse<ScenicV2WithConfigListResponse> response = scenicV2Client.listScenicsWithConfig(page, pageSize, status, name);
return handleResponse(response, "分页查询景区带配置列表失败");
}