Ver Fonte

1.公司报表增加是否有数据字段 2.公司报表明细增加广告主模糊查询 3.优化excel导出工具类 4.增加公司报表和公司报表明细的excel表格导出接口

hcst_sunzhen há 5 anos atrás
pai
commit
ffa0a17986

+ 13 - 0
jeecg-boot-module-system/pom.xml

@@ -145,6 +145,19 @@
             <artifactId>poi</artifactId>
             <version>3.17</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+            <version>3.17</version>
+        </dependency>
+        <dependency>
+        <groupId>org.apache.poi</groupId>
+        <artifactId>poi-ooxml-schemas</artifactId>
+        <version>3.17</version>
+        </dependency>
+
+
         <dependency>
             <groupId>com.bstek.ureport</groupId>
             <artifactId>ureport2-core</artifactId>

+ 78 - 2
module-common/src/main/java/cn/com/ctop/common/module/utils/ExportExcelUtils.java

@@ -4,6 +4,10 @@ import org.apache.poi.hssf.usermodel.HSSFCellStyle;
 import org.apache.poi.hssf.usermodel.HSSFFont;
 import org.apache.poi.hssf.usermodel.HSSFRichTextString;
 import org.apache.poi.hssf.util.HSSFColor;
+import org.apache.poi.ss.usermodel.BorderStyle;
+import org.apache.poi.ss.usermodel.FillPatternType;
+import org.apache.poi.ss.usermodel.HorizontalAlignment;
+import org.apache.poi.ss.usermodel.IndexedColors;
 import org.apache.poi.xssf.usermodel.*;
 
 import java.math.BigDecimal;
@@ -23,8 +27,10 @@ public class ExportExcelUtils {
      * @Title: exportExcel
      * @Description: 导出Excel的方法
      */
-    public void exportExcel(XSSFWorkbook workbook, int sheetNum,
+    public void exportExcelOld(XSSFWorkbook workbook, int sheetNum,
                             String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
+        System.out.println("!!!!!!!!!"+ XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
+        System.out.println("!!!!!!!!!"+ HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
         // 生成一个表格
         XSSFSheet sheet = workbook.createSheet();
         workbook.setSheetName(sheetNum, sheetTitle);
@@ -34,7 +40,7 @@ public class ExportExcelUtils {
         XSSFCellStyle style = workbook.createCellStyle();
         // 设置这些样式
         style.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
-        style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
+      //  style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
         style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
         style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
         style.setBorderRight(HSSFCellStyle.BORDER_THIN);
@@ -93,5 +99,75 @@ public class ExportExcelUtils {
         }
     }
 
+    public void exportExcel(XSSFWorkbook workbook, int sheetNum,
+                            String sheetTitle, String[] headers, List<List<Object>> result) throws Exception {
+        System.out.println("!!!!!!!!!"+ XSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
+        System.out.println("!!!!!!!!!"+ HSSFCellStyle.class.getProtectionDomain().getCodeSource().getLocation());
+        // 生成一个表格
+        XSSFSheet sheet = workbook.createSheet();
+        workbook.setSheetName(sheetNum, sheetTitle);
+        // 设置表格默认列宽度为20个字节
+        sheet.setDefaultColumnWidth((short) 20);
+        // 生成一个样式
+        XSSFCellStyle style = workbook.createCellStyle();
+        // 设置这些样式
+        style.setFillForegroundColor(IndexedColors.PALE_BLUE.index);
+        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
+        style.setBorderBottom(BorderStyle.THIN);
+        style.setBorderLeft(BorderStyle.THIN);
+        style.setBorderRight(BorderStyle.THIN);
+        style.setBorderTop(BorderStyle.THIN);
+        style.setAlignment(HorizontalAlignment.CENTER);
+        // 生成一个字体
+        XSSFFont font = workbook.createFont();
+        font.setColor(IndexedColors.BLACK.index);
+        font.setFontHeightInPoints((short) 12);
+        font.setBold(true);
+        // 把字体应用到当前的样式
+        style.setFont(font);
+
+        // 指定当单元格内容显示不下时自动换行
+        style.setWrapText(true);
+
+        // 产生表格标题行
+        XSSFRow row = sheet.createRow(0);
+        for (int i = 0; i < headers.length; i++) {
+            XSSFCell cell = row.createCell((short) i);
+
+            cell.setCellStyle(style);
+            XSSFRichTextString text = new XSSFRichTextString(headers[i]);
+            cell.setCellValue(headers[i]);
+        }
+        // 遍历集合数据,产生数据行
+        if (result != null) {
+            int index = 1;
+            for (List<Object> m : result) {
+                row = sheet.createRow(index);
+                int cellIndex = 0;
+                for (Object obj : m) {
+                    XSSFCell cell = row.createCell((short) cellIndex);
+                    if (!Check.isNull(obj)) {
+                        if (obj instanceof String) {
+                            cell.setCellValue((String) obj);
+                        } else if (obj instanceof Double) {
+                            cell.setCellValue((Double) obj);
+                        } else if (obj instanceof BigDecimal) {
+                            BigDecimal bigDecimal = (BigDecimal) obj;
+                            cell.setCellValue(bigDecimal.doubleValue());
+                        } else if (obj instanceof Long) {
+                            Long aLong = Long.valueOf(String.valueOf(obj));
+                            cell.setCellValue(aLong.doubleValue());
+                        } else {
+                            cell.setCellValue(obj.toString());
+                        }
+                    } else {
+                        cell.setCellValue(0);
+                    }
 
+                    cellIndex++;
+                }
+                index++;
+            }
+        }
+    }
 }

+ 134 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyAgentSumController.java

@@ -1,24 +1,28 @@
 package cn.com.ctop.kuaishou.modules.report.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.io.OutputStream;
+import java.util.*;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.net.URLDecoder;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
+import cn.com.ctop.common.module.utils.RateUtil;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent;
 import cn.com.ctop.kuaishou.modules.report.entity.ParamsDTO;
+import com.alibaba.fastjson.JSONObject;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentSumService;
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -256,11 +260,12 @@ public class KuaishouReportDailyAgentSumController {
 	  * @param dto
 	  * @return Result<KuaishouReportDailyAgentSum>
 	  */
-	 @AutoLog(value = "公司报表按时间汇总")
-	 @ApiOperation(value="公司报表按时间汇总", notes="公司报表按时间汇总")
+	 @AutoLog(value = "公司报表按天明细")
+	 @ApiOperation(value="公司报表按天明细", notes="公司报表按天明细")
 	 @PostMapping(value = "/companyReportAccountDetailList")
 	 public Result<List<KuaishouReportDailyAgent>> companyReportAccountDetailList(@RequestBody ParamsDTO dto) {
 		 Result<List<KuaishouReportDailyAgent>> result = new Result<>();
+		 String advertiserName = dto.getAdvertiserName();
 		 String date = dto.getDate();
 		 if(StringUtils.isBlank(date)){
 			 result.setSuccess(false);
@@ -268,7 +273,7 @@ public class KuaishouReportDailyAgentSumController {
 			 return result;
 		 }
 
-		 List<KuaishouReportDailyAgent> kuaishouReportDailyAgentList = kuaishouReportDailyAgentSumService.companyReportAccountDetailList(date);
+		 List<KuaishouReportDailyAgent> kuaishouReportDailyAgentList = kuaishouReportDailyAgentSumService.companyReportAccountDetailList(date, advertiserName);
 		 result.setResult(kuaishouReportDailyAgentList);
 		 result.setSuccess(true);
 		 result.setMessage("success");
@@ -276,4 +281,125 @@ public class KuaishouReportDailyAgentSumController {
 		 return result;
 	 }
 
-}
+	 @AutoLog(value = "公司报表按天导出Excel")
+	 @ApiOperation(value="公司报表按天导出Excel", notes="公司报表按天导出Excel")
+	 @GetMapping(value = "/companyReportExportExcel")
+	 public void companyReportExportExcel( @RequestBody ParamsDTO dto,
+										   //@RequestParam("startDate")String startDate,
+										   //@RequestParam("endDate")String endDate,
+										   HttpServletRequest request,
+										   HttpServletResponse response) throws Exception{
+		 Result result = new Result<>();
+		 result.setSuccess(true);
+		 result.setMessage("success");
+
+		 //公司报表
+		 List<KuaishouReportDailyAgentSum> kuaishouReportDailyAgentSumList = kuaishouReportDailyAgentSumService.companyReport(dto.getStartDate(),dto.getEndDate());
+
+		 //导出excel
+		 List<List<Object>> group = new ArrayList<>();
+		 if (!Check.isNull(kuaishouReportDailyAgentSumList)) {
+			 for (KuaishouReportDailyAgentSum sum : kuaishouReportDailyAgentSumList) {
+				 List<Object> kuaishouReportDailyAgentSum = new ArrayList();
+				 kuaishouReportDailyAgentSum.add(DateUtils.formatDate(sum.getDate()));  //日期
+				 kuaishouReportDailyAgentSum.add(sum.getCostCampaignCount() );  //有消费计划数
+				 kuaishouReportDailyAgentSum.add(sum.getBalance());  //总余额
+				 kuaishouReportDailyAgentSum.add(sum.getCost());  //总消耗
+				 kuaishouReportDailyAgentSum.add(sum.getXianjinCost());  //现金消耗
+				 kuaishouReportDailyAgentSum.add(sum.getFandianCost());  //后返消耗
+				 kuaishouReportDailyAgentSum.add(sum.getKuangfanCost());  //框返消耗
+				 kuaishouReportDailyAgentSum.add(sum.getJiliCost());  //激励账户消耗
+				 kuaishouReportDailyAgentSum.add(sum.getXinyongCost());  //信用账户消耗
+				 kuaishouReportDailyAgentSum.add(sum.getFengmianShowCount());  //封面曝光数
+				 kuaishouReportDailyAgentSum.add(sum.getFengmianClickCount());  //封面点击数
+				 kuaishouReportDailyAgentSum.add(sum.getSucaiShowCount());  //素材曝光数
+				 kuaishouReportDailyAgentSum.add(sum.getConvertCount());  //行为数
+				 kuaishouReportDailyAgentSum.add(sum.getFengmianClickCount());  //封面点击率
+				 kuaishouReportDailyAgentSum.add(sum.getConvertClickRate());  //转化点击率
+				 group.add(kuaishouReportDailyAgentSum);
+			 }
+		 }
+
+		 String[] groupHeaders = {"日期", "有消费计划数", "总余额", "总消耗", "现金消耗", "后返消耗", "框返消耗", "激励账户消耗", "信用账户消耗", "封面曝光数", "封面点击数", "素材曝光数", "行为数", "封面点击率", "转化点击率"};
+		 OutputStream os = response.getOutputStream();
+		 ExportExcelUtils eeu = new ExportExcelUtils();
+		 XSSFWorkbook workbook = new XSSFWorkbook();
+		 eeu.exportExcel(workbook, 0, "公司日报表", groupHeaders, group);
+		 this.setResponseHeader(response, "公司日报表.xlsx");
+		 workbook.write(os);
+		 os.flush();
+		 os.close();
+
+	 }
+
+	 @AutoLog(value = "公司日报明细表按天导出Excel")
+	 @ApiOperation(value="公司日报明细表按天导出Excel", notes="公司报表按天导出Excel")
+	 @GetMapping(value = "/companyReportAccountDetailListExportExcel")
+	 public void companyReportAccountDetailListExportExcel( @RequestBody ParamsDTO dto,
+										   //@RequestParam("date")String date,
+										   HttpServletRequest request,
+										   HttpServletResponse response) throws Exception{
+		 Result result = new Result<>();
+		 result.setSuccess(true);
+		 result.setMessage("success");
+
+		 //公司报表按天明细
+		 List<KuaishouReportDailyAgent> kuaishouReportDailyAgentList = kuaishouReportDailyAgentSumService.companyReportAccountDetailList(dto.getDate(), null);
+
+		 //导出excel
+		 List<List<Object>> group = new ArrayList<>();
+		 if (!Check.isNull(kuaishouReportDailyAgentList)) {
+			 for (KuaishouReportDailyAgent agent : kuaishouReportDailyAgentList) {
+				 List<Object> kuaishouReportDailyAgentSum = new ArrayList();
+				 kuaishouReportDailyAgentSum.add(DateUtils.formatDate(agent.getDate()));  //日期
+				 kuaishouReportDailyAgentSum.add(agent.getKid());  //快手id
+				 kuaishouReportDailyAgentSum.add(agent.getAdvertiserName());  //广告主名称
+				 kuaishouReportDailyAgentSum.add(DateUtils.formatDate(agent.getAdvertiserCreateTime()));  //广告主创建时间
+				 kuaishouReportDailyAgentSum.add(agent.getCostCampaignCount());  //有消费计划数量
+				 kuaishouReportDailyAgentSum.add(agent.getBalance());  //总余额
+				 kuaishouReportDailyAgentSum.add(agent.getCost());  //总消耗
+				 kuaishouReportDailyAgentSum.add(agent.getXianjinCost());  //现金消耗
+				 kuaishouReportDailyAgentSum.add(agent.getFandianCost());  //后返消耗
+				 kuaishouReportDailyAgentSum.add(agent.getKuangfanCost());  //框返消耗
+				 kuaishouReportDailyAgentSum.add(agent.getJiliCost());  //激励账户消耗
+				 kuaishouReportDailyAgentSum.add(agent.getXinyongCost());  //信用账户消耗
+				 kuaishouReportDailyAgentSum.add(agent.getFengmianShowCount());  //封面曝光数
+				 kuaishouReportDailyAgentSum.add(agent.getFengmianClickCount());  //封面点击数
+				 kuaishouReportDailyAgentSum.add(agent.getSucaiShowCount());  //素材曝光数
+				 kuaishouReportDailyAgentSum.add(agent.getConvertCount());  //行为数
+				 kuaishouReportDailyAgentSum.add(agent.getFengmianClickRate());  //封面点击率
+				 kuaishouReportDailyAgentSum.add(agent.getConvertClickRate());  //转化点击率
+				 group.add(kuaishouReportDailyAgentSum);
+			 }
+		 }
+
+		 String[] groupHeaders = {"日期", "快手id", "广告主名称", "广告主创建时间", "有消费计划数量", "总余额", "总消耗", "现金消耗", "后返消耗", "框返消耗", "激励账户消耗", "信用账户消耗", "封面曝光数", "封面点击数", "素材曝光数", "行为数", "封面点击率", "转化点击率"};
+		 OutputStream os = response.getOutputStream();
+		 ExportExcelUtils eeu = new ExportExcelUtils();
+		 XSSFWorkbook workbook = new XSSFWorkbook();
+		 eeu.exportExcel(workbook, 0, "公司日报明细表", groupHeaders, group);
+		 this.setResponseHeader(response, "公司日报明细表.xlsx");
+		 workbook.write(os);
+		 os.flush();
+		 os.close();
+	 }
+
+
+	 //发送响应流方法
+	 public void setResponseHeader(HttpServletResponse response, String fileName) {
+		 try {
+			 try {
+				 fileName = new String(fileName.getBytes(), "ISO8859-1");
+			 } catch (UnsupportedEncodingException e) {
+				 e.printStackTrace();
+			 }
+			 response.setContentType("application/octet-stream;charset=ISO8859-1");
+			 response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+			 response.addHeader("Pargam", "no-cache");
+			 response.addHeader("Cache-Control", "no-cache");
+		 } catch (Exception ex) {
+			 ex.printStackTrace();
+		 }
+	 }
+
+ }

+ 71 - 25
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java

@@ -28,92 +28,138 @@ import org.jeecgframework.poi.excel.annotation.Excel;
 @ApiModel(value="ctop_kuaishou_report_daily_agent对象", description="代理商报表")
 public class KuaishouReportDailyAgent {
 
-	/**日期*/
+	/**
+	 * 日期
+	 */
 	@Excel(name = "日期", width = 15, format = "yyyy-MM-dd")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
 	@ApiModelProperty(value = "日期")
 	@TableId(type = IdType.INPUT)
 	private java.util.Date date;
-	/**账户ID*/
+	/**
+	 * 账户ID
+	 */
 	@Excel(name = "账户ID", width = 15)
 	@ApiModelProperty(value = "账户ID")
 	@TableId(type = IdType.INPUT)
 	private java.lang.Integer accountId;
-	/**快手ID*/
+	/**
+	 * 快手ID
+	 */
 	@Excel(name = "快手ID", width = 15)
 	@ApiModelProperty(value = "快手ID")
 	private java.lang.Integer kid;
-	/**广告主名称*/
+	/**
+	 * 广告主名称
+	 */
 	@Excel(name = "广告主名称", width = 15)
 	@ApiModelProperty(value = "广告主名称")
 	private java.lang.String advertiserName;
-	/**广告主创建时间*/
+	/**
+	 * 广告主创建时间
+	 */
 	@Excel(name = "广告主创建时间", width = 15, format = "yyyy-MM-dd")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
 	@ApiModelProperty(value = "广告主创建时间")
 	private java.util.Date advertiserCreateTime;
-	/**有消费计划数*/
+	/**
+	 * 有消费计划数
+	 */
 	@Excel(name = "有消费计划数", width = 15)
 	@ApiModelProperty(value = "有消费计划数")
 	private java.lang.Integer costCampaignCount;
-	/**总余额*/
+	/**
+	 * 总余额
+	 */
 	@Excel(name = "总余额", width = 15)
 	@ApiModelProperty(value = "总余额")
 	private java.math.BigDecimal balance;
-	/**总消耗*/
+	/**
+	 * 总消耗
+	 */
 	@Excel(name = "总消耗", width = 15)
 	@ApiModelProperty(value = "总消耗")
 	private java.math.BigDecimal cost;
-	/**现金消耗*/
+	/**
+	 * 现金消耗
+	 */
 	@Excel(name = "现金消耗", width = 15)
 	@ApiModelProperty(value = "现金消耗")
 	private java.math.BigDecimal xianjinCost;
-	/**后返消耗*/
+	/**
+	 * 后返消耗
+	 */
 	@Excel(name = "后返消耗", width = 15)
 	@ApiModelProperty(value = "后返消耗")
 	private java.math.BigDecimal fandianCost;
-	/**框返消耗*/
+	/**
+	 * 框返消耗
+	 */
 	@Excel(name = "框返消耗", width = 15)
 	@ApiModelProperty(value = "框返消耗")
 	private java.math.BigDecimal kuangfanCost;
-	/**激励账户消耗*/
+	/**
+	 * 激励账户消耗
+	 */
 	@Excel(name = "激励账户消耗", width = 15)
 	@ApiModelProperty(value = "激励账户消耗")
 	private java.math.BigDecimal jiliCost;
-	/**信用账户消耗*/
+	/**
+	 * 信用账户消耗
+	 */
 	@Excel(name = "信用账户消耗", width = 15)
 	@ApiModelProperty(value = "信用账户消耗")
 	private java.math.BigDecimal xinyongCost;
-	/**封面曝光数*/
+	/**
+	 * 封面曝光数
+	 */
 	@Excel(name = "封面曝光数", width = 15)
 	@ApiModelProperty(value = "封面曝光数")
 	private java.lang.Integer fengmianShowCount;
-	/**封面点击数*/
+	/**
+	 * 封面点击数
+	 */
 	@Excel(name = "封面点击数", width = 15)
 	@ApiModelProperty(value = "封面点击数")
 	private java.lang.Integer fengmianClickCount;
-	/**素材曝光数*/
+	/**
+	 * 素材曝光数
+	 */
 	@Excel(name = "素材曝光数", width = 15)
 	@ApiModelProperty(value = "素材曝光数")
 	private java.lang.Integer sucaiShowCount;
-	/**行为数*/
+	/**
+	 * 行为数
+	 */
 	@Excel(name = "行为数", width = 15)
 	@ApiModelProperty(value = "行为数")
 	private java.lang.Integer convertCount;
-	/**封面点击率*/
+	/**
+	 * 封面点击率
+	 */
 	@Excel(name = "封面点击率", width = 15)
 	@ApiModelProperty(value = "封面点击率")
 	private java.math.BigDecimal fengmianClickRate;
-	/**转化点击率*/
+	/**
+	 * 转化点击率
+	 */
 	@Excel(name = "转化点击率", width = 15)
 	@ApiModelProperty(value = "转化点击率")
 	private java.math.BigDecimal convertClickRate;
-	/**创建时间*/
+	/**
+	 * 创建时间
+	 */
 	@ApiModelProperty(value = "创建时间")
 	private java.util.Date createTime;
-	/**修改时间*/
+	/**
+	 * 修改时间
+	 */
 	@ApiModelProperty(value = "修改时间")
 	private java.util.Date updateTime;
+
+	@TableField(exist = false)
+	private Integer isHasData;
+
 }

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/ParamsDTO.java

@@ -10,4 +10,5 @@ public class ParamsDTO implements Serializable {
     private String startDate;
     private String endDate;
     private String date;
+    private String advertiserName;  //广告主名称
 }

+ 6 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyAgentSumMapper.java

@@ -18,5 +18,10 @@ public interface KuaishouReportDailyAgentSumMapper extends BaseMapper<KuaishouRe
 
     KuaishouReportDailyAgentSum companyReportSum(@Param("startDate")String startDate, @Param("endDate")String endDate);
 
-    List<KuaishouReportDailyAgent> companyReporAccountDetailList(@Param("date")String date);
+    //根据某天的时间获取公司报表明细
+    List<KuaishouReportDailyAgent> companyReportAccountDetailList(@Param("date")String date, @Param("advertiserName")String advertiserName);
+
+    //根据时间段获取公司报表明细
+    List<KuaishouReportDailyAgent> companyReportAccountDetailListByDateRange(@Param("startDate")String startDate, @Param("endDate")String endDate);
 }
+

+ 43 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAgentSumMapper.xml

@@ -5,7 +5,7 @@
     <!-- 公司报表sql -->
     <select id="companyReport" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">
             select
-            date as date,  <!-- 日期 -->
+            date_format(date, '%Y-%m-%d') as date,  <!-- 日期 -->
             cost_campaign_count as costCampaignCount,  <!-- 有消费计划数 -->
             balance as balance,  <!-- 总余额 -->
             cost as cost,  <!-- 总消耗 -->
@@ -51,9 +51,9 @@
     </select>
 
     <!-- 根据传入时间获取公司报表账户的列表 -->
-    <select id="companyReporAccountDetailList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent">
+    <select id="companyReportAccountDetailList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent">
             select
-            date as date,  <!-- 日期 -->
+            date_format(date, '%Y-%m-%d') as date,  <!-- 日期 -->
             account_id as accountId,  <!-- 账户id -->
             kid as kid, <!-- 快手id -->
             advertiser_name as advertiserName, <!-- 广告主名称 -->
@@ -71,11 +71,50 @@
             sucai_show_count as sucaiShowCount, <!-- 素材曝光数 -->
             convert_count as convertCount, <!-- 行为数 -->
             fengmian_click_rate as fengmianClickRate, <!-- 封面点击率 -->
-            convert_click_rate as convertClickRate <!-- 转化点击率 -->
+            convert_click_rate as convertClickRate, <!-- 转化点击率 -->
+            case
+                when
+                cost_campaign_count + balance + cost + xianjin_cost + fandian_cost + kuangfan_cost + jili_cost +
+                xinyong_cost + fengmian_show_count + fengmian_click_count + sucai_show_count + convert_count +
+                fengmian_click_rate + convert_click_rate = 0 then 0
+                else 1
+                end as isHasData
         from
         ctop_kuaishou_report_daily_agent
         where
         date_format(date, '%Y-%m-%d') = #{date}
+        <if test="advertiserName != null">
+            and advertiser_name like concat('%',${advertiserName},'%')
+        </if>
+    </select>
+
+    <!-- 根据传入开始时间和结束获取公司报表账户的列表 -->
+    <select id="companyReportAccountDetailListByDateRange" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgent">
+        select
+        date as date,  <!-- 日期 -->
+        account_id as accountId,  <!-- 账户id -->
+        kid as kid, <!-- 快手id -->
+        advertiser_name as advertiserName, <!-- 广告主名称 -->
+        advertiser_create_time as advertiserCreateTime, <!-- 广告主创建时间 -->
+        cost_campaign_count as costCampaignCount, <!-- 有消费计划数 -->
+        balance as balance, <!-- 总余额 -->
+        cost as cost, <!-- 总消耗 -->
+        xianjin_cost as xianjinCost, <!-- 现金消耗 -->
+        fandian_cost as fandianCost, <!-- 后返消耗 -->
+        kuangfan_cost as kuangfanCost, <!-- 框返消耗 -->
+        jili_cost as jiliCost, <!-- 激励账户消耗 -->
+        xinyong_cost as xinyongCost, <!-- 信用账户消耗 -->
+        fengmian_show_count as fengmianShowCount, <!-- 封面曝光数 -->
+        fengmian_click_count as fengmianClickCount, <!-- 封面点击数 -->
+        sucai_show_count as sucaiShowCount, <!-- 素材曝光数 -->
+        convert_count as convertCount, <!-- 行为数 -->
+        fengmian_click_rate as fengmianClickRate, <!-- 封面点击率 -->
+        convert_click_rate as convertClickRate <!-- 转化点击率 -->
+        from
+        ctop_kuaishou_report_daily_agent
+        where
+        date_format(date, '%Y-%m-%d') &gt; #{startDate} and
+        date_format(date, '%Y-%m-%d') &lt; #{endDate}
     </select>
 
 </mapper>

+ 3 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyAgentSumService.java

@@ -16,5 +16,7 @@ public interface IKuaishouReportDailyAgentSumService extends IService<KuaishouRe
     List<KuaishouReportDailyAgentSum> companyReport(String startDate, String endDate);
     KuaishouReportDailyAgentSum companyReportSum(String startDate, String endDate);
 
-    List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date);
+    List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date, String advertiserName);
+
+    List<KuaishouReportDailyAgent> companyReportAccountDetailListByDateRange(String startDate, String endDate);
 }

+ 8 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyAgentSumServiceImpl.java

@@ -35,8 +35,14 @@ public class KuaishouReportDailyAgentSumServiceImpl extends ServiceImpl<Kuaishou
 
     //公司报表详情
     @Override
-    public List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date){
-        return kuaishouReportDailyAgentSumMapper.companyReporAccountDetailList(date);
+    public List<KuaishouReportDailyAgent> companyReportAccountDetailList(String date, String advertiserName){
+        return kuaishouReportDailyAgentSumMapper.companyReportAccountDetailList(date, advertiserName);
+    }
+
+    //公司报表详情
+    @Override
+    public List<KuaishouReportDailyAgent> companyReportAccountDetailListByDateRange(String startDate, String endDate){
+        return kuaishouReportDailyAgentSumMapper.companyReportAccountDetailListByDateRange(startDate, endDate);
     }
 
 }