Browse Source

feat:加油包关心包

Joburgess 4 years ago
parent
commit
7d9951e0bb

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/StudentManageQueryInfo.java

@@ -40,6 +40,26 @@ public class StudentManageQueryInfo extends QueryInfo {
 
     private Integer isNewUser;
 
+    private Integer carePackage;
+
+    private Integer comeOnPackage;
+
+    public Integer getCarePackage() {
+        return carePackage;
+    }
+
+    public void setCarePackage(Integer carePackage) {
+        this.carePackage = carePackage;
+    }
+
+    public Integer getComeOnPackage() {
+        return comeOnPackage;
+    }
+
+    public void setComeOnPackage(Integer comeOnPackage) {
+        this.comeOnPackage = comeOnPackage;
+    }
+
     public Integer getIsNewUser() {
         return isNewUser;
     }

+ 2 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -1030,7 +1030,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 			StudentReviewIdMap = studentReviews.stream().collect(Collectors.toMap(CourseScheduleComplaints::getCourseScheduleId, CourseScheduleComplaints::getId));
 		}
 
-		Set<Long> practiceGroupIds = studentCourseSchedulesWithDate.stream().filter(cs -> CourseScheduleType.PRACTICE.equals(cs.getType())).map(cs->Long.valueOf(cs.getMusicGroupId())).collect(Collectors.toSet());
+		Set<Long> practiceGroupIds = studentCourseSchedulesWithDate.stream().filter(cs -> CourseScheduleType.PRACTICE.equals(cs.getType())&&Objects.nonNull(cs.getMusicGroupId())).map(cs->Long.valueOf(cs.getMusicGroupId())).collect(Collectors.toSet());
 
 		Map<Long, PracticeGroupType> practiceGroupTypeMap = new HashMap<>();
         if(!CollectionUtils.isEmpty(practiceGroupIds)){
@@ -1050,7 +1050,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             courseScheduleDto.setSubjectId(subjectIdCourseMap.get(courseScheduleDto.getId().intValue()));
 			courseScheduleDto.setReviewId(reviewIdMap.get(courseScheduleDto.getId().intValue()));
 			courseScheduleDto.setStudentReviewId(StudentReviewIdMap.get(courseScheduleDto.getId()));
-			if(CourseScheduleType.PRACTICE.equals(courseScheduleDto.getType())){
+			if(CourseScheduleType.PRACTICE.equals(courseScheduleDto.getType())&&Objects.nonNull(courseScheduleDto.getMusicGroupId())){
 				courseScheduleDto.setPracticeType(practiceGroupTypeMap.get(Long.valueOf(courseScheduleDto.getMusicGroupId())));
 			}
         }

+ 4 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/EduPracticeGroupServiceImpl.java

@@ -538,7 +538,6 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
             student.setComeOnPackage(2);
             courseTimes = 8;
         }
-        studentDao.update(student);
 
         if(courseTimes<=0){
             return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "课程信息错误");
@@ -568,7 +567,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         List<CourseSchedule> practiceCourses = new ArrayList<>();
 
-        while (practiceCourses.size()<=courseTimes){
+        while (practiceCourses.size()<courseTimes){
             courseStartDay=courseStartDay.plusDays(1);
             int dayOfWeek = courseStartDay.get(DateUtil.weekFields.dayOfWeek());
             for (PracticeDrillTimeDto drillTime : practiceGroupBuyParams.getDrillTimes()) {
@@ -624,12 +623,12 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
 
         PracticeGroupSellPrice practiceGroupSellPrice = practiceGroupSellPriceDao.get(sysUser.getOrganId());
         if(Objects.isNull(practiceGroupSellPrice)){
-            return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "所在城市暂不参与此活动");
+            throw new BizException("所在城市暂不参与此活动");
         }
 
         BigDecimal price = PracticeGroupType.CARE_PACKAGE.equals(practiceGroupBuyParams.getType())?practiceGroupSellPrice.getCarePackagePrice():practiceGroupSellPrice.getComeOnPackagePrice();
         if(Objects.isNull(price)&&PracticeGroupType.COME_ON_PACKAGE.equals(practiceGroupBuyParams.getType())){
-            return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请设置加油包价格");
+            throw new BizException("请设置加油包价格");
         }
 
         practiceGroupBuyParams.setCoursesStartDate(practiceCourses.stream().min(Comparator.comparing(CourseSchedule::getStartClassTime)).get().getStartClassTime());
@@ -759,6 +758,7 @@ public class EduPracticeGroupServiceImpl implements EduPracticeGroupService{
         courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
         courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
         teacherAttendanceDao.batchInsert(teacherAttendances);
+        studentDao.update(student);
 
         try {
             courseScheduleService.checkNewCourseSchedules(practiceCourses,false,false);

+ 1 - 1
mec-biz/src/main/resources/config/mybatis/PracticeGroupMapper.xml

@@ -699,7 +699,7 @@
     </select>
 
     <select id="getPracticeGroupByIds" resultMap="PracticeCourseDto">
-        SELECT pg.id_,t.real_name_,et.real_name_ edu_teacher_name_ FROM practice_group pg
+        SELECT pg.id_,pg.type_,t.real_name_,et.real_name_ edu_teacher_name_ FROM practice_group pg
         LEFT JOIN sys_user t ON pg.user_id_ = t.id_
         LEFT JOIN sys_user et ON et.id_ = pg.educational_teacher_id_
         WHERE pg.id_ IN

+ 6 - 0
mec-biz/src/main/resources/config/mybatis/StudentManageDao.xml

@@ -199,6 +199,12 @@
             <if test="isNewUser != null">
                 AND s.is_new_user_ = #{isNewUser}
             </if>
+            <if test="carePackage != null">
+                AND s.care_package_ = #{carePackage}
+            </if>
+            <if test="comeOnPackage != null">
+                AND s.come_on_package_ = #{comeOnPackage}
+            </if>
         </where>
     </sql>
 

+ 0 - 4
mec-web/src/main/java/com/ym/mec/web/controller/education/EduPracticeGroupController.java

@@ -126,10 +126,6 @@ public class EduPracticeGroupController extends BaseController {
                     if(weekNumApplyTimesMapEntry.getValue().contains(nextTime.format(DateUtil.timeFormatter))){
                         continue;
                     }
-                    LocalTime preTime = time.plusMinutes(-30);
-                    if(weekNumApplyTimesMapEntry.getValue().contains(preTime.format(DateUtil.timeFormatter))){
-                        continue;
-                    }
                     iterator.remove();
                 }
             }