|
|
@@ -1,7 +1,5 @@
|
|
|
package com.etotem.cfc.service;
|
|
|
|
|
|
-import com.etotem.cfc.service.api.AssessmentAppointmentServiceInterface;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.etotem.cfc.entity.AssessmentAppointment;
|
|
|
@@ -103,32 +101,16 @@ public class AssessmentAppointmentService extends ServiceImpl<AssessmentAppointm
|
|
|
return assessmentAppointmentMapper.selectList(wrapper);
|
|
|
}
|
|
|
|
|
|
- public void confirmAppointmentByOrder(AssessmentOrder order) {
|
|
|
- // 优先通过 appointmentId 直接关联
|
|
|
- if (order.getAppointmentId() != null) {
|
|
|
- AssessmentAppointment appointment = assessmentAppointmentMapper.selectById(order.getAppointmentId());
|
|
|
- if (appointment != null && appointment.getStatus() == 0) {
|
|
|
- appointment.setStatus(1);
|
|
|
- appointment.setUpdatedAt(new Date());
|
|
|
- assessmentAppointmentMapper.updateById(appointment);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- // 回退匹配:通过 userId + childId + guideId + packageId 精确定位
|
|
|
- LambdaQueryWrapper<AssessmentAppointment> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.eq(AssessmentAppointment::getUserId, order.getUserId());
|
|
|
- wrapper.eq(AssessmentAppointment::getChildId, order.getChildId());
|
|
|
- wrapper.eq(AssessmentAppointment::getGuideId, order.getGuideId());
|
|
|
- wrapper.eq(AssessmentAppointment::getPackageId, order.getPackageId());
|
|
|
- wrapper.eq(AssessmentAppointment::getStatus, 0);
|
|
|
- wrapper.orderByDesc(AssessmentAppointment::getCreatedAt);
|
|
|
- wrapper.last("LIMIT 1");
|
|
|
- List<AssessmentAppointment> list = assessmentAppointmentMapper.selectList(wrapper);
|
|
|
- if (!list.isEmpty()) {
|
|
|
- AssessmentAppointment appointment = list.get(0);
|
|
|
- appointment.setStatus(1);
|
|
|
- appointment.setUpdatedAt(new Date());
|
|
|
- assessmentAppointmentMapper.updateById(appointment);
|
|
|
- }
|
|
|
+ public AssessmentAppointment confirmAppointmentByOrder(AssessmentOrder order) {
|
|
|
+ AssessmentAppointment appointment = new AssessmentAppointment();
|
|
|
+ appointment.setChildId(order.getChildId());
|
|
|
+ appointment.setGuideId(order.getGuideId());
|
|
|
+ appointment.setStatus(0); // pending
|
|
|
+ appointment.setUserId(order.getUserId());
|
|
|
+ appointment.setPackageId(order.getPackageId());
|
|
|
+ appointment.setCreatedAt(new Date());
|
|
|
+ appointment.setUpdatedAt(new Date());
|
|
|
+ assessmentAppointmentMapper.insert(appointment);
|
|
|
+ return appointment;
|
|
|
}
|
|
|
}
|