Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

zouxuan 4 лет назад
Родитель
Сommit
7b85b7eef2

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -451,5 +451,6 @@ public interface CourseScheduleStudentPaymentDao extends BaseDAO<Long, CourseSch
      */
     CourseSchedule getStudentHistoryLastCourse(@Param("studentId") Integer studentId,
                                                @Param("monday") String monday,
+                                               @Param("groupId") String groupId,
                                                @Param("courseType")CourseSchedule.CourseScheduleType courseType);
 }

+ 16 - 5
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentPaymentOrderDao.java

@@ -170,14 +170,14 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
     Integer findOrderByGroupType(@Param("userId") Integer userId, @Param("sporadicId") Integer sporadicId, @Param("groupType") String groupType, @Param("status") DealStatusEnum status);
 
     /**
-     * @describe 获取零星订单
-     * @author qnc99
-     * @date 2020/12/5 0005
      * @param userId:
      * @param sporadicId:
      * @param groupType:
      * @param status:
      * @return java.util.List<com.ym.mec.biz.dal.entity.StudentPaymentOrder>
+     * @describe 获取零星订单
+     * @author qnc99
+     * @date 2020/12/5 0005
      */
     List<StudentPaymentOrder> findPaymentOrderByGroupType(@Param("userId") Integer userId, @Param("sporadicId") Integer sporadicId, @Param("groupType") String groupType, @Param("status") DealStatusEnum status);
 
@@ -359,6 +359,7 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
 
     /**
      * 获取用户某种类型的订单
+     *
      * @param userId
      * @param type
      * @param status
@@ -367,14 +368,24 @@ public interface StudentPaymentOrderDao extends BaseDAO<Long, StudentPaymentOrde
     List<StudentPaymentOrder> getUserOrderByType(@Param("userId") Integer userId, @Param("type") OrderTypeEnum type, @Param("status") DealStatusEnum status);
 
     /**
+     * @param params:
+     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipDouble11Dto>
      * @describe 获取参与双十一的学员
      * @author qnc99
      * @date 2020/11/25 0025
-     * @param params:
-     * @return java.util.List<com.ym.mec.biz.dal.dto.StudentVipDouble11Dto>
      */
     List<StudentVipDouble11Dto> queryDouble11Students(Map<String, Object> params);
+
     int countDouble11Students(Map<String, Object> params);
 
     List<StudentVipDouble11Dto> findStudentsDouble11Infos(@Param("studentIds") List<Integer> studentIds);
+
+
+    /**
+     * 获取学生的报名订单
+     * @param userId
+     * @param musicGroupId
+     * @return
+     */
+    List<StudentPaymentOrderExportDto> getUserApplyOrders(@Param("userId") Integer userId, @Param("musicGroupId") String musicGroupId);
 }

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

@@ -1927,7 +1927,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 								preTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
 							}
 						}
-                        if (CollectionUtils.isEmpty(preTeachingTeacherIdList)) {
+                        if (CollectionUtils.isEmpty(preTeachingTeacherIdList)&&Objects.isNull(preCourseSchedule.getId())) {
                             IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(preCourseSchedule.getClassGroupId().longValue());
                             if (Objects.nonNull(integerAndIntegerListDto)) {
 								preTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
@@ -1943,7 +1943,7 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
                         if (CollectionUtils.isEmpty(backTeachingTeacherIdList)) {
                             IntegerAndIntegerListDto integerAndIntegerListDto = classGroupTeachingTeacherMap.get(backCourseSchedule.getClassGroupId().longValue());
                             if (Objects.nonNull(integerAndIntegerListDto)) {
-								backTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
+//								backTeachingTeacherIdList.addAll(integerAndIntegerListDto.getIds());
                             }
                         }
 

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

@@ -168,7 +168,7 @@ public class ExtracurricularExercisesReplyServiceImpl extends BaseServiceImpl<Lo
 		extracurricularExercises.setCompletedNum(submitStudentNum);
 		extracurricularExercisesDao.update(extracurricularExercises);
 
-		studentServeService.updateExercisesSituation(extracurricularExercises.getCreateTime(), Arrays.asList(extracurricularExercisesReply.getUserId()), extracurricularExercises.getTeacherId());
+		studentServeService.updateExercisesSituation(extracurricularExercises.getCreateTime(), Arrays.asList(existExtra.getUserId()), extracurricularExercises.getTeacherId());
 
 		if(push){
 			Map<Integer, String> userMap = new HashMap<>();

+ 52 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -328,12 +328,24 @@ public class StudentServeServiceImpl implements StudentServeService {
                 List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.SINGLE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
                 if(CollectionUtils.isEmpty(weekCourseInfo)){
                     Map<String, List<StudentServeCourseDto>> groupCourseInfo = futureCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
+
+                    Map<Integer, Integer> teacherNumMap = new HashMap<>();
                     for (Map.Entry<String, List<StudentServeCourseDto>> groupCourseInfoEntry : groupCourseInfo.entrySet()) {
                         StudentServeCourseDto courseInfo = groupCourseInfoEntry.getValue().stream().min(Comparator.comparing(StudentServeCourseDto::getCourseStartTime)).get();
+
+                        if(!teacherNumMap.containsKey(courseInfo.getActualTeacherId())){
+                            teacherNumMap.put(courseInfo.getActualTeacherId(), 1);
+                        }else{
+                            teacherNumMap.put(courseInfo.getActualTeacherId(), teacherNumMap.get(courseInfo.getActualTeacherId())+1);
+                        }
+                    }
+
+                    for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
                         StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
-                                courseInfo.getActualTeacherId(),nowDate.get(DateUtil.weekFields.weekOfYear()),
+                                teacherNumMapEntry.getKey(),nowDate.get(DateUtil.weekFields.weekOfYear()),
                                 DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
                                 "EXERCISE", null);
+                        studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
                         results.add(studentExtracurricularExercisesSituation);
                     }
                 }else{
@@ -387,16 +399,41 @@ public class StudentServeServiceImpl implements StudentServeService {
                     }
                 }
             }else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.MIX)){
-                CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monDayDate.toString(), CourseSchedule.CourseScheduleType.SINGLE);
-                StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
-                        Objects.isNull(studentHistoryLastCourse)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():studentHistoryLastCourse.getActualTeacherId(),
-                        nowDate.get(DateUtil.weekFields.weekOfYear()),
-                        DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
-                        "EXERCISE", null);
-                if(Objects.isNull(studentExtracurricularExercisesSituation.getTeacherId())){
-                    continue;
+                List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.MIX);
+                List<StudentServeCourseDto> weekCourseInfo = futureCourseInfo.stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
+                List<StudentServeCourseDto> serveCourseInfo;
+                if(CollectionUtils.isEmpty(weekCourseInfo)){
+                    serveCourseInfo = futureCourseInfo;
+                }else{
+                    serveCourseInfo = weekCourseInfo;
+                }
+                Map<String, List<StudentServeCourseDto>> groupCourseInfo = serveCourseInfo.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getMusicGroupId));
+
+                Map<Integer, Integer> teacherNumMap = new HashMap<>();
+                for (String groupId : groupCourseInfo.keySet()) {
+                    CourseSchedule studentHistoryLastCourse = courseScheduleStudentPaymentDao.getStudentHistoryLastCourse(studentCourseMapEntry.getKey(), monDayDate.toString(), groupId, CourseSchedule.CourseScheduleType.SINGLE);
+                    Integer teacherId = Objects.isNull(studentHistoryLastCourse)?studentCourseMapEntry.getValue().get(0).getLeadTeacherId():studentHistoryLastCourse.getActualTeacherId();
+                    if(Objects.isNull(teacherId)){
+                        continue;
+                    }
+
+                    if(!teacherNumMap.containsKey(teacherId)){
+                        teacherNumMap.put(teacherId, 1);
+                    }else{
+                        teacherNumMap.put(teacherId, teacherNumMap.get(teacherId)+1);
+                    }
+
+                }
+
+                for (Map.Entry<Integer, Integer> teacherNumMapEntry : teacherNumMap.entrySet()) {
+                    StudentExtracurricularExercisesSituation studentExtracurricularExercisesSituation=new StudentExtracurricularExercisesSituation(studentCourseMapEntry.getKey(),
+                            teacherNumMapEntry.getKey(),
+                            nowDate.get(DateUtil.weekFields.weekOfYear()),
+                            DateUtil.stringToDate(monDayDate.toString(), "yyyy-MM-dd"), DateUtil.stringToDate(sunDayDate.toString(), "yyyy-MM-dd"),
+                            "EXERCISE", null);
+                    studentExtracurricularExercisesSituation.setExpectExercisesNum(teacherNumMapEntry.getValue());
+                    results.add(studentExtracurricularExercisesSituation);
                 }
-                results.add(studentExtracurricularExercisesSituation);
             }else if(typeCourseMap.containsKey(CourseSchedule.CourseScheduleType.PRACTICE)){
                 List<StudentServeCourseDto> futureCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE);
                 List<StudentServeCourseDto> weekCourseInfo = typeCourseMap.get(CourseSchedule.CourseScheduleType.PRACTICE).stream().filter(c -> c.getCourseStartTime().compareTo(nextMonday) < 0).collect(Collectors.toList());
@@ -481,7 +518,7 @@ public class StudentServeServiceImpl implements StudentServeService {
                     Set<String> courseIds = Arrays.stream(weekServiceWithStudent.getCourseIds().split(",")).collect(Collectors.toSet());
                     List<StudentServeCourseHomeworkDto> studentHomeworks = studentAllHomeworks.stream().filter(s -> courseIds.contains(s.getCourseScheduleId().toString())).collect(Collectors.toList());
                     if(!CollectionUtils.isEmpty(studentHomeworks)){
-                        weekServiceWithStudent.setActualExercisesNum(1);
+                        weekServiceWithStudent.setActualExercisesNum(studentHomeworks.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentHomeworks.size());
                         long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
                         weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
                         long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
@@ -512,7 +549,7 @@ public class StudentServeServiceImpl implements StudentServeService {
                 if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
                     List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
                     if(!CollectionUtils.isEmpty(studentExercises)){
-                        weekServiceWithStudent.setActualExercisesNum(1);
+                        weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
                         long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
                         if(weekServiceWithStudent.getExercisesReplyNum()<=0){
                             weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
@@ -671,9 +708,9 @@ public class StudentServeServiceImpl implements StudentServeService {
             weekServiceWithStudent.setActualExercisesNum(0);
             if(!CollectionUtils.isEmpty(studentAllHomeworks)&&weekServiceWithStudent.getServeType().equals("HOMEWORK")){
                 Set<String> courseIds = Arrays.stream(weekServiceWithStudent.getCourseIds().split(",")).collect(Collectors.toSet());
-                List<StudentServeCourseHomeworkDto> studentHomeworks = studentAllHomeworks.stream().filter(s -> courseIds.contains(s.getCourseScheduleId())).collect(Collectors.toList());
+                List<StudentServeCourseHomeworkDto> studentHomeworks = studentAllHomeworks.stream().filter(s -> courseIds.contains(s.getCourseScheduleId().toString())).collect(Collectors.toList());
                 if(!CollectionUtils.isEmpty(studentHomeworks)){
-                    weekServiceWithStudent.setActualExercisesNum(1);
+                    weekServiceWithStudent.setActualExercisesNum(studentHomeworks.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentHomeworks.size());
                     long replyNum = studentHomeworks.stream().filter(e -> YesOrNoEnum.YES.equals(e.getStatus())).count();
                     weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);
                     long haveSubmitTimes = studentHomeworks.stream().filter(e -> Objects.nonNull(e.getSubmitTime())).count();
@@ -704,7 +741,7 @@ public class StudentServeServiceImpl implements StudentServeService {
             if(!CollectionUtils.isEmpty(studentAllExercises)&&weekServiceWithStudent.getServeType().equals("EXERCISE")){
                 List<ExtracurricularExercisesReply> studentExercises = studentAllExercises.stream().filter(s -> weekServiceWithStudent.getTeacherId().equals(s.getExtracurricularExercises().getTeacherId())).collect(Collectors.toList());
                 if(!CollectionUtils.isEmpty(studentExercises)){
-                    weekServiceWithStudent.setActualExercisesNum(1);
+                    weekServiceWithStudent.setActualExercisesNum(studentExercises.size()>weekServiceWithStudent.getExpectExercisesNum()?weekServiceWithStudent.getExpectExercisesNum():studentExercises.size());
                     long replyNum = studentExercises.stream().filter(e -> e.getStatus()==1).count();
                     if(weekServiceWithStudent.getExercisesReplyNum()<=0){
                         weekServiceWithStudent.setExercisesReplyNum(replyNum>0?1:0);

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -679,6 +679,9 @@
 		SELECT cs.* FROM course_schedule_student_payment cssp
 		LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
 		WHERE cssp.user_id_=#{studentId}
+		  <if test="groupId!=null">
+			  AND cs.music_group_id_=#{groupId}
+		  </if>
 		  AND cs.class_date_&lt;#{monday}
 		  AND cs.type_=#{courseType, typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler}
 		  AND (cs.del_flag_ != 1 OR cs.del_flag_ IS NULL)

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

@@ -175,7 +175,7 @@
 		WHERE
 			sees.monday_ = #{startDate}
 			AND sees.teacher_id_ = #{teacherId}
-			AND sees.actual_exercises_num_ = 0
+			AND sees.actual_exercises_num_ &lt; sees.expect_exercises_num_
 			AND sees.serve_type_ = 'EXERCISE'
 		<if test="search!=null">
 				AND (su.username_ LIKE CONCAT('%', #{search}, '%') OR su.phone_ LIKE CONCAT(#{search}, '%'))

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

@@ -839,4 +839,27 @@
             GROUP BY
                 spo.user_id_
     </select>
+
+    <resultMap type="com.ym.mec.biz.dal.dto.StudentPaymentOrderExportDto" id="applyOrderAndDetail"
+               extends="StudentPaymentOrder">
+        <collection property="orderDetailList" ofType="com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail">
+            <result column="detail_id_" property="id"/>
+            <result column="detail_type_" property="type"/>
+            <result column="detail_price_" property="price"/>
+            <result column="detail_kit_group_purchase_type_" property="kitGroupPurchaseType"/>
+            <collection property="goodsList" ofType="com.ym.mec.biz.dal.entity.Goods">
+                <result column="goods_id" property="id"/>
+                <result column="goods_name" property="name"/>
+            </collection>
+        </collection>
+    </resultMap>
+    <select id="getUserApplyOrders" resultMap="applyOrderAndDetail" parameterType="map">
+        SELECT spo.*,spod.id_ detail_id_,spod.type_ detail_type_,spod.price_
+        detail_price_,spod.kit_group_purchase_type_ detail_kit_group_purchase_type_,
+        g.id_ goods_id, g.name_ goods_name
+        FROM student_payment_order spo
+        LEFT JOIN student_payment_order_detail spod on spo.id_ = spod.payment_order_id_
+        LEFT JOIN goods g on FIND_IN_SET(g.id_,spod.goods_id_list_)
+        WHERE spo.user_id_ = #{userId} AND spo.type_='APPLY' AND spo.music_group_id_=#{musicGroupId}
+    </select>
 </mapper>

+ 15 - 0
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -2,6 +2,8 @@ package com.ym.mec.student.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
@@ -28,6 +30,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.DigestUtils;
@@ -78,6 +81,8 @@ public class StudentOrderController extends BaseController {
     private LuckDrawCountService luckDrawCountService;
     @Autowired
     private DegreeRegistrationDao degreeRegistrationDao;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
 
     @Value("${spring.profiles.active:dev}")
@@ -747,4 +752,14 @@ public class StudentOrderController extends BaseController {
         practice4Organs = practice4Organs.stream().sorted(Comparator.comparingDouble(Practice4OrganDto::getScale).reversed()).collect(Collectors.toList());
         return succeed(practice4Organs);
     }
+
+    @GetMapping("/getUserApplyOrders")
+    public HttpResponseResult<List<StudentPaymentOrderExportDto>> getUserApplyOrders(String musicGroupId){
+        SysUser sysUser = sysUserFeignService.queryUserInfo();
+        if (sysUser == null) {
+            return failed(HttpStatus.FORBIDDEN, "请登录");
+        }
+        return succeed(studentPaymentOrderDao.getUserApplyOrders(sysUser.getId(),musicGroupId));
+    }
+
 }