puzhibing
2023-12-08 a1e80d905fd38f6ead484396b788fe19b0a3d7d5
cloud-server-course/src/main/java/com/dsh/course/service/impl/TCoursePackageServiceImpl.java
@@ -123,9 +123,9 @@
    @Override
    public List<CoursePackageListVo> queryCourseList(Integer uid, CoursePackageList coursePackageList) throws Exception {
        AppUser appUser = appUserClient.queryAppUser(uid);
        Map<String, String> geocode = gdMapGeocodingUtil.geocode(coursePackageList.getLon(), coursePackageList.getLat());
        String provinceCode = geocode.get("provinceCode");
        String cityCode = geocode.get("cityCode");
//        Map<String, String> geocode = gdMapGeocodingUtil.geocode(coursePackageList.getLon(), coursePackageList.getLat());
//        String provinceCode = geocode.get("provinceCode");
//        String cityCode = geocode.get("cityCode");
//        QueryWrapper<TCoursePackage> wrapper = new QueryWrapper<TCoursePackage>().in("status", Arrays.asList(1, 2))
//                .eq("auditStatus", 2).eq("state", 1).eq("provinceCode", provinceCode).eq("cityCode", cityCode);
@@ -581,7 +581,7 @@
     * @throws Exception
     */
    @Override
    public CoursePackageInfo queryCourseInfo(Integer uid, Integer id, String lon, String lat) throws Exception {
    public CoursePackageInfo queryCourseInfo(Integer uid, Integer id, String lon, String lat, Integer stuId) throws Exception {
        AppUser appUser = appUserClient.queryAppUser(uid);
        TCoursePackage coursePackage = this.getById(id);
        CoursePackageInfo coursePackageInfo = new CoursePackageInfo();
@@ -783,8 +783,13 @@
        });
        coursePackageInfo.setList(list);
        Student student = studentClient.queryDefaultStudent(uid);
        StudentVo studentVo = new StudentVo();
        Student student = null;
        if(null != stuId){
            student = studentClient.queryStudentById(stuId);
        }else{
            student = studentClient.queryDefaultStudent(uid);
        }
        if (null != student) {
            studentVo.setId(student.getId());
            studentVo.setPhone(student.getPhone());
@@ -808,7 +813,7 @@
    @Override
    public ResultUtil paymentCourse(Integer uid, PaymentCourseVo paymentCourseVo) throws Exception {
        AppUser appUser = appUserClient.queryAppUser(uid);
        CoursePackageInfo coursePackageInfo = queryCourseInfo(uid, paymentCourseVo.getId(), null, null);
        CoursePackageInfo coursePackageInfo = queryCourseInfo(uid, paymentCourseVo.getId(), null, null, null);
        //校验是否已经报满
        Integer integer = coursePackagePaymentService.queryCountNumber(paymentCourseVo.getId());
        TCoursePackage course = coursePackageService.getById(paymentCourseVo.getId());
@@ -1310,7 +1315,6 @@
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
                SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
                //剩余课时
                Integer laveClassHours = coursePackageOrderStudent.getLaveClassHours();
                //扣除课时数
@@ -1337,11 +1341,26 @@
                        continue;
                    }
                    //大于有效期不进行排课
                    if (calendar.getTimeInMillis() >= validity.getTime()) {
                        break;
                    }
                    //检查是否有体验购课
                    int count = coursePackageSchedulingService.count(new QueryWrapper<CoursePackageScheduling>()
                            .eq("type", 3)
                            .eq("appUserId", userId)
                            .eq("studentId", sId)
                            .eq("coursePackageId", tCoursePackage.getId())
                            .eq("status", 1)
                            .eq("DATE_FORMAT(classDate, '%Y-%m-%d')", format.format(time))
                    );
                    //有体验购课,不进行排课
                    if(count != 0){
                        calendar.set(Calendar.DAY_OF_YEAR, calendar.get(Calendar.DAY_OF_YEAR) + 1);
                        continue;
                    }
                    for (int j = 0; j < split.length; j++) {
                        //剩余数量不足以排课
                        if (laveClassHours.compareTo(codeTime) < 0) {