录音时长统计修改
This commit is contained in:
@@ -140,5 +140,6 @@ hikari:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class AudioStatisticsController {
|
|||||||
* 查询指定销售人员的统计数据
|
* 查询指定销售人员的统计数据
|
||||||
*/
|
*/
|
||||||
@Operation(summary = "查询指定销售人员的统计数据", description = "根据销售人员ID或电话号码查询指定日期范围内的录音统计数据")
|
@Operation(summary = "查询指定销售人员的统计数据", description = "根据销售人员ID或电话号码查询指定日期范围内的录音统计数据")
|
||||||
@GetMapping("/sales")
|
@PostMapping("/sales")
|
||||||
public Result<?> getStatisticsBySales(
|
public Result<?> getStatisticsBySales(
|
||||||
@Parameter(description = "销售人员ID")
|
@Parameter(description = "销售人员ID")
|
||||||
@RequestParam(required = false) String salesId,
|
@RequestParam(required = false) String salesId,
|
||||||
@@ -141,27 +141,7 @@ public class AudioStatisticsController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询指定项目的统计数据
|
|
||||||
*/
|
|
||||||
@Operation(summary = "查询指定项目的统计数据", description = "查询指定项目在指定日期范围内的录音统计数据")
|
|
||||||
@GetMapping("/project/{projectId}")
|
|
||||||
public Result<?> getStatisticsByProject(
|
|
||||||
@Parameter(description = "项目ID")
|
|
||||||
@PathVariable String projectId,
|
|
||||||
@Parameter(description = "开始日期,格式:yyyy-MM-dd")
|
|
||||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate,
|
|
||||||
@Parameter(description = "结束日期,格式:yyyy-MM-dd")
|
|
||||||
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate) {
|
|
||||||
try {
|
|
||||||
List<AudioManagementStatistics> statistics = audioStatisticsService.getStatisticsByProject(projectId, startDate, endDate);
|
|
||||||
Result<?> result = Result.ok(statistics);
|
|
||||||
result.setMsg("查询成功");
|
|
||||||
return result;
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Result.error("查询失败:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询指定日期的统计数据
|
* 查询指定日期的统计数据
|
||||||
|
|||||||
@@ -61,42 +61,18 @@ public class AudioManagementStatistics implements Serializable {
|
|||||||
@TableField("sales_id")
|
@TableField("sales_id")
|
||||||
private String salesId;
|
private String salesId;
|
||||||
|
|
||||||
@Schema(description = "销售人员姓名")
|
|
||||||
@TableField("sales_name")
|
|
||||||
private String salesName;
|
|
||||||
|
|
||||||
@Schema(description = "销售人员录音总时长(分钟)")
|
@Schema(description = "销售人员录音总时长(分钟)")
|
||||||
@TableField("sales_total_duration")
|
@TableField("personal_total_duration")
|
||||||
private Long salesTotalDuration;
|
private Long salesTotalDuration;
|
||||||
|
|
||||||
@Schema(description = "销售人员录音数量")
|
@Schema(description = "销售人员录音数量")
|
||||||
@TableField("sales_recording_count")
|
@TableField("personal_recording_count")
|
||||||
private Integer salesRecordingCount;
|
private Integer salesRecordingCount;
|
||||||
|
|
||||||
@Schema(description = "销售人员录音平均时长(分钟)")
|
@Schema(description = "销售人员录音平均时长(分钟)")
|
||||||
@TableField("sales_avg_duration")
|
@TableField("personal_avg_duration")
|
||||||
private BigDecimal salesAvgDuration;
|
private BigDecimal salesAvgDuration;
|
||||||
|
|
||||||
@Schema(description = "项目ID")
|
|
||||||
@TableField("project_id")
|
|
||||||
private String projectId;
|
|
||||||
|
|
||||||
@Schema(description = "项目名称")
|
|
||||||
@TableField("project_name")
|
|
||||||
private String projectName;
|
|
||||||
|
|
||||||
@Schema(description = "项目录音总时长(分钟)")
|
|
||||||
@TableField("project_total_duration")
|
|
||||||
private Long projectTotalDuration;
|
|
||||||
|
|
||||||
@Schema(description = "项目录音数量")
|
|
||||||
@TableField("project_recording_count")
|
|
||||||
private Integer projectRecordingCount;
|
|
||||||
|
|
||||||
@Schema(description = "项目录音平均时长(分钟)")
|
|
||||||
@TableField("project_avg_duration")
|
|
||||||
private BigDecimal projectAvgDuration;
|
|
||||||
|
|
||||||
@Schema(description = "统计日期")
|
@Schema(description = "统计日期")
|
||||||
@TableField("statistics_date")
|
@TableField("statistics_date")
|
||||||
private LocalDate statisticsDate;
|
private LocalDate statisticsDate;
|
||||||
|
|||||||
@@ -124,37 +124,6 @@ public class AudioStatisticsExample {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 示例5:查询指定项目的统计数据
|
|
||||||
*/
|
|
||||||
public void exampleQueryProjectStatistics() {
|
|
||||||
System.out.println("=== 示例5:查询指定项目的统计数据 ===");
|
|
||||||
|
|
||||||
String projectId = "project001"; // 假设项目ID
|
|
||||||
LocalDate startDate = LocalDate.now().minusDays(30); // 最近30天
|
|
||||||
LocalDate endDate = LocalDate.now().minusDays(1);
|
|
||||||
|
|
||||||
List<AudioManagementStatistics> statistics = audioStatisticsService.getStatisticsByProject(projectId, startDate, endDate);
|
|
||||||
|
|
||||||
System.out.println("项目ID: " + projectId);
|
|
||||||
System.out.println("查询到统计记录数: " + statistics.size());
|
|
||||||
|
|
||||||
// 计算该项目的总统计
|
|
||||||
long totalDuration = 0;
|
|
||||||
int totalCount = 0;
|
|
||||||
|
|
||||||
for (AudioManagementStatistics stat : statistics) {
|
|
||||||
totalDuration += stat.getProjectTotalDuration();
|
|
||||||
totalCount += stat.getProjectRecordingCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("项目总录音时长: " + totalDuration + "秒");
|
|
||||||
System.out.println("项目总录音数量: " + totalCount);
|
|
||||||
if (totalCount > 0) {
|
|
||||||
System.out.println("项目平均录音时长: " + (totalDuration / totalCount) + "秒");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 示例6:批量生成历史统计数据
|
* 示例6:批量生成历史统计数据
|
||||||
*/
|
*/
|
||||||
@@ -179,37 +148,5 @@ public class AudioStatisticsExample {
|
|||||||
System.out.println("批量生成完成,总记录数: " + totalCount);
|
System.out.println("批量生成完成,总记录数: " + totalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 运行所有示例
|
|
||||||
*/
|
|
||||||
public void runAllExamples() {
|
|
||||||
System.out.println("开始运行门店录音统计功能示例...");
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
try {
|
|
||||||
exampleGenerateStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
exampleQueryRecentStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
exampleQueryDealershipStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
exampleQuerySalesStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
exampleQueryProjectStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
exampleBatchGenerateStatistics();
|
|
||||||
System.out.println();
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("示例运行失败: " + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("示例运行完成!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public interface AudioManagementStatisticsMapper extends BaseMapper<AudioManagem
|
|||||||
*/
|
*/
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
"sales_id, " +
|
"sales_id, " +
|
||||||
"sales_name, " +
|
|
||||||
"SUM(duration) as total_duration_minutes, " +
|
"SUM(duration) as total_duration_minutes, " +
|
||||||
"COUNT(*) as recording_count, " +
|
"COUNT(*) as recording_count, " +
|
||||||
"AVG(duration) as avg_duration_minutes " +
|
"AVG(duration) as avg_duration_minutes " +
|
||||||
@@ -54,27 +53,9 @@ public interface AudioManagementStatisticsMapper extends BaseMapper<AudioManagem
|
|||||||
"WHERE DATE(recording_time) = #{date} " +
|
"WHERE DATE(recording_time) = #{date} " +
|
||||||
"AND sales_id IS NOT NULL " +
|
"AND sales_id IS NOT NULL " +
|
||||||
"AND sales_id != '' " +
|
"AND sales_id != '' " +
|
||||||
"GROUP BY sales_id, sales_name")
|
"GROUP BY sales_id")
|
||||||
List<Map<String, Object>> getSalesStatisticsByDate(@Param("date") LocalDate date);
|
List<Map<String, Object>> getSalesStatisticsByDate(@Param("date") LocalDate date);
|
||||||
|
|
||||||
/**
|
|
||||||
* 按项目统计指定日期的录音数据
|
|
||||||
* @param date 统计日期
|
|
||||||
* @return 项目统计结果列表
|
|
||||||
*/
|
|
||||||
@Select("SELECT " +
|
|
||||||
"project_id, " +
|
|
||||||
"project_name, " +
|
|
||||||
"SUM(duration) as total_duration_minutes, " +
|
|
||||||
"COUNT(*) as recording_count, " +
|
|
||||||
"AVG(duration) as avg_duration_minutes " +
|
|
||||||
"FROM audio_management " +
|
|
||||||
"WHERE DATE(recording_time) = #{date} " +
|
|
||||||
"AND project_id IS NOT NULL " +
|
|
||||||
"AND project_id != '' " +
|
|
||||||
"GROUP BY project_id, project_name")
|
|
||||||
List<Map<String, Object>> getProjectStatisticsByDate(@Param("date") LocalDate date);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查指定日期的统计数据是否已存在
|
* 检查指定日期的统计数据是否已存在
|
||||||
* @param date 统计日期
|
* @param date 统计日期
|
||||||
@@ -99,12 +80,11 @@ public interface AudioManagementStatisticsMapper extends BaseMapper<AudioManagem
|
|||||||
*/
|
*/
|
||||||
@Select("SELECT " +
|
@Select("SELECT " +
|
||||||
"sales_id, " +
|
"sales_id, " +
|
||||||
"MAX(sales_name) as sales_name, " +
|
"SUM(personal_total_duration) as total_duration, " +
|
||||||
"SUM(sales_total_duration) as total_duration, " +
|
"SUM(personal_recording_count) as total_count, " +
|
||||||
"SUM(sales_recording_count) as total_count, " +
|
|
||||||
"CASE " +
|
"CASE " +
|
||||||
" WHEN SUM(sales_recording_count) > 0 THEN " +
|
" WHEN SUM(personal_recording_count) > 0 THEN " +
|
||||||
" ROUND(SUM(sales_total_duration) / SUM(sales_recording_count), 2) " +
|
" ROUND(SUM(personal_total_duration) / SUM(personal_recording_count), 2) " +
|
||||||
" ELSE 0 " +
|
" ELSE 0 " +
|
||||||
"END as avg_duration " +
|
"END as avg_duration " +
|
||||||
"FROM audio_management_statistics " +
|
"FROM audio_management_statistics " +
|
||||||
|
|||||||
@@ -64,13 +64,4 @@ public interface IAudioManagementStatisticsService extends IService<AudioManagem
|
|||||||
* @return 统计记录列表
|
* @return 统计记录列表
|
||||||
*/
|
*/
|
||||||
List<AudioManagementStatistics> getStatisticsBySales(String salesId, String salesPhone, LocalDate startDate, LocalDate endDate);
|
List<AudioManagementStatistics> getStatisticsBySales(String salesId, String salesPhone, LocalDate startDate, LocalDate endDate);
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询指定项目的统计数据
|
|
||||||
* @param projectId 项目ID
|
|
||||||
* @param startDate 开始日期
|
|
||||||
* @param endDate 结束日期
|
|
||||||
* @return 统计记录列表
|
|
||||||
*/
|
|
||||||
List<AudioManagementStatistics> getStatisticsByProject(String projectId, LocalDate startDate, LocalDate endDate);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
// 查询该日期的销售人员录音统计数据
|
// 查询该日期的销售人员录音统计数据
|
||||||
List<Map<String, Object>> salesStatsList = baseMapper.getSalesStatisticsByDate(date);
|
List<Map<String, Object>> salesStatsList = baseMapper.getSalesStatisticsByDate(date);
|
||||||
|
|
||||||
// 查询该日期的项目录音统计数据
|
|
||||||
List<Map<String, Object>> projectStatsList = baseMapper.getProjectStatisticsByDate(date);
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
// 处理门店统计数据
|
// 处理门店统计数据
|
||||||
@@ -102,9 +99,6 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
Object salesIdObj = salesStat.get("sales_id");
|
Object salesIdObj = salesStat.get("sales_id");
|
||||||
statistics.setSalesId(salesIdObj != null ? salesIdObj.toString() : "");
|
statistics.setSalesId(salesIdObj != null ? salesIdObj.toString() : "");
|
||||||
|
|
||||||
Object salesNameObj = salesStat.get("sales_name");
|
|
||||||
statistics.setSalesName(salesNameObj != null ? salesNameObj.toString() : "未知销售");
|
|
||||||
|
|
||||||
// 设置销售人员录音统计数据
|
// 设置销售人员录音统计数据
|
||||||
Object salesTotalDurationObj = salesStat.get("total_duration_minutes");
|
Object salesTotalDurationObj = salesStat.get("total_duration_minutes");
|
||||||
if (salesTotalDurationObj != null) {
|
if (salesTotalDurationObj != null) {
|
||||||
@@ -131,56 +125,11 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
} else {
|
} else {
|
||||||
// 如果没有找到对应的销售人员数据,设置为空
|
// 如果没有找到对应的销售人员数据,设置为空
|
||||||
statistics.setSalesId("");
|
statistics.setSalesId("");
|
||||||
statistics.setSalesName("");
|
|
||||||
statistics.setSalesTotalDuration(0L);
|
statistics.setSalesTotalDuration(0L);
|
||||||
statistics.setSalesRecordingCount(0);
|
statistics.setSalesRecordingCount(0);
|
||||||
statistics.setSalesAvgDuration(BigDecimal.ZERO);
|
statistics.setSalesAvgDuration(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查找该门店对应的项目统计数据
|
|
||||||
String dealershipIdForProject = dealershipIdObj != null ? dealershipIdObj.toString() : "";
|
|
||||||
Map<String, Object> projectStat = findProjectStatByDealership(projectStatsList, dealershipIdForProject);
|
|
||||||
|
|
||||||
if (projectStat != null) {
|
|
||||||
// 设置项目信息
|
|
||||||
Object projectIdObj = projectStat.get("project_id");
|
|
||||||
statistics.setProjectId(projectIdObj != null ? projectIdObj.toString() : "");
|
|
||||||
|
|
||||||
Object projectNameObj = projectStat.get("project_name");
|
|
||||||
statistics.setProjectName(projectNameObj != null ? projectNameObj.toString() : "未知项目");
|
|
||||||
|
|
||||||
// 设置项目录音统计数据
|
|
||||||
Object projectTotalDurationObj = projectStat.get("total_duration_minutes");
|
|
||||||
if (projectTotalDurationObj != null) {
|
|
||||||
statistics.setProjectTotalDuration(Long.valueOf(projectTotalDurationObj.toString()));
|
|
||||||
} else {
|
|
||||||
statistics.setProjectTotalDuration(0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object projectRecordingCountObj = projectStat.get("recording_count");
|
|
||||||
if (projectRecordingCountObj != null) {
|
|
||||||
statistics.setProjectRecordingCount(Integer.valueOf(projectRecordingCountObj.toString()));
|
|
||||||
} else {
|
|
||||||
statistics.setProjectRecordingCount(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 计算项目平均时长
|
|
||||||
if (statistics.getProjectRecordingCount() > 0 && statistics.getProjectTotalDuration() > 0) {
|
|
||||||
BigDecimal projectAvgDuration = BigDecimal.valueOf(statistics.getProjectTotalDuration())
|
|
||||||
.divide(BigDecimal.valueOf(statistics.getProjectRecordingCount()), 2, RoundingMode.HALF_UP);
|
|
||||||
statistics.setProjectAvgDuration(projectAvgDuration);
|
|
||||||
} else {
|
|
||||||
statistics.setProjectAvgDuration(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 如果没有找到对应的项目数据,设置为空
|
|
||||||
statistics.setProjectId("");
|
|
||||||
statistics.setProjectName("");
|
|
||||||
statistics.setProjectTotalDuration(0L);
|
|
||||||
statistics.setProjectRecordingCount(0);
|
|
||||||
statistics.setProjectAvgDuration(BigDecimal.ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置统计日期和时间
|
// 设置统计日期和时间
|
||||||
statistics.setStatisticsDate(date);
|
statistics.setStatisticsDate(date);
|
||||||
statistics.setCreatedAt(LocalDateTime.now());
|
statistics.setCreatedAt(LocalDateTime.now());
|
||||||
@@ -210,22 +159,6 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据门店ID查找对应的项目统计数据
|
|
||||||
* @param projectStatsList 项目统计列表
|
|
||||||
* @param dealershipId 门店ID
|
|
||||||
* @return 项目统计数据
|
|
||||||
*/
|
|
||||||
private Map<String, Object> findProjectStatByDealership(List<Map<String, Object>> projectStatsList, String dealershipId) {
|
|
||||||
// 这里需要根据业务逻辑来确定门店和项目的对应关系
|
|
||||||
// 由于原始数据中可能没有直接的关联关系,这里返回第一个项目数据作为示例
|
|
||||||
// 实际使用时需要根据具体的业务逻辑来调整
|
|
||||||
if (!projectStatsList.isEmpty()) {
|
|
||||||
return projectStatsList.get(0);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int generateYesterdayStatistics() {
|
public int generateYesterdayStatistics() {
|
||||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
@@ -302,7 +235,6 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
Long totalDuration = null;
|
Long totalDuration = null;
|
||||||
Integer totalCount = null;
|
Integer totalCount = null;
|
||||||
BigDecimal avgDuration = null;
|
BigDecimal avgDuration = null;
|
||||||
String salesName = null;
|
|
||||||
|
|
||||||
// 获取总录音时长
|
// 获取总录音时长
|
||||||
Object totalDurationObj = aggregateResult.get("total_duration");
|
Object totalDurationObj = aggregateResult.get("total_duration");
|
||||||
@@ -322,12 +254,6 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
avgDuration = new BigDecimal(avgDurationObj.toString());
|
avgDuration = new BigDecimal(avgDurationObj.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取销售人员姓名
|
|
||||||
Object salesNameObj = aggregateResult.get("sales_name");
|
|
||||||
if (salesNameObj != null) {
|
|
||||||
salesName = salesNameObj.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 将聚合统计结果设置到每条记录上
|
// 将聚合统计结果设置到每条记录上
|
||||||
for (AudioManagementStatistics stat : statisticsList) {
|
for (AudioManagementStatistics stat : statisticsList) {
|
||||||
// 设置总录音时长(汇总)
|
// 设置总录音时长(汇总)
|
||||||
@@ -346,23 +272,9 @@ public class AudioManagementStatisticsServiceImpl extends ServiceImpl<AudioManag
|
|||||||
} else {
|
} else {
|
||||||
stat.setSalesAvgDuration(BigDecimal.ZERO);
|
stat.setSalesAvgDuration(BigDecimal.ZERO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果聚合结果中有销售人员姓名,且当前记录没有,则设置
|
|
||||||
if (salesName != null && (stat.getSalesName() == null || stat.getSalesName().isEmpty())) {
|
|
||||||
stat.setSalesName(salesName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return statisticsList;
|
return statisticsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<AudioManagementStatistics> getStatisticsByProject(String projectId, LocalDate startDate, LocalDate endDate) {
|
|
||||||
LambdaQueryWrapper<AudioManagementStatistics> queryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
queryWrapper.eq(AudioManagementStatistics::getProjectId, projectId)
|
|
||||||
.between(AudioManagementStatistics::getStatisticsDate, startDate, endDate)
|
|
||||||
.orderByAsc(AudioManagementStatistics::getStatisticsDate);
|
|
||||||
return list(queryWrapper);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
spring.application.name=Langchain4j-cst20250803
|
|
||||||
|
|||||||
@@ -224,10 +224,10 @@ springdoc:
|
|||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
api:
|
api:
|
||||||
base-url: http://localhost:8090
|
base-url: http://localhost:8091
|
||||||
# http://localhost:9060/swagger-ui/index.html?urls.primaryName=public-api
|
# http://localhost:9060/swagger-ui/index.html?urls.primaryName=public-api
|
||||||
server:
|
server:
|
||||||
port: 8090
|
port: 8091
|
||||||
|
|
||||||
# Dify API 配置
|
# Dify API 配置
|
||||||
dify:
|
dify:
|
||||||
|
|||||||
@@ -91,33 +91,11 @@ public class AudioManagementStatisticsServiceTest {
|
|||||||
|
|
||||||
// 打印销售人员统计信息
|
// 打印销售人员统计信息
|
||||||
for (AudioManagementStatistics stat : statistics) {
|
for (AudioManagementStatistics stat : statistics) {
|
||||||
System.out.println("销售人员: " + stat.getSalesName() +
|
System.out.println("销售人员ID: " + stat.getSalesId() +
|
||||||
", 日期: " + stat.getStatisticsDate() +
|
", 日期: " + stat.getStatisticsDate() +
|
||||||
", 录音数量: " + stat.getSalesRecordingCount() +
|
", 录音数量: " + stat.getSalesRecordingCount() +
|
||||||
", 总时长: " + stat.getSalesTotalDuration() + "秒" +
|
", 总时长: " + stat.getSalesTotalDuration() + "秒" +
|
||||||
", 平均时长: " + stat.getSalesAvgDuration() + "秒");
|
", 平均时长: " + stat.getSalesAvgDuration() + "秒");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testGetStatisticsByProject() {
|
|
||||||
// 测试查询指定项目的统计数据
|
|
||||||
String projectId = "project001"; // 假设项目ID
|
|
||||||
LocalDate startDate = LocalDate.now().minusDays(30); // 最近30天
|
|
||||||
LocalDate endDate = LocalDate.now().minusDays(1);
|
|
||||||
|
|
||||||
List<AudioManagementStatistics> statistics = audioStatisticsService.getStatisticsByProject(projectId, startDate, endDate);
|
|
||||||
|
|
||||||
assertNotNull(statistics, "统计列表不应该为null");
|
|
||||||
System.out.println("查询到项目统计记录数: " + statistics.size());
|
|
||||||
|
|
||||||
// 打印项目统计信息
|
|
||||||
for (AudioManagementStatistics stat : statistics) {
|
|
||||||
System.out.println("项目: " + stat.getProjectName() +
|
|
||||||
", 日期: " + stat.getStatisticsDate() +
|
|
||||||
", 录音数量: " + stat.getProjectRecordingCount() +
|
|
||||||
", 总时长: " + stat.getProjectTotalDuration() + "秒" +
|
|
||||||
", 平均时长: " + stat.getProjectAvgDuration() + "秒");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user