|
@@ -24,15 +24,16 @@ public class AssessmentAppointmentService extends ServiceImpl<AssessmentAppointm
|
|
|
private EnergyService energyService;
|
|
private EnergyService energyService;
|
|
|
|
|
|
|
|
public AssessmentAppointment createAppointment(Long userId, Long childId, Long guideId,
|
|
public AssessmentAppointment createAppointment(Long userId, Long childId, Long guideId,
|
|
|
- Long packageId, String appointmentDate, String appointmentTime, String notes) {
|
|
|
|
|
|
|
+ Long assessorId, Long packageId, String appointmentDate, String appointmentTime, String notes) {
|
|
|
AssessmentAppointment appointment = new AssessmentAppointment();
|
|
AssessmentAppointment appointment = new AssessmentAppointment();
|
|
|
appointment.setUserId(userId);
|
|
appointment.setUserId(userId);
|
|
|
appointment.setChildId(childId);
|
|
appointment.setChildId(childId);
|
|
|
appointment.setGuideId(guideId);
|
|
appointment.setGuideId(guideId);
|
|
|
|
|
+ appointment.setAssessorId(assessorId);
|
|
|
appointment.setPackageId(packageId);
|
|
appointment.setPackageId(packageId);
|
|
|
appointment.setAppointmentDate(appointmentDate);
|
|
appointment.setAppointmentDate(appointmentDate);
|
|
|
appointment.setAppointmentTime(appointmentTime);
|
|
appointment.setAppointmentTime(appointmentTime);
|
|
|
- appointment.setTeacherId(guideId);
|
|
|
|
|
|
|
+ appointment.setTeacherId(assessorId != null ? assessorId : guideId);
|
|
|
appointment.setStatus(0); // pending
|
|
appointment.setStatus(0); // pending
|
|
|
appointment.setNotes(notes);
|
|
appointment.setNotes(notes);
|
|
|
appointment.setCreatedAt(new Date());
|
|
appointment.setCreatedAt(new Date());
|
|
@@ -50,10 +51,12 @@ public class AssessmentAppointmentService extends ServiceImpl<AssessmentAppointm
|
|
|
return appointment;
|
|
return appointment;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public boolean confirmAppointment(Long id, Long teacherId) {
|
|
|
|
|
|
|
+ public boolean confirmAppointment(Long id, Long userId) {
|
|
|
AssessmentAppointment appointment = assessmentAppointmentMapper.selectById(id);
|
|
AssessmentAppointment appointment = assessmentAppointmentMapper.selectById(id);
|
|
|
if (appointment == null) return false;
|
|
if (appointment == null) return false;
|
|
|
- if (!teacherId.equals(appointment.getGuideId())) return false;
|
|
|
|
|
|
|
+ // 允许被指派的测评师(assessorId)或规划师(guideId)确认
|
|
|
|
|
+ Long expectedId = appointment.getAssessorId() != null ? appointment.getAssessorId() : appointment.getGuideId();
|
|
|
|
|
+ if (!userId.equals(expectedId)) return false;
|
|
|
appointment.setStatus(1); // confirmed
|
|
appointment.setStatus(1); // confirmed
|
|
|
appointment.setUpdatedAt(new Date());
|
|
appointment.setUpdatedAt(new Date());
|
|
|
return assessmentAppointmentMapper.updateById(appointment) > 0;
|
|
return assessmentAppointmentMapper.updateById(appointment) > 0;
|
|
@@ -101,6 +104,13 @@ public class AssessmentAppointmentService extends ServiceImpl<AssessmentAppointm
|
|
|
return assessmentAppointmentMapper.selectList(wrapper);
|
|
return assessmentAppointmentMapper.selectList(wrapper);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public List<AssessmentAppointment> getByAssessorId(Long assessorId) {
|
|
|
|
|
+ LambdaQueryWrapper<AssessmentAppointment> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.eq(AssessmentAppointment::getAssessorId, assessorId);
|
|
|
|
|
+ wrapper.orderByDesc(AssessmentAppointment::getCreatedAt);
|
|
|
|
|
+ return assessmentAppointmentMapper.selectList(wrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public AssessmentAppointment confirmAppointmentByOrder(AssessmentOrder order) {
|
|
public AssessmentAppointment confirmAppointmentByOrder(AssessmentOrder order) {
|
|
|
AssessmentAppointment appointment = new AssessmentAppointment();
|
|
AssessmentAppointment appointment = new AssessmentAppointment();
|
|
|
appointment.setChildId(order.getChildId());
|
|
appointment.setChildId(order.getChildId());
|