|
@@ -30,82 +30,145 @@ public interface AskaStatMapper {
|
|
|
" date(`pay_time`), count(*) `cc`, sum(`pay_amount`) `pay_amount`\n" +
|
|
|
" from `pay_request`\n" +
|
|
|
" where date(`pay_time`) = #{dateStr}")
|
|
|
- void insertPayAmountStat(@Param("dateStr") String dateStr);
|
|
|
+ void insertPlatformPayAmountStat(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台退款,包括不可分账退款
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '退款', \n" +
|
|
|
" date(`create_time`), count(*) cc, sum(`refund_amount`) \n" +
|
|
|
" from `refund_order` where date(`refund_order`.`create_time`) = #{dateStr}")
|
|
|
- void insertRefundAmountStat(@Param("dateStr") String dateStr);
|
|
|
+ void insertPlatformRefundAmountStat(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方同意的提现金额
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '平台','1', '提现', \n" +
|
|
|
" date(`payTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
|
|
|
- " from `aska_cashrequest` where status='同意' or status='已付款' where date(`aska_cashrequest`.`payTime`) = #{dateStr}")
|
|
|
- void insertRequestAmountStat(@Param("dateStr") String dateStr);
|
|
|
+ " from `aska_cashrequest` where status='同意' or status='已付款' and date(`aska_cashrequest`.`payTime`) = #{dateStr}")
|
|
|
+ void insertPlatformRequestAmountStat(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算给门店分账佣金
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '门店分账佣金', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, sum(`retailRealtimeAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=1 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertRetailAmountStat(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=1 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformRetailAmountStat(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算的给门店记账佣金
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '门店记账佣金', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, sum(`retailAccountAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=1 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertRetailAccountStat(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=1 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformRetailAccountStat(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算给门店分账退款
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '门店分账退款', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, -sum(`retailRealtimeAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=2 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertRetailRefundAmount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=2 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformRetailRefundAmount(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算门店记账退款
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '门店记账退款', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, -sum(`retailAccountAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=2 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertRetailRefundAccount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=2 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformRetailRefundAccount(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算渠道的分账佣金
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '渠道分账佣金', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, sum(`channelRealtimeAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=1 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertChannelAmount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=1 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformChannelAmount(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算记账佣金
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '渠道记账佣金', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, sum(`channelAccountAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=1 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertChannelAccount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=1 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformChannelAccount(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算分账佣金退款
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '渠道分账退款', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, -sum(`channelRealtimeAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=2 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertChannelRefundAmount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=2 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformChannelRefundAmount(@Param("dateStr") String dateStr);
|
|
|
|
|
|
// 平台方计算记账佣金退款
|
|
|
@Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) \n" +
|
|
|
" select '平台','1', '渠道记账退款', \n" +
|
|
|
" date(`createTime`), count(*) `cc`, -sum(`channelAccountAmount`) `pay_amount`\n" +
|
|
|
" from `aska_splitrecord`\n" +
|
|
|
- " where `recordType`=2 where date(`createTime`) = #{dateStr}")
|
|
|
- void insertChannelRefundAccount(@Param("dateStr") String dateStr);
|
|
|
+ " where `recordType`=2 and date(`createTime`) = #{dateStr}")
|
|
|
+ void insertPlatformChannelRefundAccount(@Param("dateStr") String dateStr);
|
|
|
+
|
|
|
+ // 门店方计算分账佣金
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '门店',`retailId`, '门店分账佣金', date(`createTime`), count(*) cc, sum(`retailRealtimeAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=1 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `retailId`")
|
|
|
+ void insertRetailRealtimeAmount(@Param("dateStr") String dateStr);
|
|
|
+
|
|
|
+ // 门店方计算记账佣金
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '门店',`retailId`, '门店记账佣金', date(`createTime`), count(*) cc, sum(`retailAccountAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=1 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `retailId`")
|
|
|
+ void insertRetailAccount(@Param("dateStr") String dateStr);
|
|
|
+ // 门店方计算分账佣金退款
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '门店',`retailId`, '门店分账退款', date(`createTime`), count(*) cc, -sum(`retailRealtimeAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=2 and `retailId`>0" +
|
|
|
+ " group by `retailId`")
|
|
|
+ void insertRetailRefund(@Param("dateStr") String dateStr);
|
|
|
+ // 门店计算记账佣金退款
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '门店',`retailId`, '门店记账退款', date(`createTime`), count(*) cc, -sum(`retailAccountAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=2 and `retailId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `retailId`")
|
|
|
+ void insertRetailAccountRefund(@Param("dateStr") String dateStr);
|
|
|
+ // 门店计算同意的提现
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '门店',`partnerId`, '提现', date(`requestTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
|
|
|
+ " from `aska_cashrequest` \n" +
|
|
|
+ " where `partnerType`='retail' and (`status`='同意' or `status`='已付款') and date(`aska_cashrequest`.`requestTime`) = #{dateStr}" +
|
|
|
+ " group by `partnerId`")
|
|
|
+ void insertRetailRequestCash(@Param("dateStr") String dateStr);
|
|
|
+ // 渠道方
|
|
|
+ // 渠道计算分账佣金
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '渠道',`channelId`, '渠道分账佣金', date(`createTime`), count(*) cc, sum(`channelAccountAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=1 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `channelId`")
|
|
|
+ void insertChannelAmount(@Param("dateStr") String dateStr);
|
|
|
+ // 渠道计算记账佣金
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '渠道',`channelId`, '渠道记账佣金', date(`createTime`), count(*) cc, sum(`channelAccountAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=1 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `channelId`")
|
|
|
+ void insertChannelAccount(@Param("dateStr") String dateStr);
|
|
|
+ // 渠道计算分账佣金退款
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '渠道',`channelId`, '渠道分账退款', date(`createTime`), count(*) cc, -sum(`channellRealtimeAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=2 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `channelId`")
|
|
|
+ void insertChannelAmountRefund(@Param("dateStr") String dateStr);
|
|
|
+ // 4. statistics channel income 渠道 记账佣金退款
|
|
|
+ @Insert("INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '渠道',`channelId`, '渠道记账退款', date(`createTime`), count(*) cc, -sum(`channelAccountAmount`) \n" +
|
|
|
+ " from `aska_splitrecord` \n" +
|
|
|
+ " where `recordType`=2 and `channelId`>0 and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `channelId`")
|
|
|
+ void insertChannelAccountRefund(@Param("dateStr") String dateStr);
|
|
|
+ // 4:提现
|
|
|
+ @Insert(" INSERT into `aska_stat`(`aType`,`aId`,`cType`,`statDay`,`orders`,`amount`) select '渠道',`partnerId`, '提现', date(`requestTime`), count(*) cc, sum(`requestAmount`) `amount`\n" +
|
|
|
+ " from `aska_cashrequest` \n" +
|
|
|
+ " where `partnerType`='channel' and (`status`='同意' or `status`='已付款') and date(`aska_splitrecord`.`createTime`) = #{dateStr}" +
|
|
|
+ " group by `partnerId`")
|
|
|
+ void insertChannelCashRequest(@Param("dateStr") String dateStr);
|
|
|
}
|