add:添加真人数字人

This commit is contained in:
Maxchen
2025-10-27 14:04:42 +08:00
parent e12e4c4669
commit 0d403b6725
12 changed files with 1103 additions and 5 deletions

View File

@@ -18,6 +18,7 @@
<properties>
<easyexcel.version>3.2.1</easyexcel.version>
<jna.version>5.13.0</jna.version>
</properties>
<!-- 按照用户要求,不添加任何依赖 -->
@@ -70,5 +71,18 @@
<groupId>org.ruoyi</groupId>
<artifactId>ruoyi-common-excel</artifactId>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>${jna.version}</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>${jna.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,157 @@
package org.ruoyi.aihuman.controller;
import java.util.List;
import cn.dev33.satoken.annotation.SaIgnore;
import lombok.RequiredArgsConstructor;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.*;
import cn.dev33.satoken.annotation.SaCheckPermission;
import org.ruoyi.common.log.enums.OperatorType;
import org.springframework.web.bind.annotation.*;
import org.springframework.validation.annotation.Validated;
import org.ruoyi.common.idempotent.annotation.RepeatSubmit;
import org.ruoyi.common.log.annotation.Log;
import org.ruoyi.common.web.core.BaseController;
import org.ruoyi.core.page.PageQuery;
import org.ruoyi.common.core.domain.R;
import org.ruoyi.common.core.validate.AddGroup;
import org.ruoyi.common.core.validate.EditGroup;
import org.ruoyi.common.log.enums.BusinessType;
import org.ruoyi.common.excel.utils.ExcelUtil;
import org.ruoyi.aihuman.domain.vo.AihumanRealConfigVo;
import org.ruoyi.aihuman.domain.bo.AihumanRealConfigBo;
import org.ruoyi.aihuman.service.AihumanRealConfigService;
import org.ruoyi.core.page.TableDataInfo;
/**
* 真人交互数字人配置
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
//临时免登录
@SaIgnore
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/aihuman/aihumanRealConfig")
public class AihumanRealConfigController extends BaseController {
private final AihumanRealConfigService aihumanRealConfigService;
/**
* 查询真人交互数字人配置列表
*/
@SaCheckPermission("aihuman:aihumanRealConfig:list")
@GetMapping("/list")
public TableDataInfo<AihumanRealConfigVo> list(AihumanRealConfigBo bo, PageQuery pageQuery) {
return aihumanRealConfigService.queryPageList(bo, pageQuery);
}
/**
* 导出真人交互数字人配置列表
*/
@SaCheckPermission("aihuman:aihumanRealConfig:export")
@Log(title = "真人交互数字人配置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(AihumanRealConfigBo bo, HttpServletResponse response) {
List<AihumanRealConfigVo> list = aihumanRealConfigService.queryList(bo);
ExcelUtil.exportExcel(list, "真人交互数字人配置", AihumanRealConfigVo.class, response);
}
/**
* 获取真人交互数字人配置详细信息
*
* @param id 主键
*/
@SaCheckPermission("aihuman:aihumanRealConfig:query")
@GetMapping("/{id}")
public R<AihumanRealConfigVo> getInfo(@NotNull(message = "主键不能为空")
@PathVariable Integer id) {
return R.ok(aihumanRealConfigService.queryById(id));
}
/**
* 新增真人交互数字人配置
*/
@SaCheckPermission("aihuman:aihumanRealConfig:add")
@Log(title = "真人交互数字人配置", businessType = BusinessType.INSERT)
@RepeatSubmit()
@PostMapping()
public R<Void> add(@Validated(AddGroup.class) @RequestBody AihumanRealConfigBo bo) {
return toAjax(aihumanRealConfigService.insertByBo(bo));
}
/**
* 修改真人交互数字人配置
*/
@SaCheckPermission("aihuman:aihumanRealConfig:edit")
@Log(title = "真人交互数字人配置", businessType = BusinessType.UPDATE)
@RepeatSubmit()
@PutMapping()
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AihumanRealConfigBo bo) {
return toAjax(aihumanRealConfigService.updateByBo(bo));
}
/**
* 删除真人交互数字人配置
*
* @param ids 主键串
*/
@SaCheckPermission("aihuman:aihumanRealConfig:remove")
@Log(title = "真人交互数字人配置", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R<Void> remove(@NotEmpty(message = "主键不能为空")
@PathVariable Integer[] ids) {
return toAjax(aihumanRealConfigService.deleteWithValidByIds(List.of(ids), true));
}
/**
* 1.执行以下命令:
* cd F:\Projects\AI-Human\LiveTalking
* conda activate D:\zg117\C\Users\zg117\.conda\envs\livetalking_new
* python app.py --transport webrtc --model wav2lip --avatar_id wav2lip256_avatar1
*
* 2.监听 python app.py --transport webrtc --model wav2lip --avatar_id wav2lip256_avatar1 执行情况
*
* 3.返回执行结果并打开页面
* http://127.0.0.1:8010/webrtcapi-diy.html
*/
@SaCheckPermission("aihuman:aihumanRealConfig:run")
//@Log(title = "真人交互数字人配置", businessType = BusinessType.UPDATE, operatorType = OperatorType.OTHER)
@RepeatSubmit()
@PutMapping("/run")
public R<String> run(@Validated(EditGroup.class) @RequestBody AihumanRealConfigBo bo) {
boolean result = aihumanRealConfigService.runByBo(bo);
if (result) {
// 返回前端页面URL前端可以根据这个URL跳转或打开新页面
// http://127.0.0.1:8010/webrtcapi-diy.html 其中的 http://127.0.0.1 获取当前java服务的IP地址
// return R.ok("http://127.0.0.1:8010/webrtcapi-diy.html");
// 运行状态
bo.setRunStatus("1");
return R.ok("http://127.0.0.1:8010/webrtcapi-diy.html");
} else {
return R.fail("启动真人交互数字人失败");
}
}
/**
* 停止真人交互数字人配置任务
*/
@SaCheckPermission("aihuman:aihumanRealConfig:stop")
//@Log(title = "真人交互数字人配置", businessType = BusinessType.UPDATE, operatorType = OperatorType.OTHER)
@RepeatSubmit()
@PutMapping("/stop")
public R<String> stop(@Validated(EditGroup.class) @RequestBody AihumanRealConfigBo bo) {
boolean result = aihumanRealConfigService.stopByBo(bo);
if (result) {
// 运行状态
bo.setRunStatus("0");
return R.ok("真人交互数字人任务已停止");
} else {
return R.fail("停止真人交互数字人任务失败或没有正在运行的任务");
}
}
}

View File

@@ -0,0 +1,101 @@
package org.ruoyi.aihuman.domain;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* 真人交互数字人配置对象 aihuman_real_config
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
@Data
@TableName("aihuman_real_config")
public class AihumanRealConfig implements Serializable {
/**
* 主键id
*/
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
/**
* 场景名称
*/
private String name;
/**
* 真人形象名称
*/
private String avatars;
/**
* 模型名称
*/
private String models;
/**
* 形象参数(预留)
*/
private String avatarsParams;
/**
* 模型参数(预留)
*/
private String modelsParams;
/**
* 智能体参数(扣子)
*/
private String agentParams;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 状态
*/
private Integer status;
/**
* 发布状态
*/
private Integer publish;
/**
* 运行参数
*/
private String runParams;
/**
* 运行状态
*/
private String runStatus;
/**
* 创建部门
*/
private String createDept;
/**
* 创建用户
*/
private String createBy;
/**
* 更新用户
*/
private String updateBy;
}

View File

@@ -0,0 +1,87 @@
package org.ruoyi.aihuman.domain.bo;
import org.ruoyi.aihuman.domain.AihumanRealConfig;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.time.LocalDateTime;
import java.io.Serializable;
/**
* 真人交互数字人配置业务对象 aihuman_real_config
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
@Data
@AutoMapper(target = AihumanRealConfig.class, reverseConvertGenerate = false)
public class AihumanRealConfigBo implements Serializable {
private Integer id;
/**
* 场景名称
*/
private String name;
/**
* 真人形象名称
*/
private String avatars;
/**
* 模型名称
*/
private String models;
/**
* 形象参数(预留)
*/
private String avatarsParams;
/**
* 模型参数(预留)
*/
private String modelsParams;
/**
* 智能体参数(扣子)
*/
private String agentParams;
/**
* 创建时间
*/
private LocalDateTime createTime;
/**
* 更新时间
*/
private LocalDateTime updateTime;
/**
* 状态
*/
private Integer status;
/**
* 发布状态
*/
private Integer publish;
/**
* 运行参数
*/
private String runParams;
/**
* 运行状态
*/
private String runStatus;
/**
* 创建部门
*/
private String createDept;
/**
* 创建用户
*/
private String createBy;
/**
* 更新用户
*/
private String updateBy;
}

View File

@@ -0,0 +1,108 @@
package org.ruoyi.aihuman.domain.vo;
import java.time.LocalDateTime;
import java.io.Serializable;
import org.ruoyi.aihuman.domain.AihumanRealConfig;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import org.ruoyi.common.excel.annotation.ExcelDictFormat;
import org.ruoyi.common.excel.convert.ExcelDictConvert;
/**
* 真人交互数字人配置视图对象 aihuman_real_config
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = AihumanRealConfig.class)
public class AihumanRealConfigVo implements Serializable {
private Integer id;
/**
* 场景名称
*/
@ExcelProperty(value = "场景名称")
private String name;
/**
* 真人形象名称
*/
@ExcelProperty(value = "真人形象名称")
private String avatars;
/**
* 模型名称
*/
@ExcelProperty(value = "模型名称")
private String models;
/**
* 形象参数(预留)
*/
@ExcelProperty(value = "形象参数", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
private String avatarsParams;
/**
* 模型参数(预留)
*/
@ExcelProperty(value = "模型参数", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
private String modelsParams;
/**
* 智能体参数(扣子)
*/
@ExcelProperty(value = "智能体参数", converter = ExcelDictConvert.class)
@ExcelDictFormat(readConverterExp = "$column.readConverterExp()")
private String agentParams;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;
/**
* 更新时间
*/
@ExcelProperty(value = "更新时间")
private LocalDateTime updateTime;
/**
* 状态
*/
@ExcelProperty(value = "状态")
private Integer status;
/**
* 发布状态
*/
@ExcelProperty(value = "发布状态")
private Integer publish;
/**
* 运行参数
*/
@ExcelProperty(value = "运行参数")
private String runParams;
/**
* 运行状态
*/
@ExcelProperty(value = "运行状态")
private String runStatus;
/**
* 创建部门
*/
@ExcelProperty(value = "创建部门")
private String createDept;
/**
* 创建用户
*/
@ExcelProperty(value = "创建用户")
private String createBy;
/**
* 更新用户
*/
@ExcelProperty(value = "更新用户")
private String updateBy;
}

View File

@@ -0,0 +1,17 @@
package org.ruoyi.aihuman.mapper;
import org.ruoyi.aihuman.domain.AihumanRealConfig;
import org.ruoyi.aihuman.domain.vo.AihumanRealConfigVo;
import org.ruoyi.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
/**
* 真人交互数字人配置Mapper接口
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
@Mapper
public interface AihumanRealConfigMapper extends BaseMapperPlus<AihumanRealConfig, AihumanRealConfigVo> {
}

View File

@@ -0,0 +1,56 @@
package org.ruoyi.aihuman.service;
import org.ruoyi.aihuman.domain.vo.AihumanRealConfigVo;
import org.ruoyi.aihuman.domain.bo.AihumanRealConfigBo;
import org.ruoyi.core.page.TableDataInfo;
import org.ruoyi.core.page.PageQuery;
import java.util.Collection;
import java.util.List;
/**
* 真人交互数字人配置Service接口
*
* @author ageerle
* @date Tue Oct 21 11:46:52 GMT+08:00 2025
*/
public interface AihumanRealConfigService {
/**
* 查询真人交互数字人配置
*/
AihumanRealConfigVo queryById(Integer id);
/**
* 查询真人交互数字人配置列表
*/
TableDataInfo<AihumanRealConfigVo> queryPageList(AihumanRealConfigBo bo, PageQuery pageQuery);
/**
* 查询真人交互数字人配置列表
*/
List<AihumanRealConfigVo> queryList(AihumanRealConfigBo bo);
/**
* 新增真人交互数字人配置
*/
Boolean insertByBo(AihumanRealConfigBo bo);
/**
* 修改真人交互数字人配置
*/
Boolean updateByBo(AihumanRealConfigBo bo);
/**
* 执行真人交互数字人配置
*/
Boolean runByBo(AihumanRealConfigBo bo);
/**
* 校验并批量删除真人交互数字人配置信息
*/
Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid);
// 在AihumanRealConfigService接口中添加
Boolean stopByBo(AihumanRealConfigBo bo);
}

View File

@@ -0,0 +1,19 @@
-- 菜单 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051584, '真人交互数字人配置', '2000', '1', 'aihumanRealConfig', 'aihuman/aihumanRealConfig/index', 1, 0, 'C', '0', '0', 'aihuman:aihumanRealConfig:list', '#', 103, 1, sysdate(), null, null, '真人交互数字人配置菜单');
-- 按钮 SQL
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051585, '真人交互数字人配置查询', 1980480880138051584, '1', '#', '', 1, 0, 'F', '0', '0', 'aihuman:aihumanRealConfig:query', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051586, '真人交互数字人配置新增', 1980480880138051584, '2', '#', '', 1, 0, 'F', '0', '0', 'aihuman:aihumanRealConfig:add', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051587, '真人交互数字人配置修改', 1980480880138051584, '3', '#', '', 1, 0, 'F', '0', '0', 'aihuman:aihumanRealConfig:edit', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051588, '真人交互数字人配置删除', 1980480880138051584, '4', '#', '', 1, 0, 'F', '0', '0', 'aihuman:aihumanRealConfig:remove', '#', 103, 1, sysdate(), null, null, '');
insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_dept, create_by, create_time, update_by, update_time, remark)
values(1980480880138051589, '真人交互数字人配置导出', 1980480880138051584, '5', '#', '', 1, 0, 'F', '0', '0', 'aihuman:aihumanRealConfig:export', '#', 103, 1, sysdate(), null, null, '');

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.ruoyi.aihuman.mapper.AihumanRealConfigMapper">
</mapper>

View File

@@ -3,8 +3,8 @@ gen:
# 作者
author: ageerle
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
packageName: org.ruoyi.system
packageName: org.ruoyi.aihuman
# 自动去除表前缀默认是false
autoRemovePre: false
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
tablePrefix: aihuman_