|
|
@@ -59,6 +59,22 @@ public class AssessmentAppointmentService extends ServiceImpl<AssessmentAppointm
|
|
|
appointment.setNotes(notes);
|
|
|
appointment.setCreatedAt(new Date());
|
|
|
appointment.setUpdatedAt(new Date());
|
|
|
+
|
|
|
+ // 预约时间冲突校验(SC-P-36 边界):同会员同日期时间已有非终态预约(0 待确认 / 1 已确认)时
|
|
|
+ // 拒绝创建且不落库(2 已完成 / 3 已取消 / 4 未到 为终态,不算冲突)
|
|
|
+ if (memberId != null && appointmentDate != null && appointmentTime != null) {
|
|
|
+ LambdaQueryWrapper<AssessmentAppointment> conflictWrapper = new LambdaQueryWrapper<>();
|
|
|
+ conflictWrapper.eq(AssessmentAppointment::getMemberId, memberId);
|
|
|
+ conflictWrapper.eq(AssessmentAppointment::getAppointmentDate, appointmentDate);
|
|
|
+ conflictWrapper.eq(AssessmentAppointment::getAppointmentTime, appointmentTime);
|
|
|
+ conflictWrapper.in(AssessmentAppointment::getStatus, 0, 1);
|
|
|
+ List<AssessmentAppointment> conflicts = assessmentAppointmentMapper.selectList(conflictWrapper);
|
|
|
+ if (conflicts != null && !conflicts.isEmpty()) {
|
|
|
+ throw new RuntimeException(
|
|
|
+ "预约时间冲突:该会员在所选日期时间已有待确认/已确认的测评预约,请调整预约时间");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.save(appointment);
|
|
|
|
|
|
// 测评预约能量发放
|