From 986989a2b7a49353598fda317e3bdaed59f09abc Mon Sep 17 00:00:00 2001 From: nickchange <126672920+nickchange@users.noreply.github.com> Date: 星期二, 31 十月 2023 16:19:55 +0800 Subject: [PATCH] 10.31 --- cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java | 184 ++++++++++++++++++++-------------------------- 1 files changed, 80 insertions(+), 104 deletions(-) diff --git a/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java b/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java index cae2ee6..ae124df 100644 --- a/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java +++ b/cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java @@ -488,7 +488,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 +555,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 +588,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 +605,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 +687,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 +757,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 +790,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 +807,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); + } } } -- Gitblit v1.7.1