| | |
| | | import com.alipay.api.domain.Person; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.course.entity.*; |
| | | import com.dsh.course.feignclient.account.AppUserClient; |
| | | import com.dsh.course.feignclient.account.CoachClient; |
| | | import com.dsh.course.feignclient.account.StudentClient; |
| | | import com.dsh.course.feignclient.account.model.AppUser; |
| | | import com.dsh.course.feignclient.account.model.Coach; |
| | | import com.dsh.course.feignclient.account.model.Student; |
| | | import com.dsh.course.feignclient.activity.BenefitVideoClient; |
| | | import com.dsh.course.feignclient.activity.CouponClient; |
| | | import com.dsh.course.feignclient.activity.model.BenefitsVideos; |
| | |
| | | import com.dsh.course.feignclient.other.StoreClient; |
| | | import com.dsh.course.feignclient.other.model.Store; |
| | | import com.dsh.course.mapper.*; |
| | | import com.dsh.course.model.QueryRegistrationRecord; |
| | | import com.dsh.course.model.QueryWalkInStudentList; |
| | | import com.dsh.course.model.dto.DiscountJsonDto; |
| | | import com.dsh.course.model.vo.RegisterCourseVo; |
| | | import com.dsh.course.model.vo.request.ClasspaymentRequest; |
| | |
| | | import com.dsh.course.model.vo.response.AppUserVideoResponse; |
| | | import com.dsh.course.model.vo.response.CourseDetailsResponse; |
| | | import com.dsh.course.model.vo.response.CourseOfVideoResponse; |
| | | import com.dsh.course.service.ICoursePackageSchedulingService; |
| | | import com.dsh.course.service.TCoursePackagePaymentService; |
| | | import com.dsh.course.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | @Resource |
| | | private BenefitVideoClient bfvoClient; |
| | | |
| | | |
| | | @Resource |
| | | private UserVideoDetailsMapper uvdmapper; |
| | | |
| | |
| | | @Resource |
| | | private TCoursePackageDiscountMapper tcpdMapper; |
| | | |
| | | |
| | | @Resource |
| | | private CoursePackagePaymentConfigMapper cpConfigMapper; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private AppUserClient appuClient; |
| | | |
| | | @Resource |
| | | private StudentClient studentClient; |
| | | |
| | | @Autowired |
| | | private ICoursePackageSchedulingService coursePackageSchedulingService; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取课包报名信息 |
| | | * @param page |
| | | * @param queryRegistrationRecord |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryRegistrationRecord(Page<Map<String, Object>> page, QueryRegistrationRecord queryRegistrationRecord) { |
| | | Integer coursePackageId = queryRegistrationRecord.getCoursePackageId(); |
| | | String userName = queryRegistrationRecord.getUserName(); |
| | | List<Integer> userIds = null; |
| | | List<Integer> studentIds = null; |
| | | if(ToolUtil.isNotEmpty(userName)){ |
| | | List<AppUser> appUsers = appuClient.queryAppUserListByName(userName); |
| | | if(appUsers.size() > 0){ |
| | | userIds = appUsers.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | String studentName = queryRegistrationRecord.getStudentName(); |
| | | if(ToolUtil.isNotEmpty(studentName)){ |
| | | List<Student> students = studentClient.queryStudentListByName(studentName); |
| | | if(students.size() > 0){ |
| | | studentIds = students.stream().map(Student::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<Map<String, Object>> list = this.baseMapper.queryRegistrationRecord(page, coursePackageId, userIds, studentIds); |
| | | for (Map<String, Object> map : list) { |
| | | Long id = Long.valueOf(map.get("id").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer studentId = Integer.valueOf(map.get("studentId").toString()); |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | map.put("userName", null != appUser ? appUser.getName() : ""); |
| | | map.put("phone", null != appUser ? appUser.getPhone() : ""); |
| | | Student student = studentClient.queryStudentById(studentId); |
| | | map.put("studentName", null != student ? student.getName() : ""); |
| | | Integer integer = cpsMapper.selectCount(new QueryWrapper<CoursePackageStudent>().eq("appUserId", appUserId) |
| | | .eq("studentId", studentId).eq("coursePackagePaymentId", id).eq("signInOrNot", 1)); |
| | | map.put("already", integer); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取未预约排课学员列表 |
| | | * @param page |
| | | * @param queryWalkInStudentList |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String, Object>> queryWalkInStudentList(Page<Map<String, Object>> page, QueryWalkInStudentList queryWalkInStudentList) { |
| | | Long coursePackageSchedulingId = queryWalkInStudentList.getCoursePackageSchedulingId(); |
| | | CoursePackageScheduling coursePackageScheduling = coursePackageSchedulingService.getById(coursePackageSchedulingId); |
| | | String userName = queryWalkInStudentList.getUserName(); |
| | | List<Integer> userIds = null; |
| | | List<Integer> studentIds = null; |
| | | if(ToolUtil.isNotEmpty(userName)){ |
| | | List<AppUser> appUsers = appuClient.queryAppUserListByName(userName); |
| | | if(appUsers.size() > 0){ |
| | | userIds = appUsers.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | String studentName = queryWalkInStudentList.getStudentName(); |
| | | if(ToolUtil.isNotEmpty(studentName)){ |
| | | List<Student> students = studentClient.queryStudentListByName(studentName); |
| | | if(students.size() > 0){ |
| | | studentIds = students.stream().map(Student::getId).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<Long> coursePackagePaymentId = null; |
| | | List<CoursePackageStudent> coursePackageStudents = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>().eq("coursePackageSchedulingId", coursePackageSchedulingId).eq("reservationStatus", 1)); |
| | | if(coursePackageStudents.size() > 0){ |
| | | coursePackagePaymentId = coursePackageStudents.stream().map(CoursePackageStudent::getCoursePackagePaymentId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | List<Map<String, Object>> list = this.baseMapper.queryWalkInStudentList(page, coursePackageScheduling.getCoursePackageId(), coursePackagePaymentId, userIds, studentIds); |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); |
| | | Integer now = Integer.valueOf(sdf.format(new Date())); |
| | | for (Map<String, Object> map : list) { |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer student_Id = Integer.valueOf(map.get("studentId").toString()); |
| | | AppUser appUser = appuClient.queryAppUser(appUserId); |
| | | Student student = studentClient.queryStudentById(student_Id); |
| | | map.put("userName", appUser.getName()); |
| | | map.put("phone", student.getPhone()); |
| | | map.put("studentName", student.getName()); |
| | | map.put("age", null != student.getBirthday() ? now - Integer.valueOf(sdf.format(student.getBirthday())) : "-"); |
| | | map.put("sex", student.getSex()); |
| | | } |
| | | return list; |
| | | } |
| | | } |