Bläddra i källkod

1、存在毫秒导致的日期判断错误

Joburgess 5 år sedan
förälder
incheckning
51f4f18c13

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

@@ -1,8 +1,10 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.Student;
+import org.apache.ibatis.annotations.Param;
 
 public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Student> {
 
+    int lockUser(@Param("userId") Integer userId);
 	
-}
+}

+ 4 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PracticeGroupServiceImpl.java

@@ -72,6 +72,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
     private MusicGroupDao musicGroupDao;
     @Autowired
     private ImFeignService imFeignService;
+    @Autowired
+    private StudentDao studentDao;
 
     private static Map<Integer, Map<Integer, List<Integer>>> schoolSubjectTeachersMap;
 
@@ -578,13 +580,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
         List<Integer> teacherIds = new ArrayList<>();
 
-//        boolean checkTeacherLeaveDate=true;
-//        SysConfig teacherLeaveDataConfig = sysConfigService.findByParamName(SysConfigService.TEACHER_LEAVE_DATAS);
-//        if (Objects.nonNull(teacherLeaveDataConfig.getParanValue())
-//            &&StringUtils.isNotBlank(teacherLeaveDataConfig.getParanValue())){
-//
-//        }
-
         //如果是广州分部的,并且声部满足条件的需要特殊处理
         if (sysUser.getOrganId().equals(GUANGZHOU_ORGAN_ID) && GUANGZHOU_SUBJECTIDS.contains(subjectId)) {
             List<MusicGroup> userMusicGroups = musicGroupDao.findUserMusicGroups(userId);
@@ -861,6 +856,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
         }
         allCourseDates.sort(Comparator.comparing(Date::getTime));
 
+        studentDao.lockUser(practiceGroup.getStudentId());
+
         Integer applyTimes = practiceGroupDao.countUserPracticeApplyRecord(practiceGroup.getStudentId());
 
         if (applyTimes >= 1) {

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -22,6 +22,10 @@
 	<select id="findAll" resultMap="Student">
 		SELECT * FROM student
 	</select>
+
+	<select id="lockUser" resultType="int">
+		SELECT * FROM sys_user WHERE id_=#{userId} FOR UPDATE
+	</select>
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.ym.mec.biz.dal.entity.Student" useGeneratedKeys="true" keyColumn="id" keyProperty="id">