浏览代码

双十一活动

zouxuan 3 年之前
父节点
当前提交
04a14fde98

+ 27 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupActivityDao.java

@@ -73,6 +73,15 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
 	*/
     List<DoubleEleven2021ActivityDto> countActivityStatis();
 
+	/**
+	* @description: 双十一活动统计
+	 * @param
+	* @return java.util.List<com.ym.mec.biz.dal.dto.DoubleEleven2021ActivityDto>
+	* @author zx
+	* @date 2021/10/25 13:46
+	*/
+    List<DoubleEleven2021ActivityDto> countOrganActivityStatis(@Param("organIdList") List<Integer> organIdList);
+
     /**
     * @description: 双十一活动统计
      * @param
@@ -82,6 +91,15 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
     */
 	DoubleEleven2021Dto countDoubleEleven2021Statis();
 
+    /**
+    * @description: 双十一活动统计
+     * @param
+    * @return com.ym.mec.biz.dal.dto.DoubleEleven2021Dto
+    * @author zx
+    * @date 2021/10/25 15:44
+    */
+	List<DoubleEleven2021Dto> countOrganDoubleEleven2021Statis();
+
 	/**
 	* @description: 双十一活动统计
 	 * @param
@@ -90,4 +108,13 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
 	* @date 2021/10/25 15:54
 	*/
 	int countGiveMemberNum();
+
+	/**
+	* @description: 双十一活动统计
+	 * @param
+	* @return int
+	* @author zx
+	* @date 2021/10/25 15:54
+	*/
+	List<Map<Integer,Integer>> countOrganGiveMemberNum(@Param("organIdList") List<Integer> organIdList);
 }

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/DoubleEleven2021ActivityDto.java

@@ -16,6 +16,16 @@ public class DoubleEleven2021ActivityDto {
     @ApiModelProperty(value = "购买的活动类型1、1v1 20节,2、1v1 40节,3、1v2 20节,4、1v2 40节,5、乐理课",required = false)
     private Integer type;
 
+    private Integer organId;
+
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
     public Integer getType() {
         return type;
     }

+ 21 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/DoubleEleven2021Dto.java

@@ -10,6 +10,11 @@ public class DoubleEleven2021Dto {
 
     List<DoubleEleven2021ActivityDto> activityDtoList;
 
+    private Integer organId;
+
+    @ApiModelProperty(value = "分部",required = false)
+    private String organName;
+
     @ApiModelProperty(value = "总成交额",required = false)
     private BigDecimal totalBuyAmount = BigDecimal.ZERO;
 
@@ -22,6 +27,22 @@ public class DoubleEleven2021Dto {
     @ApiModelProperty(value = "赠送会员人数",required = false)
     private int giveMemberNum;
 
+    public Integer getOrganId() {
+        return organId;
+    }
+
+    public void setOrganId(Integer organId) {
+        this.organId = organId;
+    }
+
+    public String getOrganName() {
+        return organName;
+    }
+
+    public void setOrganName(String organName) {
+        this.organName = organName;
+    }
+
     public List<DoubleEleven2021ActivityDto> getActivityDtoList() {
         return activityDtoList;
     }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java

@@ -195,7 +195,16 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 
     @Override
     public Object organDoubleEleven2021Statis() {
+		List<DoubleEleven2021Dto> doubleEleven2021Dtos = vipGroupActivityDao.countOrganDoubleEleven2021Statis();
+		if(doubleEleven2021Dtos != null && doubleEleven2021Dtos.size() > 0){
+			List<Integer> organIdList = doubleEleven2021Dtos.stream().map(e -> e.getOrganId()).collect(Collectors.toList());
+			List<DoubleEleven2021ActivityDto> activityDtoList = vipGroupActivityDao.countOrganActivityStatis(organIdList);
+			if(activityDtoList != null && activityDtoList.size() > 0){
+				Map<Integer, List<DoubleEleven2021ActivityDto>> collect = activityDtoList.stream().collect(Collectors.groupingBy(DoubleEleven2021ActivityDto::getOrganId));
+			}
+			Map<Integer, Integer> maps = MapUtil.convertIntegerMap(vipGroupActivityDao.countOrganGiveMemberNum(organIdList));
 
+		}
 		return null;
     }
 

+ 32 - 0
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -336,6 +336,7 @@
 		<result property="buyNum" column="buy_num_"/>
 		<result property="buyAmount" column="buy_amount_"/>
 		<result property="type" column="type_"/>
+		<result property="organId" column="organ_id_"/>
 	</resultMap>
 	<select id="countActivityStatis" resultMap="DoubleEleven2021ActivityDto">
 		SELECT SUM(aum.actual_price_) buy_amount_,COUNT(DISTINCT aum.user_id_) buy_num_,
@@ -349,6 +350,8 @@
 	<resultMap id="DoubleEleven2021Dto" type="com.ym.mec.biz.dal.dto.DoubleEleven2021Dto">
 		<result property="totalBuyAmount" column="total_buy_amount_"/>
 		<result property="totalBuyNum" column="total_buy_num_"/>
+		<result property="organName" column="organ_name_"/>
+		<result property="organId" column="organ_id_"/>
 	</resultMap>
 	<select id="countDoubleEleven2021Statis" resultMap="DoubleEleven2021Dto">
 		SELECT SUM(expect_amount_) total_buy_amount_,COUNT(DISTINCT user_id_) total_buy_num_ FROM student_payment_order
@@ -359,4 +362,33 @@
 		SELECT COUNT(DISTINCT student_id_) FROM cloud_teacher_order WHERE remark_ = '双十一活动赠送会员'
 		AND organ_id_ NOT IN (36,38,39,41,42,43,44,45,46,47,48,49,50,52,54,55,56,2,27,22,24)
 	</select>
+	<select id="countOrganGiveMemberNum" resultType="java.lang.Integer">
+		SELECT organ_id_ 'key',COUNT(DISTINCT student_id_) 'value' FROM cloud_teacher_order WHERE remark_ = '双十一活动赠送会员'
+		AND organ_id_ IN
+		<foreach collection="organIdList" open="(" close=")" item="organId" separator=",">
+			#{organId}
+		</foreach>
+		GROUP BY organ_id_
+	</select>
+	<select id="countOrganActivityStatis" resultMap="DoubleEleven2021ActivityDto">
+		SELECT SUM(aum.actual_price_) buy_amount_,COUNT(DISTINCT aum.user_id_) buy_num_,
+		CASE WHEN aum.activity_id_ = 215 THEN 2 WHEN aum.activity_id_ = 216 THEN 1
+		WHEN aum.activity_id_ = 217 THEN 4 WHEN aum.activity_id_ = 218 THEN 3 ELSE 5 END type_,spo.organ_id_
+		FROM student_payment_order spo
+		LEFT JOIN activity_user_mapper aum ON spo.id_ = aum.payment_order_id_ AND spo.user_id_ = aum.user_id_
+		WHERE spo.type_ = 'DOUBLE_ELEVEN2021' AND spo.status_ = 'SUCCESS'
+		AND spo.organ_id_ IN
+		<foreach collection="organIdList" open="(" close=")" item="organId" separator=",">
+			#{organId}
+		</foreach>
+		GROUP BY spo.organ_id_,aum.activity_id_,aum.user_id_
+	</select>
+	<select id="countOrganDoubleEleven2021Statis" resultMap="DoubleEleven2021Dto">
+		SELECT SUM(spo.expect_amount_) total_buy_amount_,COUNT(DISTINCT spo.user_id_) total_buy_num_,o.name_ organ_name_,spo.organ_id_
+		FROM student_payment_order spo
+		LEFT JOIN organization o ON o.id_ = spo.organ_id_
+		WHERE spo.type_ = 'DOUBLE_ELEVEN2021' AND spo.status_ = 'SUCCESS'
+		AND spo.organ_id_ NOT IN (36,38,39,41,42,43,44,45,46,47,48,49,50,52,54,55,56,2,27,22,24)
+		GROUP BY spo.organ_id_
+	</select>
 </mapper>