liujie
2023-09-26 6d7fdf8edc3d4e2f91bbf438fa785504caa94eb5
后台修改
6个文件已修改
298 ■■■■■ 已修改文件
cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java 282 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/AppUserClient.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/course/feignClient/course/CourseStuddentClient.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/CoursePackageService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
cloud-server-course/src/main/java/com/dsh/course/controller/CourseStudentController.java
@@ -1,6 +1,7 @@
package com.dsh.course.controller;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -9,6 +10,7 @@
import com.dsh.course.feignclient.account.AppUserClient;
import com.dsh.course.feignclient.account.StudentClient;
import com.dsh.course.feignclient.account.model.Student;
import com.dsh.course.mapper.CoursePackageSchedulingMapper;
import com.dsh.course.model.dto.ToClassDto;
import com.dsh.course.service.*;
import com.dsh.course.util.ResultUtil;
@@ -23,10 +25,9 @@
import javax.annotation.Resource;
import javax.swing.text.html.parser.Entity;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Api
@@ -38,6 +39,9 @@
    CoursePackageStudentService studentService ;
    @Autowired
    TCoursePackagePaymentService paymentService;
    @Resource
    private CoursePackageSchedulingMapper coursePackageSchedulingService;
    //获取学员课时数信息
    @RequestMapping("/getInfo")
    @ResponseBody
@@ -159,7 +163,7 @@
        List<TCoursePackage> list = packageService.list(new QueryWrapper<TCoursePackage>()
                .select("id", "name")
                .eq("storeId", storeId)
                .eq("type","1")
                .eq("type","1").ne("id",id)
        );
        List<SelectDto> selectDtos = new ArrayList<>();
        for (TCoursePackage t :list){
@@ -456,6 +460,7 @@
            payment.setLaveClassHours(laveClassHoursnew);
            payment.setTotalClassHours(totalClassHoursnew);
            payment.setAppUserId(null);
            payment.setStatus(3);
            paymentService.updateById(payment);
@@ -471,7 +476,126 @@
            holi.setLaveClassHours(toHoliDto.getClassNum());
            holi.setState(1);
            holi.setInsertTime(new Date());
            holi.setPayStatus(2);
            paymentService.save(holi);
            TCoursePackage tCoursePackage = packageService.getById(toHoliDto.getClassId());
            String classWeeks = tCoursePackage.getClassWeeks();
            List<Integer> week = week(classWeeks);
            String[] split = tCoursePackage.getClassStartTime().split(",");
            String[] split1 = tCoursePackage.getClassEndTime().split(",");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            // 本周周几
            int i = DateUtil.dayOfWeek(new Date())-1;
            for (Integer integer : week) {
                if(integer<i){
                    // 找下一周的时间
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7-(i-integer));
                    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());
                            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 if(integer>i) {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,integer-i);
                    Date time1 = instance.getTime();
                    List<Date> list = new ArrayList<>();
                    list.add(time1);
                    instance.add(Calendar.DATE,7);
                    Date time2 = instance.getTime();
                    list.add(time2);
                    for (Date time : list) {
                        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());
                                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());
                            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();
                        }
                    }
                }
            }
            System.out.println("保存成功=============》="+holi);
@@ -486,7 +610,36 @@
    }
    private List<Integer> week(String week){
        String[] split = week.split(";");
        ArrayList<Integer> integers = new ArrayList<>();
        for (String s : split) {
            switch (s){
                case "周一":
                    integers.add(1);
                    break;
                case "周二":
                    integers.add(2);
                    break;
                case "周三":
                    integers.add(3);
                    break;
                case "周四":
                    integers.add(4);
                    break;
                case "周五":
                    integers.add(5);
                    break;
                case "周六":
                    integers.add(6);
                    break;
                case "周日":
                    integers.add(7);
                    break;
            }
        }
        return integers;
    }
    @RequestMapping(value = "/toTrans",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
@@ -533,10 +686,127 @@
            holi.setLaveClassHours(laveClassHours);
            holi.setState(1);
            holi.setInsertTime(new Date());
            holi.setPayStatus(2);
            paymentService.save(holi);
            System.out.println("保存成功=============》="+holi);
            TCoursePackage tCoursePackage = packageService.getById(toHoliDto.getClassId());
            String classWeeks = tCoursePackage.getClassWeeks();
            List<Integer> week = week(classWeeks);
            String[] split = tCoursePackage.getClassStartTime().split(",");
            String[] split1 = tCoursePackage.getClassEndTime().split(",");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
            // 本周周几
            int i = DateUtil.dayOfWeek(new Date())-1;
            for (Integer integer : week) {
                if(integer<i){
                    // 找下一周的时间
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,7-(i-integer));
                    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());
                            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 if(integer>i) {
                    Calendar instance = Calendar.getInstance();
                    instance.add(Calendar.DATE,integer-i);
                    Date time1 = instance.getTime();
                    List<Date> list = new ArrayList<>();
                    list.add(time1);
                    instance.add(Calendar.DATE,7);
                    Date time2 = instance.getTime();
                    list.add(time2);
                    for (Date time : list) {
                        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());
                                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());
                            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();
                        }
                    }
                }
            }
        }
cloud-server-course/src/main/java/com/dsh/course/feignclient/account/AppUserClient.java
@@ -5,7 +5,6 @@
import com.dsh.course.feignclient.account.model.AppUser;
import com.dsh.course.feignclient.account.model.TCourseInfoRecord;
import com.dsh.course.model.AppUserByNameAndPhoneDTO;
//import com.dsh.course.model.TAppUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackagePaymentServiceImpl.java
@@ -1008,7 +1008,7 @@
                    student1.setCoursePackageId(tCoursePackage.getId());
                    student1.setCoursePackagePaymentId(tCoursePackagePayment1.getId());
                    student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                    student1.setSignInOrNot(0);
                    student1.setSignInOrNot(1);
                    student1.setReservationStatus(1);
                    student1.setInsertTime(new Date());
                    student1.setType(1);
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -1072,7 +1072,7 @@
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(paymentId);
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(0);
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        cpsMapper.insert(student1);
@@ -1109,7 +1109,7 @@
                            student1.setCoursePackageId(tCoursePackage.getId());
                            student1.setCoursePackagePaymentId(paymentId);
                            student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                            student1.setSignInOrNot(0);
                            student1.setSignInOrNot(1);
                            student1.setReservationStatus(1);
                            student1.setInsertTime(new Date());
                            cpsMapper.insert(student1);
@@ -1133,10 +1133,6 @@
                        coursePackageScheduling.setClassDate(parse);
                        coursePackageScheduling.setEndDate(parse1);
                        coursePackageScheduling.setStatus(1);
                        coursePackageScheduling.setCourseId(tCoursePackage.getId());
                        coursePackageScheduling.setIntegral(0);
                        coursePackageScheduling.setCancelClasses("");
                        coursePackageScheduling.setDeductClassHour(0);
                        coursePackageSchedulingService.save(coursePackageScheduling);
                        CoursePackageStudent student1 = new CoursePackageStudent();
@@ -1145,7 +1141,7 @@
                        student1.setCoursePackageId(tCoursePackage.getId());
                        student1.setCoursePackagePaymentId(paymentId);
                        student1.setCoursePackageSchedulingId(coursePackageScheduling.getId());
                        student1.setSignInOrNot(0);
                        student1.setSignInOrNot(1);
                        student1.setReservationStatus(1);
                        student1.setInsertTime(new Date());
                        cpsMapper.insert(student1);
cloud-server-management/src/main/java/com/dsh/course/feignClient/course/CourseStuddentClient.java
@@ -89,7 +89,6 @@
    @RequestMapping(value = "/courdent/toHoli",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String toHoli(@RequestBody ToHoliDto toHoliDto);
    @RequestMapping(value = "/courdent/toTrans",produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = "application/json;charset=UTF-8")
    String toTrans(@RequestBody ToHoliDto toHoliDto);
cloud-server-management/src/main/java/com/dsh/guns/modular/system/service/impl/CoursePackageService.java
@@ -417,7 +417,7 @@
        }
        List<CoursePackageStudent> coursePackageStudents = coursePackageStudentClient.queryByCoursePackageSchedulingId(id);
        if(coursePackageStudents.size() > 0){
            return ResultUtil.error("不能取消本次");
//            return ResultUtil.error("不能取消本次");
        }
        coursePackageScheduling = new CoursePackageScheduling();
        coursePackageScheduling.setId(id);