fix: [临时提交]

This commit is contained in:
ovo 2025-05-07 18:47:17 +08:00
parent bebac77236
commit 6d80269b2c
20 changed files with 195 additions and 92 deletions

View File

@ -1 +1 @@
EWEPEPEOGMGTELIZJUGECKIUJDBCJTCNISGPBNHLJTJUBHEWGNAKGEGAIOHJDQAJGNCFDRFZJEDMJTGFGBEAAWGLBZAUCNHCCPBZCIIKBJATGYARHRAZHXFRBIEBCHIXAFDLFQBZFVJQGTCEHDIMIVGQEJAJIYHXHTISIVETBACMCCGFDPEKDQHYGGAPFXIOCJAAGOHYIFHNHZHWIGCZIGHHDMDXHQGTFLJOHGAYIVBGIHIQHHHJDJFWHMCRHJAMHZESGWGGAUJRGDHAGHIQITIJIUAXAEIZGBGZCCHJAHASGNCVIIJAIYFOEQGFELEIEDECJTCXBCAPIKHTFTHBAGJTERHQGSAFEUDIHLDDITDPIMACAOGTIIHFEMHLHIHYJTFDFDGWAKHJEIEIJFGABQJCIHIADYCXAHIMJTHOASFLGFFIBJJEHDHLHOCMDIGGDOJDHNBQCJENFUBAGOAZITIRJSFBBUCUHABLHRFVIUBWCADJCMDXDPATBPJSJRJLBRABGVFTDNFOAQDOARDEBRHJAQGYHIGMBDCJCSJKFBBLGECAEFEYCVCHAEAZJRIOFEHLCJILEHJVGYIVCWGHCMGJGLBTFMHFCAEAAUJQJLAEARDHDFHDBJJGALEHFNGSAIHOJUBOEAJDDFFYFTINITHTBNIJFDHLEAFGBFHFFQGHGFGREVFHFDCZGYEVBWAZDSCAGLDMIAAEFOAXIXFECSFQDWHFFHCFASFSGAHVJSDBBZJQAZBXARILBAJFJEHCANAIABBMECBJJFIOGYGHBXCUCVBDJOCYBZDZAJEXAXEPFRFOGVHQAOJLCYBOHFEKJFIJBDHDDCEAAUJVDRIGGGGCJOFVECAHAQFSBSGYJVGKCQDDHPGUCIARFAIEJGGDITAUDIIVBBJUEFCIDTGJGYJODRDEJPBMFNCXAKCPAIGOJQGHBZHQJUCOBKCKDPJSGGCVCAIWFVHIIEA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GBIHENHJFNITEWCIBPCEIYDVFCJQGZHDILIUGYFJBAGTICJVDYJLGIBMJAAUFIJNIEERJOIMDCFAANCEEXHBBBGNESJKCMDYDBGOBCBVEDAFCBIQAKHVHUIUEOHVBPCJIRDGIFCQBWAFACELFSGYEMENEUITANIAIMBLBAAQGCHOGFDSENIFEWFVEYHZIVEUGXAXGCHSCXEOALHQGPCYDIBRHYHCEFAFHNAMCVHBBUFPJMHPDXIHBXGXJPFRCHBPGPFWABCKIEHOIZFLJECTERFOHAHZGXGLIJAAFBCRDCGOFPBCIGJPBXJMEYGQDVAXHMJGBIIOCLDYJQHNJMECBK

View File

@ -10,5 +10,7 @@ RBAC——基于角色权限的模型
要做全控制
表单 按钮 视图
merge和rebase

View File

@ -13,7 +13,7 @@ public class CacheConstants {
*/
public static final List<String> CACHE_LIST = List.of(
"userCache",
"paperCache"
"paperCache"
);

View File

@ -12,9 +12,11 @@ public class SecurityConstants {
* 这些路径可以直接访问不需要认证
*/
public static final List<String> WHITE_LIST = List.of(
"/faceTest","/compareFaces",
"/minio/**",
"/exam/api/paper/**",
"/bs/**",
"/bs/user/login",
"/bs/user/register",
"/api/common/**", //公共接口
"/demo/**", // 测试接口
"/api/products",

View File

@ -32,14 +32,13 @@ public class BSUserController {
public Result<UserDTO> register(@RequestBody @Valid BSRegisterDTO request) {
try {
log.info("用户注册: {}", request);
// return Result.success("注册成功", userService.register(request));
return Result.success("注册成功", userService.register(request));
} catch (IllegalArgumentException e) {
// return Result.validateFailed(e.getMessage());
return Result.validateFailed(e.getMessage());
} catch (Exception e) {
log.error("注册失败", e);
// return Result.error("系统错误");
return Result.error("系统错误");
}
return null;
}
@PostMapping("/login")

View File

@ -557,6 +557,14 @@ public class CommonController {
}
@PostMapping("/sendCode")
public void sendCode(@RequestParam String code){
System.out.println("code = " + code);
}
}

View File

@ -1,4 +1,3 @@
/*
package com.guwan.backend.controller;
import com.github.dockerjava.api.DockerClient;
@ -7,10 +6,13 @@ import com.github.dockerjava.api.command.ExecCreateCmdResponse;
import com.github.dockerjava.core.DockerClientBuilder;
import com.github.dockerjava.core.command.ExecStartResultCallback;
import com.github.dockerjava.httpclient5.ApacheDockerHttpClient;
import lombok.RequiredArgsConstructor;
import java.io.ByteArrayOutputStream;
import java.net.URI;
import java.util.concurrent.TimeUnit;
@RequiredArgsConstructor
public class DockerCppRunner {
private static final String IMAGE_NAME = "cpp-runner";
@ -22,7 +24,7 @@ public class DockerCppRunner {
DockerClient dockerClient = DockerClientBuilder.getInstance()
.withDockerHttpClient(
new ApacheDockerHttpClient.Builder()
.dockerHost(DockerClientBuilder.getDefaultDockerHost())
.dockerHost(URI.create("tcp://localhost:2375"))
.build()
).build();
@ -76,4 +78,4 @@ public class DockerCppRunner {
return outputStream.toString().trim();
}
}*/
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
package com.guwan.backend.controller;
import com.guwan.backend.common.Result;
import com.guwan.backend.util.MinioUtil;
import lombok.RequiredArgsConstructor;
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;
@RestController
@RequestMapping("/minio")
@RequiredArgsConstructor
public class MinioController {
private final MinioUtil minioUtil;
@PostMapping("/uploadBase64Image")
public Result uploadBase64Image(@RequestParam String bucketName,
@RequestParam String base64Image,
@RequestParam String folder){
String fileName = minioUtil.uploadBase64Image(bucketName, base64Image, folder);
return Result.success(fileName);
}
}

View File

@ -0,0 +1,16 @@
package com.guwan.backend.controller;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/setAuthentication")
@RequiredArgsConstructor
public class SetController {
@GetMapping
public void setAuthentication(){
}
}

View File

@ -1,3 +1,4 @@
/*
package com.guwan.backend.controller;
import cn.hutool.core.date.DateUtil;
@ -158,4 +159,4 @@ public class UserController {
return Result.error(e.getMessage());
}
}
}
} */

View File

@ -9,7 +9,9 @@ public class Base64Util {
if (!ObjectUtils.isEmpty(base64Str)) {
String photoBase64 = base64Str.substring(0, 30).toLowerCase();
int indexOf = photoBase64.indexOf("base64,");
if (indexOf > 0) {
if (indexOf >= 0) {
//包括起始下标 beginIndex
//不包括结束下标 endIndex
base64Str = base64Str.substring(indexOf + 7);
}
base64Str = base64Str.replaceAll(" ", "+");

View File

@ -3,6 +3,7 @@ package com.guwan.backend.model.exam.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.guwan.backend.common.Result;
import com.guwan.backend.controller.BaseExamController;
import com.guwan.backend.core.api.ApiRest;
import com.guwan.backend.core.api.controller.BaseController;
import com.guwan.backend.core.api.dto.BaseIdReqDTO;
@ -19,12 +20,18 @@ import com.guwan.backend.model.exam.entity.Exam;
import com.guwan.backend.model.exam.service.ExamService;
import com.guwan.backend.pojo.entity.BaseExam;
import com.guwan.backend.service.BaseExamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
//import org.apache.shiro.authz.annotation.RequiresRoles;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -40,11 +47,13 @@ import java.util.List;
@Api(tags={"考试"})
@RestController
@RequestMapping("/api/common/exam")
@RequiredArgsConstructor
public class ExamController extends BaseController {
@Autowired
private ExamService examService;
private final ExamService examService;
private final BaseExamService baseExamService;
/**
* 分页查找
@ -71,15 +80,27 @@ public class ExamController extends BaseController {
@GetMapping("/exam")
public Result getExam() {
BaseExam baseExam = baseExamService.getById(1);
// 模拟数据可以从数据库中查询
ExamResponseDTO response = new ExamResponseDTO();
response.setId("1");
response.setTitle("模拟考试试卷 (含新题型)");
response.setTotalScore(100);
response.setTotalTime(120);
response.setLeftSeconds(7180);
response.setExamStartTime("2025-04-17 00:10:24");
response.setExamDuration(60 * 60 * 2);
response.setTitle(baseExam.getTitle());
response.setTotalScore(baseExam.getTotalScore());
response.setTotalTime(baseExam.getTotalTime());
//response.setLeftSeconds(7180);
LocalDateTime localDateTime = baseExam.getStartTime().toInstant()
.atZone(ZoneId.systemDefault())
.toLocalDateTime();
// 格式化
String formatted = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
response.setExamStartTime(formatted);
// 填充题数据
List<QuestionDTO> fillList = new ArrayList<>();

View File

@ -10,14 +10,11 @@ import java.util.List;
@AllArgsConstructor
@NoArgsConstructor
public class ExamResponseDTO {
private String id;
private String title;
private int totalScore;
private int totalTime;
private int leftSeconds;
private String examStartTime; // 这里用字符串格式而不是标准时间
private int examDuration;
private List<QuestionDTO> fillList;
private List<QuestionDTO> judgeList;
private List<QuestionDTO> radioList;

View File

@ -9,7 +9,10 @@ import lombok.Data;
public class BSRegisterDTO {
@NotBlank(message = "用户名不能为空")
private String username;
@NotBlank(message = "密码不能为空")
private String password;
@Email(message = "邮箱格式不正确")
private String email;
@NotBlank(message = "邮箱验证码不能为空")
private String emailCode;
}

View File

@ -22,10 +22,10 @@ public class RegisterDTO {
@NotBlank(message = "邮箱验证码不能为空")
private String emailCode;
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
/* @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
private String phone;
@NotBlank(message = "手机验证码不能为空")
private String phoneCode;
private String phoneCode;*/
}

View File

@ -1,9 +1,6 @@
package com.guwan.backend.service;
import com.guwan.backend.pojo.dto.user.ChangePasswordDTO;
import com.guwan.backend.pojo.dto.user.LoginDto;
import com.guwan.backend.pojo.dto.user.RegisterDTO;
import com.guwan.backend.pojo.dto.user.UserDTO;
import com.guwan.backend.pojo.dto.user.*;
public interface UserService {
/**
@ -11,7 +8,7 @@ public interface UserService {
* @param registerDTO
* @return
*/
UserDTO register(RegisterDTO registerDTO);
UserDTO register(BSRegisterDTO registerDTO);
/**
* 登录

View File

@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guwan.backend.annotation.OperationLog;
import com.guwan.backend.common.BusinessException;
import com.guwan.backend.pojo.dto.user.ChangePasswordDTO;
import com.guwan.backend.pojo.dto.user.LoginDto;
import com.guwan.backend.pojo.dto.user.RegisterDTO;
import com.guwan.backend.pojo.dto.user.UserDTO;
import com.guwan.backend.pojo.dto.user.*;
import com.guwan.backend.pojo.entity.User;
import com.guwan.backend.pojo.enums.UserEnums;
import com.guwan.backend.mapper.UserMapper;
@ -49,7 +46,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Override
@Transactional
@OperationLog(description = "用户注册", operationType = "注册")
public UserDTO register(RegisterDTO request) {
public UserDTO register(BSRegisterDTO request) {
// 检查用户名是否已存在
if (findByUsername(request.getUsername()) != null) {
throw new IllegalArgumentException("用户名已存在");
@ -60,11 +57,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
throw new IllegalArgumentException("邮箱已被注册");
}
// 检查手机号是否已存在
if (findByPhone(request.getPhone()) != null) {
throw new IllegalArgumentException("手机号已被注册");
}
// 校验邮箱验证码
String redisEmailCode = (String) redisUtil.get(request.getEmail());
@ -72,25 +64,25 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
throw new IllegalArgumentException("邮箱验证码错误");
}
// 校验手机号验证码
/* // 校验手机号验证码
String redisPhoneCode = (String) redisUtil.get(request.getPhone());
if (!request.getPhoneCode().equals(redisPhoneCode)) {
throw new IllegalArgumentException("手机验证码错误");
}
}*/
User user = new User();
BeanUtils.copyProperties(request, user);
user.setPassword(passwordEncoder.encode(request.getPassword()));
user.setPhone(request.getPhone());
//user.setPhone();
user.setEmail(request.getEmail());
user.setStatus(1);
userMapper.insert(user);
redisUtil.del(request.getEmail());
redisUtil.del(request.getPhone());
// redisUtil.del(request.getPhone());
return convertToDTO(user);
}
@ -99,6 +91,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@OperationLog(description = "用户登录", operationType = "登录")
public UserDTO login(LoginDto request) {
User user = null;
System.out.println("request = " + request);
if (request.getActiveTab().equals("account")) {
@ -139,7 +132,6 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
throw new IllegalArgumentException("账号已被禁用");
}
// 更新最后登录时间
user.setLastLoginTime(LocalDateTime.now());
userMapper.updateById(user);

View File

@ -204,8 +204,6 @@ public class MinioUtil {
// 使用 byte[] 创建 InputStream
InputStream byteArrayInputStream = new ByteArrayInputStream(data);
// 上传文件
minioClient.putObject(
PutObjectArgs.builder()

View File

@ -126,10 +126,10 @@ springdoc:
config:
arcface-sdk:
version: 4.1
app-id: 5nPWymNAibvWTq6XPypUWxroyzjMScZ9RwVkDjCFgK32
sdk-key: 7dsPvanADtYAP1TiiiFjTsms2mAU85m5duVwHChhumyV
active-key: 86C1-11T1-K131-FJQU
active-file: 86C111T1K131FJQU.dat
app-id: 2R54v3QUQ8uTynQr6ioF8wWHeqXJuJBv1VqhcWpj2Jmd
sdk-key: 6m5KtW1EV6x9hrnUGSiM1kQF2DXLf3hkRwqBKbvLyHFB
active-key: 86L1-11WX-R13T-CHZ6
active-file:
detect-pool-size: 16
compare-pool-size: 16
rec-face-thd: 0.8