录音列表添加权限控制
This commit is contained in:
@@ -134,5 +134,7 @@ hikari:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ public class AudioManagementConstants {
|
||||
*/
|
||||
public static final String SERVICE_STATUS_IN_SERVICE = "服务中";
|
||||
public static final String SERVICE_STATUS_SERVICE_FINISH = "服务结束";
|
||||
public static final String SERVICE_STATUS_SERVICE_FINISH_SYS = "服务结束非正常";
|
||||
|
||||
public static final String TEXT_MERGED_STATUS_FINISH = "文本合并完成";
|
||||
public static final String TEXT_MERGED_STATUS_UNFINISH = "文本未合并";
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -1770,7 +1771,7 @@ public class AudioFileController {
|
||||
/**
|
||||
* 关联Audio数据到audio_management表
|
||||
* 根据deviceNo查找或创建对应的audio_management记录,并将ID设置到requestBody中
|
||||
*
|
||||
* 处理多条服务状态为: 服务中 的记录 , 这是不正常现象
|
||||
* @param requestBody 请求体,用于获取deviceNo,并在方法中设置audioManagementId
|
||||
*/
|
||||
private void associateAudioManagement(Map<String, Object> requestBody) {
|
||||
@@ -1815,7 +1816,7 @@ public class AudioFileController {
|
||||
for (AudioManagement audio : audioList) {
|
||||
if (audio.getUpdateTime() != null) {
|
||||
// 计算时间差(天数)
|
||||
long daysBetween = java.time.temporal.ChronoUnit.DAYS.between(audio.getUpdateTime(), now);
|
||||
long daysBetween = ChronoUnit.HOURS.between(audio.getUpdateTime(), now);
|
||||
if (daysBetween >= 1) {
|
||||
LambdaQueryWrapper<AudioManagementSegments> audioQuery2 = new LambdaQueryWrapper<>();
|
||||
audioQuery2.eq(AudioManagementSegments::getParentId, audio.getId()) ; // 关联这个id的所有录音片段
|
||||
@@ -1825,7 +1826,7 @@ public class AudioFileController {
|
||||
total.add(segment2.getDuration());//分钟
|
||||
});
|
||||
|
||||
audio.setServiceStatus(AudioManagementConstants.SERVICE_STATUS_SERVICE_FINISH);
|
||||
audio.setServiceStatus(AudioManagementConstants.SERVICE_STATUS_SERVICE_FINISH_SYS);
|
||||
audio.setDuration(total);
|
||||
serviceManager.getAudioManagementService().updateById(audio);
|
||||
log.info("更新audio_management记录状态为服务结束,ID: {}, updateTime: {}, 距离现在: {}天",
|
||||
@@ -1845,9 +1846,20 @@ public class AudioFileController {
|
||||
// 如果找到(一条或多条),取最新的一条记录
|
||||
audioManagementId = audioList.get(0).getId();
|
||||
for (AudioManagement audio : audioList) {
|
||||
|
||||
// 计算录音总时长, 根据每段录音的时长加在一起。
|
||||
LambdaQueryWrapper<AudioManagementSegments> audioQuery2 = new LambdaQueryWrapper<>();
|
||||
audioQuery2.eq(AudioManagementSegments::getParentId, audio.getId()) ; // 关联这个id的所有录音片段
|
||||
List<AudioManagementSegments> segmentsList = audioManagementSegmentsService.list(audioQuery2);
|
||||
BigDecimal total = new BigDecimal(0);
|
||||
segmentsList.forEach(segment2 ->{ //计算录音时长
|
||||
total.add(segment2.getDuration());//分钟
|
||||
});
|
||||
|
||||
if (!audio.getId().equals(audioManagementId) ) {
|
||||
audio.setServiceStatus(AudioManagementConstants.SERVICE_STATUS_SERVICE_FINISH);
|
||||
audio.setServiceStatus(AudioManagementConstants.SERVICE_STATUS_SERVICE_FINISH_SYS);
|
||||
audio.setUpdateTime(LocalDateTime.now());
|
||||
audio.setDuration(total);
|
||||
serviceManager.getAudioManagementService().updateById(audio);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,9 +328,11 @@ public class AudioManagementController {
|
||||
@Parameter(description = "意向级别") @RequestParam(required = false) String intentionLevel,
|
||||
@Parameter(description = "服务状态") @RequestParam(required = false) String serviceStatus ,
|
||||
@Parameter(description = "销售人员电话(模糊查询)") @RequestParam(required = false) String salesPhone,
|
||||
@Parameter(description = "场景") @RequestParam(required = false) String scenario) {
|
||||
@Parameter(description = "场景") @RequestParam(required = false) String scenario,
|
||||
@RequestHeader(value = "X-Role-Name", required = false) String roleName) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
|
||||
Page<AudioManagement> page = new Page<>(current, size);
|
||||
LambdaQueryWrapper<AudioManagement> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -353,8 +355,16 @@ public class AudioManagementController {
|
||||
if (intentionLevel != null && !intentionLevel.trim().isEmpty()) {
|
||||
queryWrapper.eq(AudioManagement::getIntentionLevel, intentionLevel);
|
||||
}
|
||||
if (salesPhone != null && !salesPhone.trim().isEmpty()) {
|
||||
queryWrapper.like(AudioManagement::getSalesPhone, salesPhone);
|
||||
// 如果角色不包含admin,必须添加salesPhone查询条件
|
||||
if (roleName == null || !roleName.contains("admin")) {
|
||||
if (salesPhone != null && !salesPhone.trim().isEmpty()) {
|
||||
queryWrapper.like(AudioManagement::getSalesPhone, salesPhone);
|
||||
}
|
||||
} else {
|
||||
// admin角色可以按salesPhone查询,但不强制
|
||||
if (salesPhone != null && !salesPhone.trim().isEmpty()) {
|
||||
queryWrapper.like(AudioManagement::getSalesPhone, salesPhone);
|
||||
}
|
||||
}
|
||||
if (serviceStatus != null && !serviceStatus.trim().isEmpty()) { //AudioManagementConstants.SERVICE_STATUS_SERVICE_FINISH
|
||||
queryWrapper.eq(AudioManagement::getServiceStatus, serviceStatus);
|
||||
@@ -465,9 +475,9 @@ public class AudioManagementController {
|
||||
audioManagementDB.setUpdateTime(LocalDateTime.now());
|
||||
audioManagementDB.setCustomerName(audioManagement.getCustomerName());
|
||||
audioManagementDB.setCustomerPhone(audioManagement.getCustomerPhone());
|
||||
|
||||
audioManagementDB.setRecordingName(audioManagement.getRecordingName());
|
||||
audioManagementDB.setId(audioManagement.getId());
|
||||
|
||||
audioManagementDB.setRemarks(audioManagement.getRemarks());
|
||||
boolean success = audioManagementService.updateById(audioManagementDB);
|
||||
|
||||
if (success) {
|
||||
@@ -494,7 +504,7 @@ public class AudioManagementController {
|
||||
if (customerToUpdate != null) {
|
||||
customerToUpdate.setCustomerName(audioManagement.getCustomerName());
|
||||
customerToUpdate.setContact(audioManagement.getCustomerPhone());
|
||||
customerToUpdate.setRemark(audioManagement.getRemarks());
|
||||
customerToUpdate.setDetailedAddress(audioManagement.getRemarks());
|
||||
|
||||
customerToUpdate.setUpdateTime(LocalDateTime.now());
|
||||
customerManagementService.updateById(customerToUpdate);
|
||||
|
||||
@@ -186,17 +186,7 @@ public class CustomerManagementController {
|
||||
@Parameter(description = "所属人姓名(模糊查询)")@RequestParam(required = false) String salesName,
|
||||
@Parameter(description = "所属人电话")@RequestParam(required = false) String salesPhone,
|
||||
@Parameter(description = "联系方式(模糊查询)")
|
||||
@RequestParam(required = false) String contact,
|
||||
@Parameter(description = "所属门店ID")
|
||||
@RequestParam(required = false) String dealershipId,
|
||||
@Parameter(description = "创建开始时间", example = "2025-01-01 00:00:00")
|
||||
@RequestParam(required = false) String createStartTime,
|
||||
@Parameter(description = "创建结束时间", example = "2025-12-31 23:59:59")
|
||||
@RequestParam(required = false) String createEndTime,
|
||||
@Parameter(description = "修改开始时间", example = "2025-01-01 00:00:00")
|
||||
@RequestParam(required = false) String updateStartTime,
|
||||
@Parameter(description = "修改结束时间", example = "2025-12-31 23:59:59")
|
||||
@RequestParam(required = false) String updateEndTime) {
|
||||
@RequestParam(required = false) String contact) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
Page<CustomerManagement> page = new Page<>(current, size);
|
||||
@@ -212,53 +202,6 @@ public class CustomerManagementController {
|
||||
if (contact != null && !contact.trim().isEmpty()) {
|
||||
queryWrapper.like(CustomerManagement::getContact, contact);
|
||||
}
|
||||
if (dealershipId != null && !dealershipId.trim().isEmpty()) {
|
||||
queryWrapper.eq(CustomerManagement::getDealershipId, dealershipId);
|
||||
}
|
||||
|
||||
// 添加时间范围查询条件
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
if (createStartTime != null && !createStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
LocalDateTime startTime = LocalDateTime.parse(createStartTime, formatter);
|
||||
queryWrapper.ge(CustomerManagement::getCreateTime, startTime);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建开始时间格式错误,请使用格式:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (createEndTime != null && !createEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
LocalDateTime endTime = LocalDateTime.parse(createEndTime, formatter);
|
||||
queryWrapper.le(CustomerManagement::getCreateTime, endTime);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "创建结束时间格式错误,请使用格式:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateStartTime != null && !updateStartTime.trim().isEmpty()) {
|
||||
try {
|
||||
LocalDateTime startTime = LocalDateTime.parse(updateStartTime, formatter);
|
||||
queryWrapper.ge(CustomerManagement::getUpdateTime, startTime);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改开始时间格式错误,请使用格式:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
if (updateEndTime != null && !updateEndTime.trim().isEmpty()) {
|
||||
try {
|
||||
LocalDateTime endTime = LocalDateTime.parse(updateEndTime, formatter);
|
||||
queryWrapper.le(CustomerManagement::getUpdateTime, endTime);
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "修改结束时间格式错误,请使用格式:yyyy-MM-dd HH:mm:ss");
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
|
||||
// 按创建时间倒序排列
|
||||
queryWrapper.orderByDesc(CustomerManagement::getUpdateTime);
|
||||
|
||||
@@ -436,7 +379,7 @@ public class CustomerManagementController {
|
||||
audio.setDealershipId(customer.getDealershipId());
|
||||
audio.setDealershipName(customer.getDealershipName());
|
||||
audio.setIntentionLevel(customer.getIntendedModel());
|
||||
audio.setRemarks(customer.getRemark());
|
||||
audio.setRemarks(customer.getDetailedAddress());
|
||||
audio.setInfoCarddescription(customer.getInfoCard());
|
||||
audio.setCompanyType(customer.getCustomerSource());
|
||||
audio.setServiceStatus(AudioManagementConstants.SERVICE_STATUS_IN_SERVICE);
|
||||
|
||||
Reference in New Issue
Block a user