Selaa lähdekoodia

结算单-快手

yangzian 3 vuotta sitten
vanhempi
commit
01003d8fdd

+ 3 - 0
jeecg-boot-finance/src/main/java/org/jeecg/ctop/finance/policy/service/ICreateSheetService.java

@@ -16,5 +16,8 @@ import java.util.Map;
  * @version V1.0
  */
 public interface ICreateSheetService {
+
     void createBytedance(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList,String uploadYears);
+
+    void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList,String uploadYears);
 }

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

@@ -12,9 +12,7 @@ import org.jeecg.ctop.finance.policy.mapper.CwjsPolicyInfoMapper;
 import org.jeecg.ctop.finance.policy.service.ICreateSheetService;
 import org.jeecg.ctop.finance.policy.service.ICwjsPolicyInfoService;
 import org.jeecg.ctop.finance.policy.utils.Check;
-import org.jeecg.ctop.finance.settlement.entity.vo.ProfitReportBytedanceVo;
-import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
-import org.jeecg.ctop.finance.settlement.entity.vo.SheetBytedanceVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.*;
 import org.jeecg.ctop.finance.settlement.mapper.ReportSettlementMapper;
 import org.jeecg.ctop.finance.utils.SettlementUtil;
 import org.springframework.beans.BeanUtils;
@@ -243,6 +241,223 @@ public class CreateSheetServiceImpl implements ICreateSheetService {
         }
     }
 
+    @Override
+    public void createKuaiShou(HSSFWorkbook wb, HSSFCellStyle style, List<String> accountIdList, String uploadYears) {
+        DecimalFormat sf  = new DecimalFormat("#.####");//保留四位小数
+        //2:创建sheet 设置sheet名称
+        HSSFSheet sheet = wb.createSheet("汇总页");
+        //3:添加 第一行单元格
+        HSSFRow row0 = sheet.createRow(0);
+        HSSFCell cell0 = row0.createCell(0);
+        //设置 第一行 表头
+        cell0.setCellValue(uploadYears+"-快手结算单汇总");
+        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 10);
+        sheet.addMergedRegion(region);//合并行
+        cell0.setCellStyle(style);
+        //4:添加表头2行
+        HSSFRow row = sheet.createRow(1);
+        //5:创建第2行的单元格
+        HSSFCell cell = row.createCell(0);     //第一个单元格
+        cell.setCellValue("日期");         //设定值
+        cell.setCellStyle(style);          //内容居中
+
+        cell = row.createCell(1);
+        cell.setCellValue("账户快手ID");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(2);
+        cell.setCellValue("广告主账户ID");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(3);
+        cell.setCellValue("广告主账户名称");
+        cell.setCellStyle(style);
+
+
+        cell = row.createCell(4);
+        cell.setCellValue("日总花费");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(5);
+        cell.setCellValue("充值花费");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(6);
+        cell.setCellValue("框返花费");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(7);
+        cell.setCellValue("激励花费");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(8);
+        cell.setCellValue("充值转入");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(9);
+        cell.setCellValue("框返转入");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(10);
+        cell.setCellValue("激励转入");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(11);
+        cell.setCellValue("总转入");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(12);
+        cell.setCellValue("转出");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(13);
+        cell.setCellValue("日终结余");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(14);
+        cell.setCellValue("返点类型");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(15);
+        cell.setCellValue("返点比例");
+        cell.setCellStyle(style);
+
+        cell = row.createCell(16);
+        cell.setCellValue("政策时间");
+        cell.setCellStyle(style);
+
+        sheet.autoSizeColumn(0, true);
+
+        List<SheetKuaiShouVo> resultList = new ArrayList<>(accountIdList.size());
+        //查询该时段 快手 数据
+        List<Map<String,Object>> accountList = reportSettlementMapper.getProfitKuaiShouAccountCostSheet(accountIdList,uploadYears+"-01",uploadYears+"-31");
+        for (Map<String,Object> map : accountList) {
+            SheetKuaiShouVo voSource = new SheetKuaiShouVo();
+            voSource.setAccountId(map.get("accountId")+"");
+            voSource.setKsId(map.get("ksId")+"");
+
+            //政策所有时间点
+            List<String> policyDaysList = new ArrayList<>();
+            if (!Check.isNull(map.get("productName"))) {
+                //查询 快手利润表  返点类型和比列
+                List<Map<String, Object>> rateMap = reportSettlementMapper.getProfitBytedance(map.get("advertiserName")+"",map.get("productName") + "", null,"2", uploadYears+"-01",uploadYears+"-31");
+                List listPolicyTIme = new ArrayList();
+                for (Map<String, Object> rate : rateMap) {
+                    listPolicyTIme.add(rate.get("policyStartDate"));
+                    listPolicyTIme.add(rate.get("policyEndDate"));
+                }
+
+                //政策时间 去重 排序
+                List<Object> times = SettlementUtil.sortlistTest(listPolicyTIme);
+                // 使用政策的时间段 拼接 开始 和 截至 时间
+                List<Map<String, String>> arrayList = new ArrayList<>();
+                if (!Check.isNull(times)){
+                    for (int i = 0; i < times.size(); i++) {
+                        HashMap<String, String> mapTime = new HashMap<>();
+                        mapTime.put("startDate", times.get(i).toString());
+                        mapTime.put("endDate", times.size() < 2 ? times.get(i).toString() : times.get(i + 1).toString());
+                        i += 1;
+                        arrayList.add(mapTime);
+                    }
+                }
+
+                for (Map<String, String> stringMap : arrayList) {
+                    SheetKuaiShouVo vo = new SheetKuaiShouVo();
+                    //使用政策 返点类型和比例
+                    Map<String, Object> policyRateMap = reportSettlementMapper.getProfitRebate(map.get("advertiserName")+"",map.get("productName") + "", null,"2",stringMap.get("startDate"), stringMap.get("endDate"));
+                    if (!Check.isNull(policyRateMap)) {
+                        if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 0) {
+                            vo.setRebateType("返现");//返点类型
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 1) {
+                            vo.setRebateType("返货");
+                        } else if (Integer.valueOf(policyRateMap.get("rebateType").toString()) == 2) {
+                            vo.setRebateType("返现+返货");
+                        }
+                        vo.setRebateRate(policyRateMap.getOrDefault("rebateRate", "") + "%");//返点比列
+                    } else {
+                        vo.setRebateType("");
+                    }
+
+                    // 时间段内 账户流水 信息
+                    List<SheetKuaiShouVo>  listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                    listInfo.removeAll(Collections.singleton(null));
+                    vo.setAccountName(listInfo.get(0).getAccountName());
+                    vo.setDailyCharge(listInfo.stream().filter(v -> !Check.isNull(v.getDailyCharge())).map(SheetKuaiShouVo::getDailyCharge).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealCharged())).map(SheetKuaiShouVo::getRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setContractRebateRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealCharged())).map(SheetKuaiShouVo::getContractRebateRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setDirectRebateRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealCharged())).map(SheetKuaiShouVo::getDirectRebateRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setDailyTransferIn(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferIn())).map(SheetKuaiShouVo::getDailyTransferIn).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setDailyTransferOut(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferOut())).map(SheetKuaiShouVo::getDailyTransferOut).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setBalance(listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).map(SheetKuaiShouVo::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealRecharged())).map(SheetKuaiShouVo::getRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    vo.setContractRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealRecharged())).map(SheetKuaiShouVo::getContractRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                    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"));
+                    resultList.add(vo);
+                    policyDaysList.addAll(SettlementUtil.getAllDatesOfTwoTimes(stringMap.get("startDate"), stringMap.get("endDate")));
+                }
+            }
+
+            //不使用政策 的时间段
+            // 获取两个日期之间 所有的 时间 年-月-日
+            List<String> betweenDaysList = SettlementUtil.getAllDatesOfTwoTimes(uploadYears+"-01",uploadYears+"-31");
+            // 时间差集(所有时间段 - 使用政策的时间段)
+            List<String> reduceList = betweenDaysList.stream().filter(item -> !policyDaysList.contains(item)).collect(Collectors.toList());
+            //差集拼接  开始 和 结束时间
+            List<Map<String, String>> stringList = SettlementUtil.getTime(reduceList);
+            for (Map<String, String> stringMap : stringList) {
+                SheetKuaiShouVo vo = new SheetKuaiShouVo();
+                // 不使用 政策 则 返点为空
+                //政策 返点类型和比例
+                vo.setRebateType("");//返点类型
+                vo.setRebateRate("");//返点比列
+                // 时间段内 账户流水 信息
+                List<SheetKuaiShouVo>  listInfo = reportSettlementMapper.getTransactionDayKuaiShouSheet(map.get("accountId") + "", stringMap.get("startDate"), stringMap.get("endDate"));
+                listInfo.removeAll(Collections.singleton(null));
+                vo.setAccountName(listInfo.get(0).getAccountName());
+                vo.setDailyCharge(listInfo.stream().filter(v -> !Check.isNull(v.getDailyCharge())).map(SheetKuaiShouVo::getDailyCharge).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealCharged())).map(SheetKuaiShouVo::getRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setContractRebateRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealCharged())).map(SheetKuaiShouVo::getContractRebateRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setDirectRebateRealCharged(listInfo.stream().filter(v -> !Check.isNull(v.getDirectRebateRealCharged())).map(SheetKuaiShouVo::getDirectRebateRealCharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setDailyTransferIn(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferIn())).map(SheetKuaiShouVo::getDailyTransferIn).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setDailyTransferOut(listInfo.stream().filter(v -> !Check.isNull(v.getDailyTransferOut())).map(SheetKuaiShouVo::getDailyTransferOut).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setBalance(listInfo.stream().filter(v -> !Check.isNull(v.getBalance())).map(SheetKuaiShouVo::getBalance).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getRealRecharged())).map(SheetKuaiShouVo::getRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                vo.setContractRebateRealRecharged(listInfo.stream().filter(v -> !Check.isNull(v.getContractRebateRealRecharged())).map(SheetKuaiShouVo::getContractRebateRealRecharged).reduce(BigDecimal.ZERO, BigDecimal::add));
+                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") : "");
+                resultList.add(vo);
+            }
+        }
+
+        for (int i = 0; i < resultList.size(); i++) {
+            SheetKuaiShouVo vo = resultList.get(i);
+            //创建行 (表头占0-1行 所以 从 2开始)
+            row = sheet.createRow(i + 2);
+            sheet.autoSizeColumn(0, true);
+            sheet.autoSizeColumn(i + 1, true);
+            //创建单元格并且添加数据
+            row.createCell(0).setCellValue(uploadYears);
+            row.createCell(1).setCellValue(vo.getKsId());
+            row.createCell(2).setCellValue(vo.getAccountId());
+            row.createCell(3).setCellValue(vo.getAccountName());
+            row.createCell(4).setCellValue(sf.format(vo.getDailyCharge()));
+            row.createCell(5).setCellValue(sf.format(vo.getRealCharged()));
+            row.createCell(6).setCellValue(sf.format(vo.getContractRebateRealCharged()));
+            row.createCell(7).setCellValue(sf.format(vo.getDirectRebateRealCharged()));
+            row.createCell(8).setCellValue(sf.format(vo.getRealRecharged()));
+            row.createCell(9).setCellValue(sf.format(vo.getContractRebateRealRecharged()));
+            row.createCell(10).setCellValue(sf.format(vo.getDirectRebateRealRecharged()));
+            row.createCell(11).setCellValue(sf.format(vo.getDailyTransferIn()));
+            row.createCell(12).setCellValue(sf.format(vo.getDailyTransferOut()));
+            row.createCell(13).setCellValue(sf.format(vo.getBalance()));
+            row.createCell(14).setCellValue(vo.getRebateType());
+            row.createCell(15).setCellValue(vo.getRebateRate());
+            row.createCell(16).setCellValue(vo.getTime());
+        }
+    }
 
 
 }

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

@@ -26,6 +26,7 @@ public class SettlementReportKuaiShouVo implements Serializable {
      */
     @ApiModelProperty(value = "账户ID")
     private String accountId;
+    private String accountName;
     /**
      * 时间
      */

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

@@ -0,0 +1,65 @@
+package org.jeecg.ctop.finance.settlement.entity.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @description: 头条 结算单 汇总页
+ * @return:
+ * @author: zianY
+ */
+@Data
+public class SheetKuaiShouVo implements Serializable {
+
+
+    @ApiModelProperty(value = "账户ID")
+    private String accountId;
+    private String accountName;
+
+
+    @ApiModelProperty(value = "总花费(元)")
+    private BigDecimal dailyCharge;
+
+    @ApiModelProperty(value = "充值花费(元)")
+    private BigDecimal realCharged;
+
+    @ApiModelProperty(value = "框返花费(元)")
+    private BigDecimal contractRebateRealCharged;
+
+    @ApiModelProperty(value = "激励花费(元)")
+    private BigDecimal directRebateRealCharged;
+
+    @ApiModelProperty(value = "转入(元)")
+    private BigDecimal dailyTransferIn;
+
+    @ApiModelProperty(value = "转出(元)")
+    private BigDecimal dailyTransferOut;
+
+    @ApiModelProperty(value = "日终结余(元)")
+    private BigDecimal balance;
+
+    @ApiModelProperty(value = "充值转入(元)")
+    private BigDecimal realRecharged;
+
+    @ApiModelProperty(value = "框返转入(元)")
+    private BigDecimal contractRebateRealRecharged;
+
+    @ApiModelProperty(value = "激励转入(元)")
+    private BigDecimal directRebateRealRecharged;
+
+    private String ksId;
+
+
+    private String rebateType;
+    private String rebateRate;
+
+    private String time;
+
+
+
+
+}

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

@@ -4,6 +4,7 @@ import io.lettuce.core.dynamic.annotation.Param;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementFileParamsVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportBytedanceVo;
 import org.jeecg.ctop.finance.settlement.entity.vo.SettlementReportKuaiShouVo;
+import org.jeecg.ctop.finance.settlement.entity.vo.SheetKuaiShouVo;
 
 import java.util.List;
 import java.util.Map;
@@ -44,6 +45,9 @@ public interface ReportSettlementMapper {
     // 获取快手 结算单 账户 和 代理商 维度
     List<SettlementReportKuaiShouVo> getTransactionDayKuaiShouAgentAndAccount(SettlementFileParamsVo paramsVo);
 
+    List<SheetKuaiShouVo> getTransactionDayKuaiShouSheet(@Param("accountId")String accountId, @Param("startTime")String startTime , @Param("endTime")String endTime);
+
+
 
     /**
      * 查询 账户id
@@ -76,10 +80,14 @@ public interface ReportSettlementMapper {
      * @return
      */
     List<Map<String,Object>> getProfitKuaiShouAgentAccount(@Param("startTime")String startTime ,@Param("endTime")String endTime);
-    Map<String,Object> getProfitKuaiShouAccountCost(@Param("accountId")String accountId,@Param("startTime")String startTime ,@Param("endTime")String endTime);
+    Map<String,Object> getProfitKuaiShouAccountCost(@Param("accountId")String accountIds,@Param("startTime")String startTime ,@Param("endTime")String endTime);
+    List<Map<String,Object>> getProfitKuaiShouAccountCostSheet(@Param("accountIds")List<String> accountIds,@Param("startTime")String startTime ,@Param("endTime")String endTime);
     //快手 利润表 账户 时间段内的数据信息
     List<Map<String,Object>> getProfitKuaiShouCost(@Param("accountId")String accountId,@Param("startTime")String startTime ,@Param("endTime")String endTime);
 
+
+
+
     /**
      * 查询 头条利润表  返点类型和比列
      * @param
@@ -100,6 +108,7 @@ public interface ReportSettlementMapper {
 
 
 
+
     /**
      * 查询 所有已绑定用户的运营人员id
      * @return

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

@@ -535,6 +535,39 @@
 
     </select>
 
+    <!-- 查询 快手 利润表 总花费 结算单-->
+    <select id="getProfitKuaiShouAccountCostSheet" resultType="java.util.LinkedHashMap">
+        SELECT
+        d.account_id as accountId,
+        d.user_id AS ksId,
+        round(SUM(d.total_charged_in_yuan),3) AS cost,
+        round(SUM((d.real_charged_in_yuan + d.total_rebate_real_charged_in_yuan + d.credit_real_charged_in_yuan)),3) as cashCost,
+        IFNULL((SELECT a.name from ctop_user_allocation u,ctop_advertiser a where d.account_id = u.account_id and u.advertiser_id = a.id),(SELECT a.name
+        from ctop_cwjs_settlement_info c ,ctop_advertiser a where c.account_id = d.account_id and c.advertiser_id = a.id)) as advertiserName,
+        IFNULL((SELECT
+        p.product_name
+        FROM ctop_user_allocation u,ctop_project pj,ctop_product p where d.account_id = u.account_id and u.project_id = pj.id and pj.product_id = p.id
+        ),(SELECT p.product_name
+        FROM ctop_cwjs_settlement_info c,ctop_product p where d.account_id = c.account_id and c.product_id = p.id)) productName
+        FROM
+        ctop_kuaishou_daily_agent d
+        <where>
+            AND account_id in
+            <foreach collection="accountIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+            and d.total_charged_in_yuan > 0
+            <if test="startTime !=null and startTime != ''">
+                AND d.date_time &gt;= #{startTime}
+            </if>
+            <if test="endTime !=null and endTime != ''">
+                AND d.date_time &lt;= #{endTime}
+            </if>
+        </where>
+        GROUP BY d.account_id
+    </select>
+
     <!-- 查询 快手 利润表 总花费-->
     <select id="getProfitKuaiShouCost" resultType="java.util.LinkedHashMap">
         SELECT
@@ -628,4 +661,82 @@
 	AND c.user_id = #{userId}
     </select>
 
+
+
+
+
+    <!-- 获取快手 账户 日流水信息  代理商 和 账户 结算单 -汇总页-->
+    <select id="getTransactionDayKuaiShouSheet" resultType="org.jeecg.ctop.finance.settlement.entity.vo.SheetKuaiShouVo">
+        SELECT
+            *
+        FROM
+            (
+                SELECT
+                    t.*
+                FROM
+                    (
+                        SELECT
+                            date_time 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
+                            ctop_kuaishou_daily_agent
+                        WHERE
+                            total_charged_in_yuan >0
+                          and account_id = #{accountId}
+                    ) t
+                WHERE
+                   t.date &gt;= #{startTime}
+                  AND t.date &lt;= #{endTime}
+                ORDER BY
+                    t.date
+                    LIMIT 31
+            ) a
+                LEFT JOIN (
+                SELECT
+                    t.*,
+                    c.auth_name AS accountNameF,
+                    base.user_id AS ksIdF
+                FROM
+                    (
+                        SELECT
+                            account_id AS accountIdF,
+                            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
+                            ctop_kuaishou_daily_flows
+                        WHERE
+                            account_id = #{accountId}
+                    ) t
+                        LEFT JOIN ctop_user_allocation c ON t.accountIdF = c.account_id
+                        LEFT JOIN ctop_kuaishou_advertiser_base_info base ON base.account_id = t.accountIdF
+                WHERE
+                   t.date &gt;= #{startTime}
+                  AND t.date &lt;= #{endTime}
+                ORDER BY
+                    date
+                    LIMIT 31
+            ) b ON a.accountId = b.accountIdF
+                AND a.date = b.date
+            LIMIT 31
+
+    </select>
+
+
+
+
+
+
+
+
 </mapper>

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

@@ -360,7 +360,8 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             if (Check.isNull(accountIdList)){
                 return Result.errorMsg("该广告主和产品下无法查询到绑定的快手账户信息");
             }
-
+            //设置第一个sheet 汇总页-快手
+            createSheetService.createKuaiShou(wb,style,accountIdList,paramsVo.getUploadYears());
             int num = 0;
             for (int k = 0; k < accountIdList.size(); k++) {
                 String accountId = accountIdList.get(k);
@@ -679,24 +680,6 @@ public class ReportSettlementServiceImpl implements IReportSettlementService {
             }
             List<ProfitReportKuaiShouVo> resultList = new ArrayList<>(list.size());
             for (Map<String, Object> mapList : list) {
-                //查看该账户 状态信息
-               /* QueryWrapper<SysLog> sysLogQw = new QueryWrapper<>();
-                sysLogQw.eq("log_type", 2);
-                //操作类型
-                sysLogQw.eq("operate_type", 10001);
-                sysLogQw.eq("log_content", "0");//0开 1关
-                sysLogQw.eq("request_param", mapList.get("account_id").toString());
-                sysLogQw.orderByDesc("create_time");
-                sysLogQw.last("limit 1");
-                SysLog sysLog = sysLogMapper.selectOne(sysLogQw);
-                if (!Check.isNull(sysLog)) {
-                    SimpleDateFormat m = new SimpleDateFormat("MM");
-                    String createMonth = m.format(sysLog.getCreateTime());
-                    int crate = Integer.parseInt(createMonth);
-                    Calendar cal = Calendar.getInstance();
-                    int month = cal.get(Calendar.MONTH) + 1;
-
-                }*/
 
                 //查询账户数据信息
                Map<String,Object> map = reportSettlementMapper.getProfitKuaiShouAccountCost(mapList.get("account_id").toString(),paramsVo.getStartTime(),paramsVo.getEndTime());