自动插入客户信息

This commit is contained in:
2026-04-04 14:34:55 +08:00
parent aba24953d9
commit 28fc0d0e50
3 changed files with 18 additions and 7 deletions

View File

@@ -511,8 +511,15 @@ public class AudioManagementController {
customerManagementService.updateById(customerToUpdate);
log.info("同步更新客户信息成功客户ID: {}", customerToUpdate.getId());
} else {
log.warn("未找到对应的客户信息无法同步更新。customerId: {}, customerPhone: {}",
audioManagement.getCustomerId(), audioManagement.getCustomerPhone());
log.warn("未找到对应的客户信息无法同步更新。customerId: {}, customerPhone: {}",
audioManagement.getCustomerId(), audioManagement.getCustomerPhone());
customerToUpdate = new CustomerManagement();
customerToUpdate.setCustomerName(audioManagement.getCustomerName());
customerToUpdate.setContact(audioManagement.getCustomerPhone());
customerToUpdate.setDetailedAddress(audioManagement.getRemarks());
customerToUpdate.setUpdateTime(LocalDateTime.now());
customerManagementService.save(customerToUpdate);
}
} catch (Exception e) {
// 客户信息更新失败不影响音频信息更新的结果,只记录日志
@@ -601,17 +608,21 @@ public class AudioManagementController {
boolean success = audioManagementService.updateById(audio);
// 根据 customerId把客户 customer_management 表的 recording_count 录音数加 1
// 根据已校验的客户记录,将 customer_management.recording_count 加 1(无客户或查不到客户则跳过)
if (customer != null) {
try {
CustomerManagement customerForUpdate = new CustomerManagement();
customerForUpdate.setId(customer.getId());
customerForUpdate.setUpdateTime(LocalDateTime.now());
Integer rc = customer.getRecordingCount();
customerForUpdate.setRecordingCount(rc == null ? 1 : rc + 1);
customerManagementService.updateById(customerForUpdate);
log.info("更新客户录音数成功客户ID: {} ", customerId );
log.info("更新客户录音数成功客户ID: {}", customer.getId());
} catch (Exception e) {
// 客户录音数更新失败不影响录音服务结束的结果,只记录日志
log.error("更新客户录音数时发生异常: {}", e.getMessage(), e);
}
}
if (success) {