|
|
|
@ -6,7 +6,6 @@ import com.example.attendance.entity.Student;
|
|
|
|
|
import com.example.attendance.service.RollCallService;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
|
@ -16,11 +15,11 @@ public class RollCallServiceImpl implements RollCallService {
|
|
|
|
|
@Override
|
|
|
|
|
public RollCallResponse startRollCall(List<Student> students, RollCallSettings settings) {
|
|
|
|
|
// 1. 根据设定选择点名或提问模式
|
|
|
|
|
String mode = settings.isRollCall() ? "点名" : "提问";
|
|
|
|
|
String mode = "点名".equals(settings.getRollCallMode()) ? "点名" : "提问";
|
|
|
|
|
System.out.println("当前模式:" + mode);
|
|
|
|
|
|
|
|
|
|
// 2. 处理命运轮盘 (所有人概率相等)
|
|
|
|
|
if (settings.isWheelOfFortune()) {
|
|
|
|
|
if ("是".equals(settings.getWheelOfFortune())) {
|
|
|
|
|
return handleWheelOfFortune(students);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -32,7 +31,7 @@ public class RollCallServiceImpl implements RollCallService {
|
|
|
|
|
response.setPoints(selectedStudent.getPoints());
|
|
|
|
|
|
|
|
|
|
// 4. 判断是否触发随机事件
|
|
|
|
|
if (settings.isTriggerRandomEvent()) {
|
|
|
|
|
if ("触发".equals(settings.getTriggerRandomEvent())) {
|
|
|
|
|
response.setMessage("触发了随机事件: " + triggerRandomEvent());
|
|
|
|
|
} else {
|
|
|
|
|
response.setMessage("没有触发随机事件," + selectedStudent.getName() + " 被点了!");
|
|
|
|
|