Jelajahi Sumber

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

zouxuan 7 bulan lalu
induk
melakukan
d1e4461ad8

+ 32 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/StudentTime.java

@@ -73,6 +73,38 @@ public class StudentTime implements Serializable {
     private Date firstActivityTime;
 
 
+
+    @ApiModelProperty("第一次VIP课购买时间 ")
+    @TableField(value = "first_vip_course_time_")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date firstVipCourseTime;
+
+
+
+    @ApiModelProperty("第一次畅学卡购买时间 ")
+    @TableField(value = "first_discount_time_")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
+    private Date firstDiscountTime;
+
+
+    public Date getFirstVipCourseTime() {
+        return firstVipCourseTime;
+    }
+
+    public void setFirstVipCourseTime(Date firstVipCourseTime) {
+        this.firstVipCourseTime = firstVipCourseTime;
+    }
+
+    public Date getFirstDiscountTime() {
+        return firstDiscountTime;
+    }
+
+    public void setFirstDiscountTime(Date firstDiscountTime) {
+        this.firstDiscountTime = firstDiscountTime;
+    }
+
     public Date getFirstSvipTime() {
         return firstSvipTime;
     }

+ 8 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/HomeServiceImpl.java

@@ -148,6 +148,8 @@ public class HomeServiceImpl implements HomeService {
         Integer musicNum = 0;
         Integer shoppingNum = 0;
         Integer payStudentNum = 0;
+        Integer discountNum = 0;
+        Integer vipCourseNum = 0;
 
         for (HomeTotalStudent totalStudent : totalList) {
             totalStudent.setRegisterNum(null == totalStudent.getRegisterNum() ? 0 : totalStudent.getRegisterNum());
@@ -159,6 +161,8 @@ public class HomeServiceImpl implements HomeService {
             totalStudent.setMusicNum(null == totalStudent.getMusicNum() ? 0 : totalStudent.getMusicNum());
             totalStudent.setShoppingNum(null == totalStudent.getShoppingNum() ? 0 : totalStudent.getShoppingNum());
             totalStudent.setPayStudentNum(null == totalStudent.getPayStudentNum() ? 0 : totalStudent.getPayStudentNum());
+            totalStudent.setDiscountNum(null == totalStudent.getDiscountNum() ? 0 : totalStudent.getDiscountNum());
+            totalStudent.setVipCourseNum(null == totalStudent.getVipCourseNum() ? 0 : totalStudent.getVipCourseNum());
 
             registerNum += totalStudent.getRegisterNum();
             vipNum += totalStudent.getVipNum();
@@ -169,6 +173,8 @@ public class HomeServiceImpl implements HomeService {
             musicNum += totalStudent.getMusicNum();
             shoppingNum += totalStudent.getShoppingNum();
             payStudentNum += totalStudent.getPayStudentNum();
+            discountNum += totalStudent.getDiscountNum();
+            vipCourseNum += totalStudent.getVipCourseNum();
         }
         HomeTotalStudent total = new HomeTotalStudent();
         total.setRegisterNum(registerNum);
@@ -180,6 +186,8 @@ public class HomeServiceImpl implements HomeService {
         total.setMusicNum(musicNum);
         total.setShoppingNum(shoppingNum);
         total.setPayStudentNum(payStudentNum);
+        total.setDiscountNum(discountNum);
+        total.setVipCourseNum(vipCourseNum);
 
         total.setInfoList(totalList);
         return HttpResponseResult.succeed(total);

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

@@ -85,6 +85,12 @@ public class StudentTimeServiceImpl extends ServiceImpl<StudentTimeDao, StudentT
                 if (null == studentTime.getFirstPracticeTime() && GoodTypeEnum.PRACTICE.equals(detailVo.getGoodType())) {
                     studentTime.setFirstPracticeTime(now);
                 }
+                if (null == studentTime.getFirstVipCourseTime() && GoodTypeEnum.VIP_COURSE.equals(detailVo.getGoodType())) {
+                    studentTime.setFirstVipCourseTime(now);
+                }
+                if (null == studentTime.getFirstDiscountTime() && GoodTypeEnum.DISCOUNT.equals(detailVo.getGoodType())) {
+                    studentTime.setFirstDiscountTime(now);
+                }
                 if (null == studentTime.getFirstLiveTime() && GoodTypeEnum.LIVE.equals(detailVo.getGoodType())) {
                     studentTime.setFirstLiveTime(now);
                 }

+ 6 - 87
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/res/HomeTotalStudent.java

@@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.vo.res;
 
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
 
 import java.util.List;
 
@@ -9,6 +10,7 @@ import java.util.List;
  * @Author: liweifan
  * @Data: 2022/4/21 11:29
  */
+@Data
 @ApiModel(value = "HomeTotalStudent", description = "后台首页学生数据统计查询对象")
 public class HomeTotalStudent {
     @ApiModelProperty("学生注册量 ")
@@ -19,6 +21,10 @@ public class HomeTotalStudent {
     private Integer svipNum;
     @ApiModelProperty("新增趣纠课学员 ")
     private Integer practiceNum;
+    @ApiModelProperty("新增VIP课学员 ")
+    private Integer vipCourseNum;
+    @ApiModelProperty("新增畅学卡学员 ")
+    private Integer discountNum;
     @ApiModelProperty("新增视频课学员 ")
     private Integer videoNum;
     @ApiModelProperty("新增直播课学员 ")
@@ -35,91 +41,4 @@ public class HomeTotalStudent {
     @ApiModelProperty("付费学员数")
     private Integer payStudentNum;
 
-    public Integer getPayStudentNum() {
-        return payStudentNum;
-    }
-
-    public void setPayStudentNum(Integer payStudentNum) {
-        this.payStudentNum = payStudentNum;
-    }
-
-    public Integer getRegisterNum() {
-        return registerNum;
-    }
-
-    public void setRegisterNum(Integer registerNum) {
-        this.registerNum = registerNum;
-    }
-
-    public Integer getVipNum() {
-        return vipNum;
-    }
-
-    public void setVipNum(Integer vipNum) {
-        this.vipNum = vipNum;
-    }
-
-    public Integer getPracticeNum() {
-        return practiceNum;
-    }
-
-    public void setPracticeNum(Integer practiceNum) {
-        this.practiceNum = practiceNum;
-    }
-
-    public Integer getVideoNum() {
-        return videoNum;
-    }
-
-    public void setVideoNum(Integer videoNum) {
-        this.videoNum = videoNum;
-    }
-
-    public Integer getLiveNum() {
-        return liveNum;
-    }
-
-    public void setLiveNum(Integer liveNum) {
-        this.liveNum = liveNum;
-    }
-
-    public Integer getMusicNum() {
-        return musicNum;
-    }
-
-    public void setMusicNum(Integer musicNum) {
-        this.musicNum = musicNum;
-    }
-
-    public Integer getShoppingNum() {
-        return shoppingNum;
-    }
-
-    public void setShoppingNum(Integer shoppingNum) {
-        this.shoppingNum = shoppingNum;
-    }
-
-    public String getTimeStr() {
-        return timeStr;
-    }
-
-    public void setTimeStr(String timeStr) {
-        this.timeStr = timeStr;
-    }
-
-    public List<HomeTotalStudent> getInfoList() {
-        return infoList;
-    }
-
-    public void setInfoList(List<HomeTotalStudent> infoList) {
-        this.infoList = infoList;
-    }
-
-    public Integer getSvipNum() {
-        return svipNum;
-    }
-
-    public void setSvipNum(Integer svipNum) {
-        this.svipNum = svipNum;
-    }
 }

+ 32 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/HomeMapper.xml

@@ -121,6 +121,8 @@
 			sum(a.registerNum) as registerNum,
 			sum(b.vipNum) as vipNum,
 			sum(b2.svipNum) as svipNum,
+			sum(b2.discountNum) as discountNum,
+			sum(b2.vipCourseNum) as vipCourseNum,
 			sum(c.practiceNum) as practiceNum,
 			sum(d.videoNum) as videoNum,
 			sum(e.liveNum) as liveNum,
@@ -175,6 +177,36 @@
 		) b2 on t.sys_day_ymd_ = b2.timeStr
 		left join (
 		select
+		DATE_FORMAT(t.first_discount_time_,'%Y-%m-%d') as timeStr,
+		count(1) as discountNum
+		from student_time t
+		<where>
+			<if test="param.startTime !=null">
+				<![CDATA[AND t.first_discount_time_ >= #{param.startTime} ]]>
+			</if>
+			<if test="param.endTime !=null">
+				<![CDATA[AND t.first_discount_time_ < #{param.endTime} ]]>
+			</if>
+		</where>
+		group by DATE_FORMAT(t.first_discount_time_,'%Y-%m-%d')
+		) b2 on t.sys_day_ymd_ = b2.timeStr
+		left join (
+		select
+		DATE_FORMAT(t.first_vip_course_time_,'%Y-%m-%d') as timeStr,
+		count(1) as vipCourseNum
+		from student_time t
+		<where>
+			<if test="param.startTime !=null">
+				<![CDATA[AND t.first_vip_course_time_ >= #{param.startTime} ]]>
+			</if>
+			<if test="param.endTime !=null">
+				<![CDATA[AND t.first_vip_course_time_ < #{param.endTime} ]]>
+			</if>
+		</where>
+		group by DATE_FORMAT(t.first_vip_course_time_,'%Y-%m-%d')
+		) b2 on t.sys_day_ymd_ = b2.timeStr
+		left join (
+		select
 			DATE_FORMAT(t.first_pay_time_,'%Y-%m-%d') as timeStr,
 			count(1) as payNum
 		from student_time t