44323
2023-11-14 ddbb38c54db9c3670e5ff53f4bf713525de1099d
cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java
@@ -42,7 +42,8 @@
    TCoursePackagePaymentService paymentService;
    @Autowired
    private CourseCounsumService counsumService;
    @Autowired
    private TCoursePackageService coursePackageService;
    //获取退费记录
    @RequestMapping("/getRefund")
    @ResponseBody
@@ -73,13 +74,16 @@
    @RequestMapping("/bypac")
    @ResponseBody
    public List<Map<String, Object>> bypac(@RequestBody PacQueryDto pacQueryDto) {
        System.out.println("-====studentQeryDto========="+pacQueryDto);
        if (pacQueryDto.getStoreIds()!=null && pacQueryDto.getStoreIds().size()!=0){
            // 根据门店id 查询课包ids
            List<Integer> coursePackageIds = coursePackageService.list(new QueryWrapper<TCoursePackage>()
                    .in("storeId", pacQueryDto.getStoreIds())).stream()
                    .map(TCoursePackage::getId).collect(Collectors.toList());
            pacQueryDto.setStoreIds(coursePackageIds);
        }
        List<Map<String, Object>>  pays =  paymentService.bypac(pacQueryDto);
        System.out.println("=========pays======"+pays);
        return  pays;
@@ -488,7 +492,7 @@
    private StudentClient studentClient;
    @RequestMapping(value = "/toHoli",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    @ResponseBody
    public String toHoli(@RequestBody ToHoliDto toHoliDto){
    public String toHoli(@RequestBody ToHoliDto toHoliDto) throws ParseException {
        String [] ids = toHoliDto.getIds();
        List<String> strings = new ArrayList<>();
@@ -555,27 +559,23 @@
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                        try {
                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                                                    Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                            CoursePackageStudent student1 = new CoursePackageStudent();
                            student1.setAppUserId(student.getAppUserId());
                            student1.setStudentId(student.getId());
                            student1.setCoursePackageId(tCoursePackage.getId());
                            student1.setCoursePackagePaymentId(holi.getId());
                            student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                            student1.setSignInOrNot(1);
                            student1.setReservationStatus(1);
                            student1.setInsertTime(new Date());
                            studentService.save(student1);
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                        CoursePackageStudent student1 = new CoursePackageStudent();
                        student1.setAppUserId(student.getAppUserId());
                        student1.setStudentId(student.getId());
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(holi.getId());
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        studentService.save(student1);
                    }
@@ -592,45 +592,12 @@
                        for (int i1 = 0; i1 < split.length; i1++) {
                            CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                            coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                            try {
                                Date parse = format1.parse(format.format(time) + " " + split[i1]);
                                                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                                Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                                coursePackageScheduling.setClassDate(parse);
                                coursePackageScheduling.setEndDate(parse1);
                                coursePackageScheduling.setStatus(1);
                                coursePackageSchedulingService.insert(coursePackageScheduling);
                                CoursePackageStudent student1 = new CoursePackageStudent();
                                student1.setAppUserId(student.getAppUserId());
                                student1.setStudentId(student.getId());
                                student1.setCoursePackageId(tCoursePackage.getId());
                                student1.setCoursePackagePaymentId(holi.getId());
                                student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                                student1.setSignInOrNot(1);
                                student1.setReservationStatus(1);
                                student1.setInsertTime(new Date());
                                studentService.save(student1);
                            } catch (ParseException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                }else {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7);
                    Date time = instance.getTime();
                    for (int i1 = 0; i1 < split.length; i1++) {
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                        try {
                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                            CoursePackageStudent student1 = new CoursePackageStudent();
                            student1.setAppUserId(student.getAppUserId());
@@ -642,9 +609,34 @@
                            student1.setReservationStatus(1);
                            student1.setInsertTime(new Date());
                            studentService.save(student1);
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                    }
                }else {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7);
                    Date time = instance.getTime();
                    for (int i1 = 0; i1 < split.length; i1++) {
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                                                    Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                        CoursePackageStudent student1 = new CoursePackageStudent();
                        student1.setAppUserId(student.getAppUserId());
                        student1.setStudentId(student.getId());
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(holi.getId());
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        studentService.save(student1);
                    }
                }
            }
@@ -699,7 +691,7 @@
    @RequestMapping(value = "/toTrans",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    @ResponseBody
    public String toTrans(@RequestBody ToHoliDto toHoliDto){
    public String toTrans(@RequestBody ToHoliDto toHoliDto) throws ParseException {
        String [] ids = toHoliDto.getIds();
        List<String> strings = new ArrayList<>();
@@ -769,27 +761,23 @@
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                        try {
                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                        Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                            CoursePackageStudent student1 = new CoursePackageStudent();
                            student1.setAppUserId(student.getAppUserId());
                            student1.setStudentId(student.getId());
                            student1.setCoursePackageId(tCoursePackage.getId());
                            student1.setCoursePackagePaymentId(holi.getId());
                            student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                            student1.setSignInOrNot(1);
                            student1.setReservationStatus(1);
                            student1.setInsertTime(new Date());
                            studentService.save(student1);
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                        CoursePackageStudent student1 = new CoursePackageStudent();
                        student1.setAppUserId(student.getAppUserId());
                        student1.setStudentId(student.getId());
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(holi.getId());
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        studentService.save(student1);
                    }
@@ -806,45 +794,12 @@
                        for (int i1 = 0; i1 < split.length; i1++) {
                            CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                            coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                            try {
                                Date parse = format1.parse(format.format(time) + " " + split[i1]);
                                                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                                Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                                coursePackageScheduling.setClassDate(parse);
                                coursePackageScheduling.setEndDate(parse1);
                                coursePackageScheduling.setStatus(1);
                                coursePackageSchedulingService.insert(coursePackageScheduling);
                                CoursePackageStudent student1 = new CoursePackageStudent();
                                student1.setAppUserId(student.getAppUserId());
                                student1.setStudentId(student.getId());
                                student1.setCoursePackageId(tCoursePackage.getId());
                                student1.setCoursePackagePaymentId(holi.getId());
                                student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                                student1.setSignInOrNot(1);
                                student1.setReservationStatus(1);
                                student1.setInsertTime(new Date());
                                studentService.save(student1);
                            } catch (ParseException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                }else {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7);
                    Date time = instance.getTime();
                    for (int i1 = 0; i1 < split.length; i1++) {
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                        try {
                            Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                            CoursePackageStudent student1 = new CoursePackageStudent();
                            student1.setAppUserId(student.getAppUserId());
@@ -856,10 +811,35 @@
                            student1.setReservationStatus(1);
                            student1.setInsertTime(new Date());
                            studentService.save(student1);
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                    }
                }else {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7);
                    Date time = instance.getTime();
                    for (int i1 = 0; i1 < split.length; i1++) {
                        CoursePackageScheduling coursePackageScheduling = new CoursePackageScheduling();
                        coursePackageScheduling.setCoursePackageId(tCoursePackage.getId());
                                                    Date parse = format1.parse(format.format(time) + " " + split[i1]);
                            Date parse1 = format1.parse(format.format(time) + " " + split1[i1]);
                            coursePackageScheduling.setClassDate(parse);
                            coursePackageScheduling.setEndDate(parse1);
                            coursePackageScheduling.setStatus(1);
                            coursePackageSchedulingService.insert(coursePackageScheduling);
                        CoursePackageStudent student1 = new CoursePackageStudent();
                        student1.setAppUserId(student.getAppUserId());
                        student1.setStudentId(student.getId());
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(holi.getId());
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        studentService.save(student1);
                    }
                }
            }