luo
2023-09-25 35fec86ca49916eb8a8082f7f1e99185ee1e3c24
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -8,6 +8,7 @@
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.entity.TAppUser;
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.CoachClient;
import com.dsh.course.feignclient.account.StudentClient;
@@ -724,17 +725,23 @@
        }
        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);
            TAppUser appUser = appuClient.queryAppUser1(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));
                    .eq("studentId", studentId).eq("coursePackagePaymentId", id).eq("signInOrNot", 2));
            map.put("already", integer);
//            if (student != null && student.getName().equals("杨锴1")) {
//                map.put("totalClassHours", "测试");
//            }
            ;
        }
        return list;
    }
@@ -831,7 +838,7 @@
        // 今天周几
        int i = cn.hutool.core.date.DateUtil.dayOfWeek(new Date())-1;
        SimpleDateFormat format = new SimpleDateFormat("MM.dd");
        SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd");
        ArrayList<String> strings1 = new ArrayList<>();
        for (Integer integer : week) {
@@ -930,7 +937,7 @@
            return ResultUtil.error("当前课包课时数不足");
        }
        tCoursePackagePayment.setLaveClassHours(tCoursePackagePayment.getLaveClassHours()-req.getNum());
        this.baseMapper.updateById(tCoursePackagePayment);
        this.baseMapper.updateHoursById(tCoursePackagePayment.getId(),-req.getNum());
        TCoursePackage tCoursePackage = tcpmapper.selectById(req.getCourseId());
@@ -987,7 +994,7 @@
                    student1.setReservationStatus(1);
                    student1.setInsertTime(new Date());
                    cpsMapper.insert(student1);
                } catch (ParseException e) {
                } catch (Exception e) {
                    e.printStackTrace();
                }
@@ -998,7 +1005,7 @@
        // 2.0
        TCourseInfoRecord tCourseInfoRecord = new TCourseInfoRecord();
        tCourseInfoRecord.setUserId(userId);
        tCourseInfoRecord.setCourseId(req.getOldCourseId());
        tCourseInfoRecord.setCourseId(req.getCourseId());
        tCourseInfoRecord.setName("体验购课");
        tCourseInfoRecord.setNum(req.getNum());
        tCourseInfoRecord.setTime(new Date());
@@ -1032,7 +1039,7 @@
    }
    @Override
    public List<Integer> getStudentIds(Integer payId) {
    public List<Integer> getStudentIds(Long payId) {
       return  this.baseMapper.getStudentIds(payId);
    }