|
@@ -5,6 +5,7 @@ import com.etotem.cfc.common.Result;
|
|
|
import com.etotem.cfc.dto.BindGuideDTO;
|
|
import com.etotem.cfc.dto.BindGuideDTO;
|
|
|
import com.etotem.cfc.entity.GuideFamily;
|
|
import com.etotem.cfc.entity.GuideFamily;
|
|
|
import com.etotem.cfc.service.GuideFamilyService;
|
|
import com.etotem.cfc.service.GuideFamilyService;
|
|
|
|
|
+import com.etotem.cfc.service.MembershipService;
|
|
|
import com.etotem.cfc.service.TeacherMessageService;
|
|
import com.etotem.cfc.service.TeacherMessageService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -26,15 +27,18 @@ public class BindController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private TeacherMessageService teacherMessageService;
|
|
private TeacherMessageService teacherMessageService;
|
|
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private MembershipService membershipService;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 家长确认绑定指导师
|
|
* 家长确认绑定指导师
|
|
|
*/
|
|
*/
|
|
|
@Operation(summary = "确认绑定指导师")
|
|
@Operation(summary = "确认绑定指导师")
|
|
|
@PostMapping("/accept")
|
|
@PostMapping("/accept")
|
|
|
public Result<Boolean> acceptBind(@RequestAttribute("userId") Long userId,
|
|
public Result<Boolean> acceptBind(@RequestAttribute("userId") Long userId,
|
|
|
- @RequestAttribute("familyId") Long familyId,
|
|
|
|
|
@RequestBody BindGuideDTO dto) {
|
|
@RequestBody BindGuideDTO dto) {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ Long familyId = membershipService.getUserFamilyId(userId);
|
|
|
boolean success = guideFamilyService.confirmBind(dto.getGuideId(), familyId,
|
|
boolean success = guideFamilyService.confirmBind(dto.getGuideId(), familyId,
|
|
|
dto.getServiceType(), dto.getServicePrice());
|
|
dto.getServiceType(), dto.getServicePrice());
|
|
|
return Result.success(success);
|
|
return Result.success(success);
|
|
@@ -48,7 +52,8 @@ public class BindController {
|
|
|
*/
|
|
*/
|
|
|
@Operation(summary = "获取绑定的指导师列表")
|
|
@Operation(summary = "获取绑定的指导师列表")
|
|
|
@PostMapping("/guides")
|
|
@PostMapping("/guides")
|
|
|
- public Result<List<Map<String, Object>>> getBoundGuides(@RequestAttribute("familyId") Long familyId) {
|
|
|
|
|
|
|
+ public Result<List<Map<String, Object>>> getBoundGuides(@RequestAttribute("userId") Long userId) {
|
|
|
|
|
+ Long familyId = membershipService.getUserFamilyId(userId);
|
|
|
List<GuideFamily> bindings = guideFamilyService.getGuidesByFamily(familyId);
|
|
List<GuideFamily> bindings = guideFamilyService.getGuidesByFamily(familyId);
|
|
|
|
|
|
|
|
List<Map<String, Object>> result = bindings.stream().map(binding -> {
|
|
List<Map<String, Object>> result = bindings.stream().map(binding -> {
|
|
@@ -71,8 +76,8 @@ public class BindController {
|
|
|
@Operation(summary = "解除绑定规划师")
|
|
@Operation(summary = "解除绑定规划师")
|
|
|
@PostMapping("/unbind")
|
|
@PostMapping("/unbind")
|
|
|
public Result<Boolean> unbind(@RequestAttribute("userId") Long userId,
|
|
public Result<Boolean> unbind(@RequestAttribute("userId") Long userId,
|
|
|
- @RequestAttribute("familyId") Long familyId,
|
|
|
|
|
- @RequestBody Map<String, Object> params) {
|
|
|
|
|
|
|
+ @RequestBody Map<String, Object> params) {
|
|
|
|
|
+ Long familyId = membershipService.getUserFamilyId(userId);
|
|
|
Long id = Long.valueOf(params.get("id").toString());
|
|
Long id = Long.valueOf(params.get("id").toString());
|
|
|
try {
|
|
try {
|
|
|
GuideFamily gf = guideFamilyService.unbindAndGet(id, familyId);
|
|
GuideFamily gf = guideFamilyService.unbindAndGet(id, familyId);
|