feat:后端完整

main
poppoppuppylove 1 month ago
parent cc432df3b4
commit a455c7db4a

@ -16,5 +16,10 @@
<option name="name" value="JBoss Community repository" /> <option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" /> <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://maven.aliyun.com/repository/public" />
</remote-repository>
</component> </component>
</project> </project>

@ -124,7 +124,7 @@ public class StudentController {
return "学生数据导入失败:" + e.getMessage(); return "学生数据导入失败:" + e.getMessage();
} }
} }
/* /*
*/ */
@GetMapping("/export-students") @GetMapping("/export-students")
public ResponseEntity<byte[]> exportStudents() throws IOException { public ResponseEntity<byte[]> exportStudents() throws IOException {

@ -12,3 +12,4 @@ public class RollCallSettings {
private String triggerRandomEvent; // 触发("触发")或不触发("不触发")随机事件 private String triggerRandomEvent; // 触发("触发")或不触发("不触发")随机事件
private String wheelOfFortune; // 开启("是")或关闭("否")命运轮盘 private String wheelOfFortune; // 开启("是")或关闭("否")命运轮盘
} }

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="icon" href="/点名.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>点点小助手</title>
<script type="module" crossorigin src="/assets/index-Cb5FnDWH.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B1hDzaLh.css">
</head>
<body>
<div id="app"></div>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1727709759865" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6581" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="48"><path d="M485.568 906.496c-0.64-0.192-145.088 10.368-209.216-16.256-86.528-35.968-117.184-62.592-117.184-79.488 0-15.936-2.944-98.112 77.248-123.2a4319.36 4319.36 0 0 1 155.264-43.136 25.216 25.216 0 0 0 22.08-24.832V541.888a24.064 24.064 0 0 0-7.68-17.664c-69.248-66.56-97.728-131.456-97.728-243.584 0-53.312 14.656-91.008 39.296-119.744 26.496-31.104 68.032-46.912 123.264-46.912 159.104 0 169.408 128.384 169.408 171.392a291.072 291.072 0 0 1-26.56 122.048c-13.056 28.544-26.624 44.736-26.752 45.12a24.256 24.256 0 0 0 3.776 35.2 26.88 26.88 0 0 0 36.672-3.648c2.56-3.072 65.088-77.696 65.088-198.72 0-65.024-16.832-109.376-52.544-150.72C600.256 88.448 541.76 64 470.976 64 335.808 64 256.256 140.416 256.256 280.704c0 60.864 8.192 104.256 25.024 148.928a340.48 340.48 0 0 0 80.256 122.368v46.784c-36.928 6.72-73.408 15.552-109.312 26.368-39.232 12.16-70.848 25.536-93.824 40.256-34.176 21.632-51.456 117.76-51.456 145.344 0 45.76 48.64 83.968 149.056 125.504 67.712 28.032 213.12 17.664 215.872 18.368l6.848 1.024a25.92 25.92 0 0 0 25.28-18.496 24.704 24.704 0 0 0-18.432-30.656z" p-id="6582" fill="#8755f2"></path><path d="M937.024 515.776a26.624 26.624 0 0 0-37.376 4.16c-9.152 11.456-199.808 266.624-228.224 268.928-27.712 2.432-122.752-90.112-122.752-90.112a26.496 26.496 0 0 0-36.224 4.032 26.56 26.56 0 0 0 1.856 36.48c10.304 9.664 101.056 82.048 123.072 98.304l25.6 18.816c5.12 3.264 10.752 5.376 16.576 4.736a23.68 23.68 0 0 0 17.536-9.152c6.208-7.36 35.52-41.344 35.776-41.792l208.448-257.216a26.56 26.56 0 0 0-4.288-37.184z" p-id="6583" fill="#8755f2"></path></svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@ -1,13 +0,0 @@
package com.example.attendance;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class AttendanceApplicationTests {
@Test
void contextLoads() {
}
}

@ -1,117 +0,0 @@
package com.example.attendance;
import com.example.attendance.entity.RollCallResponse;
import com.example.attendance.entity.RollCallSettings;
import com.example.attendance.entity.Student;
import com.example.attendance.service.impl.RollCallServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.MockitoAnnotations;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
class RollCallServiceImplTest {
@InjectMocks
private RollCallServiceImpl rollCallService;
private List<Student> students;
private RollCallSettings settings;
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
// 模拟学生列表
students = Arrays.asList(
createStudent("1", "Alice", 50),
createStudent("2", "Bob", 90),
createStudent("3", "Charlie", 30)
);
// 初始化点名设置
settings = new RollCallSettings();
settings.setRollCall(true);
settings.setTriggerRandomEvent(false);
settings.setWheelOfFortune(false);
}
// 测试正常点名模式
@Test
void testStartRollCall_NormalMode() {
RollCallResponse response = rollCallService.startRollCall(students, settings);
// 控制台输出
System.out.println("Test: Normal Mode");
System.out.println("Student ID: " + response.getStudentId());
System.out.println("Message: " + response.getMessage());
assertNotNull(response);
assertNotNull(response.getStudentId());
assertTrue(response.getMessage().contains("没有触发随机事件"));
}
// 测试提问模式
@Test
void testStartRollCall_QuestionMode() {
settings.setRollCall(false); // 设置为提问模式
RollCallResponse response = rollCallService.startRollCall(students, settings);
// 控制台输出
System.out.println("Test: Question Mode");
System.out.println("Student ID: " + response.getStudentId());
System.out.println("Message: " + response.getMessage());
assertNotNull(response);
assertNotNull(response.getStudentId());
assertTrue(response.getMessage().contains("没有触发随机事件"));
}
// 测试命运轮盘模式
@Test
void testStartRollCall_WheelOfFortune() {
settings.setWheelOfFortune(true); // 开启命运轮盘
RollCallResponse response = rollCallService.startRollCall(students, settings);
// 控制台输出
System.out.println("Test: Wheel of Fortune Mode");
System.out.println("Student ID: " + response.getStudentId());
System.out.println("Message: " + response.getMessage());
assertNotNull(response);
assertNotNull(response.getStudentId());
assertTrue(response.getMessage().contains("命运轮盘"));
}
// 测试触发随机事件
@Test
void testStartRollCall_TriggerRandomEvent() {
settings.setTriggerRandomEvent(true); // 触发随机事件
RollCallResponse response = rollCallService.startRollCall(students, settings);
// 控制台输出
System.out.println("Test: Random Event Triggered");
System.out.println("Student ID: " + response.getStudentId());
System.out.println("Message: " + response.getMessage());
assertNotNull(response);
assertNotNull(response.getStudentId());
assertTrue(response.getMessage().contains("触发了随机事件"));
}
// 辅助方法,创建学生
private Student createStudent(String id, String name, int points) {
Student student = new Student();
student.setStudentNumber(id);
student.setName(name);
student.setPoints(BigDecimal.valueOf(points));
return student;
}
}

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/java" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="main" />
</component>
</module>
Loading…
Cancel
Save