Parcourir la source

Merge remote-tracking branch 'origin/master'

Joburgess il y a 5 ans
Parent
commit
8ccbee2dfa

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

@@ -122,9 +122,9 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
         //老师默认的课酬
         List<Integer> teacherUserIds = classGroupTeacherMapperList.stream().map(teacher -> teacher.getUserId()).collect(Collectors.toList());
         List<TeacherDefaultMusicGroupSalary> teacherSalaryList = teacherDefaultMusicGroupSalaryDao.findByTeacher(teacherUserIds);
-        Map<CourseSchedule.CourseScheduleType, TeacherDefaultMusicGroupSalary> teacherDefaultSalary = new HashMap<>();
+        Map<String, TeacherDefaultMusicGroupSalary> teacherDefaultSalary = new HashMap<>();
         if (teacherSalaryList.size() > 0) {
-            teacherDefaultSalary = teacherSalaryList.stream().collect(Collectors.toMap(TeacherDefaultMusicGroupSalary::getCourseScheduleType, teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
+            teacherDefaultSalary = teacherSalaryList.stream().collect(Collectors.toMap(teacherDefaultMusicGroupSalary->teacherDefaultMusicGroupSalary.getCourseScheduleType().getCode()+teacherDefaultMusicGroupSalary.getUserId(), teacherDefaultMusicGroupSalary -> teacherDefaultMusicGroupSalary));
         }
         List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaryList = new ArrayList<>();
         String musicGroupId = classGroupTeacherMapperList.get(0).getMusicGroupId();
@@ -149,7 +149,7 @@ public class ClassGroupTeacherMapperServiceImpl extends BaseServiceImpl<Long, Cl
 
                 TeacherDefaultMusicGroupSalary teacherDefaultMusicGroupSalary = collect.get(classGroupNoStartCourseSchedule.getType());
                 if (teacherDefaultMusicGroupSalary == null) {
-                    teacherDefaultMusicGroupSalary = teacherDefaultSalary.get(classGroupNoStartCourseSchedule.getType());
+                    teacherDefaultMusicGroupSalary = teacherDefaultSalary.get(classGroupNoStartCourseSchedule.getType().getCode()+classGroupTeacherMapper.getUserId());
                 }
                 if (teacherDefaultMusicGroupSalary == null) {
                     throw new BizException("请先设置老师课酬");

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

@@ -99,6 +99,7 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 		if(courseSchedule == null){
 			throw new BizException("课程信息不存在");
 		}
+		teacherAttendance.setCurrentClassTimes(currentCourseDetail.getCurrentClassTimes() + 1);
 		String classDate = DateUtil.format(courseSchedule.getClassDate(), DateUtil.DEFAULT_PATTERN);
 		String startClassTime = DateUtil.format(courseSchedule.getStartClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
 		String endClassTime = DateUtil.format(courseSchedule.getEndClassTime(), DateUtil.EXPANDED_TIME_FORMAT);
@@ -160,6 +161,12 @@ public class TeacherAttendanceServiceImpl extends BaseServiceImpl<Long, TeacherA
 			}else{
 				teacherAttendanceDao.insert(teacherAttendance);
 			}
+			//修改当前课时
+			ClassGroup classGroup = new ClassGroup();
+			classGroup.setId(teacherAttendance.getClassGroupId());
+			classGroup.setCurrentClassTimes(teacherAttendance.getCurrentClassTimes() + 1);
+			classGroup.setUpdateTime(date);
+			classGroupDao.update(classGroup);
 			//新增课堂作业
 			CourseHomework courseHomework=teacherSignOutDto.getCourseHomeworkInfo();
 			courseHomework.setCourseScheduleId(teacherAttendance.getCourseScheduleId());

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

@@ -321,7 +321,7 @@
         LEFT JOIN student_attendance sa ON sa.course_schedule_id_ = cssp.course_schedule_id_ AND sa.user_id_ = cssp.user_id_
         LEFT JOIN class_group cg ON cg.id_ = sa.class_group_id_
         <include refid="studentPaymentSql"/>
-        ORDER BY cs.class_date_,cs.start_class_time_ DESC
+        ORDER BY cs.class_date_ DESC,cs.start_class_time_ DESC
         <include refid="global.limit"/>
     </select>
     <sql id="studentPaymentSql">

+ 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();
+    }
+}