Browse Source

gpt月、季代充续费数据

zoujiajian 8 tháng trước cách đây
mục cha
commit
ed7b257de9

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/mapper/manage/statistics/StatisticsExportMapper.java

@@ -84,4 +84,9 @@ public interface StatisticsExportMapper{
 	Integer getActualNumberOfRenewalsByGoodsId(@Param("goodsId") Long goodsId, @Param("lastElevMonth") String lastElevMonth, @Param("lastYearMonth") String lastYearMonth);
 
 	BigDecimal getWholesaleOrderMoney(@Param("startDate") String startDate, @Param("endDate") String endDate);
+	Integer getMonthGptRechargeExNumOfUser(@Param("goodsId") Long goodsId, @Param("lastYearMonth") String lastYearMonth, @Param("lastElevMonth") String lastElevMonth, @Param("lastThreeMonth") String lastThreeMonth, @Param("lastTwoMonth") String lastTwoMonth, @Param("lastMonth") String lastMonth, @Param("thisMonth") String thisMonth);
+
+	Integer getMonthGptRechargeNumOfUserByType(@Param("goodsId") Long goodsId, @Param("type") Integer type, @Param("lastYearMonth") String lastYearMonth, @Param("lastElevMonth") String lastElevMonth, @Param("lastThreeMonth") String lastThreeMonth, @Param("lastTwoMonth") String lastTwoMonth, @Param("lastMonth") String lastMonth, @Param("thisMonth") String thisMonth, @Param("nextMonth") String nextMonth);
+
+	Integer getMonthGptRechargeNoExRenewNumOfUser(@Param("goodsId") Long goodsId, @Param("lastTwoMonth") String lastTwoMonth, @Param("thisMonth") DateTime thisMonth, @Param("nextMonth") DateTime nextMonth);
 }

+ 23 - 10
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelMonthOrderData.java

@@ -47,20 +47,33 @@ public class ExcelMonthOrderData {
 	@ExcelProperty({"品类数据类", "AI类续费(gptplus月付)", "E.超期购买"})
 	private Integer overGptPayNumOfUser;
 
-	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "A.月付当月到期的所有用户数"})
-	private Integer monthAiMidExNumOfUser;
+//	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "A.月付当月到期的所有用户数"})
+//	private Integer monthAiMidExNumOfUser;
+//
+//	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "B.A数据中主动续费的用户数"})
+//	private Integer monthAiMidExRenewNumOfUser;
+//
+//	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "C.A数据中,没有主动续费,但又购买对应品类的用户数"})
+//	private Integer monthAiMidExRePayNumOfUser;
+//
+//	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "D.非当月到期,但续费的用户数"})
+//	private Integer monthAiMidNoExRenewNumOfUser;
+//
+//	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "E.超期购买"})
+//	private Integer overMidPayNumOfUser;
+
 
-	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "B.A数据中主动续费的用户数"})
-	private Integer monthAiMidExRenewNumOfUser;
+	@ExcelProperty({"品类数据类", "AI类续费(gpt代充)", "A.当月到期的所有用户数"})
+	private Integer monthAiGptRechargeExNumOfUser;
 
-	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "C.A数据中,没有主动续费,但又购买对应品类的用户数"})
-	private Integer monthAiMidExRePayNumOfUser;
+	@ExcelProperty({"品类数据类", "AI类续费(gpt代充)", "B.A数据中,没有主动续费,但又购买对应品类的用户数"})
+	private Integer monthAiGptRechargeExRePayNumOfUser;
 
-	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "D.非当月到期,但续费的用户数"})
-	private Integer monthAiMidNoExRenewNumOfUser;
+	@ExcelProperty({"品类数据类", "AI类续费(gpt代充)", "C.非当月到期,但续费的用户数"})
+	private Integer monthAiGptRechargeNoExRenewNumOfUser;
 
-	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "E.超期购买"})
-	private Integer overMidPayNumOfUser;
+	@ExcelProperty({"品类数据类", "AI类续费(gpt代充)", "D.超期购买"})
+	private Integer overGptRechargePayNumOfUser;
 
 	@ExcelProperty({"品类数据类", "流媒类复购数据", "A.购买流媒体类产品为首单的当月新用户"})
 	private Integer monthStreamingNewNumOfUser;

+ 62 - 0
netflix-dao/src/main/resources/mapper/StatisticsExportMapper.xml

@@ -602,4 +602,66 @@
           and created_time >= #{startDate}
           and created_time < #{endDate}
     </select>
+
+    <select id="getMonthGptRechargeExNumOfUser" resultType="java.lang.Integer">
+        select count(distinct user_id)
+        from (select user_id
+              from `order_don`
+              where sku_id = 296
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{lastMonth} and #{thisMonth}
+              union all
+              select user_id
+              from `order_don`
+              where sku_id = 744
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{lastThreeMonth} and #{lastTwoMonth}
+             ) s
+    </select>
+
+    <select id="getMonthGptRechargeNumOfUserByType" resultType="java.lang.Integer">
+        select count(distinct user_id)
+        from (select user_id
+              from `order_don`
+              where sku_id = 296
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{lastMonth} and #{thisMonth}
+              union all
+              select user_id
+              from `order_don`
+              where sku_id = 744
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{lastThreeMonth} and #{lastTwoMonth}) s
+        where EXISTS(select id
+                     from order_don od
+                     where status not in ('close', 'refund', 'noPayment')
+                       and created_time between #{thisMonth} and #{nextMonth}
+                       and order_type = #{type}
+                       and od.user_id = s.user_id
+                       and goods_id = #{goodsId})
+    </select>
+
+    <select id="getMonthGptRechargeNoExRenewNumOfUser" resultType="java.lang.Integer">
+        select count(distinct user_id)
+        from (select id,user_id
+              from `order_don`
+              where sku_id = 296
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{thisMonth} and #{nextMonth}
+              union all
+              select id,user_id
+              from `order_don`
+              where sku_id = 744
+                and status not in ('close', 'noPayment', 'refund')
+                and created_time between #{lastTwoMonth} and #{nextMonth}
+             ) s
+        where EXISTS(select id
+                     from order_don od
+                     where status not in ('close', 'refund', 'noPayment')
+                       and created_time between #{thisMonth} and #{nextMonth}
+                       and order_type = 1
+                       and od.user_id = s.user_id
+                       and od.id != s.id
+                       and goods_id = #{goodsId})
+    </select>
 </mapper>

+ 35 - 18
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -590,6 +590,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Long nf_goodsId = 1l;
 		Long gpt_goodsId = 18l;
 		Long mj_goodsId = 26l;
+		//gpt代充
+		Long gptRecharge_goods_id = 40L;
 		DateTime thisMonth = DateTime.of(startTime);
 		DateTime nextMonth = DateUtil.offsetMonth(thisMonth, 1);
 		String lastMonth = DateUtil.offsetMonth(thisMonth, -1).toDateStr();
@@ -630,19 +632,30 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		//超期购买 中间隔断一个月购买的用户数
 		Integer overGptPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(null, gptMonthSkuId, lastMonth, thisMonth, nextMonth);
 
-		//Ai midjourney 月付
-		List<Long> midJourneyMonthSkuId = statisticsExportMapper.getAiMonthPlus(26l);
-		Integer monthAiMidExNumOfUser = statisticsExportMapper.getMonthAiExNumOfUser(midJourneyMonthSkuId, lastMonth, thisMonth);
-		//Ai midjourney月付 A主动续费
-		Integer monthAiMidExRenewNumOfUser = statisticsExportMapper.getMonthAiExNumOfUserByType(midJourneyMonthSkuId, 2, lastMonth, thisMonth, nextMonth.toDateStr());
-		//Ai midjourney月付 再次购买
-		Integer monthAiMidExRePayNumOfUser = statisticsExportMapper.getMonthAiExNumOfUserByType(midJourneyMonthSkuId, 1, lastMonth, thisMonth, nextMonth.toDateStr());
-		//Ai midjourney当月续费人数
-		Integer monthAiMidRenewNumOfUser = statisticsExportMapper.getMonthAiRenewNumOfUser(midJourneyMonthSkuId, thisMonth, nextMonth);
-		//非当月 midjourney续费人数
-		Integer monthAiMidNoExRenewNumOfUser = monthAiMidRenewNumOfUser - monthAiMidExRenewNumOfUser;
-		//超期购买 中间隔断一个月购买的用户数
-		Integer overMjPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(null, midJourneyMonthSkuId, lastMonth, thisMonth, nextMonth);
+//		//Ai midjourney 月付
+//		List<Long> midJourneyMonthSkuId = statisticsExportMapper.getAiMonthPlus(26l);
+//		Integer monthAiMidExNumOfUser = statisticsExportMapper.getMonthAiExNumOfUser(midJourneyMonthSkuId, lastMonth, thisMonth);
+//		//Ai midjourney月付 A主动续费
+//		Integer monthAiMidExRenewNumOfUser = statisticsExportMapper.getMonthAiExNumOfUserByType(midJourneyMonthSkuId, 2, lastMonth, thisMonth, nextMonth.toDateStr());
+//		//Ai midjourney月付 再次购买
+//		Integer monthAiMidExRePayNumOfUser = statisticsExportMapper.getMonthAiExNumOfUserByType(midJourneyMonthSkuId, 1, lastMonth, thisMonth, nextMonth.toDateStr());
+//		//Ai midjourney当月续费人数
+//		Integer monthAiMidRenewNumOfUser = statisticsExportMapper.getMonthAiRenewNumOfUser(midJourneyMonthSkuId, thisMonth, nextMonth);
+//		//非当月 midjourney续费人数
+//		Integer monthAiMidNoExRenewNumOfUser = monthAiMidRenewNumOfUser - monthAiMidExRenewNumOfUser;
+//		//超期购买 中间隔断一个月购买的用户数
+//		Integer overMjPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(null, midJourneyMonthSkuId, lastMonth, thisMonth, nextMonth);
+
+		//gpt代充
+		//gpt代充月付、季付当月过期人数
+		Integer monthGptRechargeExNumOfUser = statisticsExportMapper.getMonthGptRechargeExNumOfUser(gptRecharge_goods_id, lastYearMonth, lastElevMonth, lastThreeMonth, lastTwoMonth, lastMonth, thisMonth.toDateStr());
+		//gpt代充 当月过期再次购买
+		Integer monthGptRechargeRePayNumOfUser = statisticsExportMapper.getMonthGptRechargeNumOfUserByType(gptRecharge_goods_id, 1, lastYearMonth, lastElevMonth, lastThreeMonth, lastTwoMonth, lastMonth, thisMonth.toDateStr(), nextMonth.toDateStr());
+		//gpt代充 非当月到期当月续费人数
+		Integer monthGptRechargeRenewNoExNumOfUser = statisticsExportMapper.getMonthGptRechargeNoExRenewNumOfUser(gptRecharge_goods_id, lastTwoMonth, thisMonth, nextMonth);
+		//gpt代充超期购买 中间隔断一个月购买的用户数
+		Integer overGptRechargePayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(gptRecharge_goods_id, null, lastMonth, thisMonth, nextMonth);
+
 
 		//油管年付
 		Long ybGoodsId = 5l;
@@ -719,11 +732,15 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				.setMonthAiGptExRePayNumOfUser(monthAiGptExRePayNumOfUser)
 				.setMonthAiGptNoExRenewNumOfUser(monthAiGptNoExRenewNumOfUser)
 				.setOverGptPayNumOfUser(overGptPayNumOfUser)
-				.setMonthAiMidExNumOfUser(monthAiMidExNumOfUser)
-				.setMonthAiMidExRenewNumOfUser(monthAiMidExRenewNumOfUser)
-				.setMonthAiMidExRePayNumOfUser(monthAiMidExRePayNumOfUser)
-				.setMonthAiMidNoExRenewNumOfUser(monthAiMidNoExRenewNumOfUser)
-				.setOverMidPayNumOfUser(overMjPayNumOfUser)
+//				.setMonthAiMidExNumOfUser(monthAiMidExNumOfUser)
+//				.setMonthAiMidExRenewNumOfUser(monthAiMidExRenewNumOfUser)
+//				.setMonthAiMidExRePayNumOfUser(monthAiMidExRePayNumOfUser)
+//				.setMonthAiMidNoExRenewNumOfUser(monthAiMidNoExRenewNumOfUser)
+//				.setOverMidPayNumOfUser(overMjPayNumOfUser)
+				.setMonthAiGptRechargeExNumOfUser(monthGptRechargeExNumOfUser)
+				.setMonthAiGptRechargeExRePayNumOfUser(monthGptRechargeRePayNumOfUser)
+				.setMonthAiGptRechargeNoExRenewNumOfUser(monthGptRechargeRenewNoExNumOfUser)
+				.setOverGptRechargePayNumOfUser(overGptRechargePayNumOfUser)
 				.setMonthStreamingNewNumOfUser(monthStreamingNewNumOfUser)
 				.setMonthStreamingNewPayOtherNumOfUser(monthStreamingNewPayOtherNumOfUser)
 				.setMonthStreamingNewPayAiNumOfUser(monthStreamingNewPayAiNumOfUser)