| | |
| | | import com.alipay.api.response.AlipayTradeQueryResponse; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.util.*; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.models.auth.In; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.persistence.criteria.CriteriaBuilder; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.text.ParseException; |
| | |
| | | |
| | | |
| | | @Override |
| | | public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId) { |
| | | public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId,Integer pageNum) { |
| | | |
| | | |
| | | List<RecordAppoint> recordVoList = new ArrayList<>(); |
| | | List<TCoursePackagePayment> tCoursePackagePayments = this.baseMapper.selectList(new QueryWrapper<TCoursePackagePayment>() |
| | | .eq("studentId",stuId ) |
| | |
| | | .eq("payStatus",2 ) |
| | | .eq("status",1 ) |
| | | .orderByDesc("insertTime")); |
| | | |
| | | List<Integer> ids = new ArrayList<>(); |
| | | for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | ids.add(tCoursePackagePayment.getCoursePackageId()); |
| | | } |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy.MM.dd"); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); |
| | | if (tCoursePackagePayments.size() > 0 ){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | |
| | | List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() ) |
| | | .eq("studentId",stuId) |
| | | .eq("appUserId",appUserId) |
| | | .eq("reservationStatus",1)); |
| | | if (ToolUtil.isNotEmpty(coursePackageStudent1) && coursePackageStudent1.size() > 0){ |
| | | // int pageNum = 1; // 页码 |
| | | int pageSize = 10; // 每页记录数 |
| | | Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize); |
| | | |
| | | // for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | // List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>() |
| | | // .in("coursePackageId",ids) |
| | | // .eq("studentId",stuId) |
| | | // .eq("appUserId",appUserId) |
| | | // .eq("reservationStatus",1)); |
| | | IPage<CoursePackageStudent> coursePackageStudentPage = cpsMapper.selectPage(page, new QueryWrapper<CoursePackageStudent>() |
| | | .in("coursePackageId", ids) |
| | | .eq("studentId", stuId) |
| | | .eq("appUserId", appUserId) |
| | | .eq("reservationStatus", 1)); |
| | | List<CoursePackageStudent> coursePackageStudent1 = coursePackageStudentPage.getRecords(); |
| | | |
| | | |
| | | if (ToolUtil.isNotEmpty(coursePackageStudent1) && coursePackageStudent1.size() > 0){ |
| | | TCoursePackage coursePackage = new TCoursePackage(); |
| | | Integer coursePackageId = -1; |
| | | for (CoursePackageStudent coursePackageStudent : coursePackageStudent1) { |
| | | RecordAppoint recordVo = new RecordAppoint(); |
| | | recordVo.setCoursePackageId(tCoursePackagePayment.getCoursePackageId()); |
| | | recordVo.setCoursePackageId(coursePackageStudent.getCoursePackageId()); |
| | | |
| | | TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId()); |
| | | |
| | | |
| | | if (!coursePackageStudent.getCoursePackageId().equals(coursePackageId)) { |
| | | coursePackage = tcpmapper.selectById(coursePackageStudent.getCoursePackageId()); |
| | | coursePackageId = coursePackageStudent.getCoursePackageId(); |
| | | } |
| | | recordVo.setUserId(appUserId); |
| | | recordVo.setSiteId(coursePackage.getSiteId()); |
| | | List<Integer> ids = getIds(coursePackage.getSiteId()); |
| | | recordVo.setIds(ids); |
| | | List<Integer> ids1 = getIds(coursePackage.getSiteId()); |
| | | recordVo.setIds(ids1); |
| | | |
| | | recordVo.setCoursePackageName(coursePackage.getName()); |
| | | recordVo.setCourseHours(tCoursePackagePayment.getClassHours()); |
| | | for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) { |
| | | if (Objects.equals(coursePackageStudent.getCoursePackageId(), tCoursePackagePayment.getCoursePackageId())){ |
| | | recordVo.setCourseHours(tCoursePackagePayment.getClassHours()); |
| | | |
| | | } |
| | | } |
| | | |
| | | // recordVo.setCourseHours(tCoursePackagePayment.getClassHours()); |
| | | Date date = DateUtil.getDate(); |
| | | |
| | | String classStartTime = coursePackage.getClassStartTime(); |
| | |
| | | recordVo.setStatus(5); |
| | | }else { |
| | | CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>() |
| | | .eq("coursePackageId",tCoursePackagePayment.getCoursePackageId() )); |
| | | .eq("coursePackageId",coursePackageStudent.getCoursePackageId() )); |
| | | if (ToolUtil.isNotEmpty(cancelledClasses)){ |
| | | recordVo.setStatus(3); |
| | | // 消课 到课状态0 旷课 |
| | |
| | | } |
| | | |
| | | } |
| | | } |
| | | // } |
| | | |
| | | return recordVoList; |
| | | } |
| | | public List<Integer> getIds(Integer siteId) { |