浏览代码

1、陪练课调整
2、付费陪练课可预约时间调整

Joburgess 5 年之前
父节点
当前提交
9e2e1ab4ab

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -8,6 +8,7 @@ import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -320,6 +321,10 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      */
     List<VipGroup> queryNormalStatusList();
 
+    int countUserRepeatVipGroupInCourseStartEndTime(@Param("userId") Integer userId,
+                                                    @Param("courseStartDate")Date courseStartDate,
+                                                    @Param("courseEndDate") Date courseEndDate);
+
     VipGroup findVipGroupInfo(@Param("id") Integer id, @Param("classGroupId") Integer classGroupId);
 
     /**

+ 6 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -129,7 +129,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		return vipGroupDao;
 	}
 
-	@Transactional(rollbackFor = Exception.class)
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	@Override
 	public String createVipGroup(VipGroupApplyDto vipGroup) {
 
@@ -225,6 +225,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			}
 		}
 
+		int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
+		if(repeatVipGroups>0){
+			throw new BizException("请勿重复提交");
+		}
+
 		//生成vip课信息
 		List<String> bySubIds = subjectDao.findBySubIds(vipGroupApplyBaseInfoDto.getSubjectIdList());
 		StringBuffer className=new StringBuffer(StringUtils.join(bySubIds,","));

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

@@ -926,4 +926,8 @@
 		WHERE cs.group_type_ = 'VIP' and cs.teach_mode_ = 'ONLINE'
 		GROUP BY cssp.music_group_id_
     </select>
+
+    <select id="countUserRepeatVipGroupInCourseStartEndTime" resultType="int">
+        SELECT COUNT(id_) FROM vip_group WHERE user_id_=#{userId} AND courses_start_date=#{courseStartDate} AND courses_expire_date_=#{courseEndDate}
+    </select>
 </mapper>