Forráskód Böngészése

Merge branch 'master' of http://git.dayaedu.com/yonge/mec into zouxuan

# Conflicts:
#	mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java
zouxuan 5 éve
szülő
commit
41d13ee087

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.Student4operating;
+import com.ym.mec.biz.dal.dto.StudentServeCourseDto;
 import com.ym.mec.biz.dal.dto.StudentServeDto;
 import com.ym.mec.biz.dal.entity.Student;
 import com.ym.mec.biz.dal.enums.GroupType;
@@ -81,6 +82,8 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      */
     List<Integer> getServeStudentIds();
 
+    List<StudentServeCourseDto> getServeStudentCourseStartTimes(@Param("monday") String monday);
+
     /**
      * @describe 查询被服务学员信息
      * @author Joburgess

+ 40 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentServeCourseDto.java

@@ -0,0 +1,40 @@
+package com.ym.mec.biz.dal.dto;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2020.06.15
+ */
+public class StudentServeCourseDto {
+
+    private Integer studentId;
+
+    private Date courseStartTime;
+
+    private Date serviceTagUpdateTime;
+
+    public Date getServiceTagUpdateTime() {
+        return serviceTagUpdateTime;
+    }
+
+    public void setServiceTagUpdateTime(Date serviceTagUpdateTime) {
+        this.serviceTagUpdateTime = serviceTagUpdateTime;
+    }
+
+    public Integer getStudentId() {
+        return studentId;
+    }
+
+    public void setStudentId(Integer studentId) {
+        this.studentId = studentId;
+    }
+
+    public Date getCourseStartTime() {
+        return courseStartTime;
+    }
+
+    public void setCourseStartTime(Date courseStartTime) {
+        this.courseStartTime = courseStartTime;
+    }
+}

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

@@ -196,9 +196,11 @@ public class StudentCourseHomeworkServiceImpl extends BaseServiceImpl<Long, Stud
             byStudentAndCourseHomewok.setIsReplied(YesOrNoEnum.YES);
             studentCourseHomeworkDao.update(byStudentAndCourseHomewok);
 
+            CourseSchedule courseSchedule = courseScheduleDao.get(byStudentAndCourseHomewok.getCourseScheduleId());
+
             LocalDate nowDate = LocalDateTime.now(DateUtil.zoneId).toLocalDate();
             LocalDate monDayDate = nowDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
-            LocalDate createDateTime = LocalDateTime.ofInstant(byStudentAndCourseHomewok.getCreateTime().toInstant(), DateUtil.zoneId).toLocalDate();
+            LocalDate createDateTime = LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
             LocalDate createMonday = createDateTime.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
             if(createDateTime.isBefore(monDayDate)){
                 StudentExtracurricularExercisesSituation studentExercisesSituation = studentExtracurricularExercisesSituationDao.findStudentExercisesSituationsWithMonDay(createMonday.toString(), byStudentAndCourseHomewok.getUserId());

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

@@ -1,6 +1,7 @@
 package com.ym.mec.biz.service.impl;
 
 import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dto.StudentServeCourseDto;
 import com.ym.mec.biz.dal.dto.StudentServeCourseHomeworkDto;
 import com.ym.mec.biz.dal.dto.StudentServeDto;
 import com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto;
@@ -64,15 +65,33 @@ public class StudentServeServiceImpl implements StudentServeService {
         Date nextMonday = Date.from(sunDayDate.plusDays(1).atStartOfDay(DateUtil.zoneId).toInstant());
 
         List<Integer> beServeStudentIds=studentDao.getServeStudentIds();
+        List<Integer> serveStudentIds=new ArrayList<>();
+        List<StudentServeCourseDto> serveStudentCourseStartTimes = studentDao.getServeStudentCourseStartTimes(monDayDate.toString());
+        Map<Integer, List<StudentServeCourseDto>> studentTimesMap = new HashMap<>();
+        if(!CollectionUtils.isEmpty(serveStudentCourseStartTimes)){
+            studentTimesMap = serveStudentCourseStartTimes.stream().collect(Collectors.groupingBy(StudentServeCourseDto::getStudentId));
+        }
+        for (Integer beServeStudentId : beServeStudentIds) {
+            List<StudentServeCourseDto> studentServeCourseDtos = studentTimesMap.get(beServeStudentId);
+            if(CollectionUtils.isEmpty(studentServeCourseDtos)){
+                serveStudentIds.add(beServeStudentId);
+                continue;
+            }
+            long thisWeekCourses = studentServeCourseDtos.stream().filter(e -> !e.getCourseStartTime().before(e.getServiceTagUpdateTime()) && e.getCourseStartTime().compareTo(nextMonday) <= 0).count();
+            if(thisWeekCourses>0){
+                serveStudentIds.add(beServeStudentId);
+            }
+        }
+
         BigDecimal currentPage=BigDecimal.ONE,
                 pageSize=new BigDecimal(1000),
-                total=new BigDecimal(beServeStudentIds.size()),
+                total=new BigDecimal(serveStudentIds.size()),
                 totalPage=total.divide(pageSize, BigDecimal.ROUND_UP);
 
         List<StudentExtracurricularExercisesSituation> results=new ArrayList<>();
 
         while (currentPage.compareTo(totalPage)<=0){
-            List<Integer> studentIds=beServeStudentIds.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
+            List<Integer> studentIds=serveStudentIds.stream().skip(pageSize.multiply(currentPage.subtract(BigDecimal.ONE)).longValue()).limit(pageSize.longValue()).collect(Collectors.toList());
 
             List<StudentServeDto> serviceStudents;
             if(sunDayDate.isBefore(LocalDate.now())){

+ 16 - 9
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -56,7 +56,7 @@
         <if test="operatingTempTag != null">
             operating_temp_tag_,
         </if>
-        teacher_id_,create_time_,update_time_)
+        teacher_id_,create_time_,update_time_,service_tag_update_time_)
         VALUES
         (#{userId},#{subjectIdList},
         <if test="serviceTag != null">
@@ -65,7 +65,7 @@
         <if test="operatingTag != null">
             #{operatingTag},
         </if>
-        #{teacherId},NOW(),NOW())
+        #{teacherId},NOW(),NOW(),NOW())
     </insert>
 
     <update id="update" parameterType="com.ym.mec.biz.dal.entity.Student">
@@ -86,12 +86,8 @@
             <if test="teacherId != null">
                 teacher_id_=#{teacherId},
             </if>
-            <if test="updateTime != null">
-                update_time_ = #{updateTime},
-            </if>
-            <if test="updateTime == null">
-                update_time_ = NOW()
-            </if>
+                update_time_ = NOW(),
+                service_tag_update_time_=IF(service_tag_ = #{serviceTag}, service_tag_update_time_, NOW())
         </set>
         WHERE user_id_ = #{userId}
     </update>
@@ -196,7 +192,8 @@
             <if test="serviceTag != null">
                 service_tag_ = #{serviceTag},
             </if>
-            update_time_ = NOW()
+            update_time_ = NOW(),
+            service_tag_update_time_ = IF(service_tag_=#{serviceTag}, service_tag_update_time_, NOW())
         </set>
         WHERE
             service_tag_=0
@@ -455,4 +452,14 @@
           LEFT JOIN sys_user su ON stu.user_id_=su.id_
         WHERE service_tag_=1 AND su.del_flag_=0
     </select>
+    <select id="getServeStudentCourseStartTimes" resultType="com.ym.mec.biz.dal.dto.StudentServeCourseDto">
+        SELECT
+            cssp.user_id_ studentId,
+            stu.service_tag_update_time_ serviceTagUpdateTime,
+            CONCAT(cs.class_date_, ' ', cs.start_class_time_) courseStartTime
+        FROM course_schedule_student_payment cssp
+            LEFT JOIN course_schedule cs ON cs.id_=cssp.course_schedule_id_
+            LEFT JOIN student stu ON cssp.user_id_ = stu.user_id_
+        WHERE stu.service_tag_=1 AND class_date_&gt;=#{monday}
+    </select>
 </mapper>

+ 3 - 0
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -786,6 +786,9 @@ public class RoomServiceImpl implements RoomService {
             msg.setType(taskInfo.getTypeEnum().ordinal());
             msg.setOpUserId(authUser.getId().toString());
             msg.setOpUserName(authUser.getUsername());
+            if (typeEnum.equals(DeviceTypeEnum.HandUp)){
+                userId = authUser.getId().toString();
+            }
             imHelper.publishMessage(authUser.getId().toString(), userId, roomId, msg);
         } else {
             if (typeEnum.equals(DeviceTypeEnum.Camera)) {