基础结构修改,以及基础接口添加完善逻辑
This commit is contained in:
@@ -45,19 +45,6 @@ public class ChatWebSocketHandler {
|
||||
// @Value("${whisper.language}")
|
||||
private String language = "en";
|
||||
|
||||
/**
|
||||
* 16kHz
|
||||
*/
|
||||
private static final int SAMPLE_RATE = 16000;
|
||||
/**
|
||||
* 4 KB 每次读取
|
||||
*/
|
||||
private static final int BUFFER_SIZE = 4096;
|
||||
/**
|
||||
* 每样本 16 位
|
||||
*/
|
||||
private static final int BITS_PER_SAMPLE = 16;
|
||||
|
||||
/**
|
||||
* 缓存客户端流式解析的语音文本数据
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.vetti.web.controller.system;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
import com.vetti.common.utils.MessageUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -29,6 +31,7 @@ import com.vetti.system.service.ISysMenuService;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags ="登录模块")
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
@@ -53,6 +56,7 @@ public class SysLoginController
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation("登录方法")
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
@@ -69,6 +73,7 @@ public class SysLoginController
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@ApiOperation("获取用户信息")
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
@@ -84,11 +89,13 @@ public class SysLoginController
|
||||
tokenService.refreshToken(loginUser);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
ajax.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||
ajax.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||
Map mapInfo = new HashMap();
|
||||
mapInfo.put("user", user);
|
||||
mapInfo.put("roles", roles);
|
||||
mapInfo.put("permissions", permissions);
|
||||
mapInfo.put("isDefaultModifyPwd", initPasswordIsModify(user.getPwdUpdateDate()));
|
||||
mapInfo.put("isPasswordExpired", passwordIsExpiration(user.getPwdUpdateDate()));
|
||||
ajax.put("data", mapInfo);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@@ -97,6 +104,7 @@ public class SysLoginController
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@ApiOperation("获取路由信息")
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
@@ -128,4 +136,19 @@ public class SysLoginController
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 忘记密码
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ApiOperation("忘记密码")
|
||||
@PostMapping("/forgotPassword")
|
||||
public AjaxResult handlePassword(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
loginService.resetPassword(loginBody.getUsername(),loginBody.getPassword(),loginBody.getRepeatPassword(),loginBody.getCode(),loginBody.getUuid());
|
||||
return AjaxResult.success(MessageUtils.messageCustomize("systemCommonTip10001"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.vetti.web.controller.system;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -16,23 +18,19 @@ import com.vetti.system.service.ISysConfigService;
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Api(tags ="注册验证模块")
|
||||
@RestController
|
||||
public class SysRegisterController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SysRegisterService registerService;
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@ApiOperation("注册方法")
|
||||
@PostMapping("/register")
|
||||
public AjaxResult register(@RequestBody RegisterBody user)
|
||||
{
|
||||
if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser"))))
|
||||
{
|
||||
return error("当前系统没有开启注册功能!");
|
||||
}
|
||||
String msg = registerService.register(user);
|
||||
return StringUtils.isEmpty(msg) ? success() : error(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.vetti.web.controller.system;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.vetti.common.core.controller.BaseController;
|
||||
import com.vetti.common.core.domain.R;
|
||||
import com.vetti.common.exception.ServiceException;
|
||||
import com.vetti.common.service.verification.VerificationEmailService;
|
||||
import com.vetti.common.utils.MessageUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author ID
|
||||
* @date 2025/8/28 16:16
|
||||
*/
|
||||
@Api(tags ="邮箱验证码")
|
||||
@RestController
|
||||
@RequestMapping("/verificationEmail")
|
||||
@RequiredArgsConstructor
|
||||
public class VerificationEmailController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private final VerificationEmailService verificationEmailService;
|
||||
|
||||
|
||||
@ApiOperation("发送验证码(标题、内容走的配置文件)")
|
||||
@PostMapping("/send")
|
||||
public R sendVerificationCode(@RequestParam String email) {
|
||||
boolean isSent = verificationEmailService.sendVerificationEm7941VerificationCode(email);
|
||||
if (isSent) {
|
||||
return R.ok(MessageUtils.messageCustomize("systemVerificationEmailController10001"));
|
||||
} else {
|
||||
return R.fail(MessageUtils.messageCustomize("systemVerificationEmailController10002"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证邮箱验证码
|
||||
*/
|
||||
@PostMapping("/verify")
|
||||
public R verifyCode(@RequestParam String email, @RequestParam String code) {
|
||||
boolean isValid = verificationEmailService.verifyCode(email, code);
|
||||
if (isValid) {
|
||||
return R.ok(MessageUtils.messageCustomize("systemVerificationEmailController10003"));
|
||||
} else {
|
||||
return R.fail(MessageUtils.messageCustomize("systemVerificationEmailController10004"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,10 @@ twilio:
|
||||
from-name: RouteZ
|
||||
template-ids:
|
||||
routez-verification-code: d-321fee8a85704983849eb1f69313ae24
|
||||
accountSID: 1111
|
||||
authToken: 22222
|
||||
sendPhoneNumber: 33333
|
||||
|
||||
verification:
|
||||
code:
|
||||
email:
|
||||
@@ -148,6 +152,7 @@ elevenLabs:
|
||||
# apiKey: sk_5240d8f56cb1eb5225fffcf903f62479884d1af5b3de6812
|
||||
apiKey: sk_88f5a560e1bbde0e5b8b6b6eb1812163a98bfb98554acbec
|
||||
modelId: eleven_turbo_v2_5
|
||||
|
||||
# 语音转文本
|
||||
whisper:
|
||||
apiUrl: https://api.openai.com/v1/audio/transcriptions
|
||||
|
||||
@@ -37,6 +37,21 @@ systemVerificationEmailController10004 = The Verification Code Is Invalid Or Has
|
||||
|
||||
SystemCommandOverhaulAppController10001 = Operation Successful
|
||||
|
||||
|
||||
systemSysLoginService10001 = The username cannot be empty
|
||||
systemSysLoginService10002 = User password cannot be empty
|
||||
systemSysLoginService10003 = User does not exist
|
||||
systemSysLoginService10004 = Passwords do not match
|
||||
|
||||
systemSysRegisterService10001 = The username cannot be empty
|
||||
systemSysRegisterService10002 = User password cannot be empty
|
||||
systemSysRegisterService10003 = The account length must be between 2 and 20 characters
|
||||
systemSysRegisterService10004 = The password length must be between 5 and 20 characters
|
||||
systemSysRegisterService10005 = Save User
|
||||
systemSysRegisterService10006 = Failed, registered account already exists
|
||||
systemSysRegisterService10007 = Registration failed, please contact the system administrator
|
||||
|
||||
|
||||
systemEmailUtil10001 = Sending Email Failed
|
||||
systemR10001 = Operation Successful
|
||||
|
||||
|
||||
@@ -37,6 +37,19 @@ systemVerificationEmailController10004 = 验证码无效或已过期
|
||||
|
||||
SystemCommandOverhaulAppController10001 = 操作成功
|
||||
|
||||
systemSysLoginService10001 = 用户名不能为空
|
||||
systemSysLoginService10002 = 用户密码不能为空
|
||||
systemSysLoginService10003 = 用户不存在
|
||||
systemSysLoginService10004 = 密码不一致
|
||||
|
||||
systemSysRegisterService10001 = 用户名不能为空
|
||||
systemSysRegisterService10002 = 用户密码不能为空
|
||||
systemSysRegisterService10003 = 账户长度必须在2到20个字符之间
|
||||
systemSysRegisterService10004 = 密码长度必须在5到20个字符之间
|
||||
systemSysRegisterService10005 = 保存用户
|
||||
systemSysRegisterService10006 = 失败,注册账号已存在
|
||||
systemSysRegisterService10007 = 注册失败,请联系系统管理人员
|
||||
|
||||
systemEmailUtil10001 = 发送邮件失败
|
||||
systemR10001 = 操作成功
|
||||
|
||||
|
||||
Reference in New Issue
Block a user