ソースを参照

快手 下载结算单, 导出添加激活数

zhaoxian 1 年間 前
コミット
8af31ccc68

+ 20 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/impl/CreateSheetServiceImpl.java

@@ -114,6 +114,11 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         cell = row.createCell(15);
         cell.setCellValue("政策时间");
         cell.setCellStyle(style);
+
+        cell = row.createCell(16);
+        cell.setCellValue("激活");
+        cell.setCellStyle(style);
+
         sheet.autoSizeColumn(0, true);
         List<SheetBytedanceVo> resultList = new ArrayList<>(accountIdList.size());
         //获取当前年月的 第一天 和 最后一天
@@ -180,6 +185,9 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                     vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut", "") + "");//总转出
                     BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
                     vo.setTime(stringMap.get("startDate") + "----" + stringMap.get("endDate"));
+
+                    String active = reportSettlementMapper.getBytedanceActive(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                    vo.setActive(active);
                     resultList.add(vo);
                     policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"), stringMap.get("endDate")));
                 }
@@ -213,6 +221,8 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 vo.setTransferOut(Check.isNull(listAccount) ? "0" : listAccount.get(0).getOrDefault("transferOut", "") + "");//总转出
                 BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
                 vo.setTime((!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : ""));
+                String active = reportSettlementMapper.getBytedanceActive(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                vo.setActive(active);
                 resultList.add(vo);
             }
         }
@@ -240,6 +250,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             row.createCell(13).setCellValue(vo.getRebateType());
             row.createCell(14).setCellValue(vo.getRebateRate());
             row.createCell(15).setCellValue(vo.getTime());
+            row.createCell(16).setCellValue(vo.getActive());
             // row.setRowStyle(style);
         }
     }
@@ -334,6 +345,10 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         cell.setCellValue("政策时间");
         cell.setCellStyle(style);
 
+        cell = row.createCell(18);
+        cell.setCellValue("激活");
+        cell.setCellStyle(style);
+
         sheet.autoSizeColumn(0, true);
 
         List<SheetKuaiShouVo> resultList = new ArrayList<>(accountIdList.size());
@@ -409,6 +424,8 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                     vo.setDirectRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealRecharged())).map(SheetKuaiShouVo::getDirectRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                     BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
                     vo.setTime(stringMap.get("startDate") + "----" + stringMap.get("endDate"));
+                    String activation = reportSettlementMapper.getKuaiShouActivation(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                    vo.setActivation(activation);
                     resultList.add(vo);
                     policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"), stringMap.get("endDate")));
                 }
@@ -444,6 +461,8 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
                 vo.setDirectRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealRecharged())).map(SheetKuaiShouVo::getDirectRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
                 BeanUtils.copyProperties(voSource, vo, SettlementUtil.getNullPropertyNames(voSource));
                 vo.setTime(!Check.isNull(vo.getRebateType()) ? stringMap.get("startDate") + "----" + stringMap.get("endDate") : "");
+                String activation = reportSettlementMapper.getKuaiShouActivation(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                vo.setActivation(activation);
                 resultList.add(vo);
             }
         }
@@ -473,6 +492,7 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
             row.createCell(15).setCellValue(vo.getRebateType());
             row.createCell(16).setCellValue(vo.getRebateRate());
             row.createCell(17).setCellValue(vo.getTime());
+            row.createCell(18).setCellValue(vo.getActivation());
         }
     }
 

+ 1 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportBytedanceVo.java

@@ -52,6 +52,7 @@ public class SettlementReportBytedanceVo implements Serializable {
     private String accountName;
     private String agentId;
     private String agentName;
+    private String active;
 
 
 

+ 1 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SettlementReportKuaiShouVo.java

@@ -86,6 +86,7 @@ public class SettlementReportKuaiShouVo implements Serializable {
     private String directRebateRealRecharged;
 
     private String ksId;
+    private String activation;
 
 
 

+ 1 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SheetBytedanceVo.java

@@ -37,6 +37,7 @@ public class SheetBytedanceVo implements Serializable {
     private String sharedWalletCost;
     private String transferIn;
     private String transferOut;
+    private String active;
 
 
 

+ 1 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/entity/vo/SheetKuaiShouVo.java

@@ -59,6 +59,7 @@ public class SheetKuaiShouVo implements Serializable {
     private String rebateRate;
 
     private String time;
+    private String activation;
 
 
 

+ 4 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/ReportSettlementMapper.java

@@ -102,4 +102,8 @@ public interface ReportSettlementMapper {
     List<Map<String, Object>> getAccountAndProductByOperate(String userId);
 
 
+    String getBytedanceActive(@Param("accountId") String accountId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
+    String getKuaiShouActivation(@Param("accountId") String accountId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+
 }

+ 60 - 58
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/IntranetSettlementMapper.xml

@@ -7,66 +7,68 @@
     <select id="getTransactionDayKuaiShouAgentAndAccountInrtanet"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo">
 
-        SELECT
-            *
-        FROM
-            (
-                SELECT
-                    t.*
-                FROM
-                    (
-                        SELECT
-                            date_format(date_time,'%Y%m%d') as 'date',
-                            account_id AS accountId,
-                            total_charged_in_yuan as dailyCharge,
-                            contract_rebate_real_charged_in_yuan as contractRebateRealCharged,
-                            direct_rebate_real_charged_in_yuan as directRebateRealCharged,
-                            ( real_charged_in_yuan + total_rebate_real_charged_in_yuan + credit_real_charged_in_yuan ) realCharged,
-                            account_name AS accountName,
-                            user_id AS ksId
-                        FROM
-                            `jeecg-boot`.ctop_kuaishou_daily_agent
-                        WHERE
-                            total_charged_in_yuan >0
-                          and account_id = #{accountId}
-                    ) t
-                WHERE
-                    t.date >= DATE_FORMAT( #{startTime}, '%Y%m%d' )
-                    and t.date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d' )
-                ORDER BY
-                    t.date
+        SELECT *
+        FROM (
+                 SELECT t.*
+                 FROM (
+                          SELECT date_format(date_time, '%Y%m%d') as 'date',
+                                 account_id                           AS accountId,
+                                 total_charged_in_yuan                as dailyCharge,
+                                 contract_rebate_real_charged_in_yuan as contractRebateRealCharged,
+                                 direct_rebate_real_charged_in_yuan   as directRebateRealCharged,
+                                 (real_charged_in_yuan + total_rebate_real_charged_in_yuan +
+                                  credit_real_charged_in_yuan)           realCharged,
+                                 account_name                         AS accountName,
+                                 user_id                              AS ksId
+                          FROM `jeecg-boot`.ctop_kuaishou_daily_agent
+                          WHERE total_charged_in_yuan > 0
+                            and account_id = #{accountId}
+                      ) t
+                 WHERE t.date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
+                   and t.date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
+                 ORDER BY t.date
              ) a
-                LEFT JOIN (
-                SELECT
-                    t.*,
-                    c.auth_name AS accountNameF,
-                    base.user_id AS ksIdF
-                FROM
-                    (
-                        SELECT
-                            advertiser_id AS accountIdF,
-                            daily_charge as flowDailyCharge,
-                            date_format(date,'%Y%m%d') as 'date',
-                            daily_transfer_in as dailyTransferIn,
-                            daily_transfer_out as dailyTransferOut,
-                            balance as balance,
-                            real_recharged as realRecharged,
+                 LEFT JOIN (
+            SELECT t.*,
+                   c.auth_name  AS accountNameF,
+                   base.user_id AS ksIdF
+            FROM (
+                     SELECT advertiser_id                  AS accountIdF,
+                            daily_charge                   as flowDailyCharge,
+                            date_format(date, '%Y%m%d') as 'date',
+                            daily_transfer_in              as dailyTransferIn,
+                            daily_transfer_out             as dailyTransferOut,
+                            balance                        as balance,
+                            real_recharged                 as realRecharged,
                             contract_rebate_real_recharged as contractRebateRealRecharged,
-                            direct_rebate_real_recharged as directRebateRealRecharged
-                        FROM
-                            `application`.kuaishou_advertiser_fund_daily_flows
-                        WHERE
-                            advertiser_id = #{accountId}
-                    ) t
-                        LEFT JOIN `jeecg-boot`.ctop_user_allocation c ON t.accountIdF = c.account_id
-                        LEFT JOIN `jeecg-boot`.ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
-                WHERE
-                    DATE_FORMAT( t.date, '%Y-%m-%d' ) >= #{startTime}
-                    AND DATE_FORMAT( t.date, '%Y-%m-%d' ) &lt;= #{endTime}
-                ORDER BY
-                    date
-             ) b ON a.accountId = b.accountIdF
-                AND a.date = b.date
+                            direct_rebate_real_recharged   as directRebateRealRecharged
+                     FROM `application`.kuaishou_advertiser_fund_daily_flows
+                     WHERE advertiser_id = #{accountId}
+                 ) t
+                     LEFT JOIN `jeecg-boot`.ctop_user_allocation c ON t.accountIdF = c.account_id
+                     LEFT JOIN `jeecg-boot`.ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
+            WHERE DATE_FORMAT(t.date, '%Y-%m-%d') >= #{startTime}
+              AND DATE_FORMAT(t.date, '%Y-%m-%d') &lt;= #{endTime}
+            ORDER BY
+                date
+        ) b ON a.accountId = b.accountIdF
+            AND a.date = b.date
+                 LEFT JOIN (
+        SELECT account_id as 'accountIdC',
+               SUM(activation) as'activation',
+        date_format(stat_date, '%Y%m%d') as 'date'
+        FROM application.kuaishou_account_report_daily_dw
+        WHERE account_id = #{accountId}
+        <if test="startTime !=null and startTime != ''">
+            AND stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            AND stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
+        </if>
+        GROUP BY stat_date
+        ORDER BY stat_date
+            ) c ON a.accountId = c.accountIdC
+        AND a.date = c.date
     </select>
 </mapper>
 

+ 37 - 1
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/mapper/xml/ReportSettlementMapper.xml

@@ -5,7 +5,9 @@
     <!-- 获取头条 账户 日流水信息 -->
     <select id="getAccountTransactionDayBytedance"
             resultType="org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo">
-        select t.*, c.auth_name as accountName
+        select t.*,
+               c.auth_name as accountName,
+               tt.active
         from (
                  select id,
                         advertiser_id,
@@ -39,6 +41,16 @@
                    and advertiser_id = #{accountId}
              ) t
                  LEFT JOIN ctop_user_allocation c on t.advertiser_id = c.account_id
+                 LEFT JOIN (
+            SELECT account_id,
+                   SUM(active) as 'active',
+                   stat_datetime
+            FROM application.bytedance_advertiser_report_daily_dw
+            WHERE account_id = #{accountId}
+              AND stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
+              AND stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
+            GROUP BY stat_datetime
+        ) tt ON DATE_FORMAT(t.date, '%Y%m%d') = tt.stat_datetime
         where date >= #{startTime}
           AND date &lt;= #{endTime}
         ORDER BY date
@@ -365,6 +377,30 @@
 
     </select>
 
+    <select id="getBytedanceActive" resultType="String">
+        SELECT SUM(active) as'active'
+        FROM application.bytedance_advertiser_report_daily_dw
+        WHERE account_id = #{accountId}
+        <if test="startTime !=null and startTime != ''">
+            AND stat_datetime >= DATE_FORMAT(#{startTime}, '%Y%m%d')
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            AND stat_datetime &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
+        </if>
+    </select>
+
+    <select id="getKuaiShouActivation" resultType="String">
+        SELECT SUM(activation) as'activation'
+        FROM application.kuaishou_account_report_daily_dw
+        WHERE account_id = #{accountId}
+        <if test="startTime !=null and startTime != ''">
+            AND stat_date >= DATE_FORMAT(#{startTime}, '%Y%m%d')
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            AND stat_date &lt;= DATE_FORMAT(#{endTime}, '%Y%m%d')
+        </if>
+    </select>
+
 
     <!-- 查询 头条利润表  返点类型和比列-->
     <select id="getProfitBytedance" resultType="java.util.LinkedHashMap">

+ 10 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/settlement/service/serviceImpl/ReportSettlementServiceImpl.java

@@ -234,6 +234,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 cell.setCellValue("冻结(¥)");
                 cell.setCellStyle(style);
 
+                cell = row.createCell(13);
+                cell.setCellValue("激活");
+                cell.setCellStyle(style);
+
                 for (int i = 0; i < settlementList.size(); i++) {
                     SettlementReportBytedanceVo vo = settlementList.get(i);
                     //创建行 (表头占0-1行 所以 从 2开始)
@@ -254,6 +258,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     row.createCell(10).setCellValue(vo.getTransferOut());
                     row.createCell(11).setCellValue(vo.getBalance());
                     row.createCell(12).setCellValue(vo.getFrozen());
+                    row.createCell(13).setCellValue(vo.getActive());
                 }
 
                 //查询 图片 url
@@ -494,6 +499,10 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                 cell.setCellValue("日终结余");
                 cell.setCellStyle(style);
 
+                cell = row.createCell(14);
+                cell.setCellValue("激活");
+                cell.setCellStyle(style);
+
 
                 for (int i = 0; i < settlementList.size(); i++) {
                     SettlementReportKuaiShouVo vo = settlementList.get(i);
@@ -516,6 +525,7 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
                     row.createCell(11).setCellValue(vo.getDailyTransferIn());
                     row.createCell(12).setCellValue(vo.getDailyTransferOut());
                     row.createCell(13).setCellValue(vo.getBalance());
+                    row.createCell(14).setCellValue(vo.getActivation());
                 }