|
@@ -110,6 +110,9 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
private CouponInfoService couponInfoService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private CourseGroupDao courseGroupDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private PlatformCashAccountRecordService platformCashAccountRecordService;
|
|
|
|
|
|
@Autowired
|
|
@@ -132,6 +135,11 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
return queryLiveCourseInfo(groupId, sysUserService.getUser());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public CourseInfoVo queryCourseInfo(Long groupId) {
|
|
|
+ return queryCourseInfo(groupId, sysUserService.getUser());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询课程组详情-直播课详情
|
|
|
*
|
|
@@ -144,6 +152,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
|
|
|
LiveCourseInfoVo result = new LiveCourseInfoVo();
|
|
|
result.setCourseGroupId(group.getId());
|
|
|
+ result.setType(group.getType());
|
|
|
+ result.setCourseGroupId(group.getId());
|
|
|
result.setCourseGroupName(group.getName());
|
|
|
result.setCourseStartTime(group.getCourseStartTime());
|
|
|
result.setSingleCourseMinutes(group.getSingleCourseMinutes());
|
|
@@ -202,6 +212,71 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//因为页面再点击购买按钮时,会请求/userOrder/getPendingOrder接口,如果有支付中的订单,用户选择继续支付或取消订单
|
|
|
OrderSearch query = new OrderSearch();
|
|
|
query.setUserId(id);
|
|
|
+ query.setGoodTypes(Lists.newArrayList(group.getType()));
|
|
|
+ query.setBizId(groupId);
|
|
|
+ query.setStatus(OrderStatusEnum.PAID.getCode());
|
|
|
+ List<UserOrderVo> userOrderVos = userOrderService.selectAllList(query);
|
|
|
+ if (CollectionUtils.isNotEmpty(userOrderVos)) {
|
|
|
+ result.setExistBuy(1);
|
|
|
+ }else {
|
|
|
+ result.setExistBuy(0);
|
|
|
+ if(StringUtils.equals("GROUP",group.getType()) && Objects.equals(group.getMaxStudentNum(), group.getPreStudentNum())){
|
|
|
+ result.setExistBuy(2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ private CourseInfoVo queryCourseInfo(Long groupId, SysUser sysUser) {
|
|
|
+ CourseGroup group = Optional.ofNullable(groupId).map(this::getById)
|
|
|
+ .orElseThrow(() -> new BizException("课程组信息不存在"));
|
|
|
+
|
|
|
+ CourseInfoVo result = new CourseInfoVo();
|
|
|
+ result.setCourseGroupId(group.getId());
|
|
|
+ result.setCourseGroupName(group.getName());
|
|
|
+ result.setCourseStartTime(group.getCourseStartTime());
|
|
|
+ result.setSingleCourseMinutes(group.getSingleCourseMinutes());
|
|
|
+ result.setStatus(group.getStatus());
|
|
|
+ result.setStudentCount(group.getPreStudentNum());
|
|
|
+ result.setBackgroundPic(group.getBackgroundPic());
|
|
|
+ result.setTeacherId(group.getTeacherId());
|
|
|
+ result.setCoursePrice(group.getCoursePrice());
|
|
|
+ result.setCourseNum(group.getCourseNum());
|
|
|
+ result.setCompleteCourseNum(group.getCompleteCourseNum());
|
|
|
+ result.setCourseIntroduce(group.getCourseIntroduce());
|
|
|
+ result.setSalesStartDate(group.getSalesStartDate());
|
|
|
+ result.setSalesEndDate(group.getSalesEndDate());
|
|
|
+ result.setMixStudentNum(group.getMixStudentNum());
|
|
|
+ result.setMaxStudentNum(group.getMaxStudentNum());
|
|
|
+ result.setImGroupId(group.getImGroupId());
|
|
|
+ result.setAuditVersion(group.getAuditVersion());
|
|
|
+ SysUser teacherUser = sysUserService.getByUserId(group.getTeacherId());
|
|
|
+ if (teacherUser == null) {
|
|
|
+ throw new BizException("用户不存在");
|
|
|
+ }
|
|
|
+ if (sysUser.getId().equals(teacherUser.getId())) {
|
|
|
+ result.setMyself(true);
|
|
|
+ } else {
|
|
|
+ result.setMyself(false);
|
|
|
+ }
|
|
|
+ Teacher teacher = teacherService.getById(teacherUser.getId());
|
|
|
+
|
|
|
+ if (teacher != null) {
|
|
|
+ result.setDegreeFlag(teacher.getDegreeFlag());
|
|
|
+ result.setTeacherFlag(teacher.getTeacherFlag());
|
|
|
+
|
|
|
+ }
|
|
|
+ result.setTeacherName(teacherUser.getRealName());
|
|
|
+ result.setUserName(teacherUser.getUsername());
|
|
|
+ result.setAvatar(teacherUser.getAvatar());
|
|
|
+ Optional.ofNullable(group.getSubjectId()).map(subjectService::get)
|
|
|
+ .ifPresent(subject -> result.setSubjectName(subject.getName()));
|
|
|
+ //查询是否购买过该课程组
|
|
|
+ Long id = sysUser.getId();
|
|
|
+
|
|
|
+ //这里修改为,订单完成后才算购买过,待支付和支付中订单不算
|
|
|
+ //因为页面再点击购买按钮时,会请求/userOrder/getPendingOrder接口,如果有支付中的订单,用户选择继续支付或取消订单
|
|
|
+ OrderSearch query = new OrderSearch();
|
|
|
+ query.setUserId(id);
|
|
|
query.setGoodType(GoodTypeEnum.LIVE.getCode());
|
|
|
query.setBizId(groupId);
|
|
|
query.setStatus(OrderStatusEnum.PAID.getCode());
|
|
@@ -225,7 +300,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
*/
|
|
|
public PageInfo<CourseGroupVo> queryPageLiveCourseGroup(Map<String, Object> param) {
|
|
|
//查询该月的所有直播课程
|
|
|
- param.put("type", CourseScheduleEnum.LIVE.getCode());
|
|
|
+ param.put("type", param.get("courseType") == null?CourseScheduleEnum.LIVE.getCode():param.get("courseType").toString());
|
|
|
Page<CourseGroupVo> pageInfo = PageUtil.getPageInfo(param);
|
|
|
pageInfo.setAsc("b.created_time_");
|
|
|
String os = WrapperUtil.toStr(param, "os");
|
|
@@ -263,10 +338,10 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
});
|
|
|
cacheTime.fastPut(dto.getTeacherId(), timeEntities);
|
|
|
Date now = new Date();
|
|
|
- String live = CourseScheduleEnum.LIVE.getCode();
|
|
|
+ String courseType = dto.getCourseType();
|
|
|
//写入课程组表
|
|
|
CourseGroup group = new CourseGroup();
|
|
|
- group.setType(live);
|
|
|
+ group.setType(courseType);
|
|
|
group.setTeacherId(dto.getTeacherId());
|
|
|
group.setName(dto.getName());
|
|
|
group.setSubjectId(dto.getSubjectId());
|
|
@@ -280,6 +355,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
group.setSalesEndDate(dto.getSalesEndDate());
|
|
|
group.setBackgroundPic(dto.getBackgroundPic());
|
|
|
group.setMixStudentNum(dto.getMixStudentNum());
|
|
|
+ group.setMaxStudentNum(dto.getMaxStudentNum());
|
|
|
group.setCreatedBy(dto.getTeacherId());
|
|
|
group.setCreatedTime(now);
|
|
|
this.save(group);
|
|
@@ -290,7 +366,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
dto.getCoursePlanList().forEach(o -> {
|
|
|
CourseSchedule course = new CourseSchedule();
|
|
|
course.setCourseGroupId(group.getId());
|
|
|
- course.setType(live);
|
|
|
+ course.setType(courseType);
|
|
|
course.setClassNum(o.getClassNum());
|
|
|
course.setTeacherId(dto.getTeacherId());
|
|
|
course.setClassDate(o.getStartTime());
|
|
@@ -361,7 +437,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//课程组信息
|
|
|
CourseGroup courseGroup = this.getOne(Wrappers.<CourseGroup>lambdaQuery()
|
|
|
.eq(CourseGroup::getId, groupId)
|
|
|
- .eq(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode())
|
|
|
+ .eq(CourseGroup::getType, orderGoodsInfo.getGoodType().name())
|
|
|
);
|
|
|
if (Objects.isNull(courseGroup)) {
|
|
|
throw new BizException("课程组不存在!");
|
|
@@ -379,6 +455,10 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//校验购买的课程组每节课时间是否和自己的课时冲突
|
|
|
batchCheckStudentCourseTime(studentId, courseList, CourseSchedule::getStartTime, CourseSchedule::getEndTime);
|
|
|
|
|
|
+ // 小组课判断购买人数
|
|
|
+ if (orderGoodsInfo.getGoodType() == GoodTypeEnum.GROUP && courseGroup.getLockNum()>=courseGroup.getMaxStudentNum()) {
|
|
|
+ throw new BizException("小组课已满员!");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
UserOrderDetail userOrderDetail = JSON.parseObject(JSON.toJSONString(orderGoodsInfo), UserOrderDetail.class);
|
|
@@ -418,7 +498,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> userMap = sysUserService.getMapByIds(userIds);
|
|
|
for (CourseGroupWrapper.TeacherCourseGroupDto e : records) {
|
|
|
e.setSubjectName(subjectMap.get(e.getSubjectId()));
|
|
|
- if(StringUtils.equals(query.getCourseType(),"PIANO_ROOM_CLASS")){
|
|
|
+ if(StringUtils.equals(query.getCourseType(),"PIANO_ROOM_CLASS") || StringUtils.equals(query.getCourseType(),"GROUP")){
|
|
|
List<CourseScheduleStudentPayment> studentPayments = map.get(e.getCourseGroupId());
|
|
|
if(CollectionUtils.isNotEmpty(studentPayments)){
|
|
|
List<Long> studentIds = studentPayments.stream().map(CourseScheduleStudentPayment::getUserId).distinct().collect(Collectors.toList());
|
|
@@ -464,6 +544,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
e.setSubjectName(subjectMap.get(e.getSubjectId()));
|
|
|
com.yonge.cooleshow.biz.dal.entity.SysUser user = userMap.get(e.getTeacherId());
|
|
|
if(Objects.nonNull(user)){
|
|
|
+ e.setCourseGroupName(e.getCourseGroupName() + "-" + user.getUsername());
|
|
|
e.setTeacherName(user.getUsername());
|
|
|
e.setTeacherAvatar(user.getAvatar());
|
|
|
}
|
|
@@ -527,6 +608,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
messageType = MessageTypeEnum.TEACHER_UPDATE_COURSE_PLAN_VIP;
|
|
|
}else if (CourseTypeEnum.valueOf(courseGroup.getType()) == CourseTypeEnum.PIANO_ROOM_CLASS){
|
|
|
messageType = MessageTypeEnum.TEACHER_UPDATE_COURSE_PLAN_PIANO_ROOM_CLASS;
|
|
|
+ }else if (CourseTypeEnum.valueOf(courseGroup.getType()) == CourseTypeEnum.GROUP){
|
|
|
+ messageType = MessageTypeEnum.TEACHER_UPDATE_COURSE_PLAN_GROUP;
|
|
|
}
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
messageType,
|
|
@@ -540,6 +623,26 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void buyGroupSendMessage(CourseScheduleStudentPayment studentPayment, CourseGroup courseGroup) {
|
|
|
+ //查询老师信息
|
|
|
+ SysUser teacherInfo = sysUserService.findUserById(courseGroup.getTeacherId());
|
|
|
+ //查询学生信息
|
|
|
+ SysUser studentInfo = sysUserService.findUserById(studentPayment.getUserId());
|
|
|
+ try {
|
|
|
+
|
|
|
+ //极光-消息推送-学生端-通知学生购买成功-跳转到APP
|
|
|
+ MessageTypeEnum liveBuy = MessageTypeEnum.GROUP_BUY;
|
|
|
+ Map<Long, String> studentReceivers = new HashMap<>();
|
|
|
+ studentReceivers.put(studentInfo.getId(), studentInfo.getPhone());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, liveBuy,
|
|
|
+ studentReceivers, null, 0, "", ClientEnum.STUDENT.getCode(),
|
|
|
+ teacherInfo.getUsername(), courseGroup.getName());
|
|
|
+ } catch (Exception ex) {
|
|
|
+ log.error("buyGroupSendMessage error", ex.getCause());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
*
|
|
|
* 直播课购买后数据写入
|
|
@@ -554,7 +657,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//课程组信息
|
|
|
CourseGroup courseGroup = this.getOne(Wrappers.<CourseGroup>lambdaQuery()
|
|
|
.eq(CourseGroup::getId, groupId)
|
|
|
- .eq(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode())
|
|
|
+ .eq(CourseGroup::getType, orderGoodsInfo.getGoodType().name())
|
|
|
);
|
|
|
if (Objects.isNull(courseGroup)) {
|
|
|
throw new BizException("课程组不存在!");
|
|
@@ -569,6 +672,19 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
if (CollectionUtils.isEmpty(courseList)) {
|
|
|
throw new BizException("课程组课程不存在!");
|
|
|
}
|
|
|
+
|
|
|
+ // 小组课判断购买人数
|
|
|
+ if (orderGoodsInfo.getGoodType() == GoodTypeEnum.GROUP ) {
|
|
|
+ if (courseGroup.getLockNum() >= courseGroup.getMaxStudentNum()) {
|
|
|
+ throw new BizException("小组课已满员!");
|
|
|
+ }
|
|
|
+ // 更新小组课锁定人数
|
|
|
+ int i = courseGroupDao.updateLockNum(groupId, 1);
|
|
|
+ if (i == 0) {
|
|
|
+ throw new BizException("小组课已满员!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 写入学生购买课程记录 换到订单写入成功后写入
|
|
|
buyLiveCourseAfter(orderGoodsInfo.getOrderNo(), orderGoodsInfo.getUserId(), courseList,
|
|
|
courseGroup,orderGoodsInfo.getUserOrderDetail().getActualPrice());
|
|
@@ -618,7 +734,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
coursePlanDto.setFreeEndTime(DateUtil.offsetMinute(coursePlanDto.getEndTime(), dto.getCourseFreeMinutes()));
|
|
|
}
|
|
|
// true:趣纠课PRACTICE false:LIVE直播课
|
|
|
- boolean courseTypeFlag = Lists.newArrayList(CourseScheduleEnum.PRACTICE,CourseScheduleEnum.VIP).contains(CourseScheduleEnum.existCourseType(dto.getCourseType(), "课程类型不正确!"));
|
|
|
+ boolean courseTypeFlag = Lists.newArrayList(CourseScheduleEnum.PRACTICE,CourseScheduleEnum.VIP)
|
|
|
+ .contains(CourseScheduleEnum.existCourseType(dto.getCourseType(), "课程类型不正确!"));
|
|
|
//先自校验传入时间是否交集
|
|
|
List<CourseTimeEntity> timeList = dto.getTimeList();
|
|
|
if (CollectionUtils.isEmpty(timeList)) {
|
|
@@ -1180,7 +1297,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
Map<Long, String> smsStudentReceivers = new HashMap<>();
|
|
|
smsStudentReceivers.put(studentInfo.getId(), studentInfo.getPhone());
|
|
|
sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS, smsLiveBuy,
|
|
|
- smsStudentReceivers, null, 0, null,payType,
|
|
|
+ smsStudentReceivers, null, 0, null,ClientEnum.STUDENT.getCode(),payType,
|
|
|
teacherInfo.getUsername(), courseGroup.getName());
|
|
|
log.info("buyLiveCourseSuccess buyLiveSendMessage SMS_BUY_LIVE ok");
|
|
|
|
|
@@ -1232,6 +1349,12 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
public void buyLiveCourseCancel(UserOrderDetailVo orderParam) {
|
|
|
courseScheduleStudentPaymentService.remove(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
|
|
|
.eq(CourseScheduleStudentPayment::getOrderNo, orderParam.getOrderNo()));
|
|
|
+
|
|
|
+
|
|
|
+ if (orderParam.getGoodType() == GoodTypeEnum.GROUP ) {
|
|
|
+ // 减少订单锁定
|
|
|
+ courseGroupDao.updateLockNum(orderParam.getBizId(), -1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1370,7 +1493,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
LocalDate yesterday = today.plusDays(-1L);
|
|
|
//查询今天未开售的课程组
|
|
|
List<CourseGroup> courseGroupList = this.list(Wrappers.<CourseGroup>lambdaQuery()
|
|
|
- .eq(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode())
|
|
|
+ .in(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode(),CourseScheduleEnum.GROUP.getCode())
|
|
|
.ge(CourseGroup::getSalesStartDate, yesterday)
|
|
|
.le(CourseGroup::getSalesStartDate, today)
|
|
|
.eq(CourseGroup::getStatus, CourseGroupEnum.NOT_SALE.getCode()));
|
|
@@ -1395,7 +1518,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
private void closeCourseGroup() {
|
|
|
//查询昨天要结束售卖的课程组
|
|
|
List<CourseGroup> courseGroupList = this.list(Wrappers.<CourseGroup>lambdaQuery()
|
|
|
- .eq(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode())
|
|
|
+ .in(CourseGroup::getType, CourseScheduleEnum.LIVE.getCode(),CourseScheduleEnum.GROUP.getCode())
|
|
|
.eq(CourseGroup::getSalesEndDate, LocalDate.now().plusDays(-1))
|
|
|
.in(CourseGroup::getStatus, CourseGroupEnum.APPLY.getCode(),CourseGroupEnum.OUT_SALE.getCode()));
|
|
|
if (CollectionUtils.isEmpty(courseGroupList)) {
|
|
@@ -1422,6 +1545,12 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
//添加老师进群
|
|
|
imGroupMemberService.initGroupMembers(imGroupId, Collections.singleton(courseGroup.getTeacherId()), ImGroupMemberRoleType.TEACHER);
|
|
|
courseGroup.setImGroupId(imGroupId);
|
|
|
+
|
|
|
+ // 小组课成课推送
|
|
|
+ if (courseGroup.getType().equals(CourseScheduleEnum.GROUP.getCode())) {
|
|
|
+ // 极光-消息推送-老师端-通知老师小组课程组成课
|
|
|
+ sendGroupSuccessMessage(courseGroup,true);
|
|
|
+ }
|
|
|
} else {
|
|
|
//人数未达标则修改课程组为取消状态
|
|
|
courseGroup.setStatus(CourseGroupEnum.CANCEL.getCode());
|
|
@@ -1430,14 +1559,23 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
.eq(CourseSchedule::getCourseGroupId, courseGroup.getId())
|
|
|
.set(CourseSchedule::getStatus, CourseScheduleEnum.CANCEL.getCode())
|
|
|
);
|
|
|
- // 老师直播课成课失败发送消息
|
|
|
- this.sendMessage(courseGroup);
|
|
|
-
|
|
|
- // 学生直播课成课失败发送消息
|
|
|
- this.sendStudentMessage(userIds,courseGroup);
|
|
|
|
|
|
//退款
|
|
|
this.refund(courseGroup);
|
|
|
+
|
|
|
+ // 小组课成课推送
|
|
|
+ if (courseGroup.getType().equals(CourseScheduleEnum.GROUP.getCode())) {
|
|
|
+
|
|
|
+ // 极光-消息推送-老师端-通知老师小组课程组成课
|
|
|
+ sendGroupSuccessMessage(courseGroup,false);
|
|
|
+ } else {
|
|
|
+ // 老师直播课成课失败发送消息
|
|
|
+ this.sendMessage(courseGroup);
|
|
|
+
|
|
|
+ // 学生直播课成课失败发送消息
|
|
|
+ this.sendStudentMessage(userIds, courseGroup);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
courseGroup.setUpdatedTime(new Date());
|
|
|
this.updateById(courseGroup);
|
|
@@ -1448,6 +1586,37 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ private void sendGroupSuccessMessage(CourseGroup courseGroup,boolean success) {
|
|
|
+ // 老师
|
|
|
+ SysUser sysUser = sysUserService.getByUserId(courseGroup.getTeacherId());
|
|
|
+ try {
|
|
|
+ Map<Long, String> receivers = new HashMap<>();
|
|
|
+ receivers.put(sysUser.getId(), sysUser.getPhone());
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, success?MessageTypeEnum.GROUP_SUCCESS_TEACHER:MessageTypeEnum.GROUP_FAIL_TEACHER,
|
|
|
+ receivers, null, 0, null, ClientEnum.TEACHER.getCode(), courseGroup.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("小组课成课成功推送发送失败,{}", e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<CourseScheduleStudentPayment> list = courseScheduleStudentPaymentService.list(Wrappers.<CourseScheduleStudentPayment>lambdaQuery()
|
|
|
+ .eq(CourseScheduleStudentPayment::getCourseGroupId, courseGroup.getId()));
|
|
|
+ Set<Long> userIds = list.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
|
|
|
+ // 学生
|
|
|
+ Map<Long, com.yonge.cooleshow.biz.dal.entity.SysUser> mapByIds = sysUserService.getMapByIds(new ArrayList<>( userIds));
|
|
|
+
|
|
|
+ Map<Long, String> receivers = new HashMap<>();
|
|
|
+ for (com.yonge.cooleshow.biz.dal.entity.SysUser value : mapByIds.values()) {
|
|
|
+ receivers.put(value.getId(), value.getPhone());
|
|
|
+ }
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, success?MessageTypeEnum.GROUP_SUCCESS_STUDENT:MessageTypeEnum.GROUP_FAIL_STUDENT,
|
|
|
+ receivers, null, 0, null, ClientEnum.STUDENT.getCode(), courseGroup.getName());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.warn("小组课成课成功推送发送失败,{}", e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void sendStudentMessage(Set<Long> userIds, CourseGroup courseGroup) {
|
|
|
for (Long userId : userIds) {
|
|
|
|
|
@@ -1496,14 +1665,15 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
|
|
|
List<Long> orderDetailIds = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(detail.getOrderDetailList())) {
|
|
|
- detail.getOrderDetailList().stream().filter(orderDetail -> orderDetail.getGoodType() == GoodTypeEnum.LIVE)
|
|
|
+ detail.getOrderDetailList().stream()
|
|
|
+ .filter(orderDetail -> orderDetail.getGoodType() == GoodTypeEnum.LIVE || orderDetail.getGoodType() == GoodTypeEnum.GROUP)
|
|
|
.filter(orderDetail -> orderDetail.getBizId().equals(courseGroup.getId()))
|
|
|
.forEach(orderDetail -> orderDetailIds.add(orderDetail.getId()));
|
|
|
}
|
|
|
if (order.getPaymentVersion().equals(EPaymentVersion.V1)) {
|
|
|
- userOrderRefundService.orderRefund(order.getOrderNo(), "直播课成课失败退款");
|
|
|
+ userOrderRefundService.orderRefund(order.getOrderNo(), CourseScheduleEnum.valueOf(courseGroup.getType()).getMsg() +"成课失败退款");
|
|
|
} else {
|
|
|
- userPaymentCoreService.refundPayment(order.getOrderNo(),"直播课成课失败退款", orderDetailIds);
|
|
|
+ userPaymentCoreService.refundPayment(order.getOrderNo(),CourseScheduleEnum.valueOf(courseGroup.getType()).getMsg() +"成课失败退款", orderDetailIds);
|
|
|
}
|
|
|
|
|
|
//退还优惠券
|
|
@@ -1511,8 +1681,8 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
couponInfoService.updateUserOrderCouponInfo(CouponOrderWrapper.builder().orderNo(order.getOrderNo()).reset(true).build());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- log.warn("直播课成课失败退款 退款失败,退款订单号 {}", order);
|
|
|
- log.error("直播课成课失败退款 退款失败", e);
|
|
|
+ log.warn("成课失败退款 退款失败,退款订单号 {}", order);
|
|
|
+ log.error("成课失败退款 退款失败", e);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1651,7 +1821,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
|
|
|
ShareProfitVo result = new ShareProfitVo();
|
|
|
result.setTeacherId(sysUser.getId());
|
|
|
- result.setType("LIVE");
|
|
|
+ result.setType(liveCourseInfoVo.getType());
|
|
|
result.setLiveCourseGroup(liveCourseGroupShareVo);
|
|
|
result.setUrl(MessageFormatter.arrayFormat(teacherLiveGroupShareProfitUrl, liveGroupId, sysUser.getId()));
|
|
|
result.setName(sysUser.getUsername());
|
|
@@ -1676,7 +1846,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
|
|
|
throw new BizException("只能下架销售中的课程组");
|
|
|
} else if (dto.getStatus() == 1 && !CourseGroupEnum.OUT_SALE.getCode().equals(liveCourseGroupVo.getStatus())) {
|
|
|
throw new BizException("只能上架被下架的课程组");
|
|
|
- } else if ( LocalDate.now().compareTo(liveCourseGroupVo.getSalesEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate()) > 0) {
|
|
|
+ } else if (LocalDate.now().isAfter(liveCourseGroupVo.getSalesEndDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate())) {
|
|
|
throw new BizException("课程组售卖时间已结束,不能操作");
|
|
|
}
|
|
|
|