소스 검색

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

zouxuan 5 년 전
부모
커밋
7e4a3a650f

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/ExtracurricularExercisesReplyDao.java

@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface ExtracurricularExercisesReplyDao extends BaseDAO<Long, ExtracurricularExercisesReply> {
 
@@ -109,4 +110,16 @@ public interface ExtracurricularExercisesReplyDao extends BaseDAO<Long, Extracur
 	List<ExtracurricularExercisesReply> getStudentExercisesWithTimeZone(@Param("startDate") String startDate,
                                                                         @Param("endDate") String endDate,
                                                                         @Param("studentIds") List<Integer> studentIds);
+
+    /**
+     * @describe
+     * @date 2020.06.15
+     * @param startDate:
+     * @param endDate:
+     * @param studentIds:
+     * @return java.util.Set<java.lang.Integer>
+     */
+    Set<Integer> checkStudentHaveExercisesInDateRange(@Param("startDate") String startDate,
+                                                     @Param("endDate") String endDate,
+                                                     @Param("studentIds") List<Integer> studentIds);
 }

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentCourseHomeworkDao.java

@@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Select;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHomework> {
 
@@ -121,4 +122,16 @@ public interface StudentCourseHomeworkDao extends BaseDAO<Long, StudentCourseHom
     List<StudentServeCourseHomeworkDto> findStudentHomeworkWithCourseDateRange(@Param("startDate") String startDate,
                                                                                @Param("endDate") String endDate,
                                                                                @Param("studentIds") List<Integer> studentIds);
+
+    /**
+     * @describe
+     * @date 2020.06.15
+     * @param startDate:
+     * @param endDate:
+     * @param studentIds:
+     * @return java.util.Set<java.lang.Integer>
+     */
+    Set<Integer> checkStudentHaveHomeworkInDateRange(@Param("startDate") String startDate,
+                                                     @Param("endDate") String endDate,
+                                                     @Param("studentIds") List<Integer> studentIds);
 }

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentServeService.java

@@ -1,5 +1,7 @@
 package com.ym.mec.biz.service;
 
+import java.util.Map;
+
 /**
  * @Author Joburgess
  * @Date 2020.05.27
@@ -15,4 +17,14 @@ public interface StudentServeService {
      */
     void exercisesSituationStatistics(String monday);
 
+    /**
+     * @describe
+     * @author Joburgess
+     * @date 2020.06.15
+     * @param courseScheduleId:
+     * @param studentIds:
+     * @return int
+     */
+    Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIds);
+
 }

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

@@ -768,6 +768,10 @@ public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long
             offlineTeacherSalary=teacherDefaultVipGroupSalary.getOfflineClassesSalary();
         }
 
+        if(Objects.isNull(onlineTeacherSalary)||Objects.isNull(offlineTeacherSalary)){
+            throw new BizException("教师课酬异常");
+        }
+
         VipGroupCategory vipGroupCategory = vipGroupCategoryDao.get(vipGroup.getVipGroupCategoryId().intValue());
 
         BigDecimal studentNumDecimal = new BigDecimal(studentNum);

+ 51 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServeServiceImpl.java

@@ -1,19 +1,15 @@
 package com.ym.mec.biz.service.impl;
 
-import com.ym.mec.biz.dal.dao.ExtracurricularExercisesReplyDao;
-import com.ym.mec.biz.dal.dao.StudentCourseHomeworkDao;
-import com.ym.mec.biz.dal.dao.StudentDao;
-import com.ym.mec.biz.dal.dao.StudentExtracurricularExercisesSituationDao;
+import com.ym.mec.biz.dal.dao.*;
 import com.ym.mec.biz.dal.dto.StudentServeCourseHomeworkDto;
 import com.ym.mec.biz.dal.dto.StudentServeDto;
 import com.ym.mec.biz.dal.dto.StudentServiceHomeworkDto;
-import com.ym.mec.biz.dal.entity.ExtracurricularExercisesReply;
-import com.ym.mec.biz.dal.entity.Student;
-import com.ym.mec.biz.dal.entity.StudentExtracurricularExercisesSituation;
+import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.GroupType;
 import com.ym.mec.biz.dal.enums.TeachModeEnum;
 import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.service.StudentServeService;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.util.date.DateUtil;
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -37,6 +33,10 @@ import java.util.stream.Collectors;
 public class StudentServeServiceImpl implements StudentServeService {
 
     @Autowired
+    private CourseScheduleDao courseScheduleDao;
+    @Autowired
+    private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+    @Autowired
     private StudentDao studentDao;
     @Autowired
     private StudentCourseHomeworkDao studentCourseHomeworkDao;
@@ -266,4 +266,48 @@ public class StudentServeServiceImpl implements StudentServeService {
             currentPage1=currentPage1.add(BigDecimal.ONE);
         }
     }
+
+    @Override
+    public Map<String, Object> checkeIsAssignHomework(Long courseScheduleId, String studentIdsStr) {
+        Map<String, Object> result=new HashMap<>();
+        if(Objects.isNull(courseScheduleId)&&Objects.isNull(studentIdsStr)){
+            result.put("isAssignHomework", 0);
+            return result;
+        }
+        List<Integer> studentIds=new ArrayList<>();
+        if(StringUtils.isNotBlank(studentIdsStr)){
+            studentIds= Arrays.asList(studentIdsStr.split(",")).stream().map(id->Integer.valueOf(id)).collect(Collectors.toList());
+        }
+
+        LocalDate localDate=LocalDate.now();
+
+        if(Objects.nonNull(courseScheduleId)){
+            CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
+            if(Objects.isNull(courseSchedule)){
+                result.put("isAssignHomework", 0);
+                return result;
+            }
+            localDate=LocalDateTime.ofInstant(courseSchedule.getClassDate().toInstant(), DateUtil.zoneId).toLocalDate();
+            List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseScheduleId);
+            if(CollectionUtils.isEmpty(courseScheduleStudentPayments)){
+                result.put("isAssignHomework", 0);
+                return result;
+            }
+            studentIds = courseScheduleStudentPayments.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toList());
+        }
+
+        LocalDate monDayDate = localDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.MONDAY.getValue());
+        LocalDate sunDayDate = localDate.with(DateUtil.weekFields.dayOfWeek(), DayOfWeek.SUNDAY.getValue());
+
+        Set<Integer> hss = studentCourseHomeworkDao.checkStudentHaveHomeworkInDateRange(monDayDate.toString(), sunDayDate.toString(), studentIds);
+        Set<Integer> ess = extracurricularExercisesReplyDao.checkStudentHaveExercisesInDateRange(monDayDate.toString(), sunDayDate.toString(), studentIds);
+        for (Integer studentId : studentIds) {
+            if(!hss.contains(studentId)&&!ess.contains(studentId)){
+                result.put("isAssignHomework", 1);
+                return result;
+            }
+        }
+        result.put("isAssignHomework", 0);
+        return result;
+    }
 }

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

@@ -2482,6 +2482,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("VIP课程组尚未成立,无法添加学员,请走学员购买流程!");
 		}
 
+		if(VipGroupStatusEnum.PAUSE.equals(vipGroup.getStatus())){
+			throw new BizException("当前课程组已经停止,无法进行添加学员操作。");
+		}
+
         Integer studentNum = classGroupStudentMapperDao.countClassGroupStudentNum(classGroup.getId());
         if(studentNum.compareTo(classGroup.getExpectStudentNum())>=0){
             throw new BizException("该班级人数已达上限");

+ 13 - 0
mec-biz/src/main/resources/config/mybatis/ExtracurricularExercisesReplyMapper.xml

@@ -490,4 +490,17 @@
 			DATE_FORMAT( eer.create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
 	</select>
 
+	<select id="checkStudentHaveExercisesInDateRange" resultType="java.lang.Integer">
+		SELECT
+			DISTINCT user_id_
+		FROM
+			extracurricular_exercises_reply
+		WHERE
+			DATE_FORMAT( create_time_, '%Y-%m-%d' ) BETWEEN #{startDate} AND #{endDate}
+			AND user_id_ IN
+			<foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
+				#{studentId}
+			</foreach>
+	</select>
+
 </mapper>

+ 14 - 0
mec-biz/src/main/resources/config/mybatis/StudentCourseHomeworkMapper.xml

@@ -364,6 +364,20 @@
                 #{studentId}
             </foreach>
     </select>
+    <select id="checkStudentHaveHomeworkInDateRange" resultType="java.lang.Integer">
+        SELECT
+            DISTINCT sch.user_id_
+        FROM
+            student_course_homework sch
+            LEFT JOIN course_schedule cs ON sch.course_schedule_id_ = cs.id_
+        WHERE
+            cs.class_date_ BETWEEN #{startDate}
+            AND #{endDate}
+            AND sch.user_id_ IN
+            <foreach collection="studentIds" item="studentId" separator="," open="(" close=")">
+                #{studentId}
+            </foreach>
+    </select>
 
     <delete id="delByCourseScheduleId">
 		DELETE FROM student_course_homework WHERE course_schedule_id_ = #{courseScheduleId} 

+ 10 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherCourseHomeworkReplyController.java

@@ -7,7 +7,9 @@ import com.ym.mec.biz.dal.entity.StudentCourseHomeworkReply;
 import com.ym.mec.biz.dal.page.StudentCourseHomeworkReplyQueryInfo;
 import com.ym.mec.biz.service.ExtracurricularExercisesMessageService;
 import com.ym.mec.biz.service.StudentCourseHomeworkReplyService;
+import com.ym.mec.biz.service.StudentServeService;
 import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.entity.HttpResponseResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -31,6 +33,8 @@ public class TeacherCourseHomeworkReplyController extends BaseController {
     @Autowired
     private StudentCourseHomeworkReplyService studentCourseHomeworkReplyService;
     @Autowired
+    private StudentServeService studentServeService;
+    @Autowired
     private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "新增回复")
@@ -90,4 +94,10 @@ public class TeacherCourseHomeworkReplyController extends BaseController {
         return succeed();
     }
 
+    @ApiOperation(value = "检测是否都布置了作业")
+    @GetMapping("/checkeIsAssignHomework")
+    public HttpResponseResult checkeIsAssignHomework(Long courseScheduleId, String studentIds){
+        return succeed(studentServeService.checkeIsAssignHomework(courseScheduleId, studentIds));
+    }
+
 }