录音统计,代码优化
This commit is contained in:
@@ -3,6 +3,7 @@ package com.rj;
|
|||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -13,6 +14,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
*/
|
*/
|
||||||
@MapperScan("com.rj.mapper")
|
@MapperScan("com.rj.mapper")
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
public class Langchain4jHeima20250803Application {
|
public class Langchain4jHeima20250803Application {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -87,3 +87,4 @@ public class PasswordUtil {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,3 +71,4 @@ public class ServiceManager {
|
|||||||
return reservationService;
|
return reservationService;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -169,7 +169,6 @@ public class AudioManagementController {
|
|||||||
List<String> dealershipIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getDealershipId);
|
List<String> dealershipIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getDealershipId);
|
||||||
List<String> saleIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getSalesId);
|
List<String> saleIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getSalesId);
|
||||||
List<String> projectIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getProjectId);
|
List<String> projectIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getProjectId);
|
||||||
List<String> customerIds = DataEnrichmentUtil.extractIds(audioPage.getRecords(), AudioManagement::getCustomerId);
|
|
||||||
|
|
||||||
|
|
||||||
// 使用工具类批量获取关联数据
|
// 使用工具类批量获取关联数据
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.rj.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.rj.common.DataEnrichmentUtil;
|
||||||
|
import com.rj.entity.AudioManagement;
|
||||||
import com.rj.entity.VideoManagement;
|
import com.rj.entity.VideoManagement;
|
||||||
import com.rj.service.IVideoManagementService;
|
import com.rj.service.IVideoManagementService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
@@ -116,6 +118,11 @@ public class VideoManagementController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DataEnrichmentUtil dataEnrichmentUtil;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询视频列表
|
* 分页查询视频列表
|
||||||
*/
|
*/
|
||||||
@@ -157,7 +164,21 @@ public class VideoManagementController {
|
|||||||
queryWrapper.orderByDesc(VideoManagement::getCreateTime);
|
queryWrapper.orderByDesc(VideoManagement::getCreateTime);
|
||||||
|
|
||||||
Page<VideoManagement> videoPage = videoManagementService.page(page, queryWrapper);
|
Page<VideoManagement> videoPage = videoManagementService.page(page, queryWrapper);
|
||||||
|
|
||||||
|
// 使用工具类提取ID列表
|
||||||
|
List<String> dealershipIds = DataEnrichmentUtil.extractIds(videoPage.getRecords(), VideoManagement::getDealershipId);
|
||||||
|
List<String> salesIds = DataEnrichmentUtil.extractIds(videoPage.getRecords(), VideoManagement::getSalesId);
|
||||||
|
|
||||||
|
// 使用工具类批量获取关联数据
|
||||||
|
Map<String, String> dealershipNameMap = dataEnrichmentUtil.getDealershipIdNameMap(dealershipIds);
|
||||||
|
Map<String, String> saleNameMap = dataEnrichmentUtil.getSalesIdNameMap(salesIds);
|
||||||
|
|
||||||
|
videoPage.getRecords().forEach(video -> {
|
||||||
|
video.setDealershipName(dealershipNameMap.get(video.getDealershipId()));
|
||||||
|
video.setSalesName(saleNameMap.get(video.getSalesId()));
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
result.put("success", true);
|
result.put("success", true);
|
||||||
result.put("message", "查询成功");
|
result.put("message", "查询成功");
|
||||||
result.put("data", videoPage.getRecords());
|
result.put("data", videoPage.getRecords());
|
||||||
|
|||||||
@@ -170,3 +170,4 @@ public class AuthController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -309,3 +309,4 @@ public class MenuController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -279,3 +279,4 @@ public class RoleController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -285,3 +285,4 @@ public class UserRoleController {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,3 +36,4 @@ public class LoginResponse {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,3 +18,4 @@ public interface IMenuService extends IService<Menu> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,3 +18,4 @@ public interface IRoleService extends IService<Role> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,3 +18,4 @@ public interface IUserRoleService extends IService<UserRole> {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,3 +22,4 @@ public class UserRoleServiceImpl extends ServiceImpl<UserRoleMapper, UserRole> i
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,3 +23,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -24,3 +24,4 @@ INSERT INTO `user_role` (`user_id`, `role_id`) VALUES
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,3 +14,4 @@ WHERE `password` = 'e10adc3949ba59abbe56e057f20f883e';
|
|||||||
-- 为original_password字段添加索引(可选)
|
-- 为original_password字段添加索引(可选)
|
||||||
-- ALTER TABLE `user` ADD INDEX `idx_original_password` (`original_password`);
|
-- ALTER TABLE `user` ADD INDEX `idx_original_password` (`original_password`);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -73,3 +73,47 @@ CREATE TABLE `device_management` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备管理表';
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='设备管理表';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- 用于存储门店录音相关的统计数据
|
||||||
|
CREATE TABLE `recording_statistics` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||||
|
`dealership_id` bigint(20) NOT NULL COMMENT '门店ID',
|
||||||
|
`dealership_name` varchar(100) NOT NULL COMMENT '门店名称',
|
||||||
|
|
||||||
|
-- 门店录音总时长相关字段
|
||||||
|
`dealership_total_duration` bigint(20) NOT NULL DEFAULT 0 COMMENT '门店录音总时长(秒)',
|
||||||
|
`dealership_recording_count` int(11) NOT NULL DEFAULT 0 COMMENT '门店录音数量',
|
||||||
|
`dealership_avg_duration` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '门店录音平均时长(秒)',
|
||||||
|
|
||||||
|
-- 个人录音相关字段
|
||||||
|
`personal_total_duration` bigint(20) NOT NULL DEFAULT 0 COMMENT '个人录音总时长(秒)',
|
||||||
|
`personal_recording_count` int(11) NOT NULL DEFAULT 0 COMMENT '个人录音数量',
|
||||||
|
`personal_avg_duration` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '个人录音平均时长(秒)',
|
||||||
|
|
||||||
|
-- 项目录音相关字段
|
||||||
|
`project_recording_count` int(11) NOT NULL DEFAULT 0 COMMENT '项目录音总数',
|
||||||
|
`project_avg_duration` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '项目录音平均时长(秒)',
|
||||||
|
|
||||||
|
-- 统计日期
|
||||||
|
`statistics_date` date NOT NULL COMMENT '统计日期',
|
||||||
|
|
||||||
|
-- 时间戳字段
|
||||||
|
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||||
|
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_statistics_date` (`statistics_date`) COMMENT '统计日期索引',
|
||||||
|
KEY `idx_dealership_id` (`dealership_id`) COMMENT '门店ID索引',
|
||||||
|
KEY `idx_created_at` (`created_at`) COMMENT '创建时间索引'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='门店录音统计表';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user