nickchange
2023-11-05 be8a63ba1e3f2e26f5cdefe519c37ad4cfd90435
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -35,14 +35,12 @@
import com.dsh.course.model.vo.RegisterCourseVo;
import com.dsh.course.model.vo.request.*;
import com.dsh.course.model.vo.response.*;
import com.dsh.course.service.CoursePackageSchedulingService;
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 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.http.MediaType;
@@ -390,6 +388,9 @@
                    registerCourseVo.setCourseTime(new SimpleDateFormat("yyyy-MM-dd").format(tCoursePackagePayment.getInsertTime()));
                    Coach coach = coachClient.queryCoachById(coursePackage.getCoachId());
                    registerCourseVo.setCourseTeacher(ToolUtil.isEmpty(coach) ? "" : coach.getName());
                    if (coursePackage.getType()==2) {
                        registerCourseVo.setTime(new SimpleDateFormat("yyyy-MM-dd").format(coursePackage.getStartTime()) + "-" + new SimpleDateFormat("yyyy-MM-dd").format(coursePackage.getEndTime()));
                    }
                    List<CoursePackageStudent> coursePackageStudents = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>()
                            .eq("coursePackageId",coursePackage.getId())
                            .eq("studentId",appUserId ));
@@ -433,6 +434,7 @@
            TCoursePackage coursePackage = tcpmapper.selectById(tCoursePackagePayment.getCoursePackageId());
            response.setCoursePackageId(tCoursePackagePayment.getCoursePackageId());
            response.setCoverDrawing(coursePackage.getCoverDrawing());
            response.setDetailDrawing(coursePackage.getDetailDrawing());
            response.setCoursePackageName(coursePackage.getName());
            response.setCoursePayId(tCoursePackagePayment.getId());
            List<Integer> integers = StrUtils.dealStrToList(coursePackage.getClassWeeks());
@@ -663,7 +665,7 @@
    public ResultUtil AlipayPayment(String code, BigDecimal request){
        TCoursePackagePaymentMapper baseMapper1 = this.baseMapper;
        ResultUtil alipay = payMoneyUtil.alipay("课包购买", "", "", code, request.toString(),
        ResultUtil alipay = payMoneyUtil.alipay("课包购买", "课包购买", "", code, request.toString(),
                "/base/coursePackage/alipayRegisteredCoursesCallback");
        if(alipay.getCode() == 200){
            new Thread(new Runnable() {
@@ -734,6 +736,7 @@
    }
    @Override
    public List<RecordAppoint> obtainStuClassDetails(Integer stuId, Integer appUserId,Integer pageNum) {
@@ -755,8 +758,8 @@
        if (tCoursePackagePayments.size() > 0 ){
//            int pageNum = 1; // 页码
            int pageSize = 10; // 每页记录数
            Page<CoursePackageStudent> page = new Page<>(pageNum, pageSize);
            int pageSize = 5; // 每页记录数
            Page<CoursePackageStudent> page = new Page<>(1, pageSize);
//            for (TCoursePackagePayment tCoursePackagePayment : tCoursePackagePayments) {
//                List<CoursePackageStudent> coursePackageStudent1 = cpsMapper.selectList(new QueryWrapper<CoursePackageStudent>()
@@ -783,6 +786,10 @@
                             coursePackage = tcpmapper.selectById(coursePackageStudent.getCoursePackageId());
                             coursePackageId = coursePackageStudent.getCoursePackageId();
                        }
                        recordVo.setSid(Arrays.asList(coursePackage.getStoreId()));
                        List<Integer> rid  = stoClient.querySiteId(coursePackage.getStoreId());
                        recordVo.setRid(rid);
                        recordVo.setUserId(appUserId);
                        recordVo.setSiteId(coursePackage.getSiteId());
                        List<Integer> ids1 = getIds(coursePackage.getSiteId());
@@ -799,9 +806,22 @@
//                        recordVo.setCourseHours(tCoursePackagePayment.getClassHours());
                        Date date = DateUtil.getDate();
                        String classStartTime = coursePackage.getClassStartTime();
                        String classEndTime = coursePackage.getClassEndTime();
                        recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime);
                        CoursePackageScheduling byId = coursePackageSchedulingService.getById(coursePackageStudent.getCoursePackageSchedulingId());
//                        String classStartTime = coursePackage.getClassStartTime();
//                        String classEndTime = coursePackage.getClassEndTime();
                        if (byId == null){
                            continue;
                        }
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        String dateString1 = sdf.format(byId.getClassDate());
                        String dateString2 = sdf.format(byId.getEndDate());
                        recordVo.setTimeFrame(dateString1 + "-" + dateString2.substring(11));
//                        recordVo.setTimeFrame(simpleDateFormat.format(date)+" "+classStartTime+"-"+classEndTime);
                        Store store = stoClient.queryStoreById(coursePackage.getStoreId());
                        recordVo.setStoreNameAddr(store.getName()+store.getAddress());
                        recordVo.setCourseStuRecordId(coursePackageStudent.getId());
@@ -810,7 +830,7 @@
                        List<String> integerList = Arrays.asList(split);
                        String weekOfDate = DateTimeHelper.getWeekOfDate(new Date());
                        if (integerList.contains(weekOfDate)){
                            String dat = simpleDateFormat.format(date) +" "+ classStartTime;
                            String dat = simpleDateFormat.format(date) +" "+ dateString2.substring(11);
                            Date start = null;
                            try {
@@ -823,8 +843,10 @@
                            }else if(coursePackageStudent.getSignInOrNot()==2){
                                recordVo.setStatus(5);
                            }else {
//                                CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>()
//                                        .eq("coursePackageId",coursePackageStudent.getCoursePackageId()));
                                CancelledClasses cancelledClasses = cacMapper.selectOne(new QueryWrapper<CancelledClasses>()
                                        .eq("coursePackageId",coursePackageStudent.getCoursePackageId() ));
                                        .eq("coursePackageSchedulingId",byId.getId()));
                                if (ToolUtil.isNotEmpty(cancelledClasses)){
                                    recordVo.setStatus(3);
                                    // 消课 到课状态0 旷课