Browse Source

Merge remote-tracking branch 'origin/feature/1113-vipCourse' into feature/1113-vipCourse

zouxuan 4 months ago
parent
commit
ea76871d5e

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

@@ -155,8 +155,10 @@ public enum MessageTypeEnum implements BaseEnum<String, MessageTypeEnum> {
 
     SYS_SUGGEST_FEEDBACK_STUDENT("意见反馈推送"),
     SYS_SUGGEST_FEEDBACK_TEACHER("意见反馈推送"),
-    STUDENT_BUY_COURSE_TO_TEACHER("约课提醒"),
-    STUDENT_BUY_COURSE_TO_STUDENT("约课成功"),
+    STUDENT_BUY_COURSE_TO_TEACHER("趣纠课约课提醒"),
+    STUDENT_BUY_COURSE_TO_STUDENT("趣纠课约课成功"),
+    STUDENT_BUY_VIP_COURSE_TO_TEACHER("vip课约课提醒"),
+    STUDENT_BUY_VIP_COURSE_TO_STUDENT("vip课约课成功"),
     //老师修改课程规划
     TEACHER_UPDATE_COURSE_PLAN("老师修改课程规划"),
     ;

+ 12 - 7
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CourseScheduleServiceImpl.java

@@ -1553,7 +1553,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
             if (recentCourses !=null &&
                     (CourseScheduleEnum.PRACTICE.getCode().equals(recentCourses.getCourseType()) || CourseScheduleEnum.VIP.getCode().equals(recentCourses.getCourseType()))) {
-                SysUser sysUser = sysUserService.getByUserId(recentCourses.getTeacherId());
+                SysUser sysUser = sysUserService.getByUserId(studentId);
                 if (sysUser != null) {
                     recentCourses.setCourseGroupName(recentCourses.getCourseGroupName() + "-" + sysUser.getUsername());
                 }
@@ -1567,8 +1567,7 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
 
             if (coursesPractice == null && coursesLive != null) {
                 homePage.setRecentCourses(coursesLive);
-            } else
-            if (coursesPractice != null && coursesLive == null) {
+            } else if (coursesPractice != null && coursesLive == null) {
                 homePage.setRecentCourses(coursesPractice);
             } else
             if (coursesPractice != null && coursesLive != null) {
@@ -1681,14 +1680,20 @@ public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleDao, Co
         teacherReceivers.put(teacherId, teacher.getPhone());
         Map<Long, String> studentReceivers = new HashMap<>();
         studentReceivers.put(studentId, student.getPhone());
+        MessageTypeEnum toStudent = MessageTypeEnum.STUDENT_BUY_COURSE_TO_STUDENT;
+        MessageTypeEnum toTeacher = MessageTypeEnum.STUDENT_BUY_COURSE_TO_TEACHER;
+        if (type == CourseScheduleEnum.VIP) {
+            toStudent = MessageTypeEnum.STUDENT_BUY_VIP_COURSE_TO_STUDENT;
+            toTeacher = MessageTypeEnum.STUDENT_BUY_VIP_COURSE_TO_TEACHER;
+        }
 
-        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_BUY_COURSE_TO_STUDENT,
+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, toStudent,
                 studentReceivers, null, 0, null, ClientEnum.STUDENT.getCode(),
-                teacher.getUsername(), courseNum,type.getMsg());
+                teacher.getUsername(), courseNum);
 
-        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.STUDENT_BUY_COURSE_TO_TEACHER,
+        sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, toTeacher,
                 teacherReceivers, null, 0, null, ClientEnum.TEACHER.getCode(),
-                student.getUsername(), courseNum,type.getMsg());
+                student.getUsername(), courseNum);
     }
 
     /**

+ 19 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/UserOrderServiceImpl.java

@@ -265,6 +265,9 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
     public UserOrderVo detailApp(UserOrder param) {
 
         UserOrderVo userOrderVo = baseMapper.detailApp(param);
+        if (userOrderVo == null) {
+            return null;
+        }
 
         if (userOrderVo.getStatus() == OrderStatusEnum.PAYING ) {
             if (userOrderVo.getPaymentVersion() == EPaymentVersion.V1) {
@@ -277,7 +280,7 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
         userOrderVo = baseMapper.detailApp(param);
 
         // 查询用户下单配置
-        String ret = redisCacheService.getUserOrderConfig(param.getUserId().toString(), userOrderVo.getOrderNo());
+        String ret = redisCacheService.getUserOrderConfig(userOrderVo.getUserId().toString(), userOrderVo.getOrderNo());
         if (!StringUtils.isEmpty(ret)) {
             UserPaymentOrderWrapper.PaymentOrderReqConfig config = UserPaymentOrderWrapper.PaymentOrderReqConfig
                     .from(ret);
@@ -307,6 +310,21 @@ public class UserOrderServiceImpl extends ServiceImpl<UserOrderDao, UserOrder> i
 
             List<UserOrderDetailVo> userOrderDetailVos = getUserOrderDetailVos(Lists.newArrayList(userOrderVo.getOrderNo()));
 
+            // 计算畅学卡优惠总金额
+            if (userOrderVo.getCardDiscountPrice() == null) {
+                userOrderVo.setCardDiscountPrice(BigDecimal.ZERO);
+            }
+            userOrderDetailVos.forEach(o -> {
+                if (StringUtils.isNotBlank(o.getDiscountJson())) {
+
+                    Map<String,BigDecimal> decimalMap = JSON.parseObject(o.getDiscountJson(), Map.class);
+                    BigDecimal bigDecimal = decimalMap.get(EDiscountType.DISCOUNT.name());
+                    if (bigDecimal != null) {
+                        userOrderVo.setCardDiscountPrice(userOrderVo.getCardDiscountPrice().add(bigDecimal));
+                    }
+                }
+            });
+
             // 设置recordId
             userOrderDetailVos.forEach(o -> {
                 if (o.getGoodType().equals(GoodTypeEnum.TENANT_ALBUM) && userOrderVo.getOrderClient().equals(ClientEnum.TENANT)) {

+ 3 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/UserOrderVo.java

@@ -45,6 +45,9 @@ public class UserOrderVo extends UserOrder {
 	@ApiModelProperty("优惠券抵扣金额 ")
 	private BigDecimal discountPrice;
 
+	@ApiModelProperty("畅学卡优惠总金额 ")
+	private BigDecimal cardDiscountPrice;
+
 
     @ApiModelProperty("机构名称")
     private String tenantName;

+ 5 - 2
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -673,6 +673,7 @@
     <select id="selectRecentCourses" resultType="com.yonge.cooleshow.biz.dal.vo.StudentHomePage$RecentCourses">
         SELECT
             u.id_ AS teacherId,
+            p.user_id_ AS studentId,
             u.username_ AS teacherName,
             u.real_name_ AS realName,
             u.avatar_ AS avatar,
@@ -705,7 +706,8 @@
             g.name_ AS courseGroupName,
             s.type_ AS courseType,
             s.status_ AS `status`,
-            s.start_time_ AS courseStartTime
+            s.start_time_ AS courseStartTime,
+        s.end_time_ AS courseEndTime
         FROM course_schedule s
         LEFT JOIN sys_user u ON s.teacher_id_=u.id_
         LEFT JOIN course_group g ON s.course_group_id_=g.id_
@@ -729,7 +731,8 @@
             g.name_ AS courseGroupName,
             s.type_ AS courseType,
             s.status_ AS `status`,
-            s.start_time_ AS courseStartTime
+            s.start_time_ AS courseStartTime,
+        s.end_time_ AS courseEndTime
         FROM course_schedule s
         LEFT JOIN sys_user u ON s.teacher_id_=u.id_
         LEFT JOIN course_group g ON s.course_group_id_=g.id_