浏览代码

Merge remote-tracking branch 'origin/feature/0529-live' into feature/0529-live

shangke 2 年之前
父节点
当前提交
f504a5e8e8

+ 4 - 55
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipBuyResultDto.java

@@ -1,11 +1,14 @@
 package com.ym.mec.biz.dal.dto;
 
+import lombok.Data;
+
 import java.util.Date;
 
 /**
  * @Author Joburgess
  * @Date 2019/11/29
  */
+@Data
 public class VipBuyResultDto {
 
     private Integer vipGroupId;
@@ -22,59 +25,5 @@ public class VipBuyResultDto {
 
     private Date endClassTime;
 
-    public Integer getVipGroupId() {
-        return vipGroupId;
-    }
-
-    public void setVipGroupId(Integer vipGroupId) {
-        this.vipGroupId = vipGroupId;
-    }
-
-    public String getVipGroupName() {
-        return vipGroupName;
-    }
-
-    public void setVipGroupName(String vipGroupName) {
-        this.vipGroupName = vipGroupName;
-    }
-
-    public String getTeacherName() {
-        return teacherName;
-    }
-
-    public void setTeacherName(String teacherName) {
-        this.teacherName = teacherName;
-    }
-
-    public Integer getClassTimes() {
-        return classTimes;
-    }
-
-    public void setClassTimes(Integer classTimes) {
-        this.classTimes = classTimes;
-    }
-
-    public Date getStartClassTime() {
-        return startClassTime;
-    }
-
-    public void setStartClassTime(Date startClassTime) {
-        this.startClassTime = startClassTime;
-    }
-
-    public Date getEndClassTime() {
-        return endClassTime;
-    }
-
-    public void setEndClassTime(Date endClassTime) {
-        this.endClassTime = endClassTime;
-    }
-
-    public String getEduTeacherName() {
-        return eduTeacherName;
-    }
-
-    public void setEduTeacherName(String eduTeacherName) {
-        this.eduTeacherName = eduTeacherName;
-    }
+    private String groupType;
 }

+ 2 - 56
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/VipGroupBuyParamsDto.java

@@ -2,6 +2,7 @@ package com.ym.mec.biz.dal.dto;
 
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.util.List;
 
@@ -9,6 +10,7 @@ import java.util.List;
  * @Author Joburgess
  * @Date 2019/10/2
  */
+@Data
 public class VipGroupBuyParamsDto extends BaseEntity {
 
     @ApiModelProperty(value = "vip课程ID")
@@ -29,61 +31,5 @@ public class VipGroupBuyParamsDto extends BaseEntity {
     @ApiModelProperty(value = "优惠券列表", required = false)
     private List<Integer> couponIdList;
 
-    public List<Integer> getCouponIdList() {
-        return couponIdList;
-    }
-
-    public void setCouponIdList(List<Integer> couponIdList) {
-        this.couponIdList = couponIdList;
-    }
-
-    public boolean isRepeatPay() {
-        return isRepeatPay;
-    }
-
-    public void setRepeatPay(boolean repeatPay) {
-        isRepeatPay = repeatPay;
-    }
-
-    public boolean isUseBalancePayment() {
-        return isUseBalancePayment;
-    }
-
-    public void setUseBalancePayment(boolean useBalancePayment) {
-        isUseBalancePayment = useBalancePayment;
-    }
-
     private Integer userId;
-
-    public Integer getUserId() {
-        return userId;
-    }
-
-    public void setUserId(Integer userId) {
-        this.userId = userId;
-    }
-
-    public Long getVipGroupId() {
-        return vipGroupId;
-    }
-
-    public void setVipGroupId(Long vipGroupId) {
-        this.vipGroupId = vipGroupId;
-    }
-
-    public String getPaymentChannel() {
-        return paymentChannel;
-    }
-
-    public void setPaymentChannel(String paymentChannel) {
-        this.paymentChannel = paymentChannel;
-    }
-
-    public String getPaymentBusinessChannel() {
-        return paymentBusinessChannel;
-    }
-
-    public void setPaymentBusinessChannel(String paymentBusinessChannel) {
-        this.paymentBusinessChannel = paymentBusinessChannel;
-    }
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/ImGroup.java

@@ -37,7 +37,8 @@ public class ImGroup extends BaseEntity {
 		VIP("VIP", "vip课"), DEMO("DEMO", "试听课"), PRACTICE("PRACTICE", "网管课"),
 		SNAP("SNAP","临时班级"), COMM("COMM", "对外课程"), HIGH_ONLINE("HIGH_ONLINE", "线上基础技能课"),
 		MUSIC_NETWORK("MUSIC_NETWORK","乐团网管课"),PARENT_MEETING("PARENT_MEETING","家长会"),
-		TRAINING("TRAINING","训练营"),REPERTOIRE_PLAY("REPERTOIRE_PLAY","曲目演奏课");
+		TRAINING("TRAINING","训练营"),REPERTOIRE_PLAY("REPERTOIRE_PLAY","曲目演奏课"),
+		LIVE("LIVE","直播课");
 
 		private String code;
 

+ 4 - 201
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysCoupon.java

@@ -1,9 +1,11 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.CouponDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.CouponTypeEnum;
 import com.ym.mec.biz.dal.enums.EffectiveTypeEnum;
 import com.ym.mec.common.entity.BaseEntity;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
 import javax.validation.constraints.Max;
@@ -17,6 +19,7 @@ import java.util.Date;
 /**
  * 对应数据库表(sys_coupon):
  */
+@Data
 public class SysCoupon extends BaseEntity implements Serializable{
 
 	private Integer id;
@@ -41,7 +44,7 @@ public class SysCoupon extends BaseEntity implements Serializable{
 
     @NotBlank(message = "优惠券详细分类不能为空!")
     @ApiModelProperty(value = "详情-CouponDetailTypeEnum-枚举类")
-    private String typeDetail;
+    private CouponDetailTypeEnum typeDetail;
 
 	@ApiModelProperty("面值")
 	private java.math.BigDecimal faceValue;
@@ -94,206 +97,6 @@ public class SysCoupon extends BaseEntity implements Serializable{
 	@ApiModelProperty("使用系统 MALL:商城  MEC:管乐迷")
 	private String useSystem;
 
-	public String getUseSystem() {
-		return useSystem;
-	}
-
-	public void setUseSystem(String useSystem) {
-		this.useSystem = useSystem;
-	}
-
-	public String getUseCondition() {
-		return useCondition;
-	}
-
-	public void setUseCondition(String useCondition) {
-		this.useCondition = useCondition;
-	}
-
-	public Integer getId() {
-		return id;
-	}
-
-	public void setId(Integer id) {
-		this.id = id;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public Integer getStatus() {
-		return status;
-	}
-
-	public void setStatus(Integer status) {
-		this.status = status;
-	}
-
-	public CouponTypeEnum getType() {
-		return type;
-	}
-
-	public void setType(CouponTypeEnum type) {
-		this.type = type;
-	}
-
-	public BigDecimal getFaceValue() {
-		return faceValue;
-	}
-
-	public void setFaceValue(BigDecimal faceValue) {
-		this.faceValue = faceValue;
-	}
-
-	public BigDecimal getFullAmount() {
-		return fullAmount;
-	}
-
-	public void setFullAmount(BigDecimal fullAmount) {
-		this.fullAmount = fullAmount;
-	}
-
-	public Integer getLimitExchangeNum() {
-		return limitExchangeNum;
-	}
-
-	public void setLimitExchangeNum(Integer limitExchangeNum) {
-		this.limitExchangeNum = limitExchangeNum;
-	}
-
-	public EffectiveTypeEnum getEffectiveType() {
-		return effectiveType;
-	}
-
-	public void setEffectiveType(EffectiveTypeEnum effectiveType) {
-		this.effectiveType = effectiveType;
-	}
-
-	public Integer getDeadline() {
-		return deadline;
-	}
-
-	public void setDeadline(Integer deadline) {
-		this.deadline = deadline;
-	}
-
-	public Date getEffectiveStartTime() {
-		return effectiveStartTime;
-	}
-
-	public void setEffectiveStartTime(Date effectiveStartTime) {
-		this.effectiveStartTime = effectiveStartTime;
-	}
-
-	public Date getEffectiveExpireTime() {
-		return effectiveExpireTime;
-	}
-
-	public void setEffectiveExpireTime(Date effectiveExpireTime) {
-		this.effectiveExpireTime = effectiveExpireTime;
-	}
-
-	public Date getEndDate() {
-		return endDate;
-	}
-
-	public void setEndDate(Date endDate) {
-		this.endDate = endDate;
-	}
-
-	public Date getStartDate() {
-		return startDate;
-	}
-
-	public void setStartDate(Date startDate) {
-		this.startDate = startDate;
-	}
-
-	public Integer getStockCount() {
-		return stockCount;
-	}
-
-	public void setStockCount(Integer stockCount) {
-		this.stockCount = stockCount;
-	}
-
-	public Integer getConsumeNum() {
-		return consumeNum;
-	}
-
-	public void setConsumeNum(Integer consumeNum) {
-		this.consumeNum = consumeNum;
-	}
-
-	public Integer getWarningStockNum() {
-		return warningStockNum;
-	}
-
-	public void setWarningStockNum(Integer warningStockNum) {
-		this.warningStockNum = warningStockNum;
-	}
-
-	public Integer getWarningStatus() {
-		return warningStatus;
-	}
-
-	public void setWarningStatus(Integer warningStatus) {
-		this.warningStatus = warningStatus;
-	}
-
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime = createTime;
-	}
-
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-
-    public Integer getIssuanceType() {
-        return issuanceType;
-    }
-
-    public void setIssuanceType(Integer issuanceType) {
-        this.issuanceType = issuanceType;
-    }
-
-    public String getTypeDetail() {
-        return typeDetail;
-    }
-
-    public void setTypeDetail(String typeDetail) {
-        this.typeDetail = typeDetail;
-    }
-
-    public Integer getCanBeGetNum() {
-        return canBeGetNum;
-    }
-
-    public void setCanBeGetNum(Integer canBeGetNum) {
-        this.canBeGetNum = canBeGetNum;
-    }
-
     @Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/MessageTypeEnum.java

@@ -33,6 +33,7 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     STUDENT_SMS_PUSH_PAYMENT_SUCCESS("STUDENT_SMS_PUSH_PAYMENT_SUCCESS", "缴费成功结果通知"),
     STUDENT_SMS_BALANCE_CONSUME("STUDENT_SMS_BALANCE_CONSUME", "余额消费"),
     STUDENT_PUSH_VIP_BUY("STUDENT_PUSH_VIP_BUY", "VIP课购买"),
+    STUDENT_PUSH_LIVE_BUY("STUDENT_PUSH_LIVE_BUY", "直播课购买"),
     STUDENT_PUSH_HAVE_COURSE_MESSAGE("STUDENT_PUSH_HAVE_COURSE_MESSAGE", "有课提醒"),
     STUDENT_PUSH_ONLINE_COURSE_ACTION("STUDENT_PUSH_ONLINE_COURSE_ACTION", "线上课开始"),
     STUDENT_PUSH_NAMES_ACHIEVE("STUDENT_PUSH_NAMES_ACHIEVE", "点名完成"),

+ 1 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/OrderTypeEnum.java

@@ -15,6 +15,7 @@ public enum OrderTypeEnum implements BaseEnum<String, OrderTypeEnum> {
     OTHER("OTHER", "其他订单"),
     SMALL_CLASS_TO_BUY("SMALL_CLASS_TO_BUY", "VIP课购买"),
     PRACTICE_GROUP_BUY("PRACTICE_GROUP_BUY", "网管课购买"),
+    LIVE_GROUP_BUY("LIVE_GROUP_BUY", "直播课购买"),
     PRACTICE_GROUP_RENEW("PRACTICE_GROUP_RENEW", "网管课续费"),
     COURSE_GROUP_BUY("COURSE_GROUP_BUY", "课程购买"),
     //余额充值活动

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/page/SysCouponCodeQueryInfo.java

@@ -28,7 +28,8 @@ public class SysCouponCodeQueryInfo extends QueryInfo {
     private String useSystem;
 
     // 优惠券类型 详情-CouponDetailTypeEnum-枚举类 多个逗号隔开
-    @ApiModelProperty("优惠券类型:OTHER:其他,MUSICAL:乐器 MAINTENANCE 乐保 ACCESSORIES 辅件 TEACHING 教材 PRACTICE 网管课 SINGLE 声部课 MIX 合奏课 VIP:VIP MEMBER:会员开通 FULLCOUPON:全类 MALLCOUPON:商城券")
+    @ApiModelProperty("优惠券类型:OTHER:其他,MUSICAL:乐器 MAINTENANCE 乐保 ACCESSORIES 辅件 TEACHING 教材 " +
+            "PRACTICE 网管课 SINGLE 声部课 MIX 合奏课 VIP:VIP LIVE:直播课 MEMBER:会员开通 FULLCOUPON:全类 MALLCOUPON:商城券")
     private String typeDetail;
 
     public String getTypeDetail() {

+ 61 - 78
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -22,6 +22,7 @@ import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import com.google.common.collect.Lists;
+import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -149,31 +150,6 @@ import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
 import com.ym.mec.biz.dal.page.VipGroupTeachingRecordQueryInfo;
 import com.ym.mec.biz.event.source.SendSeoMessageSource;
-import com.ym.mec.biz.service.ActivityUserMapperService;
-import com.ym.mec.biz.service.ClassGroupService;
-import com.ym.mec.biz.service.ContractService;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
-import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
-import com.ym.mec.biz.service.GroupClassService;
-import com.ym.mec.biz.service.ImGroupMemberService;
-import com.ym.mec.biz.service.ImGroupService;
-import com.ym.mec.biz.service.ImUserFriendService;
-import com.ym.mec.biz.service.PayService;
-import com.ym.mec.biz.service.PracticeGroupService;
-import com.ym.mec.biz.service.StudentPaymentOrderService;
-import com.ym.mec.biz.service.StudentPaymentRouteOrderService;
-import com.ym.mec.biz.service.SysConfigService;
-import com.ym.mec.biz.service.SysCouponCodeService;
-import com.ym.mec.biz.service.SysMessageService;
-import com.ym.mec.biz.service.SysTenantConfigService;
-import com.ym.mec.biz.service.SysUserCashAccountDetailService;
-import com.ym.mec.biz.service.SysUserCashAccountLogService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
-import com.ym.mec.biz.service.TeacherCourseRewardService;
-import com.ym.mec.biz.service.TeacherService;
-import com.ym.mec.biz.service.VipGroupCategoryService;
-import com.ym.mec.biz.service.VipGroupService;
 import com.ym.mec.common.constant.CommonConstants;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.dal.BaseDAO;
@@ -210,7 +186,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Autowired
     private VipGroupCategoryService vipGroupCategoryService;
     @Autowired
-    private SysUserFeignService sysUserFeignService;
+    private SysUserService sysUserService;
     @Autowired
     private TeacherDefaultVipGroupSalaryDao teacherDefaultVipGroupSalaryDao;
     @Autowired
@@ -1044,7 +1020,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         int repeatVipGroups = vipGroupDao.countUserRepeatVipGroupInCourseStartEndTime(vipGroupApplyBaseInfoDto.getUserId(), firstCourseSchedule.getStartClassTime(), latestCourseSchedule.getEndClassTime());
         if (repeatVipGroups > 0) {
-            SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
+            SysUser sysUser = sysUserService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
             throw new BizException("{}课程时间冲突({}-{})", sysUser.getRealName(), DateUtil.dateToString(firstCourseSchedule.getStartClassTime(), "yyyy-MM-dd HH:mm:ss"), DateUtil.dateToString(latestCourseSchedule.getEndClassTime(), "HH:mm:ss"));
         }
 
@@ -1233,8 +1209,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     classGroupTeacherSalary.getSalary());
         }
 
-        SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
-
         List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
 
         Map<Integer, String> userRoleMap = new HashMap<>();
@@ -1286,6 +1260,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
             //发送推送
             Map<Integer, String> map = new HashMap<>(1);
+            SysUser sysUser = sysUserService.queryUserById(vipGroupApplyBaseInfoDto.getUserId());
             map.put(vipGroupApplyBaseInfoDto.getUserId(), sysUser.getPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.CHILDREN_DAY_VIP_COURSE_TEACHER_PUSH,
                     map, null, 0, "", "TEACHER", StringUtils.join(studentNames, ","), vipGroupApplyBaseInfoDto.getName());
@@ -1885,7 +1860,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
         VipGroupManageDetailDto vipGroupBaseInfo = vipGroupDao.getVipGroupBaseInfo(vipGroupId);
         if (Objects.nonNull(vipGroupBaseInfo.getEducationalTeacherId())) {
-            SysUser eduUser = sysUserFeignService.queryUserById(vipGroupBaseInfo.getEducationalTeacherId());
+            SysUser eduUser = sysUserService.queryUserById(vipGroupBaseInfo.getEducationalTeacherId());
             if (Objects.nonNull(eduUser)) {
                 vipGroupBaseInfo.setEducationalTeacherName(eduUser.getRealName());
             }
@@ -2296,8 +2271,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     classGroupTeacherSalary.getSalary());
         }
 
-        SysUser sysUser = sysUserFeignService.queryUserById(vipGroup.getUserId());
-
         List<ClassGroupStudentMapper> classGroupStudents = classGroupStudentMapperDao.findByClassGroup(classGroup.getId());
 
         Map<Integer, String> userRoleMap = new HashMap<Integer, String>();
@@ -2328,6 +2301,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
             //发送推送短信
             Map<Integer, String> map = new HashMap<>(1);
+            SysUser sysUser = sysUserService.queryUserById(vipGroup.getUserId());
             map.put(vipGroup.getUserId(), sysUser.getPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, MessageTypeEnum.TEACHER_SMS_VIP_COURSE_ADD,
                     map, null, 0, "", "", vipGroup.getName());
@@ -2337,34 +2311,44 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     }
 
     @Override
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public HttpResponseResult buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
-        SysUser user = sysUserFeignService.queryUserInfo();
-        if (user == null) {
-            throw new BizException("用户信息获取失败");
+        SysUser user = sysUserService.getUser();
+        vipGroupBuyParams.setUserId(user.getId());
+        Integer userId = vipGroupBuyParams.getUserId();
+        VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
+        if(Objects.isNull(vipGroup)){
+            throw new BizException("课程信息不存在");
         }
-        // 判断是否存在支付中的记录
-        List<StudentPaymentOrder> list = studentPaymentOrderService
-                .queryByCondition(GroupType.VIP,
-                        vipGroupBuyParams.getVipGroupId().toString(),
-                        vipGroupBuyParams.getUserId(),
-                        DealStatusEnum.ING,
-                        OrderTypeEnum.SMALL_CLASS_TO_BUY);
 
-        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(), ClassGroupTypeEnum.VIP.getCode());
+        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(vipGroupBuyParams.getVipGroupId().toString(),vipGroup.getGroupType());
         if (Objects.isNull(classGroup)) {
             throw new BizException("班级信息错误");
         }
         classGroup = classGroupDao.lockClassGroup(classGroup.getId());
-        Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), vipGroupBuyParams.getUserId());
+        Boolean exist = classGroupStudentMapperDao.existByClassGroupIds(classGroup.getId().toString(), userId);
         if (exist) {
             throw new BizException("您已加入此课程");
         }
-        VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
-        int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(), "VIP");
+        int courseNum = courseScheduleDao.countVipGroupCourses(vipGroup.getId().intValue(), vipGroup.getGroupType());
         if (vipGroup.getStatus() != VipGroupStatusEnum.APPLYING || classGroup.getDelFlag() != 1 || courseNum > 0) {
-            throw new BizException("当前VIP课已无法通过购买加入,请联系教务老师");
+            throw new BizException("当前课已无法通过购买加入,请联系教务老师");
         }
+        GroupType groupType = GroupType.VIP;
+        OrderTypeEnum orderTypeEnum = OrderTypeEnum.SMALL_CLASS_TO_BUY;
+        CouponDetailTypeEnum couponDetailTypeEnum = CouponDetailTypeEnum.VIP;
+        if("LIVE".equals(vipGroup.getGroupType())){
+            groupType = GroupType.LIVE;
+            orderTypeEnum = OrderTypeEnum.LIVE_GROUP_BUY;
+            couponDetailTypeEnum = CouponDetailTypeEnum.LIVE;
+        }
+        // 判断是否存在支付中的记录
+        List<StudentPaymentOrder> list = studentPaymentOrderService
+                .queryByCondition(groupType,
+                        vipGroupBuyParams.getVipGroupId().toString(),
+                        userId,
+                        DealStatusEnum.ING,
+                        orderTypeEnum);
 
         if (list.size() > 0) {
             StudentPaymentOrder applyOrder = list.get(list.size() - 1);
@@ -2379,7 +2363,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         Date date = new Date();
 
         if (classGroup.getStudentNum() >= classGroup.getExpectStudentNum()) {
-            throw new BizException("该VIP课人数已满,请联系教务老师!");
+            throw new BizException("该课程组人数已满,请联系教务老师!");
         }
 
         VipGroupActivity vipGroupActivity = null;
@@ -2388,7 +2372,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         }
 
         if (Objects.nonNull(vipGroupActivity) && Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes()) && vipGroupActivity.getStudentMaxUsedTimes() != -1) {
-            int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), user.getId());
+            int useNum = activityUserMapperService.countActivityBuyNum(vipGroupActivity.getId(), userId);
             if (useNum >= vipGroupActivity.getStudentMaxUsedTimes()) {
                 throw new BizException("您已超过该活动购买限制{}次", vipGroupActivity.getStudentMaxUsedTimes());
             }
@@ -2400,7 +2384,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         if (Objects.nonNull(vipGroup.getStudentIdList())) {
             Set<Integer> userIds = Arrays.asList(vipGroup.getStudentIdList().split(",")).stream().mapToInt(Integer::parseInt).boxed().collect(Collectors.toSet());
-            if (!userIds.contains(user.getId())) {
+            if (!userIds.contains(userId)) {
                 throw new BizException("您无法购买此课程");
             }
         }
@@ -2412,14 +2396,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         courseScheduleService.checkNewCourseSchedules(courseSchedules, false, false);
 
         //校验优惠券
-        String[] checkCoupon = CouponDetailTypeEnum.getAllowType(CouponDetailTypeEnum.VIP);
+        String[] checkCoupon = CouponDetailTypeEnum.getAllowType(couponDetailTypeEnum);
         StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(vipGroupBuyParams.getCouponIdList(), vipGroup.getTotalPrice(), true, checkCoupon);
-        studentPaymentOrder.setUserId(user.getId());
-        studentPaymentOrder.setGroupType(GroupType.VIP);
+        studentPaymentOrder.setUserId(userId);
+        studentPaymentOrder.setGroupType(groupType);
         String orderNo = idGeneratorService.generatorId("payment") + "";
         studentPaymentOrder.setOrderNo(orderNo);
         studentPaymentOrder.setStatus(DealStatusEnum.ING);
-        studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
+        studentPaymentOrder.setType(orderTypeEnum);
         studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
         studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
         studentPaymentOrder.setClassGroupId(classGroup.getId());
@@ -2433,7 +2417,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         BigDecimal amount = studentPaymentOrder.getActualAmount();
         BigDecimal balance = BigDecimal.ZERO;
         if (vipGroupBuyParams.isUseBalancePayment() || amount.doubleValue() == 0) {
-            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(user.getId());
+            SysUserCashAccount userCashAccount = sysUserCashAccountService.getLocked(userId);
             if (userCashAccount == null) {
                 throw new BizException("用户账户找不到");
             }
@@ -2450,7 +2434,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
                 this.orderCallback(studentPaymentOrder);
 
-                sysUserCashAccountService.updateBalance(user.getId(), amount.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
+                sysUserCashAccountService.updateBalance(userId, amount.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, groupType.getDesc() + "购买");
 
                 Map<String, Object> result = new HashMap<>();
                 result.put("orderNo", studentPaymentOrder.getOrderNo());
@@ -2459,7 +2443,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             } else {
                 if (userCashAccount.getBalance().doubleValue() > 0) {
                     balance = userCashAccount.getBalance();
-                    sysUserCashAccountService.updateBalance(user.getId(), balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, "VIP课购买");
+                    sysUserCashAccountService.updateBalance(userId, balance.negate(), PlatformCashAccountDetailTypeEnum.PAY_FEE, groupType.getDesc() + "购买");
                     amount = amount.subtract(userCashAccount.getBalance());
                     studentPaymentOrder.setActualAmount(amount);
                     studentPaymentOrder.setBalancePaymentAmount(userCashAccount.getBalance());
@@ -2469,9 +2453,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
             }
         }
         try {
-            contractService.register(user.getId(), user.getRealName(), user.getIdCardNo(), user.getPhone());
+            contractService.register(userId, user.getRealName(), user.getIdCardNo(), user.getPhone());
         } catch (Exception e) {
-            LOGGER.error("[{}]课购买协议生成错误:{}", vipGroup.getId(), e.getCause());
+            LOGGER.error("[{}]课购买协议生成错误:{}", vipGroup.getId(), e.getCause());
         }
 
         String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
@@ -2487,10 +2471,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 orderNo,
                 baseApiUrl + "/api-student/studentOrder/callback",
                 baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
-                "vip课购买",
+                groupType.getDesc() + "购买",
                 vipGroup.getName(),
                 vipGroup.getOrganId(),
-                "vipBuy"
+                orderTypeEnum.getCode()
         );
 
         studentPaymentOrder.setOrganId(vipGroup.getOrganId());
@@ -2503,14 +2487,10 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     }
 
     @Override
-    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+    @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
     public void orderCallback(StudentPaymentOrder order) {
         Integer userId = order.getUserId();
         Integer tenantId = order.getTenantId();
-        /*StudentPaymentOrder order = studentPaymentOrderDao.lockOrder(studentPaymentOrder.getId());
-        if (!order.getStatus().equals(DealStatusEnum.ING)) {
-            return;
-        }*/
         //更新订单状态
         int updateCount = studentPaymentOrderService.update(order);
         if (updateCount <= 0) {
@@ -2520,6 +2500,12 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         ClassGroup classGroup = classGroupDao.get(order.getClassGroupId());
         if (order.getStatus() == DealStatusEnum.SUCCESS) {
             VipGroup vipGroup = vipGroupDao.get(Long.parseLong(classGroup.getMusicGroupId()));
+            GroupType groupType = GroupType.VIP;
+            MessageTypeEnum messageTypeEnum = MessageTypeEnum.STUDENT_PUSH_VIP_BUY;
+            if("LIVE".equals(vipGroup.getGroupType())){
+                groupType = GroupType.LIVE;
+                messageTypeEnum = MessageTypeEnum.STUDENT_PUSH_LIVE_BUY;
+            }
             if (vipGroup.getStatus() == VipGroupStatusEnum.DELETE ||
                     vipGroup.getStatus() == VipGroupStatusEnum.CANCEL ||
                     vipGroup.getStatus() == VipGroupStatusEnum.PAUSE) {
@@ -2541,11 +2527,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 classGroupStudentMapper.setUserId(userId);
                 classGroupStudentMapper.setCreateTime(date);
                 classGroupStudentMapper.setStatus(ClassGroupStudentStatusEnum.NORMAL);
-                classGroupStudentMapper.setGroupType(GroupType.VIP);
+                classGroupStudentMapper.setGroupType(groupType);
                 classGroupStudentMapperDao.insert(classGroupStudentMapper);
 
                 //获取班级实际人数
-                Integer studentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(VIP, classGroup.getMusicGroupId());
+                Integer studentNum = classGroupStudentMapperDao.countGroupNormalStudentNum(groupType, classGroup.getMusicGroupId());
                 //课程组人数已满,变更状态
                 if (studentNum.equals(classGroup.getExpectStudentNum())) {
                     vipGroup.setStatus(VipGroupStatusEnum.PROGRESS);
@@ -2631,7 +2617,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                     courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 
                     imGroupService.create(classGroup.getId().toString(), null, classGroup.getName(), classGroup.getName(),
-                            vipGroup.getName(), null, null, GroupType.VIP.getCode(), ImGroup.GroupTypeEnum.VIP);
+                            vipGroup.getName(), null, null, groupType.getCode(), ImGroup.GroupTypeEnum.valueOf(groupType.name()));
                     imGroupMemberService.join(classGroup.getId().toString(), userRoleMap);
                     imUserFriendService.refreshGroupImUserFriend(classGroup.getMusicGroupId(), classGroup.getGroupType());
                 }
@@ -2670,7 +2656,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
                 Map<Integer, String> map = new HashMap<>(1);
                 map.put(userId, userId.toString());
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_VIP_BUY, map, null, 0, "2", "STUDENT",
+                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, messageTypeEnum, map, null, 0, "2", "STUDENT",
                         vipGroup.getName());
 
                 //更新所属分部列表
@@ -2683,14 +2669,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 try {
                     contractService.transferVipGroupCoursesContract(userId, vipGroup.getId(), order.getType());
                 } catch (Exception e) {
-                    LOGGER.error(MessageFormatter.arrayFormat("课[{}]购买协议错误:{}", vipGroup.getId(), e.getMessage()), e);
+                    LOGGER.error(MessageFormatter.arrayFormat("课[{}]购买协议错误:{}", vipGroup.getId(), e.getMessage()), e);
                 }
             }
         } else {
             classGroup.setStudentNum(classGroup.getStudentNum() - 1);
             if (order.getBalancePaymentAmount() != null && order.getBalancePaymentAmount().doubleValue() > 0) {
                 sysUserCashAccountService.updateBalance(userId, order.getBalancePaymentAmount(), PlatformCashAccountDetailTypeEnum.REFUNDS,
-                        "VIP课购买失败");
+                        "课购买失败");
             }
             sysCouponCodeService.quit(order.getCouponCodeId());
         }
@@ -2703,10 +2689,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         if (true) {
             throw new BizException("暂不支持退课");
         }
-        SysUser sysUser = sysUserFeignService.queryUserInfo();
-        if (null == sysUser) {
-            throw new BizException("获取用户信息失败");
-        }
+        SysUser sysUser = sysUserService.getUser();
         Integer userId = sysUser.getId();
         StudentApplyRefunds studentApplyRefunds = new StudentApplyRefunds();
         StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.findByStudentVipGroup(vipGroupId, userId, DealStatusEnum.SUCCESS.getCode());
@@ -4373,7 +4356,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     @Override
     public VipGroupPayInfoDto getVipGroupPayInfo(Integer vipGroupId, Integer userId) {
         if (Objects.isNull(vipGroupId)) {
-            throw new BizException("请指定需要购买的课");
+            throw new BizException("请指定需要购买的课");
         }
         VipGroup vipGroup = vipGroupDao.get(vipGroupId.longValue());
         if (Objects.isNull(vipGroup)) {

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

@@ -219,7 +219,7 @@
 			 LEFT JOIN sys_coupon sc ON scc.coupon_id_=sc.id_
 			 LEFT JOIN sys_user su ON scc.user_id_=su.id_
 			 LEFT JOIN organization organ ON su.organ_id_=organ.id_
-		<include refid="querySysCouponUseListCondition"></include>
+		<include refid="querySysCouponUseListCondition"/>
 		ORDER BY scc.id_ DESC
 		<include refid="global.limit"></include>
 	</select>

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

@@ -867,6 +867,7 @@
         <result property="classTimes" column="total_class_times_"/>
         <result property="startClassTime" column="courses_start_date"/>
         <result property="endClassTime" column="courses_expire_date_"/>
+        <result property="groupType" column="group_type_"/>
     </resultMap>
     <select id="getVipBuyResultInfo" resultMap="VipBuyResult">
         SELECT vg.id_,
@@ -874,9 +875,10 @@
                vg.courses_start_date,
                vg.courses_expire_date_,
                cg.total_class_times_,
-               su.real_name_ username_
+               su.real_name_ username_,
+               vg.group_type_
         FROM vip_group vg
-                 LEFT JOIN class_group cg ON vg.id_ = cg.music_group_id_ AND cg.group_type_ = 'VIP'
+                 LEFT JOIN class_group cg ON vg.id_ = cg.music_group_id_ AND cg.group_type_ = vg.group_type_
                  LEFT JOIN sys_user su ON vg.user_id_ = su.id_
         WHERE vg.id_ = #{vipGroupId}
     </select>

+ 1 - 3
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -82,8 +82,6 @@ public class StudentOrderController extends BaseController {
     @Autowired
     private ReplacementInstrumentActivityDao replacementInstrumentActivityDao;
     @Autowired
-    private ChildrenDayDegreeDetailDao childrenDayDegreeDetailDao;
-    @Autowired
     private CloudTeacherOrderService cloudTeacherOrderService;
     @Autowired
     private SysCouponCodeDao sysCouponCodeDao;
@@ -285,7 +283,7 @@ public class StudentOrderController extends BaseController {
             if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
                 orderDetail.put("member", cloudTeacherOrderService.queryOrderInfoByOrderId(orderByOrderNo.getId()));
             }
-        } else if (orderByOrderNo.getGroupType().equals(GroupType.VIP)) {
+        } else if (orderByOrderNo.getGroupType().equals(GroupType.VIP) || orderByOrderNo.getGroupType().equals(GroupType.LIVE)) {
             if(orderByOrderNo.getType() == OrderTypeEnum.ACTIVITY){
                 orderDetail.put("activity", vipGroupActivityService.getDao().queryByIds(orderByOrderNo.getActivityId()));
             }else if (StringUtils.isNotEmpty(orderByOrderNo.getMusicGroupId())) {

+ 0 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentVipGroupController.java

@@ -90,7 +90,6 @@ public class StudentVipGroupController extends BaseController {
     @PostMapping("/buyVipGroup")
     @AuditLogAnnotation(operateName = "vip课购买")
     public HttpResponseResult buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) throws Exception {
-        vipGroupBuyParams.setUserId(sysUserService.getUserId());
         return vipGroupService.buyVipGroup(vipGroupBuyParams);
     }
 

+ 0 - 5
mec-web/src/main/java/com/ym/mec/web/controller/SysCouponCodeController.java

@@ -1,7 +1,5 @@
 package com.ym.mec.web.controller;
 
-import com.ym.mec.auth.api.client.SysUserFeignService;
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.page.SysCouponCodeQueryInfo;
 import com.ym.mec.biz.service.SysCouponCodeService;
 import com.ym.mec.common.controller.BaseController;
@@ -10,7 +8,6 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -21,8 +18,6 @@ public class SysCouponCodeController extends BaseController {
 
 	@Autowired
 	private SysCouponCodeService sysCouponCodeService;
-	@Autowired
-	private SysUserFeignService sysUserFeignService;
 
 	@ApiOperation("分页查询")
 	@RequestMapping(value = "queryPage")