|
|
@@ -9,6 +9,7 @@ import com.etotem.cfc.mapper.UserMapper;
|
|
|
import com.etotem.cfc.service.AssessmentAppointmentService;
|
|
|
import com.etotem.cfc.service.AssessmentQuotaService;
|
|
|
import com.etotem.cfc.service.DanAssessmentExecutionService;
|
|
|
+import com.etotem.cfc.service.GuideFamilyService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -38,6 +39,9 @@ public class AssessmentAppointmentController {
|
|
|
@Resource
|
|
|
private UserMapper userMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private GuideFamilyService guideFamilyService;
|
|
|
+
|
|
|
@Operation(summary = "创建评估预约(含新执行记录)")
|
|
|
@PostMapping("/create")
|
|
|
public Result<Map<String, Object>> createAppointment(
|
|
|
@@ -56,8 +60,23 @@ public class AssessmentAppointmentController {
|
|
|
if (memberId == null || quotaId == null) {
|
|
|
return Result.error("memberId和quotaId不能为空");
|
|
|
}
|
|
|
+ // 契约 assessment.planner.select(SC-P-32 / API_REFERENCE §4.10『预约前需规划师绑定』):
|
|
|
+ // 家长侧选规划师 = 所选规划师(guideId)必须属于家庭已绑定 T 列表;未绑定 → 提示先绑定。
|
|
|
if (assessorId == null && guideId == null) {
|
|
|
- return Result.error("assessorId或guideId必须提供一个");
|
|
|
+ return Result.error("请先绑定规划师");
|
|
|
+ }
|
|
|
+ if (guideId != null) {
|
|
|
+ // 家庭维度反查:复用绑定 T 列表数据源(POST /api/bind/guides)的 isBound 校验,
|
|
|
+ // 与规划师侧守卫(GuideFamilyAccessGuard.checkBinding)方向区分。
|
|
|
+ AssessmentQuota quotaForBind = quotaService.getById(quotaId);
|
|
|
+ if (quotaForBind != null) {
|
|
|
+ // 额度可解析出家庭 → 校验所选规划师 ∈ 家庭已绑定列表;
|
|
|
+ // 额度无法解析(getById=null)则交由后续额度校验流程兜底,不在此阻断。
|
|
|
+ Long familyIdForBind = quotaForBind.getFamilyId();
|
|
|
+ if (!appointmentService.requireBoundPlanner(guideId, familyIdForBind)) {
|
|
|
+ return Result.error("请先绑定规划师");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
User user = userMapper.selectById(userId);
|