Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

liyuyi@c-top.com.cn 4 vuotta sitten
vanhempi
commit
a01e2d5932
18 muutettua tiedostoa jossa 1385 lisäystä ja 403 poistoa
  1. 279 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceVideoEtlInfoController.java
  2. 231 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouVideoEtlInfoController.java
  3. 257 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/BytedanceVideoEtlInfoEntity.java
  4. 292 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouVideoEtlInfoEntity.java
  5. 18 20
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java
  6. 24 73
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  7. 22 17
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java
  8. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java
  9. 123 121
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouAudienceReportDaily.java
  10. 33 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouVideoEtlInfo.java
  11. 63 12
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAccountMapper.xml
  12. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouAccountReportServiceImpl.java
  13. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyAccountServiceImpl.java
  14. 0 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouVideoEtlInfoServiceImpl.java
  15. 0 150
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoEtlInfoController.java
  16. 1 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java
  17. 37 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceVideoEtlInfo.java
  18. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

+ 279 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceVideoEtlInfoController.java

@@ -0,0 +1,279 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.vo.SheetInfoVo;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceVideoEtlInfo;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.metadata.Sheet;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.excelutil.entity.BytedanceVideoEtlInfoEntity;
+import org.jeecg.modules.excelutil.entity.KuaishouXxlEntity;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.*;
+
+/**
+ * 头条视频信息清洗
+ * @author jeecg-boot
+ * @date   2020-12-25
+ * @version V1.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/bytedanceVideoEtlInfo")
+public class BytedanceVideoEtlInfoController {
+	@Autowired
+	private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param bytedanceVideoEtlInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<BytedanceVideoEtlInfo>> queryPageList(BytedanceVideoEtlInfo bytedanceVideoEtlInfo,
+															  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															  HttpServletRequest req) {
+		Result<IPage<BytedanceVideoEtlInfo>> result = new Result<>();
+		String type = bytedanceVideoEtlInfo.getType();
+		bytedanceVideoEtlInfo.setType(null);
+		String startDate = bytedanceVideoEtlInfo.getStartDate();
+		bytedanceVideoEtlInfo.setStartDate(null);
+		String endDate = bytedanceVideoEtlInfo.getEndDate();
+		bytedanceVideoEtlInfo.setEndDate(null);
+		QueryWrapper<BytedanceVideoEtlInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceVideoEtlInfo, req.getParameterMap());
+		if(null!=type&&!type.equals("")){
+			if(type.trim().equals("valid")){
+				//有效
+				if(null!=startDate&&!"".equals(startDate.trim())){
+					queryWrapper.gt("effect_date",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("effect_date",startDate);
+				}
+				queryWrapper.lt("effect_day_num",7);
+			}else if(type.trim().equals("hot")){
+				//爆款
+				if(null!=startDate&&!"faddish_date".equals(startDate.trim())){
+					queryWrapper.gt("",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("faddish_date",startDate);
+				}
+				queryWrapper.lt("faddish_day_num",30);
+			}else {
+				//上线
+				if(null!=startDate&&!"".equals(startDate.trim())){
+					queryWrapper.gt("state_date",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("state_date",startDate);
+				}
+			}
+		}
+		queryWrapper.orderByDesc("total_cost");
+		Page<BytedanceVideoEtlInfo> page = new Page<BytedanceVideoEtlInfo>(pageNo, pageSize);
+		IPage<BytedanceVideoEtlInfo> pageList = bytedanceVideoEtlInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param bytedanceVideoEtlInfo
+	 * @return
+	 */
+	@PostMapping(value = "/add")
+	public Result<BytedanceVideoEtlInfo> add(@RequestBody BytedanceVideoEtlInfo bytedanceVideoEtlInfo) {
+		Result<BytedanceVideoEtlInfo> result = new Result<>();
+		try {
+			bytedanceVideoEtlInfoService.save(bytedanceVideoEtlInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param bytedanceVideoEtlInfo
+	 * @return
+	 */
+	@PutMapping(value = "/edit")
+	public Result<BytedanceVideoEtlInfo> edit(@RequestBody BytedanceVideoEtlInfo bytedanceVideoEtlInfo) {
+		Result<BytedanceVideoEtlInfo> result = new Result<BytedanceVideoEtlInfo>();
+		BytedanceVideoEtlInfo bytedanceVideoEtlInfoEntity = bytedanceVideoEtlInfoService.getById(bytedanceVideoEtlInfo.getId());
+		if(bytedanceVideoEtlInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = bytedanceVideoEtlInfoService.updateById(bytedanceVideoEtlInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<BytedanceVideoEtlInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<BytedanceVideoEtlInfo> result = new Result<>();
+		BytedanceVideoEtlInfo bytedanceVideoEtlInfo = bytedanceVideoEtlInfoService.getById(id);
+		if(bytedanceVideoEtlInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(bytedanceVideoEtlInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @PostMapping(value = "/exportXls")
+  public void exportXls(BytedanceVideoEtlInfo bytedanceVideoEtlInfo,
+								HttpServletRequest request, HttpServletResponse response)throws Exception {
+      // Step.1 组装查询条件
+	  String type = bytedanceVideoEtlInfo.getType();
+	  bytedanceVideoEtlInfo.setType(null);
+	  String startDate = bytedanceVideoEtlInfo.getStartDate();
+	  bytedanceVideoEtlInfo.setStartDate(null);
+	  String endDate = bytedanceVideoEtlInfo.getEndDate();
+	  bytedanceVideoEtlInfo.setEndDate(null);
+	  QueryWrapper<BytedanceVideoEtlInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceVideoEtlInfo, request.getParameterMap());
+	  if(null!=type&&!type.equals("")){
+		  if(type.trim().equals("valid")){
+			  //有效
+			  if(null!=startDate&&!"".equals(startDate.trim())){
+				  queryWrapper.gt("effect_date",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("effect_date",startDate);
+			  }
+			  queryWrapper.lt("effect_day_num",7);
+		  }else if(type.trim().equals("hot")){
+			  //爆款
+			  if(null!=startDate&&!"faddish_date".equals(startDate.trim())){
+				  queryWrapper.gt("",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("faddish_date",startDate);
+			  }
+			  queryWrapper.lt("faddish_day_num",30);
+		  }else {
+			  //上线
+			  if(null!=startDate&&!"".equals(startDate.trim())){
+				  queryWrapper.gt("state_date",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("state_date",startDate);
+			  }
+		  }
+	  }
+	  queryWrapper.orderByDesc("total_cost");
+	  List<BytedanceVideoEtlInfo> pageList = bytedanceVideoEtlInfoService.list(queryWrapper);
+
+	  //查询总的消耗信息
+	  SheetInfoVo totalSheetVo = new SheetInfoVo<BytedanceVideoEtlInfoEntity>();
+	  List<BytedanceVideoEtlInfoEntity> details = new ArrayList<>();
+	  if(null!=pageList&&!pageList.isEmpty()){
+		pageList.forEach(etlInfo->{
+			details.add(new BytedanceVideoEtlInfoEntity(etlInfo));
+		});
+		totalSheetVo.setDetails(details);
+	  }
+	  totalSheetVo.setSheetName("头条视频数据统计列表");
+	  OutputStream outputStream = response.getOutputStream();
+	  String date = DateUtils.formatDate(new Date());
+	  HttpUtils.setResponseHeader(response, "头条视频数据统计列表" + date + ".xlsx");
+	  ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
+
+	  Sheet sheet = new Sheet(1, 0, BytedanceVideoEtlInfoEntity.class);
+	  sheet.setSheetName(totalSheetVo.getSheetName());
+	  excelWriter.write(totalSheetVo.getDetails(), sheet);
+	  excelWriter.finish();
+	  outputStream.flush();
+	  outputStream.close();
+  }
+
+  /**
+      * 通过excel导入数据
+   *
+   * @param request
+   * @param response
+   * @return
+   */
+  @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+  public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+          MultipartFile file = entity.getValue();
+          ImportParams params = new ImportParams();
+          params.setTitleRows(2);
+          params.setHeadRows(1);
+          params.setNeedSave(true);
+          try {
+              List<BytedanceVideoEtlInfo> listBytedanceVideoEtlInfos = ExcelImportUtil.importExcel(file.getInputStream(), BytedanceVideoEtlInfo.class, params);
+              bytedanceVideoEtlInfoService.saveBatch(listBytedanceVideoEtlInfos);
+              return Result.ok("文件导入成功!数据行数:" + listBytedanceVideoEtlInfos.size());
+          } catch (Exception e) {
+              log.error(e.getMessage(),e);
+              return Result.error("文件导入失败:"+e.getMessage());
+          } finally {
+              try {
+                  file.getInputStream().close();
+              } catch (IOException e) {
+                  e.printStackTrace();
+              }
+          }
+      }
+      return Result.ok("文件导入失败!");
+  }
+
+}

+ 231 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaishouVideoEtlInfoController.java

@@ -0,0 +1,231 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.vo.SheetInfoVo;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouVideoEtlInfoService;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.metadata.Sheet;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.excelutil.entity.BytedanceVideoEtlInfoEntity;
+import org.jeecg.modules.excelutil.entity.KuaishouVideoEtlInfoEntity;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+ /**
+ * 快手视频信息清洗
+ * @author jeecg-boot
+ * @date   2020-12-25
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="快手视频信息清洗")
+@RestController
+@RequestMapping("/ctop/kuaishouVideoEtlInfo")
+public class KuaishouVideoEtlInfoController {
+	@Autowired
+	private IKuaishouVideoEtlInfoService kuaishouVideoEtlInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param kuaishouVideoEtlInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<KuaishouVideoEtlInfo>> queryPageList(KuaishouVideoEtlInfo kuaishouVideoEtlInfo,
+															 @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															 @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															 HttpServletRequest req) {
+		Result<IPage<KuaishouVideoEtlInfo>> result = new Result<>();
+		String type = kuaishouVideoEtlInfo.getType();
+		kuaishouVideoEtlInfo.setType(null);
+		String startDate = kuaishouVideoEtlInfo.getStartDate();
+		kuaishouVideoEtlInfo.setStartDate(null);
+		String endDate = kuaishouVideoEtlInfo.getEndDate();
+		kuaishouVideoEtlInfo.setEndDate(null);
+		QueryWrapper<KuaishouVideoEtlInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouVideoEtlInfo, req.getParameterMap());
+		if(null!=type&&!type.equals("")){
+			if(type.trim().equals("valid")){
+				//有效
+				if(null!=startDate&&!"".equals(startDate.trim())){
+					queryWrapper.gt("effect_date",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("effect_date",startDate);
+				}
+				queryWrapper.lt("effect_day_num",7);
+			}else if(type.trim().equals("hot")){
+				//爆款
+				if(null!=startDate&&!"faddish_date".equals(startDate.trim())){
+					queryWrapper.gt("",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("faddish_date",startDate);
+				}
+				queryWrapper.lt("faddish_day_num",30);
+			}else {
+				//上线
+				if(null!=startDate&&!"".equals(startDate.trim())){
+					queryWrapper.gt("state_date",startDate);
+				}
+				if(null!=endDate&&!"".equals(endDate.trim())){
+					queryWrapper.lt("state_date",startDate);
+				}
+			}
+		}
+		queryWrapper.orderByDesc("total_cost");
+		Page<KuaishouVideoEtlInfo> page = new Page<KuaishouVideoEtlInfo>(pageNo, pageSize);
+		IPage<KuaishouVideoEtlInfo> pageList = kuaishouVideoEtlInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param kuaishouVideoEtlInfo
+	 * @return
+	 */
+	@PostMapping(value = "/add")
+	public Result<KuaishouVideoEtlInfo> add(@RequestBody KuaishouVideoEtlInfo kuaishouVideoEtlInfo) {
+		Result<KuaishouVideoEtlInfo> result = new Result<>();
+		try {
+			kuaishouVideoEtlInfoService.save(kuaishouVideoEtlInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param kuaishouVideoEtlInfo
+	 * @return
+	 */
+	@PutMapping(value = "/edit")
+	public Result<KuaishouVideoEtlInfo> edit(@RequestBody KuaishouVideoEtlInfo kuaishouVideoEtlInfo) {
+		Result<KuaishouVideoEtlInfo> result = new Result<KuaishouVideoEtlInfo>();
+		KuaishouVideoEtlInfo kuaishouVideoEtlInfoEntity = kuaishouVideoEtlInfoService.getById(kuaishouVideoEtlInfo.getId());
+		if(kuaishouVideoEtlInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = kuaishouVideoEtlInfoService.updateById(kuaishouVideoEtlInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<KuaishouVideoEtlInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<KuaishouVideoEtlInfo> result = new Result<>();
+		KuaishouVideoEtlInfo kuaishouVideoEtlInfo = kuaishouVideoEtlInfoService.getById(id);
+		if(kuaishouVideoEtlInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(kuaishouVideoEtlInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+
+  /**
+      * 导出excel
+   *
+   * @param request
+   * @param response
+   */
+  @PostMapping(value = "/exportXls")
+  public void exportXls(KuaishouVideoEtlInfo kuaishouVideoEtlInfo,
+								HttpServletRequest request, HttpServletResponse response) throws Exception{
+	  // Step.1 组装查询条件
+	  // Step.1 组装查询条件
+	  String type = kuaishouVideoEtlInfo.getType();
+	  kuaishouVideoEtlInfo.setType(null);
+	  String startDate = kuaishouVideoEtlInfo.getStartDate();
+	  kuaishouVideoEtlInfo.setStartDate(null);
+	  String endDate = kuaishouVideoEtlInfo.getEndDate();
+	  kuaishouVideoEtlInfo.setEndDate(null);
+	  QueryWrapper<KuaishouVideoEtlInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouVideoEtlInfo, request.getParameterMap());
+	  if(null!=type&&!type.equals("")){
+		  if(type.trim().equals("valid")){
+			  //有效
+			  if(null!=startDate&&!"".equals(startDate.trim())){
+				  queryWrapper.gt("effect_date",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("effect_date",startDate);
+			  }
+			  queryWrapper.lt("effect_day_num",7);
+		  }else if(type.trim().equals("hot")){
+			  //爆款
+			  if(null!=startDate&&!"faddish_date".equals(startDate.trim())){
+				  queryWrapper.gt("",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("faddish_date",startDate);
+			  }
+			  queryWrapper.lt("faddish_day_num",30);
+		  }else {
+			  //上线
+			  if(null!=startDate&&!"".equals(startDate.trim())){
+				  queryWrapper.gt("state_date",startDate);
+			  }
+			  if(null!=endDate&&!"".equals(endDate.trim())){
+				  queryWrapper.lt("state_date",startDate);
+			  }
+		  }
+	  }
+	  queryWrapper.orderByDesc("total_cost");
+	  List<KuaishouVideoEtlInfo> pageList = kuaishouVideoEtlInfoService.list(queryWrapper);
+
+	  //查询总的消耗信息
+	  SheetInfoVo totalSheetVo = new SheetInfoVo<KuaishouVideoEtlInfoEntity>();
+	  List<KuaishouVideoEtlInfoEntity> details = new ArrayList<>();
+	  if(null!=pageList&&!pageList.isEmpty()){
+		  pageList.forEach(etlInfo->{
+			  details.add(new KuaishouVideoEtlInfoEntity(etlInfo));
+		  });
+		  totalSheetVo.setDetails(details);
+	  }
+	  totalSheetVo.setSheetName("头条视频数据统计列表");
+	  OutputStream outputStream = response.getOutputStream();
+	  String date = DateUtils.formatDate(new Date());
+	  HttpUtils.setResponseHeader(response, "头条视频数据统计列表" + date + ".xlsx");
+	  ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
+
+	  Sheet sheet = new Sheet(1, 0, KuaishouVideoEtlInfoEntity.class);
+	  sheet.setSheetName(totalSheetVo.getSheetName());
+	  excelWriter.write(totalSheetVo.getDetails(), sheet);
+	  excelWriter.finish();
+	  outputStream.flush();
+	  outputStream.close();
+  }
+}

+ 257 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/BytedanceVideoEtlInfoEntity.java

@@ -0,0 +1,257 @@
+package org.jeecg.modules.excelutil.entity;
+
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceVideoEtlInfo;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+
+import java.math.BigDecimal;
+
+public class BytedanceVideoEtlInfoEntity extends BaseRowModel {
+    /**视频唯一标识*/
+    @ExcelProperty(value = "视频唯一标识", index = 1)
+    private String videoCode;
+    /**初次产生消耗时间*/
+    @ExcelProperty(value = "视频上线时间", index = 2)
+    private String stateDate;
+    /**url*/
+    @ExcelProperty(value = "视频链接", index = 3)
+    private String url;
+    /**coverUrl*/
+    @ExcelProperty(value = "封面链接", index = 4)
+    private String coverUrl;
+    /**companyName*/
+    @ExcelProperty(value = "所属公司", index = 5)
+    private String companyName;
+    /**planName*/
+    @ExcelProperty(value = "编导名称", index = 6)
+    private String planName;
+    /**clipName*/
+    @ExcelProperty(value = "剪辑名称", index = 7)
+    private String clipName;
+    /**shotName*/
+    @ExcelProperty(value = "拍摄名称", index = 8)
+    private String shotName;
+    /**singleWeekCost*/
+    @ExcelProperty(value = "上线一周消耗", index = 9)
+    private BigDecimal singleWeekCost;
+    /**twoWeekCost*/
+    @ExcelProperty(value = "上线两周消耗", index = 10)
+    private BigDecimal twoWeekCost;
+    /**fourWeekCost*/
+    @ExcelProperty(value = "上线四周消耗", index = 11)
+    private BigDecimal fourWeekCost;
+    /**总消耗*/
+    @ExcelProperty(value = "总消耗", index = 12)
+    private BigDecimal totalCost;
+    /**clickNum*/
+    @ExcelProperty(value = "封面点击数", index = 13)
+    private Long clickNum;
+    /**showNum*/
+    @ExcelProperty(value = "素材曝光数", index = 14)
+    private Long showNum;
+    /**activeNum*/
+    @ExcelProperty(value = "有效数", index = 15)
+    private Long activeNum;
+    /**convertNum*/
+    @ExcelProperty(value = "转化数", index = 16)
+    private Long convertNum;
+    /**effectDate*/
+    @ExcelProperty(value = "达成有效日期", index = 17)
+    private String effectDate;
+    /**faddishDate*/
+    @ExcelProperty(value = "达成爆款日期", index = 18)
+    private String faddishDate;
+    /**effectDayNum*/
+    @ExcelProperty(value = "达成有效天数", index = 19)
+    private Integer effectDayNum;
+    /**faddishDayNum*/
+    @ExcelProperty(value = "达成爆款天数", index = 20)
+    private Integer faddishDayNum;
+
+    public BytedanceVideoEtlInfoEntity(BytedanceVideoEtlInfo etlInfo) {
+        this.videoCode = etlInfo.getVideoCode();
+        this.stateDate = etlInfo.getStateDate();
+        this.url = etlInfo.getUrl();
+        this.coverUrl = etlInfo.getCoverUrl();
+        this.companyName = etlInfo.getCompanyName();
+        this.planName = etlInfo.getPlanName();
+        this.clipName = etlInfo.getClipName();
+        this.shotName = etlInfo.getShotName();
+        this.singleWeekCost = etlInfo.getSingleWeekCost();
+        this.twoWeekCost = etlInfo.getTwoWeekCost();
+        this.fourWeekCost = etlInfo.getFourWeekCost();
+        this.totalCost = etlInfo.getTotalCost();
+        this.clickNum = etlInfo.getClickNum();
+        this.showNum = etlInfo.getShowNum();
+        this.activeNum = etlInfo.getActiveNum();
+        this.convertNum = etlInfo.getConvertNum();
+        this.effectDate = etlInfo.getEffectDate();
+        this.faddishDate = etlInfo.getFaddishDate();
+        this.effectDayNum = etlInfo.getEffectDayNum();
+        this.faddishDayNum = etlInfo.getFaddishDayNum();
+    }
+
+    public BytedanceVideoEtlInfoEntity() {
+
+    }
+
+    public String getVideoCode() {
+        return videoCode;
+    }
+
+    public void setVideoCode(String videoCode) {
+        this.videoCode = videoCode;
+    }
+
+    public String getStateDate() {
+        return stateDate;
+    }
+
+    public void setStateDate(String stateDate) {
+        this.stateDate = stateDate;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getCoverUrl() {
+        return coverUrl;
+    }
+
+    public void setCoverUrl(String coverUrl) {
+        this.coverUrl = coverUrl;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getPlanName() {
+        return planName;
+    }
+
+    public void setPlanName(String planName) {
+        this.planName = planName;
+    }
+
+    public String getClipName() {
+        return clipName;
+    }
+
+    public void setClipName(String clipName) {
+        this.clipName = clipName;
+    }
+
+    public String getShotName() {
+        return shotName;
+    }
+
+    public void setShotName(String shotName) {
+        this.shotName = shotName;
+    }
+
+    public BigDecimal getSingleWeekCost() {
+        return singleWeekCost;
+    }
+
+    public void setSingleWeekCost(BigDecimal singleWeekCost) {
+        this.singleWeekCost = singleWeekCost;
+    }
+
+    public BigDecimal getTwoWeekCost() {
+        return twoWeekCost;
+    }
+
+    public void setTwoWeekCost(BigDecimal twoWeekCost) {
+        this.twoWeekCost = twoWeekCost;
+    }
+
+    public BigDecimal getFourWeekCost() {
+        return fourWeekCost;
+    }
+
+    public void setFourWeekCost(BigDecimal fourWeekCost) {
+        this.fourWeekCost = fourWeekCost;
+    }
+
+    public BigDecimal getTotalCost() {
+        return totalCost;
+    }
+
+    public void setTotalCost(BigDecimal totalCost) {
+        this.totalCost = totalCost;
+    }
+
+    public Long getClickNum() {
+        return clickNum;
+    }
+
+    public void setClickNum(Long clickNum) {
+        this.clickNum = clickNum;
+    }
+
+    public Long getShowNum() {
+        return showNum;
+    }
+
+    public void setShowNum(Long showNum) {
+        this.showNum = showNum;
+    }
+
+    public Long getActiveNum() {
+        return activeNum;
+    }
+
+    public void setActiveNum(Long activeNum) {
+        this.activeNum = activeNum;
+    }
+
+    public Long getConvertNum() {
+        return convertNum;
+    }
+
+    public void setConvertNum(Long convertNum) {
+        this.convertNum = convertNum;
+    }
+
+    public String getEffectDate() {
+        return effectDate;
+    }
+
+    public void setEffectDate(String effectDate) {
+        this.effectDate = effectDate;
+    }
+
+    public String getFaddishDate() {
+        return faddishDate;
+    }
+
+    public void setFaddishDate(String faddishDate) {
+        this.faddishDate = faddishDate;
+    }
+
+    public Integer getEffectDayNum() {
+        return effectDayNum;
+    }
+
+    public void setEffectDayNum(Integer effectDayNum) {
+        this.effectDayNum = effectDayNum;
+    }
+
+    public Integer getFaddishDayNum() {
+        return faddishDayNum;
+    }
+
+    public void setFaddishDayNum(Integer faddishDayNum) {
+        this.faddishDayNum = faddishDayNum;
+    }
+}

+ 292 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/excelutil/entity/KuaishouVideoEtlInfoEntity.java

@@ -0,0 +1,292 @@
+package org.jeecg.modules.excelutil.entity;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceVideoEtlInfo;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+
+import java.math.BigDecimal;
+
+public class KuaishouVideoEtlInfoEntity extends BaseRowModel {
+    /**
+     * 视频唯一标识
+     */
+    @ExcelProperty(value = "视频唯一标识", index = 1)
+    private String videoCode;
+    /**
+     * 初次产生消耗时间
+     */
+    @ExcelProperty(value = "视频上线时间", index = 2)
+    private String stateDate;
+    /**
+     * url
+     */
+    @ExcelProperty(value = "视频链接", index = 3)
+    private String url;
+    /**
+     * coverUrl
+     */
+    @ExcelProperty(value = "封面链接", index = 4)
+    private String coverUrl;
+    /**
+     * companyName
+     */
+    @ExcelProperty(value = "所属公司", index = 5)
+    private String companyName;
+    /**
+     * planName
+     */
+    @ExcelProperty(value = "编导名称", index = 5)
+    private String planName;
+    /**
+     * clipName
+     */
+    @ExcelProperty(value = "剪辑名称", index = 7)
+    private String clipName;
+    /**
+     * shotName
+     */
+    @ExcelProperty(value = "拍摄名称", index = 8)
+    private String shotName;
+    /**
+     * singleWeekCost
+     */
+    @ExcelProperty(value = "上线一周消耗", index = 9)
+    private BigDecimal singleWeekCost;
+    /**
+     * twoWeekCost
+     */
+    @ExcelProperty(value = "上线两周消耗", index = 10)
+    private BigDecimal twoWeekCost;
+    /**
+     * fourWeekCost
+     */
+    @ExcelProperty(value = "上线四周消耗", index = 11)
+    private BigDecimal fourWeekCost;
+    /**
+     * 总消耗
+     */
+    @ExcelProperty(value = "总消耗", index = 12)
+    private BigDecimal totalCost;
+    /**
+     * clickNum
+     */
+    @ExcelProperty(value = "封面曝光数", index = 13)
+    private Long photoShow;
+    @ExcelProperty(value = "封面点击数", index = 14)
+    private Long photoClick;
+    @ExcelProperty(value = "素材曝光数", index = 15)
+    private Long aclick;
+    /**
+     * convertNum
+     */
+    @ExcelProperty(value = "行为数", index = 16)
+    private Long bclick;
+    /**
+     * effectDate
+     */
+    @ExcelProperty(value = "达成有效日期", index = 17)
+    private String effectDate;
+    /**
+     * faddishDate
+     */
+    @ExcelProperty(value = "达成爆款日期", index = 18)
+    private String faddishDate;
+    /**
+     * effectDayNum
+     */
+    @ExcelProperty(value = "达成有效天数", index = 19)
+    private Integer effectDayNum;
+    /**
+     * faddishDayNum
+     */
+    @ExcelProperty(value = "达成爆款天数", index = 20)
+    private Integer faddishDayNum;
+
+    public KuaishouVideoEtlInfoEntity(KuaishouVideoEtlInfo etlInfo) {
+        this.videoCode = etlInfo.getVideoCode();
+        this.stateDate = etlInfo.getStateDate();
+        this.url = etlInfo.getUrl();
+        this.coverUrl = etlInfo.getCoverUrl();
+        this.companyName = etlInfo.getCompanyName();
+        this.planName = etlInfo.getPlanName();
+        this.clipName = etlInfo.getClipName();
+        this.shotName = etlInfo.getShotName();
+        this.singleWeekCost = etlInfo.getSingleWeekCost();
+        this.twoWeekCost = etlInfo.getTwoWeekCost();
+        this.fourWeekCost = etlInfo.getFourWeekCost();
+        this.totalCost = etlInfo.getTotalCost();
+        this.photoClick = etlInfo.getPhotoClick();
+        this.photoShow = etlInfo.getPhotoShow();
+        this.aclick = etlInfo.getAclick();
+        this.bclick = etlInfo.getBclick();
+        this.effectDate = etlInfo.getEffectDate();
+        this.faddishDate = etlInfo.getFaddishDate();
+        this.effectDayNum = etlInfo.getEffectDayNum();
+        this.faddishDayNum = etlInfo.getFaddishDayNum();
+    }
+
+    public KuaishouVideoEtlInfoEntity() {
+
+    }
+
+    public String getVideoCode() {
+        return videoCode;
+    }
+
+    public void setVideoCode(String videoCode) {
+        this.videoCode = videoCode;
+    }
+
+    public String getStateDate() {
+        return stateDate;
+    }
+
+    public void setStateDate(String stateDate) {
+        this.stateDate = stateDate;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getCoverUrl() {
+        return coverUrl;
+    }
+
+    public void setCoverUrl(String coverUrl) {
+        this.coverUrl = coverUrl;
+    }
+
+    public String getCompanyName() {
+        return companyName;
+    }
+
+    public void setCompanyName(String companyName) {
+        this.companyName = companyName;
+    }
+
+    public String getPlanName() {
+        return planName;
+    }
+
+    public void setPlanName(String planName) {
+        this.planName = planName;
+    }
+
+    public String getClipName() {
+        return clipName;
+    }
+
+    public void setClipName(String clipName) {
+        this.clipName = clipName;
+    }
+
+    public String getShotName() {
+        return shotName;
+    }
+
+    public void setShotName(String shotName) {
+        this.shotName = shotName;
+    }
+
+    public BigDecimal getSingleWeekCost() {
+        return singleWeekCost;
+    }
+
+    public void setSingleWeekCost(BigDecimal singleWeekCost) {
+        this.singleWeekCost = singleWeekCost;
+    }
+
+    public BigDecimal getTwoWeekCost() {
+        return twoWeekCost;
+    }
+
+    public void setTwoWeekCost(BigDecimal twoWeekCost) {
+        this.twoWeekCost = twoWeekCost;
+    }
+
+    public BigDecimal getFourWeekCost() {
+        return fourWeekCost;
+    }
+
+    public void setFourWeekCost(BigDecimal fourWeekCost) {
+        this.fourWeekCost = fourWeekCost;
+    }
+
+    public BigDecimal getTotalCost() {
+        return totalCost;
+    }
+
+    public void setTotalCost(BigDecimal totalCost) {
+        this.totalCost = totalCost;
+    }
+
+    public Long getPhotoShow() {
+        return photoShow;
+    }
+
+    public void setPhotoShow(Long photoShow) {
+        this.photoShow = photoShow;
+    }
+
+    public Long getPhotoClick() {
+        return photoClick;
+    }
+
+    public void setPhotoClick(Long photoClick) {
+        this.photoClick = photoClick;
+    }
+
+    public Long getAclick() {
+        return aclick;
+    }
+
+    public void setAclick(Long aclick) {
+        this.aclick = aclick;
+    }
+
+    public Long getBclick() {
+        return bclick;
+    }
+
+    public void setBclick(Long bclick) {
+        this.bclick = bclick;
+    }
+
+    public String getEffectDate() {
+        return effectDate;
+    }
+
+    public void setEffectDate(String effectDate) {
+        this.effectDate = effectDate;
+    }
+
+    public String getFaddishDate() {
+        return faddishDate;
+    }
+
+    public void setFaddishDate(String faddishDate) {
+        this.faddishDate = faddishDate;
+    }
+
+    public Integer getEffectDayNum() {
+        return effectDayNum;
+    }
+
+    public void setEffectDayNum(Integer effectDayNum) {
+        this.effectDayNum = effectDayNum;
+    }
+
+    public Integer getFaddishDayNum() {
+        return faddishDayNum;
+    }
+
+    public void setFaddishDayNum(Integer faddishDayNum) {
+        this.faddishDayNum = faddishDayNum;
+    }
+}

+ 18 - 20
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java

@@ -4,12 +4,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouSchedule;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
@@ -26,11 +21,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -297,7 +288,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
         String bidTypeStr = json.getString("bidType"); // 出价方式
         JSONArray bidTypeArr = JSONArray.parseArray(bidTypeStr);
         String ocpxActionTypeStr = json.getString("ocpxActionType"); // 优化目标
-        JSONArray bidArr = JSONArray.parseArray(ocpxActionTypeStr);
+        JSONArray ocpxArr = JSONArray.parseArray(ocpxActionTypeStr);
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             List<KuaiShouAppInfo> appInfos = new ArrayList<>();
@@ -317,14 +308,6 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                     Integer put_status = detail.getInteger("put_status");
                     if (put_status == 1) { // 组状态为 投放中的
                         if (status != 15) { // 广告组状态为非暂停
-                            Boolean ocpxTrueOrFalse = false;
-                            for (int j = 0; j < bidArr.size(); j++) {
-                                Integer ocpxActionType = (Integer) bidArr.get(j);
-                                if (ocpxActionType.equals(ocpx_action_type)) {
-                                    ocpxTrueOrFalse = true;
-                                    break;
-                                }
-                            }
                             Boolean bidTypeTrueOrFalse = false;
                             for (int j = 0; j < bidTypeArr.size(); j++) {
                                 Integer bidType = (Integer) bidTypeArr.get(j);
@@ -333,6 +316,21 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                                     break;
                                 }
                             }
+
+                            Boolean ocpxTrueOrFalse = false;
+                            if (ocpx_action_type == 0) {
+                                ocpxTrueOrFalse = true;
+                            } else {
+                                for (int j = 0; j < ocpxArr.size(); j++) {
+                                    Integer ocpxActionType = (Integer) ocpxArr.get(j);
+                                    if (ocpxActionType.equals(ocpx_action_type)) {
+                                        ocpxTrueOrFalse = true;
+                                        break;
+                                    }
+                                }
+                            }
+
+
                             if (!bidTypeTrueOrFalse || !ocpxTrueOrFalse) { // 出价方式设置非法
                                 if (day_budget > 500 * 1000 || day_budget == 0) { // 预算大于500 或者不限制预算 需要发送通知 并且进行暂停操作
                                     executorBidTypeService.submit(new Runnable() {

+ 24 - 73
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -4,69 +4,18 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.JsonUtil;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouConversionInfos;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouConversionTypes;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyFlows;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouConversionInfosMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouConversionTypesMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyFlowsService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
-import cn.com.ctop.kuaishou.modules.batch.service.IWarningOperationService;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeStatisticService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -100,11 +49,7 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -1016,9 +961,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     returnMap.put("success", true);
                     // 创建成功 拉取广告组信息
 
-                    Thread thread = new Thread(){
+                    Thread thread = new Thread() {
                         @Override
-                        public void run(){
+                        public void run() {
                             try {
                                 Thread.sleep(500);
                             } catch (InterruptedException e) {
@@ -1291,7 +1236,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         String bidTypeStr = json.getString("bidType"); // 出价方式
         JSONArray bidTypeArr = JSONArray.parseArray(bidTypeStr);
         String ocpxActionTypeStr = json.getString("ocpxActionType"); // 优化目标
-        JSONArray bidArr = JSONArray.parseArray(ocpxActionTypeStr);
+        JSONArray ocpxArr = JSONArray.parseArray(ocpxActionTypeStr);
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
@@ -1308,14 +1253,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     Integer put_status = detail.getInteger("put_status");
                     if (put_status == 1) { // 组状态为 投放中的
                         if (status != 15) { // 广告组状态为非暂停
-                            Boolean ocpxTrueOrFalse = false;
-                            for (int j = 0; j < bidArr.size(); j++) {
-                                Integer ocpxActionType = (Integer) bidArr.get(j);
-                                if (ocpxActionType.equals(ocpx_action_type)) {
-                                    ocpxTrueOrFalse = true;
-                                    break;
-                                }
-                            }
                             Boolean bidTypeTrueOrFalse = false;
                             for (int j = 0; j < bidTypeArr.size(); j++) {
                                 Integer bidType = (Integer) bidTypeArr.get(j);
@@ -1324,6 +1261,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                     break;
                                 }
                             }
+                            Boolean ocpxTrueOrFalse = false;
+                            if (ocpx_action_type == 0) {
+                                ocpxTrueOrFalse = true;
+                            } else {
+                                for (int j = 0; j < ocpxArr.size(); j++) {
+                                    Integer ocpxActionType = (Integer) ocpxArr.get(j);
+                                    if (ocpxActionType.equals(ocpx_action_type)) {
+                                        ocpxTrueOrFalse = true;
+                                        break;
+                                    }
+                                }
+                            }
+
+
                             if (!bidTypeTrueOrFalse || !ocpxTrueOrFalse) { // 出价方式设置非法
                                 if (day_budget > 500 * 1000 || day_budget == 0) { // 预算大于500 或者不限制预算 需要发送通知 并且进行暂停操作
                                     executorBidTypeService.submit(new Runnable() {

+ 22 - 17
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java

@@ -16,7 +16,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- *  Created by JQ.bi on 2020.11.2
+ * Created by JQ.bi on 2020.11.2
  */
 @Slf4j
 @RestController
@@ -34,24 +34,29 @@ public class KsNewPlanReportCtrl {
         Result<Map<String, Object>> resultBody = new Result<>();
         Map<String, Object> result = new HashMap<>();
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        String userId= requestBody.getString("userId");
-        if(!userId.isEmpty()){
-            accountIds= newPlanReportService.getAccountIdsByUserId(userId);
-        }
-        if(accountIds.isEmpty()){
-            return resultBody;
+        String userId = requestBody.getString("userId");
+        //TODO 没有维护快手事业部负责人角色,增加判断
+        if (userId.equals("6b4c821adc414dc8b7718ab63ccbfcaf")) {
+            accountIds = newPlanReportService.getAccountIdsByMedia();
+        } else {
+            if (!userId.isEmpty()) {
+                accountIds = newPlanReportService.getAccountIdsByUserId(userId);
+            }
+            if (accountIds.isEmpty()) {
+                return resultBody;
+            }
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
             JSONObject sumData = newPlanReportService.getSumNewPlanBy(accountIds, startDate, endDate);
             List<JSONObject> chartData = newPlanReportService.getKsNewPlanGroupByStatDate(accountIds, startDate, endDate);
-            List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate,target,order);
-            result.put("sumData",sumData);
-            result.put("chartData",chartData);
-            result.put("listData",listData);
+            List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
+            result.put("sumData", sumData);
+            result.put("chartData", chartData);
+            result.put("listData", listData);
             resultBody.setResult(result);
             resultBody.setSuccess(true);
         } catch (Exception e) {
@@ -69,15 +74,15 @@ public class KsNewPlanReportCtrl {
         Result<List<JSONObject>> result = new Result<>();
 
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
-        if(accountIds.isEmpty()){
+        if (accountIds.isEmpty()) {
             return result;
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        String target= requestBody.getString("target");
-        String order= requestBody.getString("order");
+        String target = requestBody.getString("target");
+        String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate,target,order);
+            List<JSONObject> listData = newPlanReportService.getKsNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsVideoReportCtrl.java

@@ -116,7 +116,7 @@ public class KsVideoReportCtrl {
             columns.add("cost");
         }
         String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapKs, columns);
-        List<String> titles = new ArrayList<>();
+        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapKs, columns));
         //此处增加两个元素是为了保证数据顺序
         if("exportDetail".equals(exportType)){
             titles.add(0,"客户");

+ 123 - 121
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouAudienceReportDaily.java

@@ -12,6 +12,8 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.math.BigDecimal;
+
 /**
  * 人群分析报表
  *
@@ -30,13 +32,13 @@ public class KuaishouAudienceReportDaily {
      */
     @TableId(type = IdType.INPUT)
     @ApiModelProperty(value = "id")
-    private java.lang.Long id;
+    private Long id;
     /**
      * 账户ID
      */
     @Excel(name = "账户ID", width = 15)
     @ApiModelProperty(value = "账户ID")
-    private java.lang.Long accountId;
+    private Long accountId;
 
     private Long unitId;
 
@@ -46,703 +48,703 @@ public class KuaishouAudienceReportDaily {
      */
     @Excel(name = "placementType", width = 15)
     @ApiModelProperty(value = "placementType")
-    private java.lang.String placementType;
+    private String placementType;
     /**
      * 日期
      */
     @Excel(name = "日期", width = 15)
     @ApiModelProperty(value = "日期")
-    private java.lang.String statDate;
+    private String statDate;
     /**
      * 素材曝光数
      */
     @Excel(name = "素材曝光数", width = 15)
     @ApiModelProperty(value = "素材曝光数")
-    private java.lang.Long aclick;
+    private Long aclick;
     /**
      * 行为数
      */
     @Excel(name = "行为数", width = 15)
     @ApiModelProperty(value = "行为数")
-    private java.lang.Long bclick;
+    private Long bclick;
     /**
      * 封面点成本
      */
     @Excel(name = "封面点成本", width = 15)
     @ApiModelProperty(value = "封面点成本")
-    private java.lang.Double photoClickCost;
+    private Double photoClickCost;
     /**
      * 新增关注数
      */
     @Excel(name = "新增关注数", width = 15)
     @ApiModelProperty(value = "新增关注数")
-    private java.lang.Long follow;
+    private Long follow;
     /**
      * 取消关注数
      */
     @Excel(name = "取消关注数", width = 15)
     @ApiModelProperty(value = "取消关注数")
-    private java.lang.Long cancelFollow;
+    private Long cancelFollow;
     /**
      * 举报数
      */
     @Excel(name = "举报数", width = 15)
     @ApiModelProperty(value = "举报数")
-    private java.lang.Long report;
+    private Long report;
     /**
      * 拉黑数
      */
     @Excel(name = "拉黑数", width = 15)
     @ApiModelProperty(value = "拉黑数")
-    private java.lang.Long block;
+    private Long block;
     /**
      * 减少此类作品数
      */
     @Excel(name = "减少此类作品数", width = 15)
     @ApiModelProperty(value = "减少此类作品数")
-    private java.lang.Long negative;
+    private Long negative;
     /**
      * 应用下载数据-安卓下载开始数
      */
     @Excel(name = "应用下载数据-安卓下载开始数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载开始数")
-    private java.lang.Long downloadStarted;
+    private Long downloadStarted;
     /**
      * 应用下载数据-安卓下载完成数
      */
     @Excel(name = "应用下载数据-安卓下载完成数", width = 15)
     @ApiModelProperty(value = "应用下载数据-安卓下载完成数")
-    private java.lang.Long downloadCompleted;
+    private Long downloadCompleted;
     /**
      * 应用下载数据-激活数
      */
     @Excel(name = "应用下载数据-激活数", width = 15)
     @ApiModelProperty(value = "应用下载数据-激活数")
-    private java.lang.Long activation;
+    private Long activation;
     /**
      * 提交按钮点击数
      */
     @Excel(name = "提交按钮点击数", width = 15)
     @ApiModelProperty(value = "提交按钮点击数")
-    private java.lang.Long submit;
+    private Long submit;
     /**
      * 封面点击数
      */
     @Excel(name = "封面点击数", width = 15)
     @ApiModelProperty(value = "封面点击数")
-    private java.lang.Long photoClick;
+    private Long photoClick;
     /**
      * 封面点击率
      */
     @Excel(name = "封面点击率", width = 15)
     @ApiModelProperty(value = "封面点击率")
-    private java.lang.Double photoClickRatio;
+    private Double photoClickRatio;
     /**
      * 花费
      */
     @Excel(name = "花费", width = 15)
     @ApiModelProperty(value = "花费")
-    private java.lang.Double charge;
+    private Double charge;
     /**
      * 行为率
      */
     @Excel(name = "行为率", width = 15)
     @ApiModelProperty(value = "行为率")
-    private java.lang.Double actionRatio;
+    private Double actionRatio;
     /**
      * 平均千次曝光花费(元)
      */
     @Excel(name = "平均千次曝光花费(元)", width = 15)
     @ApiModelProperty(value = "平均千次曝光花费(元)")
-    private java.math.BigDecimal impression_1kCost;
+    private BigDecimal impression_1kCost;
     /**
      * 平均行为单价(元)
      */
     @Excel(name = "平均行为单价(元)", width = 15)
     @ApiModelProperty(value = "平均行为单价(元)")
-    private java.math.BigDecimal actionCost;
+    private BigDecimal actionCost;
     /**
      * 应用下载数据-首日付费次数
      */
     @Excel(name = "应用下载数据-首日付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费次数")
-    private java.lang.Long eventPayFirstDay;
+    private Long eventPayFirstDay;
     /**
      * 应用下载数据-首日付费金额
      */
     @Excel(name = "应用下载数据-首日付费金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日付费金额")
-    private java.math.BigDecimal eventPayPurchaseAmountFirstDay;
+    private BigDecimal eventPayPurchaseAmountFirstDay;
     /**
      * 应用下载数据-首日ROI
      */
     @Excel(name = "应用下载数据-首日ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-首日ROI")
-    private java.lang.Double eventPayFirstDayRoi;
+    private Double eventPayFirstDayRoi;
     /**
      * 应用下载数据-付费次数
      */
     @Excel(name = "应用下载数据-付费次数", width = 15)
     @ApiModelProperty(value = "应用下载数据-付费次数")
-    private java.lang.Long eventPay;
+    private Long eventPay;
     /**
      * 应用下载数据-付费金额
      */
     @Excel(name = "应用下载数据-付费金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-付费金额")
-    private java.math.BigDecimal eventPayPurchaseAmount;
+    private BigDecimal eventPayPurchaseAmount;
     /**
      * 应用下载数据-ROI
      */
     @Excel(name = "应用下载数据-ROI", width = 15)
     @ApiModelProperty(value = "应用下载数据-ROI")
-    private java.lang.Double eventPayRoi;
+    private Double eventPayRoi;
     /**
      * 应用下载数据-注册数
      */
     @Excel(name = "应用下载数据-注册数", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册数")
-    private java.lang.Long eventRegister;
+    private Long eventRegister;
     /**
      * 应用下载数据-注册成本
      */
     @Excel(name = "应用下载数据-注册成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册成本")
-    private java.math.BigDecimal eventRegisterCost;
+    private BigDecimal eventRegisterCost;
     /**
      * 应用下载数据-注册率
      */
     @Excel(name = "应用下载数据-注册率", width = 15)
     @ApiModelProperty(value = "应用下载数据-注册率")
-    private java.lang.Double eventRegisterRatio;
+    private Double eventRegisterRatio;
     /**
      * 应用下载数据-完件数
      */
     @Excel(name = "应用下载数据-完件数", width = 15)
     @ApiModelProperty(value = "应用下载数据-完件数")
-    private java.lang.Long eventJinJianApp;
+    private Long eventJinJianApp;
     /**
      * 应用下载数据-完件成本
      */
     @Excel(name = "应用下载数据-完件成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-完件成本")
-    private java.math.BigDecimal eventJinJianAppCost;
+    private BigDecimal eventJinJianAppCost;
     /**
      * 应用下载数据-授信数
      */
     @Excel(name = "应用下载数据-授信数", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信数")
-    private java.lang.Long eventCreditGrantApp;
+    private Long eventCreditGrantApp;
     /**
      * 应用下载数据-授信成本
      */
     @Excel(name = "应用下载数据-授信成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信成本")
-    private java.math.BigDecimal eventCreditGrantAppCost;
+    private BigDecimal eventCreditGrantAppCost;
     /**
      * 应用下载数据-付款成功数
      */
     @Excel(name = "应用下载数据-付款成功数", width = 15)
     @ApiModelProperty(value = "应用下载数据-付款成功数")
-    private java.lang.Long eventOrderPaid;
+    private Long eventOrderPaid;
     /**
      * 应用下载数据-付款成功金额
      */
     @Excel(name = "应用下载数据-付款成功金额", width = 15)
     @ApiModelProperty(value = "应用下载数据-付款成功金额")
-    private java.math.BigDecimal eventOrderPaidPurchaseAmount;
+    private BigDecimal eventOrderPaidPurchaseAmount;
     /**
      * 落地页数据-落地页完件数
      */
     @Excel(name = "落地页数据-落地页完件数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页完件数")
-    private java.lang.Long eventJinJianLandingPage;
+    private Long eventJinJianLandingPage;
     /**
      * 落地页数据-落地页完件成本
      */
     @Excel(name = "落地页数据-落地页完件成本", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页完件成本")
-    private java.math.BigDecimal eventJinJianLandingPageCost;
+    private BigDecimal eventJinJianLandingPageCost;
     /**
      * 落地页数据-落地页授信数
      */
     @Excel(name = "落地页数据-落地页授信数", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信数")
-    private java.lang.Long eventCreditGrantLandingPage;
+    private Long eventCreditGrantLandingPage;
     /**
      * 落地页数据-落地页授信成本
      */
     @Excel(name = "落地页数据-落地页授信成本", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信成本")
-    private java.math.BigDecimal eventCreditGrantLandingPageCost;
+    private BigDecimal eventCreditGrantLandingPageCost;
     /**
      * 落地页数据-落地页授信率
      */
     @Excel(name = "落地页数据-落地页授信率", width = 15)
     @ApiModelProperty(value = "落地页数据-落地页授信率")
-    private java.lang.Double eventCreditGrantLandingRatio;
+    private Double eventCreditGrantLandingRatio;
     /**
      * 应用下载数据-次留成本(仅支持分日查询)
      */
     @Excel(name = "应用下载数据-次留成本(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留成本(仅支持分日查询)")
-    private java.math.BigDecimal eventNextDayStayCost;
+    private BigDecimal eventNextDayStayCost;
     /**
      * 应用下载数据-次留率(仅支持分日查询)
      */
     @Excel(name = "应用下载数据-次留率(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留率(仅支持分日查询)")
-    private java.math.BigDecimal eventNextDayStayRatio;
+    private BigDecimal eventNextDayStayRatio;
     /**
      * 落地页数据-表单提交点击率
      */
     @Excel(name = "落地页数据-表单提交点击率", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交点击率")
-    private java.lang.Double formActionRatio;
+    private Double formActionRatio;
     /**
      * 应用下载数据-单次付款成本
      */
     @Excel(name = "应用下载数据-单次付款成本", width = 15)
     @ApiModelProperty(value = "应用下载数据-单次付款成本")
-    private java.math.BigDecimal eventOrderPaidCost;
+    private BigDecimal eventOrderPaidCost;
     /**
      * 应用下载数据-次留数(仅支持分日查询)
      */
     @Excel(name = "应用下载数据-次留数(仅支持分日查询)", width = 15)
     @ApiModelProperty(value = "应用下载数据-次留数(仅支持分日查询)")
-    private java.lang.Long eventNextDayStay;
+    private Long eventNextDayStay;
     /**
      * 落地页数据-表单提交单价
      */
     @Excel(name = "落地页数据-表单提交单价", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交单价")
-    private java.math.BigDecimal formCost;
+    private BigDecimal formCost;
     /**
      * 落地页数据-表单提交数
      */
     @Excel(name = "落地页数据-表单提交数", width = 15)
     @ApiModelProperty(value = "落地页数据-表单提交数")
-    private java.lang.Long formCount;
+    private Long formCount;
     /**
      * 3s播放率
      */
     @Excel(name = "3s播放率", width = 15)
     @ApiModelProperty(value = "3s播放率")
-    private java.lang.Double play_3sRatio;
+    private Double play_3sRatio;
     /**
      * 数据小时
      */
     @Excel(name = "数据小时", width = 15)
     @ApiModelProperty(value = "数据小时")
-    private java.lang.Long statHour;
+    private Long statHour;
     /**
      * click1kCost
      */
     @Excel(name = "click1kCost", width = 15)
     @ApiModelProperty(value = "click1kCost")
-    private java.lang.String click_1kCost;
+    private String click_1kCost;
     /**
      * 落地页数据-有效线索数
      */
     @Excel(name = "落地页数据-有效线索数", width = 15)
     @ApiModelProperty(value = "落地页数据-有效线索数")
-    private java.lang.Long eventValidClues;
+    private Long eventValidClues;
     /**
      * 落地页数据-有效线索成本
      */
     @Excel(name = "落地页数据-有效线索成本", width = 15)
     @ApiModelProperty(value = "落地页数据-有效线索成本")
-    private java.math.BigDecimal eventValidCluesCost;
+    private BigDecimal eventValidCluesCost;
     /**
      * 商品成交数
      */
     @Excel(name = "商品成交数", width = 15)
     @ApiModelProperty(value = "商品成交数")
-    private java.lang.Long adProductCnt;
+    private Long adProductCnt;
     /**
      * 商品访问数
      */
     @Excel(name = "商品访问数", width = 15)
     @ApiModelProperty(value = "商品访问数")
-    private java.lang.Long eventGoodsView;
+    private Long eventGoodsView;
     /**
      * 涨粉量
      */
     @Excel(name = "涨粉量", width = 15)
     @ApiModelProperty(value = "涨粉量")
-    private java.lang.Long merchantRecoFans;
+    private Long merchantRecoFans;
     /**
      * 涨粉量
      */
     @Excel(name = "涨粉量", width = 15)
     @ApiModelProperty(value = "涨粉量")
-    private java.lang.Long eventOrderAmountRoi;
+    private Long eventOrderAmountRoi;
     /**
      * 新增付费人数
      */
     @Excel(name = "新增付费人数", width = 15)
     @ApiModelProperty(value = "新增付费人数")
-    private java.lang.Long eventNewUserPay;
+    private Long eventNewUserPay;
     /**
      * 新增付费人数成本:当日消耗 / 当日新增
      */
     @Excel(name = "新增付费人数成本:当日消耗 / 当日新增", width = 15)
     @ApiModelProperty(value = "新增付费人数成本:当日消耗 / 当日新增")
-    private java.math.BigDecimal eventNewUserPayCost;
+    private BigDecimal eventNewUserPayCost;
     /**
      * 新增付费人数率:当日新增付费人数 / 当日行为数
      */
     @Excel(name = "新增付费人数率:当日新增付费人数 / 当日行为数", width = 15)
     @ApiModelProperty(value = "新增付费人数率:当日新增付费人数 / 当日行为数")
-    private java.math.BigDecimal eventNewUserPayRatio;
+    private BigDecimal eventNewUserPayRatio;
     /**
      * 按钮点击数
      */
     @Excel(name = "按钮点击数", width = 15)
     @ApiModelProperty(value = "按钮点击数")
-    private java.lang.Long eventButtonClick;
+    private Long eventButtonClick;
     /**
      * 按钮点击成本
      */
     @Excel(name = "按钮点击成本", width = 15)
     @ApiModelProperty(value = "按钮点击成本")
-    private java.math.BigDecimal eventButtonClickCost;
+    private BigDecimal eventButtonClickCost;
     /**
      * 按钮点击成率
      */
     @Excel(name = "按钮点击成率", width = 15)
     @ApiModelProperty(value = "按钮点击成率")
-    private java.math.BigDecimal eventButtonClickRatio;
+    private BigDecimal eventButtonClickRatio;
     /**
      * 5s播放率
      */
     @Excel(name = "5s播放率", width = 15)
     @ApiModelProperty(value = "5s播放率")
-    private java.math.BigDecimal play_5sRatio;
+    private BigDecimal play_5sRatio;
     /**
      * 完播率
      */
     @Excel(name = "完播率", width = 15)
     @ApiModelProperty(value = "完播率")
-    private java.math.BigDecimal playEndRatio;
+    private BigDecimal playEndRatio;
     /**
      * 订单支付率
      */
     @Excel(name = "订单支付率", width = 15)
     @ApiModelProperty(value = "订单支付率")
-    private java.math.BigDecimal eventOrderPaidRoi;
+    private BigDecimal eventOrderPaidRoi;
     /**
      * 新增完件人数
      */
     @Excel(name = "新增完件人数", width = 15)
     @ApiModelProperty(value = "新增完件人数")
-    private java.lang.Long eventNewUserJinjianApp;
+    private Long eventNewUserJinjianApp;
     /**
      * 新增完件人数成本
      */
     @Excel(name = "新增完件人数成本", width = 15)
     @ApiModelProperty(value = "新增完件人数成本")
-    private java.math.BigDecimal eventNewUserJinjianAppCost;
+    private BigDecimal eventNewUserJinjianAppCost;
     /**
      * 新增完件人数率
      */
     @Excel(name = "新增完件人数率", width = 15)
     @ApiModelProperty(value = "新增完件人数率")
-    private java.math.BigDecimal eventNewUserJinjianAppRoi;
+    private BigDecimal eventNewUserJinjianAppRoi;
     /**
      * 新增授信人数
      */
     @Excel(name = "新增授信人数", width = 15)
     @ApiModelProperty(value = "新增授信人数")
-    private java.lang.Long eventNewUserCreditGrantApp;
+    private Long eventNewUserCreditGrantApp;
     /**
      * 新增授信人数成本
      */
     @Excel(name = "新增授信人数成本", width = 15)
     @ApiModelProperty(value = "新增授信人数成本")
-    private java.math.BigDecimal eventNewUserCreditGrantAppCost;
+    private BigDecimal eventNewUserCreditGrantAppCost;
     /**
      * 新增授信人数率
      */
     @Excel(name = "新增授信人数率", width = 15)
     @ApiModelProperty(value = "新增授信人数率")
-    private java.math.BigDecimal eventNewUserCreditGrantAppRoi;
+    private BigDecimal eventNewUserCreditGrantAppRoi;
     /**
      * 落地页新增完件人数
      */
     @Excel(name = "落地页新增完件人数", width = 15)
     @ApiModelProperty(value = "落地页新增完件人数")
-    private java.lang.Long eventNewUserJinjianPage;
+    private Long eventNewUserJinjianPage;
     /**
      * 落地页新增完件人数成本
      */
     @Excel(name = "落地页新增完件人数成本", width = 15)
     @ApiModelProperty(value = "落地页新增完件人数成本")
-    private java.math.BigDecimal eventNewUserJinjianPageCost;
+    private BigDecimal eventNewUserJinjianPageCost;
     /**
      * 落地页新增完件人数率
      */
     @Excel(name = "落地页新增完件人数率", width = 15)
     @ApiModelProperty(value = "落地页新增完件人数率")
-    private java.math.BigDecimal eventNewUserJinjianPageRoi;
+    private BigDecimal eventNewUserJinjianPageRoi;
     /**
      * 落地页新增授信人数
      */
     @Excel(name = "落地页新增授信人数", width = 15)
     @ApiModelProperty(value = "落地页新增授信人数")
-    private java.lang.Long eventNewUserCreditGrantPage;
+    private Long eventNewUserCreditGrantPage;
     /**
      * 落地页新增授信人数成本
      */
     @Excel(name = "落地页新增授信人数成本", width = 15)
     @ApiModelProperty(value = "落地页新增授信人数成本")
-    private java.math.BigDecimal eventNewUserCreditGrantPageCost;
+    private BigDecimal eventNewUserCreditGrantPageCost;
     /**
      * 落地页新增授信人数率
      */
     @Excel(name = "落地页新增授信人数率", width = 15)
     @ApiModelProperty(value = "落地页新增授信人数率")
-    private java.math.BigDecimal eventNewUserCreditGrantPageRoi;
+    private BigDecimal eventNewUserCreditGrantPageRoi;
     /**
      * eventAppointForm
      */
     @Excel(name = "eventAppointForm", width = 15)
     @ApiModelProperty(value = "eventAppointForm")
-    private java.lang.Long eventAppointForm;
+    private Long eventAppointForm;
     /**
      * eventAppointFormCost
      */
     @Excel(name = "eventAppointFormCost", width = 15)
     @ApiModelProperty(value = "eventAppointFormCost")
-    private java.math.BigDecimal eventAppointFormCost;
+    private BigDecimal eventAppointFormCost;
     /**
      * eventAppointFormRatio
      */
     @Excel(name = "eventAppointFormRatio", width = 15)
     @ApiModelProperty(value = "eventAppointFormRatio")
-    private java.math.BigDecimal eventAppointFormRatio;
+    private BigDecimal eventAppointFormRatio;
     /**
      * eventAppointJumpClick
      */
     @Excel(name = "eventAppointJumpClick", width = 15)
     @ApiModelProperty(value = "eventAppointJumpClick")
-    private java.lang.Long eventAppointJumpClick;
+    private Long eventAppointJumpClick;
     /**
      * eventAppointJumpClickCost
      */
     @Excel(name = "eventAppointJumpClickCost", width = 15)
     @ApiModelProperty(value = "eventAppointJumpClickCost")
-    private java.math.BigDecimal eventAppointJumpClickCost;
+    private BigDecimal eventAppointJumpClickCost;
     /**
      * eventAppointJumpClickRatio
      */
     @Excel(name = "eventAppointJumpClickRatio", width = 15)
     @ApiModelProperty(value = "eventAppointJumpClickRatio")
-    private java.math.BigDecimal eventAppointJumpClickRatio;
+    private BigDecimal eventAppointJumpClickRatio;
     /**
      * unionEventPayPurchaseAmount7d
      */
     @Excel(name = "unionEventPayPurchaseAmount_7d", width = 15)
     @ApiModelProperty(value = "unionEventPayPurchaseAmount_7d")
-    private java.lang.String unionEventPayPurchaseAmount_7d;
+    private String unionEventPayPurchaseAmount_7d;
     /**
      * 省份
      */
     @Excel(name = "省份", width = 15)
     @ApiModelProperty(value = "省份")
-    private java.lang.String province;
+    private String province;
     /**
      * eventAppInvoked
      */
     @Excel(name = "eventAppInvoked", width = 15)
     @ApiModelProperty(value = "eventAppInvoked")
-    private java.lang.String eventAppInvoked;
+    private String eventAppInvoked;
     /**
      * unionEventPayPurchaseAmount7dRoi
      */
     @Excel(name = "unionEventPayPurchaseAmount_7dRoi", width = 15)
     @ApiModelProperty(value = "unionEventPayPurchaseAmount_7dRoi")
-    private java.lang.String unionEventPayPurchaseAmount_7dRoi;
+    private String unionEventPayPurchaseAmount_7dRoi;
     /**
      * eventAddShoppingCartCost
      */
     @Excel(name = "eventAddShoppingCartCost", width = 15)
     @ApiModelProperty(value = "eventAddShoppingCartCost")
-    private java.lang.String eventAddShoppingCartCost;
+    private String eventAddShoppingCartCost;
     /**
      * 性别
      */
     @Excel(name = "性别", width = 15)
     @ApiModelProperty(value = "性别")
-    private java.lang.String gender;
+    private String gender;
     /**
      * 城市
      */
     @Excel(name = "城市", width = 15)
     @ApiModelProperty(value = "城市")
-    private java.lang.String city;
+    private String city;
     /**
      * eventAdWatchTimesRatio
      */
     @Excel(name = "eventAdWatchTimesRatio", width = 15)
     @ApiModelProperty(value = "eventAdWatchTimesRatio")
-    private java.lang.String eventAdWatchTimesRatio;
+    private String eventAdWatchTimesRatio;
     /**
      * 分享数
      */
     @Excel(name = "分享数", width = 15)
     @ApiModelProperty(value = "分享数")
-    private java.lang.String shares;
+    private String shares;
     /**
      * 商业兴趣
      */
     @Excel(name = "商业兴趣", width = 15)
     @ApiModelProperty(value = "商业兴趣")
-    private java.lang.String businessInterestTags;
+    private String businessInterestTags;
     /**
      * eventWatchAppAd
      */
     @Excel(name = "eventWatchAppAd", width = 15)
     @ApiModelProperty(value = "eventWatchAppAd")
-    private java.lang.String eventWatchAppAd;
+    private String eventWatchAppAd;
     /**
      * eventMultiConversionCost
      */
     @Excel(name = "eventMultiConversionCost", width = 15)
     @ApiModelProperty(value = "eventMultiConversionCost")
-    private java.lang.String eventMultiConversionCost;
+    private String eventMultiConversionCost;
     /**
      * 涨粉成本
      */
     @Excel(name = "涨粉成本", width = 15)
     @ApiModelProperty(value = "涨粉成本")
-    private java.math.BigDecimal merchantRecoFansCost;
+    private BigDecimal merchantRecoFansCost;
     /**
      * 广告投放场景
      */
     @Excel(name = "广告投放场景", width = 15)
     @ApiModelProperty(value = "广告投放场景")
-    private java.lang.String adScene;
+    private String adScene;
     /**
      * eventAdWatchTimesCost
      */
     @Excel(name = "eventAdWatchTimesCost", width = 15)
     @ApiModelProperty(value = "eventAdWatchTimesCost")
-    private java.lang.String eventAdWatchTimesCost;
+    private String eventAdWatchTimesCost;
     /**
      * eventAddShoppingCart
      */
     @Excel(name = "eventAddShoppingCart", width = 15)
     @ApiModelProperty(value = "eventAddShoppingCart")
-    private java.lang.String eventAddShoppingCart;
+    private String eventAddShoppingCart;
     /**
      * 年龄
      */
     @Excel(name = "年龄", width = 15)
     @ApiModelProperty(value = "年龄")
-    private java.lang.String ageSegment;
+    private String ageSegment;
     /**
      * 点赞数
      */
     @Excel(name = "点赞数", width = 15)
     @ApiModelProperty(value = "点赞数")
-    private java.lang.Long photoLike;
+    private Long photoLike;
     /**
      * 微信复制数
      */
     @Excel(name = "微信复制数", width = 15)
     @ApiModelProperty(value = "微信复制数")
-    private java.lang.Long eventAddWechat;
+    private Long eventAddWechat;
     /**
      * 微信复制成本
      */
     @Excel(name = "微信复制成本", width = 15)
     @ApiModelProperty(value = "微信复制成本")
-    private java.math.BigDecimal eventAddWechatCost;
+    private BigDecimal eventAddWechatCost;
     /**
      * 微信复制率
      */
     @Excel(name = "微信复制率", width = 15)
     @ApiModelProperty(value = "微信复制率")
-    private java.math.BigDecimal eventAddWechatRatio;
+    private BigDecimal eventAddWechatRatio;
     /**
      * eventAppInvokedCost
      */
     @Excel(name = "eventAppInvokedCost", width = 15)
     @ApiModelProperty(value = "eventAppInvokedCost")
-    private java.math.BigDecimal eventAppInvokedCost;
+    private BigDecimal eventAppInvokedCost;
     /**
      * eventMultiConversion
      */
     @Excel(name = "eventMultiConversion", width = 15)
     @ApiModelProperty(value = "eventMultiConversion")
-    private java.lang.String eventMultiConversion;
+    private String eventMultiConversion;
     /**
      * eventDspGiftForm
      */
     @Excel(name = "eventDspGiftForm", width = 15)
     @ApiModelProperty(value = "eventDspGiftForm")
-    private java.lang.String eventDspGiftForm;
+    private String eventDspGiftForm;
     /**
      * eventAppInvokedRatio
      */
     @Excel(name = "eventAppInvokedRatio", width = 15)
     @ApiModelProperty(value = "eventAppInvokedRatio")
-    private java.lang.String eventAppInvokedRatio;
+    private String eventAppInvokedRatio;
     /**
      * 封面曝光数
      */
     @Excel(name = "封面曝光数", width = 15)
     @ApiModelProperty(value = "封面曝光数")
-    private java.lang.Long photoShow;
+    private Long photoShow;
     /**
      * eventMultiConversionRatio
      */
     @Excel(name = "eventMultiConversionRatio", width = 15)
     @ApiModelProperty(value = "eventMultiConversionRatio")
-    private java.lang.String eventMultiConversionRatio;
+    private String eventMultiConversionRatio;
     /**
      * 系统
      */
     @Excel(name = "系统", width = 15)
     @ApiModelProperty(value = "系统")
-    private java.lang.String client;
+    private String client;
     /**
      * 商品访问成本
      */
     @Excel(name = "商品访问成本", width = 15)
     @ApiModelProperty(value = "商品访问成本")
-    private java.math.BigDecimal eventGoodsViewCost;
+    private BigDecimal eventGoodsViewCost;
     /**
      * 应用下载数据-授信率
      */
     @Excel(name = "应用下载数据-授信率", width = 15)
     @ApiModelProperty(value = "应用下载数据-授信率")
-    private java.math.BigDecimal eventCreditGrantAppRatio;
+    private BigDecimal eventCreditGrantAppRatio;
     /**
      * eventAdWatchTimes
      */
     @Excel(name = "eventAdWatchTimes", width = 15)
     @ApiModelProperty(value = "eventAdWatchTimes")
-    private java.lang.String eventAdWatchTimes;
+    private String eventAdWatchTimes;
 
     @TableField(exist = false)
-    private java.lang.String startTime;
+    private String startTime;
 
     @TableField(exist = false)
-    private java.lang.String endTime;
+    private String endTime;
 
     @TableField(exist = false)
-    private java.lang.String orderType;
+    private String orderType;
 
     @TableField(exist = false)
-    private java.lang.String upOrDown;
+    private String upOrDown;
     /**
      * 评论数
      */
     @Excel(name = "评论数", width = 15)
     @ApiModelProperty(value = "评论数")
-    private java.lang.Long comments;
+    private Long comments;
     /**
      * 创建时间
      */

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

@@ -2,8 +2,10 @@ package cn.com.ctop.kuaishou.modules.report.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -19,51 +21,82 @@ import java.util.Date;
 public class KuaishouVideoEtlInfo {
 
 	@TableId(type = IdType.AUTO)
+	@Excel(name = "ID", width = 15)
 	private Long id;
 	/**视频唯一标识*/
+	@Excel(name = "视频唯一标识", width = 15)
 	private String videoCode;
 	/**初次产生消耗时间*/
+	@Excel(name = "开始投放时间", width = 15)
 	private String stateDate;
 	/**url*/
+	@Excel(name = "视频链接", width = 15)
 	private String url;
 	/**coverUrl*/
+	@Excel(name = "封面链接", width = 15)
 	private String coverUrl;
 	/**渠道类型*/
 	private String channelType;
 	/**companyName*/
+	@Excel(name = "公司名称", width = 15)
 	private String companyName;
 	/**planId*/
+	@Excel(name = "策划id", width = 15)
 	private String planId;
 	/**planName*/
+	@Excel(name = "策划名称", width = 15)
 	private String planName;
 	/**clipId*/
+	@Excel(name = "剪辑id", width = 15)
 	private String clipId;
 	/**clipName*/
+	@Excel(name = "剪辑名称", width = 15)
 	private String clipName;
 	/**shotId*/
+	@Excel(name = "拍摄id", width = 15)
 	private String shotId;
 	/**shotName*/
+	@Excel(name = "拍摄名称", width = 15)
 	private String shotName;
 	/**singleWeekCost*/
+	@Excel(name = "上线一周消耗", width = 15)
 	private BigDecimal singleWeekCost;
 	/**twoWeekCost*/
+	@Excel(name = "上线两周消耗", width = 15)
 	private BigDecimal twoWeekCost;
 	/**fourWeekCost*/
+	@Excel(name = "上线四周消耗", width = 15)
 	private BigDecimal fourWeekCost;
 	/**总消耗*/
+	@Excel(name = "总消耗", width = 15)
 	private BigDecimal totalCost;
 	/**photoShow*/
+	@Excel(name = "封面曝光量", width = 15)
 	private Long photoShow;
 	/**photoClick*/
+	@Excel(name = "封面点击数", width = 15)
 	private Long photoClick;
 	/**aclick*/
+	@Excel(name = "素材曝光数", width = 15)
 	private Long aclick;
 	/**bclick*/
+	@Excel(name = "行为数", width = 15)
 	private Long bclick;
+	@Excel(name = "达成有效日期", width = 15)
 	private String effectDate;
+	@Excel(name = "达成爆款日期", width = 15)
 	private String faddishDate;
+	@Excel(name = "达成有效天数", width = 15)
 	private Integer effectDayNum;
+	@Excel(name = "达成爆款天数", width = 15)
 	private Integer faddishDayNum;
+	@TableField(exist = false)
+	private String type;
+	@TableField(exist = false)
+	private String startDate;
+	@TableField(exist = false)
+	private String endDate;
+
 	/**createTime*/
 	private Date createTime;
 	/**updateTime*/

+ 63 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAccountMapper.xml

@@ -7,14 +7,14 @@
         account_id as accountId,
         province,
         age_segment as ageSegment,
-        business_interest_tags as businessInterestTags ,
+        business_interest_tags as businessInterestTags,
         city,
         client,
         gender,
         SUM(charge) as charge,
         SUM(activation) as activation,
         SUM(event_next_day_stay) as eventNextDayStay,
-        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        IFNULL(ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2),0) as eventNextDayStayRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
         <if test="accountId != null">
@@ -50,8 +50,17 @@
             AND audience_type = #{audienceType}
             GROUP BY business_interest_tags
         </if>
-        <if test="orderType!= null">
-            ORDER BY #{orderType}
+        <if test="orderType == 'charge' ">
+            ORDER BY charge
+        </if>
+        <if test="orderType == 'activation' ">
+            ORDER BY activation
+        </if>
+        <if test="orderType == 'eventNextDayStayRatio'">
+            ORDER BY eventNextDayStayRatio
+        </if>
+        <if test="orderType == 'eventNextDayStay'">
+            ORDER BY eventNextDayStay
         </if>
         <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
             DESC
@@ -73,8 +82,8 @@
         SUM(photo_click) as photoClick,
         SUM(aclick) as aclick,
         SUM(bclick) as bclick,
-        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
-        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        IFNULL(ROUND(SUM(photo_click)/SUM(photo_show)*100,2),0) as photoClickRatio,
+        IFNULL(ROUND(SUM(bclick)/SUM(aclick)*100,2),0) as actionRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
         <if test="accountId != null">
@@ -113,7 +122,7 @@
     </select>
 
     <select id="querybusinessTypeReportForm" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        (SELECT
         stat_date as statDate,
         account_id as accountId,
         business_interest_tags as businessInterestTags ,
@@ -122,10 +131,11 @@
         sum(charge) as totalCost,
         SUM(aclick) as aclick,
         SUM(bclick) as bclick,
-        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
-        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        IFNULL(ROUND(SUM(photo_click)/SUM(photo_show)*100,2),0) as photoClickRatio,
+        IFNULL(ROUND(SUM(bclick)/SUM(aclick)*100,2),0) as actionRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
+        AND business_interest_tags != '其他'
         <if test="accountId != null">
             and account_id = #{accountId}
         </if>
@@ -137,13 +147,54 @@
         </if>
         AND audience_type = 'businessInterestTags'
         GROUP BY business_interest_tags
-        ORDER BY totalCost  desc
-        limit 10
+        ORDER BY totalCost desc
+        limit 9
+        )
+        <if test="count > 0 ">
+            union all
+            SELECT
+            statDate as statDate,
+            accountId as accountId,
+            businessInterestTags as businessInterestTags,
+            SUM(photoShow) as photoShow,
+            SUM(photoClick) as photoClick,
+            sum(charge) AS totalCost,
+            SUM(aclick) as aclick,
+            SUM(bclick) as bclick,
+            ROUND(SUM(photoClick)/SUM(photoShow)*100,2) as photoClickRatio,
+            ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+            FROM (
+            SELECT
+            stat_date as statDate,
+            account_id as accountId,
+            '其他' as businessInterestTags,
+            SUM(photo_show) as photoShow,
+            SUM(photo_click) as photoClick,
+            sum(charge) AS charge,
+            SUM(aclick) as aclick,
+            SUM(bclick) as bclick
+            FROM ctop_kuaishou_audience_report_daily_account t
+            where 1=1
+            <if test="accountId != null">
+                and account_id = #{accountId}
+            </if>
+            <if test="startTime != null">
+                AND stat_date &gt;= #{startTime}
+            </if>
+            <if test="endTime != null">
+                AND stat_date &lt;= #{endTime}
+            </if>
+            AND audience_type = 'businessInterestTags'
+            GROUP BY business_interest_tags
+            ORDER BY charge
+            limit 0,#{count}
+            ) t1
+        </if>
     </select>
 
 
     <select id="querybusinessTypeCount" resultType="java.lang.Integer">
-        SELECT count(1) FROM(
+        SELECT count(1) FROM (
         SELECT
         1
         FROM ctop_kuaishou_audience_report_daily_account

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

@@ -194,7 +194,7 @@ public class KuaiShouAccountReportServiceImpl implements IKuaiShouAccountReportS
             if ("accountId".equals(k) || "authName".equals(k) || v.toString().contains("%") || before.getString(k).contains("%")) {
                 jsonObject.put(k, "-");
             } else {
-                jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k)));
+                jsonObject.put(k, (LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k))).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP)+"%");
             }
         });
         return jsonObject;

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

@@ -75,6 +75,8 @@ public class KuaishouAudienceReportDailyAccountServiceImpl extends ServiceImpl<K
             data.put("client", clients);
         }
         audienceReport.setAudienceType("businessInterestTags");
+        int count = accountMapper.querybusinessTypeCount(audienceReport);
+        audienceReport.setCount(count - 9);
         List<JSONObject> bussiness = accountMapper.querybusinessTypeReportForm(audienceReport);
         if (!Check.isNull(bussiness)) {
             data.put("businessInterestTags", bussiness);

+ 0 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouVideoEtlInfoServiceImpl.java

@@ -1,9 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.service.impl;
 
-import cn.com.ctop.common.module.entity.MaterialAscription;
-import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.service.IMaterialAscriptionService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouVideoEtlInfo;
@@ -14,7 +11,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
-import org.opencv.core.Mat;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -24,7 +20,6 @@ import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.logging.Logger;
 
 /**
  * 快手视频信息清洗表(有效,爆款)

+ 0 - 150
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoEtlInfoController.java

@@ -1,150 +0,0 @@
-package cn.com.ctop.toutiao.modules.report.controller;
-
-import cn.com.ctop.toutiao.modules.report.entity.BytedanceVideoEtlInfo;
-import cn.com.ctop.toutiao.modules.report.service.IBytedanceVideoEtlInfoService;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-
- /**
- * 头条视频数据清洗信息
- * @author jeecg-boot
- * @date   2020-12-21
- * @version V1.0
- */
-@Slf4j
-@Api(tags="头条视频数据清洗信息")
-@RestController
-@RequestMapping("/ctop/bytedanceVideoEtlInfo")
-public class BytedanceVideoEtlInfoController {
-	@Autowired
-	private IBytedanceVideoEtlInfoService bytedanceVideoEtlInfoService;
-
-	/**
-	  * 分页列表查询
-	 * @param bytedanceVideoEtlInfo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-分页列表查询", notes="头条视频数据清洗信息-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BytedanceVideoEtlInfo>> queryPageList(BytedanceVideoEtlInfo bytedanceVideoEtlInfo,
-															  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-															  HttpServletRequest req) {
-		Result<IPage<BytedanceVideoEtlInfo>> result = new Result<>();
-		QueryWrapper<BytedanceVideoEtlInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceVideoEtlInfo, req.getParameterMap());
-		Page<BytedanceVideoEtlInfo> page = new Page<BytedanceVideoEtlInfo>(pageNo, pageSize);
-		IPage<BytedanceVideoEtlInfo> pageList = bytedanceVideoEtlInfoService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
-
-	/**
-	  *   添加
-	 * @param bytedanceVideoEtlInfo
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-添加", notes="头条视频数据清洗信息-添加")
-	@PostMapping(value = "/add")
-	public Result<BytedanceVideoEtlInfo> add(@RequestBody BytedanceVideoEtlInfo bytedanceVideoEtlInfo) {
-		Result<BytedanceVideoEtlInfo> result = new Result<>();
-		try {
-			bytedanceVideoEtlInfoService.save(bytedanceVideoEtlInfo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
-
-	/**
-	  *  编辑
-	 * @param bytedanceVideoEtlInfo
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-编辑", notes="头条视频数据清洗信息-编辑")
-	@PutMapping(value = "/edit")
-	public Result<BytedanceVideoEtlInfo> edit(@RequestBody BytedanceVideoEtlInfo bytedanceVideoEtlInfo) {
-		Result<BytedanceVideoEtlInfo> result = new Result<BytedanceVideoEtlInfo>();
-		BytedanceVideoEtlInfo bytedanceVideoEtlInfoEntity = bytedanceVideoEtlInfoService.getById(bytedanceVideoEtlInfo.getId());
-		if(bytedanceVideoEtlInfoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = bytedanceVideoEtlInfoService.updateById(bytedanceVideoEtlInfo);
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
-
-		return result;
-	}
-
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-通过id删除", notes="头条视频数据清洗信息-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			bytedanceVideoEtlInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
-
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-批量删除", notes="头条视频数据清洗信息-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<BytedanceVideoEtlInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<BytedanceVideoEtlInfo> result = new Result<>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.bytedanceVideoEtlInfoService.removeByIds(Arrays.asList(ids.split(",")));
-			result.success("删除成功!");
-		}
-		return result;
-	}
-
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="头条视频数据清洗信息-通过id查询", notes="头条视频数据清洗信息-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BytedanceVideoEtlInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<BytedanceVideoEtlInfo> result = new Result<>();
-		BytedanceVideoEtlInfo bytedanceVideoEtlInfo = bytedanceVideoEtlInfoService.getById(id);
-		if(bytedanceVideoEtlInfo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(bytedanceVideoEtlInfo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
-}

+ 1 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceVideoReportCtrl.java

@@ -113,7 +113,7 @@ public class BytedanceVideoReportCtrl {
             columns.add("cost");
         }
         String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo, columns);
-        List<String> titles = new ArrayList<>();
+        List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo, columns));
         //此处增加两个元素是为了保证数据顺序
         if("exportDetail".equals(exportType)){
             titles.add(0,"客户");
@@ -135,7 +135,6 @@ public class BytedanceVideoReportCtrl {
             columns.add(3, "projectName");
             columns.add(4, "createTime");
         }
-
         JSONArray accountIds = requestBody.getJSONArray("accountIds");
         if (accountIds.isEmpty()) {
             accountIds = null;

+ 37 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/entity/BytedanceVideoEtlInfo.java

@@ -3,7 +3,9 @@ package cn.com.ctop.toutiao.modules.report.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -20,55 +22,90 @@ public class BytedanceVideoEtlInfo {
 
 	/**id*/
 	@TableId(type = IdType.AUTO)
+	@Excel(name = "ID", width = 15)
 	private Long id;
 	/**视频唯一标识*/
+	@Excel(name = "视频唯一标识", width = 15)
 	private String videoCode;
 	/**初次产生消耗时间*/
+	@Excel(name = "视频上线时间", width = 15)
 	private String stateDate;
 	/**url*/
+	@Excel(name = "视频链接", width = 15)
 	private String url;
 	/**coverUrl*/
+	@Excel(name = "封面链接", width = 15)
 	private String coverUrl;
 	/**companyName*/
+	@Excel(name = "所属公司", width = 15)
 	private String companyName;
 	/**planId*/
+	@Excel(name = "编导ID", width = 15)
 	private String planId;
 	/**planName*/
+	@Excel(name = "编导名称", width = 15)
 	private String planName;
 	/**clipId*/
+	@Excel(name = "剪辑ID", width = 15)
 	private String clipId;
 	/**clipName*/
+	@Excel(name = "剪辑名称", width = 15)
 	private String clipName;
 	/**shotId*/
+	@Excel(name = "拍摄ID", width = 15)
 	private String shotId;
 	/**shotName*/
+	@Excel(name = "拍摄名称", width = 15)
 	private String shotName;
 	/**singleWeekCost*/
+	@Excel(name = "上线一周消耗", width = 15)
 	private BigDecimal singleWeekCost;
 	/**twoWeekCost*/
+	@Excel(name = "上线两周消耗", width = 15)
 	private BigDecimal twoWeekCost;
 	/**fourWeekCost*/
+	@Excel(name = "上线四周消耗", width = 15)
 	private BigDecimal fourWeekCost;
 	/**总消耗*/
+	@Excel(name = "总消耗", width = 15)
 	private BigDecimal totalCost;
 	/**clickNum*/
+	@Excel(name = "封面点击数", width = 15)
 	private Long clickNum;
 	/**showNum*/
+	@Excel(name = "素材曝光数", width = 15)
 	private Long showNum;
 	/**activeNum*/
+	@Excel(name = "有效数", width = 15)
 	private Long activeNum;
 	/**convertNum*/
+	@Excel(name = "转化数", width = 15)
 	private Long convertNum;
 	/**createTime*/
 	private Date createTime;
 	/**updateTime*/
 	private Date updateTime;
 	/**effectDate*/
+	@Excel(name = "达成有效日期", width = 15)
 	private String effectDate;
 	/**faddishDate*/
+	@Excel(name = "达成爆款日期", width = 15)
 	private String faddishDate;
 	/**effectDayNum*/
+	@Excel(name = "达成有效天数", width = 15)
 	private Integer effectDayNum;
 	/**faddishDayNum*/
+	@Excel(name = "达成爆款天数", width = 15)
 	private Integer faddishDayNum;
+	/**
+	 * 有效 valid
+	 * 爆款 hot
+	 * 上线 online
+	 */
+	@TableField(exist = false)
+	private String type;
+	@TableField(exist = false)
+	private String startDate;
+	@TableField(exist = false)
+	private String endDate;
 }

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -205,7 +205,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             if ("accountId".equals(k) || "authName".equals(k) || v.toString().contains("%") || before.getString(k).contains("%")) {
                 jsonObject.put(k, "-");
             } else {
-                jsonObject.put(k, LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k)));
+                jsonObject.put(k, (LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k))).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP)+"%");
             }
         });
         return jsonObject;