Ver Fonte

双十一活动

zouxuan há 3 anos atrás
pai
commit
bdc91b5467

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

@@ -72,4 +72,22 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
 	* @date 2021/10/25 13:46
 	*/
     List<DoubleEleven2021ActivityDto> countActivityStatis();
+
+    /**
+    * @description: 双十一活动统计
+     * @param
+    * @return com.ym.mec.biz.dal.dto.DoubleEleven2021Dto
+    * @author zx
+    * @date 2021/10/25 15:44
+    */
+	DoubleEleven2021Dto countDoubleEleven2021Statis();
+
+	/**
+	* @description: 双十一活动统计
+	 * @param
+	* @return int
+	* @author zx
+	* @date 2021/10/25 15:54
+	*/
+	int countGiveMemberNum();
 }

+ 10 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java

@@ -21,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -201,9 +202,15 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 	@Override
 	public Object doubleEleven2021Statis() {
 		//获取总成交数据
-//		vipGroupActivityDao.countDoubleEleven2021Statis();
+		DoubleEleven2021Dto doubleEleven2021Dto = vipGroupActivityDao.countDoubleEleven2021Statis();
+		if(doubleEleven2021Dto.getTotalBuyAmount().compareTo(BigDecimal.ZERO) > 0){
+			doubleEleven2021Dto.setAvgBuyAmount(
+					doubleEleven2021Dto.getTotalBuyAmount().divide(new BigDecimal(doubleEleven2021Dto.getTotalBuyNum()),2,BigDecimal.ROUND_CEILING));
+		}
 		//获取活动成交数据
-		List<DoubleEleven2021ActivityDto> activityDtoList = vipGroupActivityDao.countActivityStatis();
-		return null;
+		doubleEleven2021Dto.setActivityDtoList(vipGroupActivityDao.countActivityStatis());
+		//获取赠送会员数
+		doubleEleven2021Dto.setGiveMemberNum(vipGroupActivityDao.countGiveMemberNum());
+		return doubleEleven2021Dto;
 	}
 }

+ 19 - 3
mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml

@@ -335,12 +335,28 @@
 	<resultMap id="DoubleEleven2021ActivityDto" type="com.ym.mec.biz.dal.dto.DoubleEleven2021ActivityDto">
 		<result property="buyNum" column="buy_num_"/>
 		<result property="buyAmount" column="buy_amount_"/>
+		<result property="type" column="type_"/>
 	</resultMap>
-	<select id="countActivityStatis" resultType="com.ym.mec.biz.dal.dto.DoubleEleven2021ActivityDto">
-		SELECT SUM(spo.expect_amount_) buy_amount_,COUNT(DISTINCT aum.user_id_) buy_num_,aum.activity_id_
+	<select id="countActivityStatis" 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_
 		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'
+		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 aum.activity_id_,aum.user_id_
 	</select>
+	<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_"/>
+	</resultMap>
+	<select id="countDoubleEleven2021Statis" resultMap="DoubleEleven2021Dto">
+		SELECT SUM(expect_amount_) total_buy_amount_,COUNT(DISTINCT user_id_) total_buy_num_ FROM student_payment_order
+		WHERE type_ = 'DOUBLE_ELEVEN2021' AND status_ = 'SUCCESS'
+		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="countGiveMemberNum" resultType="java.lang.Integer">
+		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>
 </mapper>

+ 0 - 2
mec-web/src/main/java/com/ym/mec/web/controller/education/ActivityController.java

@@ -51,8 +51,6 @@ public class ActivityController extends BaseController {
     private VipGroupService vipGroupService;
     @Autowired
     private PracticeGroupService practiceGroupService;
-    @Autowired
-    private VipGroupActivityService vipGroupActivityService;
 
     @ApiOperation(value = "获取待排课的活动方案列表")
     @RequestMapping("/queryWaitCourseActivity")