Przeglądaj źródła

Merge remote-tracking branch 'origin/master'

周箭河 5 lat temu
rodzic
commit
0509d087bf

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

@@ -271,6 +271,15 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
     List<StudentCourseScheduleRecordDto> findStudentCourseScheduleRecords(Map<String, Object> params);
 
     /**
+     * @describe 获取班级的下一节课
+     * @author Joburgess
+     * @date 2019/11/19
+     * @param classGroupId: 班级编号
+     * @return com.ym.mec.biz.dal.entity.CourseSchedule
+     */
+    CourseSchedule getNextCourseSchedule(@Param("classGroupId") Integer classGroupId);
+
+    /**
      * @Author: Joburgess
      * @Date: 2019/9/30
      * 统计学生上课记录

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

@@ -173,6 +173,10 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			courseHomework.setMusicGroupId(currentCourseDetail.getMusicGroupId());
 			courseHomework.setClassGroupId(currentCourseDetail.getClassId().intValue());
 			courseHomework.setExpectNum(studentAttendanceDao.countNormalAttendanceStudentNums(teacherAttendance.getCourseScheduleId()));
+			CourseSchedule nextCourseSchedule = courseScheduleDao.getNextCourseSchedule(classGroup.getId());
+			if(Objects.nonNull(nextCourseSchedule)){
+				courseHomework.setExpiryDate(nextCourseSchedule.getStartClassTime());
+			}
 			courseHomeworkService.insert(courseHomework);
 			List<StudentCourseHomework> studentCourseHomeworks = studentCourseHomeworkDao
 					.constructInitialStudentHomeworkRecordsWithPayment(teacherAttendance.getCourseScheduleId(),

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

@@ -1379,4 +1379,33 @@
         LEFT JOIN student_attendance sa ON a.course_schedule_id_ = sa.course_schedule_id_
         LEFT JOIN class_group cg ON a.class_group_id_ = cg.id_ WHERE sa.user_id_ IS null
     </select>
+    <select id="getNextCourseSchedule" resultMap="CourseSchedule">
+        SELECT
+            cs.id_,
+            cs.class_group_id_,
+            cs.status_,
+            cs.subsidy_,
+            cs.class_date_,
+            CONCAT(cs.class_date_,' ',cs.start_class_time_) start_class_time_,
+            CONCAT(cs.class_date_,' ',cs.end_class_time_) end_class_time_,
+            cs.start_class_time_ start_class_time_str_,
+            cs.end_class_time_ end_class_time_str_,
+            cs.teacher_id_,
+            cs.actual_teacher_id_,
+            cs.create_time_,
+            cs.update_time_,
+            cs.teach_mode_,
+            cs.type_,
+            cs.name_,
+            cs.student_num_,
+            cs.leave_student_num_,
+            cs.schoole_id_
+        FROM
+            course_schedule cs
+        WHERE
+            cs.class_group_id_=#{classGroupId}
+            AND CONCAT( cs.class_date_, ' ', cs.start_class_time_ ) &gt; NOW()
+        ORDER BY CONCAT( cs.class_date_, ' ', cs.start_class_time_ )
+        LIMIT 1
+    </select>
 </mapper>

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/config/ResourceServerConfig.java

@@ -25,7 +25,7 @@ public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
 	@Override
 	public void configure(HttpSecurity http) throws Exception {
 		http.csrf().disable().exceptionHandling().accessDeniedHandler(baseAccessDeniedHandler).authenticationEntryPoint(baseAuthenticationEntryPoint).and()
-				.authorizeRequests().antMatchers("/task/**").hasIpAddress("0.0.0.0/0").antMatchers("/v2/api-docs","/classGroup/highClassGroups").permitAll().anyRequest().authenticated()
+				.authorizeRequests().antMatchers("/task/**").hasIpAddress("0.0.0.0/0").antMatchers("/v2/api-docs","/classGroup/highClassGroups","/code/*").permitAll().anyRequest().authenticated()
 				.and().httpBasic();
 	}
 

+ 45 - 0
mec-web/src/main/java/com/ym/mec/web/controller/SmsCodeController.java

@@ -0,0 +1,45 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.service.SmsCodeService;
+import com.ym.mec.common.controller.BaseController;
+import com.ym.mec.common.security.SecurityConstants;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("code")
+@Api(tags = "验证码服务")
+public class SmsCodeController extends BaseController {
+
+    @Autowired
+    private SmsCodeService smsCodeService;
+
+    @ApiOperation(value = "发送登录短信验证码")
+    @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String")
+    @PostMapping(value = "/sendSms")
+    public Object sendLoginVerifyCode(String mobile) throws Exception {
+        smsCodeService.sendValidCode(mobile);
+        return succeed();
+    }
+
+    @ApiOperation(value = "校验短信验证码")
+    @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
+            @ApiImplicitParam(name = "code", value = "短信验证码", required = true, dataType = "String") })
+    @PostMapping(value = "/verifySmsCode")
+    public Object verifySmsCode(String phone,String code) {
+        if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
+            return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
+        }
+        if(smsCodeService.verifyValidCode(phone,code)){
+            return succeed();
+        }
+        return failed();
+    }
+}