刘俊驰 il y a 5 jours
Parent
commit
4f3ccef04b

+ 4 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/enums/MessageTypeEnum.java

@@ -172,6 +172,10 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
     TEACHER_UPDATE_COURSE_PLAN("老师修改课程规划"),
     TEACHER_UPDATE_COURSE_PLAN_VIP("老师修改课程规划"),
     TEACHER_UPDATE_COURSE_PLAN_PIANO_ROOM_CLASS("老师修改课程规划"),
+    GROUP_SUCCESS_STUDENT("小组课已成课"),
+    GROUP_SUCCESS_TEACHER("小组课已成课"),
+    GROUP_FAIL_STUDENT("小组课成课失败"),
+    GROUP_FAIL_TEACHER("小组课成课失败"),
     ;
 
     MessageTypeEnum(String msg) {

+ 44 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseGroupServiceImpl.java

@@ -1456,8 +1456,7 @@ public class CourseGroupServiceImpl extends ServiceImpl<CourseGroupDao, CourseGr
                     // 小组课成课推送
                     if (courseGroup.getType().equals(CourseScheduleEnum.GROUP.getCode())) {
                         // 极光-消息推送-老师端-通知老师小组课程组成课
-
-
+                        sendGroupSuccessMessage(courseGroup,true);
                     }
                 } else {
                     //人数未达标则修改课程组为取消状态
@@ -1467,11 +1466,19 @@ 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);
+                    // 小组课成课推送
+                    if (courseGroup.getType().equals(CourseScheduleEnum.GROUP.getCode())) {
+
+                        // 极光-消息推送-老师端-通知老师小组课程组成课
+                        sendGroupSuccessMessage(courseGroup,false);
+                    } else {
+                        // 老师直播课成课失败发送消息
+                        this.sendMessage(courseGroup);
+
+                        // 学生直播课成课失败发送消息
+                        this.sendStudentMessage(userIds, courseGroup);
+                    }
 
                     //退款
                     this.refund(courseGroup);
@@ -1485,6 +1492,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());
+        }
+
+
+        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((List<Long>) userIds);
+
+        Map<Long, String> receivers = new HashMap<>();
+        for (com.yonge.cooleshow.biz.dal.entity.SysUser value : mapByIds.values()) {
+            receivers.put(value.getId(), value.getPhone());
+        }
+        try {
+            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) {
 

+ 3 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserPaymentCoreServiceImpl.java

@@ -1873,9 +1873,9 @@ DISCOUNT("畅学卡")
             // 已产生三方交易流水号,先判断三方订单支付状态若在支付中,则重复返回相同支付配置参数;避免用户重复支付
             // 原生支付(微信,支付宝)流水号后产品,需要查询三方支付订单状态
             if (StringUtils.isNotBlank(paymentOrder.getTransNo())
-                || EPaymentVendor.ORIGINAL.name().equalsIgnoreCase(paymentOrder.getPaymentVendor())
-                || EPaymentVendor.WXPAY.name().equalsIgnoreCase(paymentOrder.getPaymentVendor())
-                || EPaymentVendor.ALIPAY.name().equalsIgnoreCase(paymentOrder.getPaymentVendor())) {
+                || paymentOrder.getPaymentVendor().startsWith(EPayerType.ORIGINAL.name().toLowerCase())
+                || paymentOrder.getPaymentVendor().startsWith(EPaymentVendor.WXPAY.name().toLowerCase())
+                || paymentOrder.getPaymentVendor().startsWith(EPaymentVendor.ALIPAY.name().toLowerCase())) {
 
                 // 获取三方支付订单信息,根据订单状处理
                 PaymentResp paymentResp = paymentServiceContext.getPaymentService(paymentOrder.getPaymentVendor())