44323
2023-11-24 ae9bfd2d66f68a553786ac78b12f4390e65e4e09
cloud-server-account/src/main/java/com/dsh/account/controller/StudentController.java
@@ -63,6 +63,15 @@
       return studentService.save(student);
    }
    /**
     * 获取有学员的用户ids
     * @return
     */
    @ResponseBody
    @PostMapping("/student/getHasStudentUser")
    public List<Integer> getHasStudentUser(){
       return studentService.list(new QueryWrapper<TStudent>()).stream().map(TStudent::getAppUserId).distinct().collect(Collectors.toList());
    }
    /**
     * 获取用户学员列表
     * @param appUserId
     * @return
@@ -175,6 +184,12 @@
    @ResponseBody
    @PostMapping("/student/queryById")
    public TStudent queryById(@RequestBody Integer id) {
            return studentService.getById(id);
    }
    @ResponseBody
    @PostMapping("/base/appUser/updateTStudent")
    public void updateTStudent(@RequestBody TStudent student){
        try {
@@ -266,16 +281,14 @@
    @PostMapping("/student/giftSelect")
    public  List<SelectDto> giftSelect(@RequestBody GiftSearchDto giftSearchDto){
        System.out.println("======giftSelect=========giftSearchDto===="+giftSearchDto);
        TAppUser one = appUserService.getOne(new QueryWrapper<TAppUser>().eq("name", giftSearchDto.getName())
                .eq("phone", giftSearchDto.getPhone()));
//       Integer appId = studentService.getGiftSelect(giftSearchDto);
        TCoursePackagePayment1 coursePackagePaymentById = paymentClient.getCoursePackagePaymentById1(giftSearchDto.getId());
//        System.out.println("=======giftSelect======appId====>"+appId);
        List<TStudent> selectDtos =  studentService.list(new QueryWrapper<TStudent>()
                .select("name, id")
                .eq("state", 1)
                .eq("name", giftSearchDto.getName()).eq("phone",giftSearchDto.getPhone()).ne("appUserId",coursePackagePaymentById.getAppUserId()));
                .eq("appUserId",one.getId()));
        List<SelectDto> list = new ArrayList<>();
        for (TStudent student : selectDtos) {
            SelectDto selectDto = new SelectDto();
@@ -283,6 +296,8 @@
            selectDto.setId(student.getId());
            list.add(selectDto);
        }
        // 只筛选当前用户已经购买了这个课程的学员
        System.out.println("=======giftSelect======selectDtos====>"+list);
        return list;
    }