Pārlūkot izejas kodu

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

yonge 5 gadi atpakaļ
vecāks
revīzija
ca28eee329

+ 8 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -233,9 +233,17 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
 
     /**
      * 乐团开启缴费
+     *
      * @param musicGroupId
      * @param paymentStatus
      * @return
      */
     int musicGroupOpenPay(@Param("musicGroupId") String musicGroupId, @Param("paymentStatus") PaymentStatusEnum paymentStatus);
+
+    /**
+     * 删除班级学生
+     * @param classGroupId
+     * @return
+     */
+    int deleteClassGroup(@Param("classGroupId") Integer classGroupId);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupBuyParamsDto.java

@@ -17,6 +17,16 @@ public class VipGroupBuyParamsDto {
     @ApiModelProperty(value = "业务渠道")
     private String paymentBusinessChannel;
 
+    private Integer userId;
+
+    public Integer getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
     public Long getVipGroupId() {
         return vipGroupId;
     }

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

@@ -648,6 +648,7 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     public void delSingle(Integer classGroupId) {
         //删除学员班级关联关系
         classGroupStudentMapperDao.deleteByClassId(classGroupId);
+        studentRegistrationDao.deleteClassGroup(classGroupId);
         //删除班级
         classGroupDao.delete(classGroupId);
     }
@@ -655,6 +656,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void delMix(Integer classGroupId) {
+        //删除学员班级关联关系
+        classGroupStudentMapperDao.deleteByClassId(classGroupId);
         //删除班级关系
         classGroupRelationDao.deleteByClassId(classGroupId);
         //删除合奏班

+ 18 - 10
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -1,5 +1,22 @@
 package com.ym.mec.biz.service.impl;
 
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
 import com.ym.mec.auth.api.client.SysUserFeignService;
 import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dao.SysMessageDao;
@@ -18,15 +35,6 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
 import com.ym.mec.util.string.MessageFormatter;
-import org.apache.commons.lang.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.Map.Entry;
 
 @Service
 public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> implements SysMessageService {
@@ -56,7 +64,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	private final int DEFAULT_CODE = 888888;
 
-//	@Value("${message.debugMode}")
+	@Value("${message.debugMode}")
 	private boolean debugMode;
 
 	@Override

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

@@ -727,6 +727,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     }
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void updateVipGroupStudentNumAndStatus(Long vipGroupId, Integer num, boolean updateVipStatus) {
 		VipGroup vipGroup = vipGroupDao.getLockVipGroup(vipGroupId);
 		if(Objects.isNull(vipGroup)){
@@ -777,7 +778,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 			throw new BizException("课程信息错误");
 		}
 
-		ClassGroup classGroup = classGroupDao.get(vipGroupClassGroupMapper.getClassGroupId());
+		ClassGroup classGroup = vipGroupClassGroupMapperDao.findClassGroupByVipGroup(vipGroupBuyParams.getVipGroupId());
 		if(Objects.isNull(classGroup)){
 			throw new BizException("课程信息错误");
 		}
@@ -786,19 +787,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				user.getId(),
 				DealStatusEnum.ING.getCode());
 
-        if(classGroup.getStudentNum()>=classGroup.getExpectStudentNum()&&Objects.nonNull(byStudentVipGroup)){
-            throw new BizException("该课程人数已达上限");
-        }
-
 		if(Objects.nonNull(byStudentVipGroup)){
 			byStudentVipGroup.setStatus(DealStatusEnum.CLOSE);
 			studentPaymentOrderDao.update(byStudentVipGroup);
 		}else{
+			if(classGroup.getStudentNum()>=classGroup.getExpectStudentNum()){
+				throw new BizException("该课程人数已达上限");
+			}
 			//更新班级人数,如果订单支付失败则减少
-			updateVipGroupStudentNumAndStatus(vipGroup.getId(),1,false);
+			this.updateVipGroupStudentNumAndStatus(vipGroup.getId(),1,false);
 		}
 
-//		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
 		StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
 		studentPaymentOrder.setUserId(user.getId());
 		String orderNo=StringUtils.join(new String[]{user.getId().toString(),String.valueOf(System.currentTimeMillis())});
@@ -807,11 +806,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
 		studentPaymentOrder.setExpectAmount(vipGroup.getTotalPrice());
 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
-//		if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.DISCOUNT){
-//			studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount().multiply(new BigDecimal(vipGroupActivity.getAttribute1())));
-//		}else{
 		studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
-//		}
 		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
 		studentPaymentOrder.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
 
@@ -826,12 +821,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		studentPaymentOrder.setPaymentChannel((String) payMap.get("type"));
 		studentPaymentOrderDao.insert(studentPaymentOrder);
 
-//		StudentVipGroupPayment studentVipGroupPayment=new StudentVipGroupPayment();
-//		studentVipGroupPayment.setUserId(user.getId());
-//		studentVipGroupPayment.setVipGroupId(vipGroup.getId());
-//		studentVipGroupPayment.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
-//		studentVipGroupPayment.setStudentPaymentOrderId(studentPaymentOrder.getId());
-//		studentVipGroupPaymentDao.insert(studentVipGroupPayment);
 		return payMap;
 
 	}

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

@@ -54,7 +54,7 @@
 		DELETE FROM class_group_student_mapper WHERE id_ = #{id} 
 	</delete>
     <delete id="deleteByClassId">
-        DELETE FROM class_group_student_mapper WHERE class_group_id_ = #{classGroupId}
+        UPDATE class_group_student_mapper SET status_='QUIT' WHERE class_group_id_ = #{classGroupId} AND status_='NORMAL'
     </delete>
 
     <!-- 分页查询 -->

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

@@ -405,26 +405,26 @@
 
     <select id="getStudentCourseSchedulesWithDate" resultMap="courseScheduleDto">
         SELECT
-        cs.id_ seal_class_id_,
-        cs.name_,
-        cs.type_,
-        cs.id_,
-        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.status_,
-        su.username_ teacher_name_,
-        cgsm.status_ attendance_status_,
-        csc.id_ IS NOT NULL complaint_status_,
-        cs.teach_mode_
+            cs.id_ seal_class_id_,
+            cs.name_,
+            cs.type_,
+            cs.id_,
+            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.status_,
+            su.username_ teacher_name_,
+            cgsm.status_ attendance_status_,
+            csc.id_ IS NOT NULL complaint_status_,
+            cs.teach_mode_
         FROM
-        course_schedule_student_payment cssp
-	    LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
-        LEFT JOIN sys_user su ON cs.teacher_id_=su.id_
-        LEFT JOIN course_schedule_complaints csc ON csc.course_schedule_id_=cssp.course_schedule_id_ AND csc.user_id_=#{studentId}
-        LEFT JOIN class_group_student_mapper cgsm ON cgsm.class_group_id_ = cs.class_group_id_ AND cgsm.user_id_=#{studentId}
+          course_schedule_student_payment cssp
+            LEFT JOIN course_schedule cs ON cssp.course_schedule_id_=cs.id_
+            LEFT JOIN sys_user su ON cs.teacher_id_=su.id_
+            LEFT JOIN course_schedule_complaints csc ON csc.course_schedule_id_=cssp.course_schedule_id_ AND csc.user_id_=#{studentId}
+            LEFT JOIN class_group_student_mapper cgsm ON cgsm.class_group_id_ = cs.class_group_id_ AND cgsm.user_id_=#{studentId}
         WHERE
-        cs.class_date_ = DATE_FORMAT(#{classDate},'%Y%m%d')
+          cs.class_date_ = DATE_FORMAT(#{classDate},'%Y%m%d')
         AND cssp.user_id_ = #{studentId}
         ORDER BY start_class_time_
     </select>

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -475,4 +475,12 @@
         WHERE sr.music_group_id_ = #{musicGroupId} AND sr.payment_status_ != 2
         GROUP BY sr.user_id_
     </select>
+
+    <!-- 删除学生的班级 -->
+    <update id="deleteClassGroup">
+        UPDATE student_registration
+        SET class_group_id_ = 0,
+        update_time_ = now()
+        WHERE class_group_id_ = #{classGroupId}
+    </update>
 </mapper>

+ 3 - 3
mec-common/common-core/src/main/java/com/ym/mec/common/redis/config/RedisConfig.java

@@ -1,7 +1,5 @@
 package com.ym.mec.common.redis.config;
 
-import java.io.Serializable;
-
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -13,6 +11,8 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
 import org.springframework.data.redis.serializer.StringRedisSerializer;
 
+import java.io.Serializable;
+
 @Configuration
 public class RedisConfig {
 
@@ -41,7 +41,7 @@ public class RedisConfig {
 	}
 
 	@Bean
-	public RedisTemplate<String, Serializable> redisTemplate() {
+	public RedisTemplate<String, Serializable> redisTemplate(JedisConnectionFactory connectionFactory) {
 		RedisTemplate<String, Serializable> redisTemplate = new RedisTemplate<>();
 		redisTemplate.setKeySerializer(new StringRedisSerializer());
 		redisTemplate.setHashKeySerializer(new StringRedisSerializer());

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

@@ -10,6 +10,6 @@ import org.springframework.security.oauth2.config.annotation.web.configuration.R
 public class ResourceServerConfig extends ResourceServerConfigurerAdapter {
     @Override
     public void configure(HttpSecurity http) throws Exception {
-        http.authorizeRequests().antMatchers("/v2/api-docs","/user/register","/room/join").permitAll().anyRequest().authenticated().and().csrf().disable();
+        http.authorizeRequests().antMatchers("/v2/api-docs","/user/register","/group/join").permitAll().anyRequest().authenticated().and().csrf().disable();
     }
 }