浏览代码

1、vip课更新教学点时,去掉同一教学点判断

Joburgess 5 年之前
父节点
当前提交
2e450c0687

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ClassGroupDao.java

@@ -559,4 +559,22 @@ public interface ClassGroupDao extends BaseDAO<Integer, ClassGroup> {
      */
     List<SuperClassGroupDto> superFindClassGroups(Map<String, Object> params);
     int superCountClassGroups(Map<String, Object> params);
+
+    /**
+     * @describe 根据关键字查询学生相关的班级编号
+     * @author Joburgess
+     * @date 2019/12/31
+     * @param search:
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> findClassGroupIdsByStudent(@Param("search") String search);
+
+    /**
+     * @describe 根据关键字查询教师相关的班级编号
+     * @author Joburgess
+     * @date 2019/12/31
+     * @param search:
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> findClassGroupIdsByTeacher(@Param("search") String search);
 }

+ 18 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -936,4 +936,22 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     List<CourseScheduleEndDto> endFindCourseSchedules(Map<String, Object> params);
     int endCountCourseSchedules(Map<String, Object> params);
+
+    /**
+     * @describe 根据关键字查询学生相关的课程编号
+     * @author Joburgess
+     * @date 2019/12/31
+     * @param search: 搜索关键字
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> findCourseIdsByStudent(String search);
+
+    /**
+     * @describe 根据关键字查询教师相关的课程编号
+     * @author Joburgess
+     * @date 2019/12/31
+     * @param search: 搜索关键字
+     * @return java.util.List<java.lang.Integer>
+     */
+    List<Integer> findCourseIdsByTeacher(String search);
 }

+ 22 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/page/EndCourseScheduleQueryInfo.java

@@ -19,6 +19,28 @@ public class EndCourseScheduleQueryInfo extends QueryInfo {
     @ApiModelProperty(value = "班级编号")
     private Integer classGroupId;
 
+    @ApiModelProperty(value = "学生编号")
+    private Integer studentId;
+
+    @ApiModelProperty(value = "教师编号")
+    private Integer teacherId;
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public GroupType getGroupType() {
         return groupType;
     }

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

@@ -2212,6 +2212,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             if(!CollectionUtils.isEmpty(groups)){
                 params.put("groups", groups);
             }
+            List<Integer> studentClassGroupIds=classGroupDao.findClassGroupIdsByStudent(queryInfo.getSearch());
+            List<Integer> teacherClassGroupIds=classGroupDao.findClassGroupIdsByTeacher(queryInfo.getSearch());
+            studentClassGroupIds.addAll(teacherClassGroupIds);
+            if(!CollectionUtils.isEmpty(studentClassGroupIds)){
+                params.put("classGroupIds", studentClassGroupIds);
+            }
         }
 
         List<SuperClassGroupDto> results = new ArrayList<>();
@@ -2229,10 +2235,12 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             groups = groupDao.findByGroupIds(groups);
             Map<String, Map<GroupType, List<Group>>> groupsGroupByGroup = groups.stream().collect(Collectors.groupingBy(Group::getId, Collectors.groupingBy(Group::getGroupType)));
             results.forEach(result -> {
-                List<Group> groupTemps = groupsGroupByGroup.get(result.getMusicGroupId())
-                        .get(result.getGroupType());
-                if(!CollectionUtils.isEmpty(groupTemps)){
-                    result.setGroupName(groupTemps.get(0).getGroupName());
+                Map<GroupType, List<Group>> groupsTypeMap = groupsGroupByGroup.get(result.getMusicGroupId());
+                if(Objects.nonNull(groupsTypeMap)){
+                    List<Group> groupTemps = groupsTypeMap.get(result.getGroupType());
+                    if(!CollectionUtils.isEmpty(groupTemps)){
+                        result.setGroupName(groupTemps.get(0).getGroupName());
+                    }
                 }
             });
         }

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

@@ -2085,7 +2085,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
     @Override
     public PageInfo endFindCourseSchedules(EndCourseScheduleQueryInfo queryInfo) {
         PageInfo pageInfo = new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
-        Map<String, Object> params = new HashMap<>();
+        Map<String, Object> params = new HashMap<>(16);
         MapUtil.populateMap(params, queryInfo);
 
         if(StringUtils.isNotBlank(queryInfo.getSearch())){
@@ -2093,6 +2093,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             if(!CollectionUtils.isEmpty(groups)){
                 params.put("groups", groups);
             }
+            List<Integer> studentCourseIds=courseScheduleDao.findCourseIdsByStudent(queryInfo.getSearch());
+            List<Integer> teacherCourseIds=courseScheduleDao.findCourseIdsByTeacher(queryInfo.getSearch());
+            studentCourseIds.addAll(teacherCourseIds);
+            if(!CollectionUtils.isEmpty(studentCourseIds)){
+                params.put("courseIds", studentCourseIds);
+            }
         }
 
         List<CourseScheduleEndDto> results = new ArrayList<>();
@@ -2110,10 +2116,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
             groups = groupDao.findByGroupIds(groups);
             Map<String, Map<GroupType, List<Group>>> groupsGroupByGroup = groups.stream().collect(Collectors.groupingBy(Group::getId, Collectors.groupingBy(Group::getGroupType)));
             results.forEach(result -> {
-                List<Group> groupTemps = groupsGroupByGroup.get(result.getMusicGroupId())
-                        .get(result.getGroupType());
-                if(!CollectionUtils.isEmpty(groupTemps)){
-                    result.setGroupName(groupTemps.get(0).getGroupName());
+                Map<GroupType, List<Group>> groupsTypeMap = groupsGroupByGroup.get(result.getMusicGroupId());
+                if(Objects.nonNull(groupsTypeMap)){
+                    List<Group> groupTemps = groupsTypeMap.get(result.getGroupType());
+                    if(!CollectionUtils.isEmpty(groupTemps)){
+                        result.setGroupName(groupTemps.get(0).getGroupName());
+                    }
                 }
             });
         }

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

@@ -1981,8 +1981,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			oldVipGroupInfo.setOfflineClassesUnitPrice(vipGroupApplyBaseInfo.getOfflineClassesUnitPrice());
 			isChange=true;
 		}
-		if(Objects.nonNull(vipGroupApplyBaseInfo.getTeacherSchoolId())
-			&&!vipGroupApplyBaseInfo.getTeacherSchoolId().equals(oldVipGroupInfo.getTeacherSchoolId())){
+		if(Objects.nonNull(vipGroupApplyBaseInfo.getTeacherSchoolId())){
 			oldVipGroupInfo.setTeacherSchoolId(vipGroupApplyBaseInfo.getTeacherSchoolId());
 			courseScheduleDao.updateCourseSchoolByGroup(oldVipGroupInfo.getId().toString(), GroupType.VIP.getCode(), oldVipGroupInfo.getTeacherSchoolId());
 			isChange=true;
@@ -2276,8 +2275,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
-		BigDecimal avgCourseFee = surplusCoursesPrice.divide(surplusCourseNum,CommonConstants.DECIMAL_FINAL_PLACE,BigDecimal.ROUND_HALF_UP);
-
 		//生成学生单课缴费信息
 		for (Integer studentId:studentIds) {
 			SysUserCashAccount sysUserCashAccount = sysUserCashAccountService.get(studentId);

+ 23 - 0
mec-biz/src/main/resources/config/mybatis/ClassGroupMapper.xml

@@ -934,6 +934,12 @@
                         #{group.id}
                     </foreach>
                 </if>
+                <if test="classGroupIds != null">
+                    OR cg.id_ IN
+                    <foreach collection="classGroupIds" item="classGroupId" open="(" close=")" separator=",">
+                        #{classGroupId}
+                    </foreach>
+                </if>
                 )
             </if>
             <if test="groupType != null">
@@ -963,5 +969,22 @@
             class_group cg
             <include refid="superFindClassGroupsCondition"/>
     </select>
+    <select id="findClassGroupIdsByStudent" resultType="int">
+        SELECT
+            cgsm.class_group_id_
+        FROM
+            class_group_student_mapper cgsm
+            LEFT JOIN sys_user su ON cgsm.user_id_ = su.id_
+        WHERE su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
+    </select>
+    <select id="findClassGroupIdsByTeacher" resultType="int">
+        SELECT
+            cgtm.class_group_id_
+        FROM
+            class_group_teacher_mapper cgtm
+            LEFT JOIN sys_user su ON cgtm.user_id_ = su.id_
+        WHERE su.real_name_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
+    </select>
+
 
 </mapper>

+ 22 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -1861,6 +1861,12 @@
                           #{group.id}
                       </foreach>
                   </if>
+                  <if test="courseIds != null">
+                    OR cs.id_ IN
+                    <foreach collection="courseIds" item="courseId" open="(" close=")" separator=",">
+                        #{courseId}
+                    </foreach>
+                  </if>
                 )
             </if>
             <if test="groupType != null">
@@ -1904,4 +1910,20 @@
           LEFT JOIN class_group cg ON cg.id_=cs.class_group_id_
         <include refid="endFindCourseSchedulesCondition"/>
     </select>
+    <select id="findCourseIdsByStudent" resultType="int">
+        SELECT
+            cssp.course_schedule_id_
+        FROM
+            course_schedule_student_payment cssp
+            LEFT JOIN sys_user su ON cssp.user_id_ = su.id_
+        WHERE su.username_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
+    </select>
+    <select id="findCourseIdsByTeacher" resultType="int">
+        SELECT
+            csts.course_schedule_id_
+        FROM
+            course_schedule_teacher_salary csts
+            LEFT JOIN sys_user su ON csts.user_id_ = su.id_
+        WHERE real_name_ LIKE CONCAT('%',#{search},'%') OR su.id_=#{search}
+    </select>
 </mapper>

+ 4 - 4
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -543,11 +543,11 @@
         GROUP BY sr.music_group_id_
     </select>
     <select id="queryUserByPhone" resultMap="StudentRegistration">
-        SELECT sr.user_id_,sr.parents_name_,sr.parents_phone_,sr.current_grade_,
+        SELECT su.id_,su.real_name_,su.phone_,sr.current_grade_,
         sr.current_class_,su.username_ name_,su.birthdate_,su.gender_
-        FROM student_registration sr
-        LEFT JOIN sys_user su ON sr.user_id_ = su.id_
-        WHERE sr.parents_phone_ = #{mobile}
+        FROM sys_user su
+        LEFT JOIN student_registration sr ON sr.user_id_ = su.id_
+        WHERE su.phone_ = #{mobile}
         LIMIT 1
     </select>
     <select id="queryPurchaseTypeMap" resultType="java.util.Map">