Просмотр исходного кода

添加超期购买账号数据

zoujiajian 2 лет назад
Родитель
Сommit
bb5e5868e0

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

@@ -76,4 +76,6 @@ public interface StatisticsExportMapper{
 	List<MonthlyUserOrderDetailDto> getMonthlyUserOrderDetail(@Param("thisMonth") DateTime thisMonth, @Param("nextMonth") DateTime nextMonth);
 
 	Map<String, Long> getEpOrderNumsGroupSource(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+	Integer getOverPayByGoodsId(@Param("goodsId") Long goodsId, @Param("skuIds") List<Long> skuIds, @Param("lastMonth") String lastMonth, @Param("thisMonth") DateTime thisMonth, @Param("nextMonth") DateTime nextMonth);
 }

+ 9 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelMonthOrderData.java

@@ -29,6 +29,9 @@ public class ExcelMonthOrderData {
 	@ExcelProperty({"品类数据类", "奈飞续费数据", "D.非当月到期,但续费的用户数"})
 	private Integer monthNfNoExRenewNumOfUser;
 
+	@ExcelProperty({"品类数据类", "奈飞续费数据", "E.超期购买"})
+	private Integer overNfPayNumOfUser;
+
 	@ExcelProperty({"品类数据类", "AI类续费(gptplus月付)", "A.月付当月到期的所有用户数"})
 	private Integer monthAiGptExNumOfUser;
 
@@ -41,6 +44,9 @@ public class ExcelMonthOrderData {
 	@ExcelProperty({"品类数据类", "AI类续费(gptplus月付)", "D.非当月到期,但续费的用户数"})
 	private Integer monthAiGptNoExRenewNumOfUser;
 
+	@ExcelProperty({"品类数据类", "AI类续费(gptplus月付)", "E.超期购买"})
+	private Integer overGptPayNumOfUser;
+
 	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "A.月付当月到期的所有用户数"})
 	private Integer monthAiMidExNumOfUser;
 
@@ -53,6 +59,9 @@ public class ExcelMonthOrderData {
 	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "D.非当月到期,但续费的用户数"})
 	private Integer monthAiMidNoExRenewNumOfUser;
 
+	@ExcelProperty({"品类数据类", "AI类续费(midjourney月付)", "E.超期购买"})
+	private Integer overMidPayNumOfUser;
+
 	@ExcelProperty({"品类数据类", "流媒类复购数据", "A.购买流媒体类产品为首单的当月新用户"})
 	private Integer monthStreamingNewNumOfUser;
 

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

@@ -529,4 +529,50 @@
         </if>
         group by DATE_FORMAT(created_time, '%Y-%m')
     </select>
+
+    <select id="getOverPayByGoodsId" resultType="java.lang.Integer">
+        select count(DISTINCT user_id)
+        from order_don o
+        where created_time &lt; #{lastMonth}
+        <if test="goodsId !=null">
+            and goods_id = #{goodsId}
+        </if>
+        <if test="skuIds!=null">
+            and sku_id in
+            <foreach collection="skuIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        and `status` not in ('close', 'noPayment', 'refund')
+        and NOT EXISTS (select 1
+        from order_don
+        where created_time BETWEEN #{lastMonth} and #{thisMonth}
+        and `status` not in ('close', 'noPayment', 'refund')
+        AND user_id = o.user_id
+        <if test="goodsId !=null">
+            and goods_id = #{goodsId}
+        </if>
+        <if test="skuIds!=null">
+            and sku_id in
+            <foreach collection="skuIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        )
+        and EXISTS (select 1
+        from order_don
+        where created_time BETWEEN #{thisMonth} and #{nextMonth}
+        and `status` not in ('close', 'noPayment', 'refund')
+        and user_id = o.user_id
+        <if test="goodsId !=null">
+            and goods_id = #{goodsId}
+        </if>
+        <if test="skuIds!=null">
+            and sku_id in
+            <foreach collection="skuIds" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        )
+    </select>
 </mapper>

+ 12 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -559,6 +559,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	private void exportBusinessMonthlyData(List<ExcelSheetAndData> excelSheetDataList, Long startTime, Long endTime) {
 		//月付、季付、年付
 		Long nf_goodsId = 1l;
+		Long gpt_goodsId = 18l;
+		Long mj_goodsId = 26l;
 		DateTime thisMonth = DateTime.of(startTime);
 		DateTime nextMonth = DateUtil.offsetMonth(thisMonth, 1);
 		String lastMonth = DateUtil.offsetMonth(thisMonth, -1).toDateStr();
@@ -581,6 +583,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Integer monthNfRenewNumOfUser = statisticsExportMapper.getMonthNfRenewNumOfUser(nf_goodsId, thisMonth, nextMonth);
 		Integer monthNfNoExRenewNumOfUser = monthNfRenewNumOfUser - monthNfExRenewNumOfUser;
 
+		//奈飞超期购买 中间隔断一个月购买的用户数
+		Integer overNfPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(nf_goodsId, null, lastMonth, thisMonth, nextMonth);
+
 		//Ai Gpt月付
 		List<Long> gptMonthSkuId = statisticsExportMapper.getAiMonthPlus(18l);
 		//Ai类gptplus当月到期用户数
@@ -593,6 +598,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Integer monthAiGptRenewNumOfUser = statisticsExportMapper.getMonthAiRenewNumOfUser(gptMonthSkuId, thisMonth, nextMonth);
 		//非当月 续费人数
 		Integer monthAiGptNoExRenewNumOfUser = monthAiGptRenewNumOfUser - monthAiGptExRenewNumOfUser;
+		//超期购买 中间隔断一个月购买的用户数
+		Integer overGptPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(null, gptMonthSkuId, lastMonth, thisMonth, nextMonth);
 
 		//Ai midjourney 月付
 		List<Long> midJourneyMonthSkuId = statisticsExportMapper.getAiMonthPlus(26l);
@@ -605,6 +612,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		Integer monthAiMidRenewNumOfUser = statisticsExportMapper.getMonthAiRenewNumOfUser(midJourneyMonthSkuId, thisMonth, nextMonth);
 		//非当月 midjourney续费人数
 		Integer monthAiMidNoExRenewNumOfUser = monthAiMidRenewNumOfUser - monthAiMidExRenewNumOfUser;
+		//超期购买 中间隔断一个月购买的用户数
+		Integer overMjPayNumOfUser = statisticsExportMapper.getOverPayByGoodsId(null, midJourneyMonthSkuId, lastMonth, thisMonth, nextMonth);
 
 		//流媒体当月首单
 		Integer monthStreamingNewNumOfUser = statisticsExportMapper.getMonthStreamingNewNumOfUser(thisMonth, nextMonth);
@@ -659,14 +668,17 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				.setMonthNfExRenewNumOfUser(monthNfExRenewNumOfUser)
 				.setMonthNfExRePayNumOfUser(monthNfExRePayNumOfUser)
 				.setMonthNfNoExRenewNumOfUser(monthNfNoExRenewNumOfUser)
+				.setOverNfPayNumOfUser(overNfPayNumOfUser)
 				.setMonthAiGptExNumOfUser(monthAiGptExNumOfUser)
 				.setMonthAiGptExRenewNumOfUser(monthAiGptExRenewNumOfUser)
 				.setMonthAiGptExRePayNumOfUser(monthAiGptExRePayNumOfUser)
 				.setMonthAiGptNoExRenewNumOfUser(monthAiGptNoExRenewNumOfUser)
+				.setOverGptPayNumOfUser(overGptPayNumOfUser)
 				.setMonthAiMidExNumOfUser(monthAiMidExNumOfUser)
 				.setMonthAiMidExRenewNumOfUser(monthAiMidExRenewNumOfUser)
 				.setMonthAiMidExRePayNumOfUser(monthAiMidExRePayNumOfUser)
 				.setMonthAiMidNoExRenewNumOfUser(monthAiMidNoExRenewNumOfUser)
+				.setOverMidPayNumOfUser(overMjPayNumOfUser)
 				.setMonthStreamingNewNumOfUser(monthStreamingNewNumOfUser)
 				.setMonthStreamingNewPayOtherNumOfUser(monthStreamingNewPayOtherNumOfUser)
 				.setMonthStreamingNewPayAiNumOfUser(monthStreamingNewPayAiNumOfUser)