|
@@ -8,11 +8,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.etotem.cfc.common.Result;
|
|
import com.etotem.cfc.common.Result;
|
|
|
import com.etotem.cfc.dto.TaskReviewDTO;
|
|
import com.etotem.cfc.dto.TaskReviewDTO;
|
|
|
import com.etotem.cfc.entity.FamilyMember;
|
|
import com.etotem.cfc.entity.FamilyMember;
|
|
|
|
|
+import com.etotem.cfc.entity.GuideFamily;
|
|
|
import com.etotem.cfc.entity.Task;
|
|
import com.etotem.cfc.entity.Task;
|
|
|
import com.etotem.cfc.entity.User;
|
|
import com.etotem.cfc.entity.User;
|
|
|
import com.etotem.cfc.mapper.FamilyMemberMapper;
|
|
import com.etotem.cfc.mapper.FamilyMemberMapper;
|
|
|
import com.etotem.cfc.mapper.TaskMapper;
|
|
import com.etotem.cfc.mapper.TaskMapper;
|
|
|
import com.etotem.cfc.mapper.UserMapper;
|
|
import com.etotem.cfc.mapper.UserMapper;
|
|
|
|
|
+import com.etotem.cfc.service.GuideFamilyService;
|
|
|
import com.etotem.cfc.service.MembershipService;
|
|
import com.etotem.cfc.service.MembershipService;
|
|
|
import com.etotem.cfc.service.TaskService;
|
|
import com.etotem.cfc.service.TaskService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
@@ -23,6 +25,7 @@ import java.time.LocalDate;
|
|
|
import java.time.ZoneId;
|
|
import java.time.ZoneId;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
+import com.etotem.cfc.util.ParamUtils;
|
|
|
|
|
|
|
|
@Tag(name = "指导师-家庭任务管理", description = "指导师查看家庭任务、审核任务等接口")
|
|
@Tag(name = "指导师-家庭任务管理", description = "指导师查看家庭任务、审核任务等接口")
|
|
|
@RestController
|
|
@RestController
|
|
@@ -44,6 +47,35 @@ public class GuideFamilyTaskController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private MembershipService membershipService;
|
|
private MembershipService membershipService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private GuideFamilyService guideFamilyService;
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 规划师解除家庭绑定(仅限解除属于自己的绑定)
|
|
|
|
|
+ */
|
|
|
|
|
+ @Operation(summary = "规划师解除家庭绑定")
|
|
|
|
|
+ @PostMapping("/unbind")
|
|
|
|
|
+ public Result<Map<String, Object>> unbindFamily(@RequestAttribute("userId") Long guideId,
|
|
|
|
|
+ @RequestAttribute("role") String role,
|
|
|
|
|
+ @RequestBody Map<String, Object> params) {
|
|
|
|
|
+ if (!"teacher".equals(role)) {
|
|
|
|
|
+ return Result.error("Access denied");
|
|
|
|
|
+ }
|
|
|
|
|
+ Long id = ParamUtils.getLong(params.get("id"));
|
|
|
|
|
+ if (id == null) {
|
|
|
|
|
+ return Result.error("缺少绑定记录ID");
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ GuideFamily gf = guideFamilyService.unbindByGuide(id, guideId);
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+ result.put("familyId", gf.getFamilyId());
|
|
|
|
|
+ result.put("serviceType", gf.getServiceType());
|
|
|
|
|
+ return Result.success(result);
|
|
|
|
|
+ } catch (RuntimeException e) {
|
|
|
|
|
+ return Result.error(400, e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 会员任务校验:task.memberOnly==1 且家庭非会员 → 拒绝(提示开通会员)
|
|
* 会员任务校验:task.memberOnly==1 且家庭非会员 → 拒绝(提示开通会员)
|
|
|
*/
|
|
*/
|