Sfoglia il codice sorgente

Merge branch 'master' of http://git.tjyourong.com.cn/ctop/adsp-boot

zhaoxian 4 anni fa
parent
commit
9d9980b914
35 ha cambiato i file con 1617 aggiunte e 285 eliminazioni
  1. 184 136
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicInfoController.java
  2. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  3. 36 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  4. 1 1
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  5. 12 24
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  6. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  7. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  8. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVO.java
  9. 39 9
      module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVOEntity.java
  10. 7 1
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java
  11. 78 18
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVOEntity.java
  12. 118 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/CrossAccountBatchController.java
  13. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  14. 114 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java
  15. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java
  16. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewGroupReportMapper.java
  17. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewPlanReportMapper.java
  18. 13 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java
  19. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewGroupReportMapper.xml
  20. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewPlanReportMapper.xml
  21. 9 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  22. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  23. 59 31
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml
  24. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsNewGroupReportService.java
  25. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsNewPlanReportService.java
  26. 52 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsNewGroupReportServiceImpl.java
  27. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsNewPlanReportServiceImpl.java
  28. 114 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java
  29. 25 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceNewPlanReportMapper.java
  30. 6 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java
  31. 294 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceNewPlanReportMapper.xml
  32. 45 24
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  33. 8 12
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml
  34. 22 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceNewPlanReportService.java
  35. 67 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceNewPlanReportServiceImpl.java

+ 184 - 136
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BytedanceMusicInfoController.java

@@ -1,9 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
+import cn.com.ctop.common.module.service.IFileInfoService;
 import cn.com.ctop.crawler.modules.music.entity.BytedanceMusicInfo;
 import cn.com.ctop.crawler.modules.music.service.IBytedanceMusicInfoService;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -16,157 +16,205 @@ 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.*;
+import java.net.URLEncoder;
 import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
 
 /**
  * 音乐信息
+ *
  * @author jeecg-boot
- * @date   2020-10-28
  * @version V1.0
+ * @date 2020-10-28
  */
 @Slf4j
-@Api(tags="音乐信息")
+@Api(tags = "音乐信息")
 @RestController
 @RequestMapping("/ctop/bytedanceMusicInfo")
 public class BytedanceMusicInfoController {
-	@Autowired
-	private IBytedanceMusicInfoService bytedanceMusicInfoService;
+    @Autowired
+    private IBytedanceMusicInfoService bytedanceMusicInfoService;
+    @Autowired
+    private IFileInfoService fileInfoService;
 
-	 @GetMapping(value = "/downLoad")
-	 public Map<String,Object> downLoad(Long id) {
-		Map<String,Object>result = new HashMap<>();
-		if(null == id||id == 0){
-			ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
-			return result;
-		}
-		BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(id);
-		if(null == musicInfo){
-			ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
-			return result;
-		}
-		musicInfo.setDownloadNum(musicInfo.getDownloadNum()+1);
-		bytedanceMusicInfoService.updateById(musicInfo);
-		ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
-		return result;
-	 }
+    @PostMapping(value = "/netEaseDownLoad")
+    public void netEasedownLoad(JSONObject data, HttpServletResponse response) throws Exception {
+        String fileName = data.getString("musicName");
+        String fileUrl = data.getString("musicUrl");
+        String filePath = fileInfoService.downLoadByUrl(fileUrl);
+        File file = new File(filePath);
+        InputStream fis = new BufferedInputStream(new FileInputStream(filePath));
+        byte[] buffer = new byte[fis.available()];
+        fis.read(buffer);
+        fis.close();
+        response.reset();
+        response.setCharacterEncoding("UTF-8");
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+        response.addHeader("Content-Length", file.length()+ "");
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("audio/mp3");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
 
-	/**
-	  * 分页列表查询
-	 * @param bytedanceMusicInfo
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-分页列表查询", notes="音乐信息-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<BytedanceMusicInfo>> queryPageList(BytedanceMusicInfo bytedanceMusicInfo,
-														   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-														   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-														   HttpServletRequest req) {
-		Result<IPage<BytedanceMusicInfo>> result = new Result<>();
-		QueryWrapper<BytedanceMusicInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicInfo, req.getParameterMap());
-		Page<BytedanceMusicInfo> page = new Page<>(pageNo, pageSize);
-		IPage<BytedanceMusicInfo> pageList = bytedanceMusicInfoService.page(page, queryWrapper);
-		result.setSuccess(true);
-		result.setResult(pageList);
-		return result;
-	}
+    @GetMapping(value = "/downLoad")
+    public void downLoad(Long id, HttpServletResponse response) throws Exception {
+        if (null == id || id == 0) {
+            log.error("抖音音乐文件下载异常:参数异常");
+            return;
+        }
+        BytedanceMusicInfo musicInfo = bytedanceMusicInfoService.getById(id);
+        if (null == musicInfo) {
+            log.error("抖音音乐文件下载异常:音乐数据不存在");
+            return;
+        }
+        musicInfo.setDownloadNum(musicInfo.getDownloadNum() + 1);
+        bytedanceMusicInfoService.updateById(musicInfo);
+        String author = musicInfo.getAuthor();
+        String name = musicInfo.getName();
+        String fileName = author + "-" + name + ".mp3";
+        String filePath = fileInfoService.downLoadByUrl(musicInfo.getMusicUrl());
+        File file = new File(filePath);
+        InputStream fis = new BufferedInputStream(new FileInputStream(filePath));
+        byte[] buffer = new byte[fis.available()];
+        fis.read(buffer);
+        fis.close();
+        response.reset();
+        response.setCharacterEncoding("UTF-8");
+        fileName = URLEncoder.encode(fileName, "UTF-8");
+        response.addHeader("Content-Disposition", "attachment;filename=" + fileName);
+        response.addHeader("Content-Length", buffer.length + "");
+        OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
+        response.setContentType("audio/mp3");
+        toClient.write(buffer);
+        toClient.flush();
+        toClient.close();
+    }
 
-	/**
-	  *   添加
-	 * @param bytedanceMusicInfo
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-添加", notes="音乐信息-添加")
-	@PostMapping(value = "/add")
-	public Result<BytedanceMusicInfo> add(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		try {
-			bytedanceMusicInfoService.save(bytedanceMusicInfo);
-			result.success("添加成功!");
-		} catch (Exception e) {
-			log.error(e.getMessage(),e);
-			result.error500("操作失败");
-		}
-		return result;
-	}
+    /**
+     * 分页列表查询
+     *
+     * @param bytedanceMusicInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-分页列表查询", notes = "音乐信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<BytedanceMusicInfo>> queryPageList(BytedanceMusicInfo bytedanceMusicInfo,
+                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                           HttpServletRequest req) {
+        Result<IPage<BytedanceMusicInfo>> result = new Result<>();
+        QueryWrapper<BytedanceMusicInfo> queryWrapper = QueryGenerator.initQueryWrapper(bytedanceMusicInfo, req.getParameterMap());
+        Page<BytedanceMusicInfo> page = new Page<>(pageNo, pageSize);
+        IPage<BytedanceMusicInfo> pageList = bytedanceMusicInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
 
-	/**
-	  *  编辑
-	 * @param bytedanceMusicInfo
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-编辑", notes="音乐信息-编辑")
-	@PutMapping(value = "/edit")
-	public Result<BytedanceMusicInfo> edit(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
-		Result<BytedanceMusicInfo> result = new Result<BytedanceMusicInfo>();
-		BytedanceMusicInfo bytedanceMusicInfoEntity = bytedanceMusicInfoService.getById(bytedanceMusicInfo.getId());
-		if(bytedanceMusicInfoEntity==null) {
-			result.error500("未找到对应实体");
-		}else {
-			boolean ok = bytedanceMusicInfoService.updateById(bytedanceMusicInfo);
-			if(ok) {
-				result.success("修改成功!");
-			}
-		}
+    /**
+     * 添加
+     *
+     * @param bytedanceMusicInfo
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-添加", notes = "音乐信息-添加")
+    @PostMapping(value = "/add")
+    public Result<BytedanceMusicInfo> add(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        try {
+            bytedanceMusicInfoService.save(bytedanceMusicInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
 
-		return result;
-	}
+    /**
+     * 编辑
+     *
+     * @param bytedanceMusicInfo
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-编辑", notes = "音乐信息-编辑")
+    @PutMapping(value = "/edit")
+    public Result<BytedanceMusicInfo> edit(@RequestBody BytedanceMusicInfo bytedanceMusicInfo) {
+        Result<BytedanceMusicInfo> result = new Result<BytedanceMusicInfo>();
+        BytedanceMusicInfo bytedanceMusicInfoEntity = bytedanceMusicInfoService.getById(bytedanceMusicInfo.getId());
+        if (bytedanceMusicInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = bytedanceMusicInfoService.updateById(bytedanceMusicInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
 
-	/**
-	  *   通过id删除
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-通过id删除", notes="音乐信息-通过id删除")
-	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
-		try {
-			bytedanceMusicInfoService.removeById(id);
-		} catch (Exception e) {
-			log.error("删除失败",e.getMessage());
-			return Result.error("删除失败!");
-		}
-		return Result.ok("删除成功!");
-	}
+        return result;
+    }
 
-	/**
-	  *  批量删除
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-批量删除", notes="音乐信息-批量删除")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<BytedanceMusicInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		if(ids==null || "".equals(ids.trim())) {
-			result.error500("参数不识别!");
-		}else {
-			this.bytedanceMusicInfoService.removeByIds(Arrays.asList(ids.split(",")));
-			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 {
+            bytedanceMusicInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
 
-	/**
-	  * 通过id查询
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value="音乐信息-通过id查询", notes="音乐信息-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<BytedanceMusicInfo> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<BytedanceMusicInfo> result = new Result<>();
-		BytedanceMusicInfo bytedanceMusicInfo = bytedanceMusicInfoService.getById(id);
-		if(bytedanceMusicInfo==null) {
-			result.error500("未找到对应实体");
-		}else {
-			result.setResult(bytedanceMusicInfo);
-			result.setSuccess(true);
-		}
-		return result;
-	}
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-批量删除", notes = "音乐信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<BytedanceMusicInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.bytedanceMusicInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "音乐信息-通过id查询", notes = "音乐信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<BytedanceMusicInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<BytedanceMusicInfo> result = new Result<>();
+        BytedanceMusicInfo bytedanceMusicInfo = bytedanceMusicInfoService.getById(id);
+        if (bytedanceMusicInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(bytedanceMusicInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
 }

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

@@ -37,7 +37,6 @@ public class ImageCostController {
 
     @PostMapping("bytedance/cost/export")
     public void bytedanceImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
-
         SheetInfoVo vo = imageReportDailyService.getbytedanceImageCostVo(data);
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());

+ 36 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java

@@ -31,6 +31,14 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     public Map<String,Object> bytedanceImageCost(JSONObject data) {
         Map<String,Object>result = new HashMap<>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
@@ -56,7 +64,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
         }
         PageHelper.startPage(pageNumber,pageSize);
-        List<BytedanceImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code);
+        List<BytedanceImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,order,target);
         PageInfo<BytedanceImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
@@ -66,6 +74,14 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     public SheetInfoVo getbytedanceImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<BytedanceImageCostVOEntity>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
@@ -82,7 +98,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
         if(null == code|| "".equals(code.trim())){
             code = null;
         }
-        List<BytedanceImageCostVOEntity>details = bytedanceReportMaterialDailyMapper.bytedanceImageCostEntity(startDate,endDate,accountList,code);
+        List<BytedanceImageCostVOEntity>details = bytedanceReportMaterialDailyMapper.bytedanceImageCostEntity(startDate,endDate,accountList,code,order,target);
         sheetInfoVo.setDetails(details);
         return sheetInfoVo;
     }
@@ -90,6 +106,14 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     public Map<String, Object> kuaishouImageCost(JSONObject data) {
         Map<String,Object>result = new HashMap<>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
@@ -115,7 +139,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
         }
         PageHelper.startPage(pageNumber,pageSize);
-        List<KuaishouImageCostVO> vos = kuaishouReportDailyImageMapper.imageCost(startDate,endDate,accountList,code);
+        List<KuaishouImageCostVO> vos = kuaishouReportDailyImageMapper.imageCost(startDate,endDate,accountList,code,order,target);
         PageInfo<KuaishouImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
@@ -125,6 +149,14 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
     @Override
     public SheetInfoVo getkuaishouImageCostVo(JSONObject data) {
         SheetInfoVo sheetInfoVo = new SheetInfoVo<KuaishouImageCostVOEntity>();
+        String order = data.getString("order");
+        if(null == order|| "".equals(order.trim())){
+            order = "desc";
+        }
+        String target = data.getString("target");
+        if(null == target|| "".equals(target.trim())){
+            target = "cost";
+        }
         String startDate = data.getString("startDate");
         if(null == startDate|| "".equals(startDate.trim())){
             startDate = null;
@@ -142,7 +174,7 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             code = null;
         }
         sheetInfoVo.setSheetName("快手图片消耗统计");
-        List<KuaishouImageCostVOEntity> details = kuaishouReportDailyImageMapper.imageCostEntity(startDate,endDate,accountList,code);
+        List<KuaishouImageCostVOEntity> details = kuaishouReportDailyImageMapper.imageCostEntity(startDate,endDate,accountList,code,order,target);
         sheetInfoVo.setDetails(details);
         return sheetInfoVo;
     }

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -156,7 +156,7 @@ jeecg:
     #webapp文件路径
     webapp: /mnt/webapp
     video-upload: /mnt/upload/video/
-    image-upload: /mnt/upload/image/
+    image-upload: D://data//image//
     kuaishou-agent-image: D://temp.png
     kuaishou-account-captcha-image: D://captcha.png
     chrome-driver: D://chromedriver.exe

File diff suppressed because it is too large
+ 12 - 24
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java


+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java

@@ -34,7 +34,7 @@ public interface ICtopOauthTokenService extends IService<CtopOauthToken> {
 
     List<CtopOauthToken> getToutiaoTokenByCreateTime(String createTime);
 
-    List<CtopOauthToken> getByProjectId(long projectId);
+    List<CtopOauthToken> getByProjectId(Long projectId);
 
     CtopOauthToken selectOneByMediaId(String platformTypeKuaishou);
 

+ 1 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java

@@ -223,7 +223,7 @@ public class CtopOauthTokenServiceImpl extends ServiceImpl<CtopOauthTokenMapper,
     }
 
     @Override
-    public List<CtopOauthToken> getByProjectId(long projectId) {
+    public List<CtopOauthToken> getByProjectId(Long projectId) {
         QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("project_id", projectId).eq("account_status", 0);
         return this.list(queryWrapper);

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVO.java

@@ -17,4 +17,7 @@ public class BytedanceImageCostVO implements Serializable {
     private Long convert;
     private String userId;
     private String userName;
+    private BigDecimal clickRate;
+    private BigDecimal convertRate;
+    private BigDecimal convertCost;
 }

+ 39 - 9
module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVOEntity.java

@@ -8,23 +8,29 @@ import java.math.BigDecimal;
 public class BytedanceImageCostVOEntity extends BaseRowModel {
     @ExcelProperty(index = 1, value = "图片链接")
     private String imageUrl;
-    @ExcelProperty(index = 1, value = "上传时间")
+    @ExcelProperty(index = 2, value = "上传时间")
     private String statDate;
-    @ExcelProperty(index = 1, value = "图片标识")
+    @ExcelProperty(index = 3, value = "图片标识")
     private String signature;
-    @ExcelProperty(index = 1, value = "项目名称")
+    @ExcelProperty(index = 4, value = "项目名称")
     private String projectName;
-    @ExcelProperty(index = 1, value = "消耗")
+    @ExcelProperty(index = 5, value = "消耗")
     private BigDecimal cost;
-    @ExcelProperty(index = 1, value = "点击数")
+    @ExcelProperty(index = 6, value = "点击数")
     private Long click;
-    @ExcelProperty(index = 1, value = "展示数")
+    @ExcelProperty(index = 7, value = "展示数")
     private Long showNum;
-    @ExcelProperty(index = 1, value = "转化数")
+    @ExcelProperty(index = 8, value = "转化数")
     private Long convert;
-    @ExcelProperty(index = 1, value = "平面id")
+    @ExcelProperty(index = 9, value = "点击率")
+    private BigDecimal clickRate;
+    @ExcelProperty(index = 10, value = "转化率")
+    private BigDecimal convertRate;
+    @ExcelProperty(index = 11, value = "转化成本")
+    private BigDecimal convertCost;
+    @ExcelProperty(index = 12, value = "平面id")
     private String userId;
-    @ExcelProperty(index = 1, value = "平面名称")
+    @ExcelProperty(index = 10, value = "平面名称")
     private String userName;
 
     public BytedanceImageCostVOEntity() {
@@ -120,4 +126,28 @@ public class BytedanceImageCostVOEntity extends BaseRowModel {
     public void setUserName(String userName) {
         this.userName = userName;
     }
+
+    public BigDecimal getClickRate() {
+        return clickRate;
+    }
+
+    public void setClickRate(BigDecimal clickRate) {
+        this.clickRate = clickRate;
+    }
+
+    public BigDecimal getConvertRate() {
+        return convertRate;
+    }
+
+    public void setConvertRate(BigDecimal convertRate) {
+        this.convertRate = convertRate;
+    }
+
+    public BigDecimal getConvertCost() {
+        return convertCost;
+    }
+
+    public void setConvertCost(BigDecimal convertCost) {
+        this.convertCost = convertCost;
+    }
 }

+ 7 - 1
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java

@@ -10,9 +10,15 @@ public class KuaishouImageCostVO implements Serializable {
     String imageUrl;
     String signature;
     String projectName;
-    BigDecimal charge;
+    BigDecimal cost;
     Long photoClick;
+    BigDecimal photoClickRate;
     Long photoShow;
+    BigDecimal photoShowCost;
+    Long aclick;
+    BigDecimal aclickCost;
+    Long bclick;
+    BigDecimal bclickRate;
     Long activation;
     Long eventRegister;
     Long eventPay;

+ 78 - 18
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVOEntity.java

@@ -13,28 +13,96 @@ public class KuaishouImageCostVOEntity extends BaseRowModel {
     @ExcelProperty(index = 3, value = "所属项目")
     String projectName;
     @ExcelProperty(index = 4, value = "消耗")
-    BigDecimal charge;
+    BigDecimal cost;
     @ExcelProperty(index = 5, value = "封面点击数")
     Long photoClick;
-    @ExcelProperty(index = 6, value = "封面曝光数")
+    @ExcelProperty(index = 6, value = "封面点击率")
+    BigDecimal photoClickRate;
+    @ExcelProperty(index = 7, value = "封面曝光数")
     Long photoShow;
-    @ExcelProperty(index = 7, value = "激活数")
+    @ExcelProperty(index = 8, value = "千次封面曝光花费")
+    BigDecimal photoShowCost;
+    @ExcelProperty(index = 9, value = "素材曝光数")
+    Long aclick;
+    @ExcelProperty(index = 10, value = "千次素材曝光花费")
+    BigDecimal aclickCost;
+    @ExcelProperty(index = 11, value = "行为数")
+    Long bcilck;
+    @ExcelProperty(index = 12, value = "行为率")
+    BigDecimal bclickRate;
+    @ExcelProperty(index = 13, value = "激活数")
     Long activation;
-    @ExcelProperty(index = 8, value = "注册数")
+    @ExcelProperty(index = 14, value = "注册数")
     Long eventRegister;
-    @ExcelProperty(index = 9, value = "付费数")
+    @ExcelProperty(index = 15, value = "付费数")
     Long eventPay;
-    @ExcelProperty(index = 10, value = "表单提交数")
+    @ExcelProperty(index = 16, value = "表单提交数")
     Long formCount;
-    @ExcelProperty(index = 11, value = "完件数")
+    @ExcelProperty(index = 17, value = "完件数")
     Long eventJinJianApp;
-    @ExcelProperty(index = 12, value = "授信数")
+    @ExcelProperty(index = 18, value = "授信数")
     Long eventCreditGrantApp;
-    @ExcelProperty(index = 13, value = "所属平面id")
+    @ExcelProperty(index = 19, value = "所属平面id")
     String userId;
-    @ExcelProperty(index = 14, value = "所属平面")
+    @ExcelProperty(index = 20, value = "所属平面")
     String userName;
 
+    public BigDecimal getCost() {
+        return cost;
+    }
+
+    public void setCost(BigDecimal cost) {
+        this.cost = cost;
+    }
+
+    public BigDecimal getPhotoClickRate() {
+        return photoClickRate;
+    }
+
+    public void setPhotoClickRate(BigDecimal photoClickRate) {
+        this.photoClickRate = photoClickRate;
+    }
+
+    public BigDecimal getPhotoShowCost() {
+        return photoShowCost;
+    }
+
+    public void setPhotoShowCost(BigDecimal photoShowCost) {
+        this.photoShowCost = photoShowCost;
+    }
+
+    public Long getAclick() {
+        return aclick;
+    }
+
+    public void setAclick(Long aclick) {
+        this.aclick = aclick;
+    }
+
+    public BigDecimal getAclickCost() {
+        return aclickCost;
+    }
+
+    public void setAclickCost(BigDecimal aclickCost) {
+        this.aclickCost = aclickCost;
+    }
+
+    public Long getBcilck() {
+        return bcilck;
+    }
+
+    public void setBcilck(Long bcilck) {
+        this.bcilck = bcilck;
+    }
+
+    public BigDecimal getBclickRate() {
+        return bclickRate;
+    }
+
+    public void setBclickRate(BigDecimal bclickRate) {
+        this.bclickRate = bclickRate;
+    }
+
     public KuaishouImageCostVOEntity() {
     }
 
@@ -62,14 +130,6 @@ public class KuaishouImageCostVOEntity extends BaseRowModel {
         this.projectName = projectName;
     }
 
-    public BigDecimal getCharge() {
-        return charge;
-    }
-
-    public void setCharge(BigDecimal charge) {
-        this.charge = charge;
-    }
-
     public Long getPhotoClick() {
         return photoClick;
     }

+ 118 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/CrossAccountBatchController.java

@@ -190,6 +190,124 @@ public class CrossAccountBatchController {
     }
 
 
+
+
+
+    /**
+     * 批量创建广告组
+     *
+     * @param requestJson
+     * @return
+     */
+    @PostMapping(value = "/batchUnitCreate")
+    public Result<JSONArray> batchUnitCreate(@RequestBody JSONObject requestJson) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            System.err.println(requestJson);
+            JSONArray accountArr = requestJson.getJSONArray("accountArr");
+            if (Check.isNull(accountArr)) {
+                throw new Exception("请选择需要创建的账户");
+            }
+            JSONArray returnArr = new JSONArray();
+
+            for (int i = 0; i < accountArr.size(); i++) {
+                Long accountId = accountArr.getLong(i);
+                CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+                if (Check.isNull(oauthToken)) {
+                    throw new Exception("未获取到账户信息");
+                }
+
+                JSONObject returnJson = new JSONObject();
+                returnJson.put("accountId", accountId);
+                JSONObject campaignJson = new JSONObject();
+                campaignJson.put("day_budget", requestJson.getLong("dayBudget"));
+                Integer nameType = requestJson.getInteger("nameType");
+                Integer type = requestJson.getInteger("type");
+                campaignJson.put("type", type);
+                if (!Check.isNull(requestJson.getLong("dayBudget"))) {
+                    campaignJson.put("day_budget", requestJson.getLong("dayBudget"));
+                }
+
+                if (!Check.isNull(requestJson.getJSONArray("dayBudgetSchedule"))) {
+                    campaignJson.put("day_budget_schedule", requestJson.getJSONArray("dayBudgetSchedule"));
+                }
+
+                JSONArray campaignNames = new JSONArray();
+                if (nameType == 0) { // 0 为统一命名  1 为分别命名
+                    //    Integer startNum = requestJson.getInteger("startNum");
+                    Integer createTotal = requestJson.getInteger("createTotal");
+                    String campaignName = requestJson.getString("campaignName");
+                    for (int j = 0; j < createTotal; j++) {
+                        if (campaignName.contains("{{数值}}")) {
+                            String name = getName(campaignName, accountId, j, type);
+                            campaignNames.add(name);
+                        } else {
+                            String name = null;
+                            if (createTotal == 1) {
+                                name = getName(campaignName, accountId, null, type);
+                            } else {
+                                name = getName(campaignName + "_" + j, accountId, null, type);
+                            }
+                            campaignNames.add(name);
+                        }
+                    }
+                } else if (nameType == 1) { // "分别命名"
+                    JSONArray nameArr = requestJson.getJSONArray("nameArr");
+                    for (int j = 0; j < nameArr.size(); j++) {
+                        JSONObject nameJson = nameArr.getJSONObject(j);
+                        if (nameJson.getLong("accountId").equals(accountId)) {
+                            campaignNames = nameJson.getJSONArray("campaignNames");
+                        }
+                    }
+                }
+                if (!Check.isNull(campaignNames)) {
+                    JSONArray returnCampaigns = new JSONArray();
+                    for (int j = 0; j < campaignNames.size(); j++) {
+                        JSONObject returnCampaignJson = new JSONObject();
+                        String campaignName = (String) campaignNames.get(j);
+                        campaignJson.put("campaign_name", campaignName);
+                        Map<String, Object> campaignMap = kuaishouInterfaceService.campaignCreate(oauthToken.getAccessToken(), accountId, campaignJson);
+                        if ((Integer) campaignMap.get("code") == 0) {
+                            returnCampaignJson.put("code", 0);
+                            returnCampaignJson.put("campaignId", campaignMap.get("campaignId"));
+                            returnCampaignJson.put("campaignName", campaignName);
+                            returnCampaignJson.put("type", type);
+                            returnCampaignJson.put("message", campaignMap.get("message"));
+                        } else {
+                            returnCampaignJson.put("code", -1);
+                            returnCampaignJson.put("campaignName", campaignName);
+                            returnCampaignJson.put("message", campaignMap.get("message"));
+                        }
+                        returnCampaigns.add(returnCampaignJson);
+
+                    }
+                    returnJson.put("createDetail", returnCampaigns);
+
+                }
+                returnArr.add(returnJson);
+            }
+            result.setSuccess(true);
+            System.err.println(returnArr);
+            result.setResult(returnArr);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setMessage(e.getMessage());
+
+        }
+        return result;
+
+    }
+
+
+
+
+
+
+
+
+
+
     /**
      * @param content   计划名称
      * @param accountId 账户id

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

@@ -420,7 +420,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("end_date", DateUtils.formatDate(endDate));
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 500);
+        param.put("page_size", 2000);
         param.put("page", page);
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
@@ -588,7 +588,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("end_date", DateUtils.formatDate(endDate));
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 500);
+        param.put("page_size", 2000);
         param.put("page", page);
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
@@ -686,6 +686,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("page_size", 1000);
         param.put("page", page);
 
+
         String result = HttpUtils.httpPostRequest(url, param, headers);
         JSONObject resultJson = JSONObject.parseObject(result);
         Integer code = resultJson.getInteger("code");
@@ -796,7 +797,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         param.put("end_date", DateUtils.formatDate(endDate));
         param.put("advertiser_id", token.getAccountId());
         param.put("temporal_granularity", "HOURLY");
-        param.put("page_size", 200);
+        param.put("page_size", 2000);
         param.put("page", page);
 
         String result = HttpUtils.httpPostRequest(url, param, headers);
@@ -1211,7 +1212,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         headers.put("Content-Type", "application/json");
 
         String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
-        System.out.println(result);
         JSONObject resultJson = JSONObject.parseObject(result);
         if (Check.isNull(resultJson)) {
             log.error("获取广告组接口异常,advertiserId:{}", token.getAccountId());

+ 114 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java

@@ -0,0 +1,114 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKsNewGroupReportService;
+import cn.com.ctop.kuaishou.modules.report.service.IKsNewPlanReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ *  Created by JQ.bi on 2020.11.6
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/kuaishou/newGroup")
+public class KsNewGroupReportCtrl {
+
+    @Autowired
+    IKsNewGroupReportService newGroupReportService;
+
+    @Autowired
+    IKsNewPlanReportService newPlanReportService;
+
+    /**
+     * 新建计划、有效计划 chart数据
+     */
+    @PostMapping("/report/data")
+    public Result<Map<String, Object>> getNewGroupChartReport(@RequestBody JSONObject requestBody) {
+        Result<Map<String, Object>> resultBody = new Result<>();
+        Map<String, Object> result = new HashMap<>();
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        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");
+        try {
+            JSONObject sumData = newGroupReportService.getSumNewGroupBy(accountIds, startDate, endDate);
+            List<JSONObject> chartData = newGroupReportService.getKsNewGroupGroupByStatDate(accountIds, startDate, endDate);
+            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(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) {
+            log.error(e.getMessage(), e);
+            resultBody.setSuccess(false);
+        }
+        return resultBody;
+    }
+
+    @PostMapping("/report/list")
+    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        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");
+        try {
+            List<JSONObject> listData = newGroupReportService.getKsNewGroupGroupByAccount(accountIds, startDate, endDate,target,order);
+            result.setResult(listData);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+    /**
+     * 查询所有的快手运营
+     */
+    @PostMapping("/report/AllOperator")
+    public Result<List<JSONObject>> getAllOperator() {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> listData = newPlanReportService.getAllOperator();
+            result.setResult(listData);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+}

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

@@ -38,8 +38,6 @@ public class KsNewPlanReportCtrl {
         if(!userId.isEmpty()){
             accountIds= newPlanReportService.getAccountIdsByUserId(userId);
         }
-
-
         if(accountIds.isEmpty()){
             return resultBody;
         }

+ 18 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewGroupReportMapper.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface KsNewGroupReportMapper {
+
+    List<JSONObject> queryKsNewGroupGroupByAccount(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("target") String target, @Param("order") String order);
+
+    List<JSONObject> queryKsNewGroupGroupByStatDate(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<JSONObject> queryKsNewGroupGroupByMonth(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    JSONObject querySumNewGroupBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+}

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewPlanReportMapper.java

@@ -19,4 +19,7 @@ public interface KsNewPlanReportMapper {
     List<JSONObject> queryAllOperator();
 
     JSONArray queryAccountIdsByUserId(String userId);
+
+    JSONArray queryAccountIdsByMedia();
+
 }

+ 13 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java

@@ -5,6 +5,7 @@ import cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
 import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -18,11 +19,21 @@ public interface KuaishouReportDailyImageMapper extends BaseMapper<KuaishouRepor
 
     void loadImageDailyReport(Long accountId, String localPath);
 
-    List<KuaishouImageCostVO> imageCost(String startDate, String endDate, JSONArray accountList, String code);
+    List<KuaishouImageCostVO> imageCost(@Param(value = "startDate") String startDate,
+                                        @Param(value = "endDate")String endDate,
+                                        @Param(value = "accountList")JSONArray accountList,
+                                        @Param(value = "code")String code,
+                                        @Param(value = "order")String order,
+                                        @Param(value = "target")String target);
 
     void updateImageReportCode();
 
-    List<KuaishouImageCostVOEntity> imageCostEntity(String startDate, String endDate, JSONArray accountList, String code);
+    List<KuaishouImageCostVOEntity> imageCostEntity(@Param(value = "startDate") String startDate,
+                                                    @Param(value = "endDate")String endDate,
+                                                    @Param(value = "accountList")JSONArray accountList,
+                                                    @Param(value = "code")String code,
+                                                    @Param(value = "order")String order,
+                                                    @Param(value = "target")String target);
 
     void updateImageReportUserId();
 

+ 248 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewGroupReportMapper.xml

@@ -0,0 +1,248 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KsNewGroupReportMapper">
+
+    <select id="queryKsNewGroupGroupByAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        u.project_name as projectName,
+        u.auth_name as authName,
+        u.user_name as userName,
+        t.account_id accountId,
+        COUNT(t.unit_id) new,
+        COUNT(IF(t.charge > 500, TRUE, NULL)) valid,
+        max(t.group_create_time) maxCreateTime
+        FROM
+        (
+        SELECT
+        t1.account_id,
+        t1.unit_id,
+        t1.group_create_time,
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(charge), 0)
+        FROM
+        ctop_kuaishou_report_daily_group t2
+        WHERE
+        t2.unit_id = t1.unit_id
+        AND stat_date >= DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_date &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS charge
+        FROM
+        ctop_kuaishou_group t1
+        WHERE
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        unit_id
+        ) t LEFT JOIN ctop_user_allocation u on t.account_id=u.account_id
+        GROUP BY
+        t.account_id
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryKsNewGroupGroupByMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        DATE_FORMAT(t.statDate, '%Y-%m') statDate,
+        COUNT(t.unit_id) new,
+        COUNT(IF(t.charge > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id,
+        t1.unit_id,
+        t1.group_create_time,
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(charge), 0)
+        FROM
+        ctop_kuaishou_report_daily_group t2
+        WHERE
+        t2.unit_id = t1.unit_id
+        AND stat_date >= DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_date &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS charge
+        FROM
+        ctop_kuaishou_group t1
+        WHERE
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        unit_id
+        ) t
+        GROUP BY DATE_FORMAT(t.statDate, '%Y-%m')
+        ORDER BY statDate
+    </select>
+
+    <select id="queryKsNewGroupGroupByStatDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t.statDate,
+        COUNT(t.unit_id) new,
+        COUNT(IF(t.charge > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id,
+        t1.unit_id,
+        t1.group_create_time,
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(charge), 0)
+        FROM
+        ctop_kuaishou_report_daily_group t2
+        WHERE
+        t2.unit_id = t1.unit_id
+        AND stat_date >= DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_date &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS charge
+        FROM
+        ctop_kuaishou_group t1
+        WHERE
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        unit_id
+        ) t
+        GROUP BY
+        statDate
+        ORDER BY statDate
+    </select>
+
+    <select id="querySumNewGroupBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        COUNT(t.unit_id) new,
+        COUNT(IF(t.charge > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id,
+        t1.unit_id,
+        t1.group_create_time,
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(charge), 0)
+        FROM
+        ctop_kuaishou_report_daily_group t2
+        WHERE
+        t2.unit_id = t1.unit_id
+        AND stat_date >= DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_date &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS charge
+        FROM
+        ctop_kuaishou_group t1
+        WHERE
+        DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.group_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        unit_id
+        ) t
+    </select>
+
+</mapper>

+ 11 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewPlanReportMapper.xml

@@ -274,6 +274,17 @@
             ctop_user_allocation
         WHERE
             user_id = #{userId}
+        and account_status=0
+    </select>
+
+    <select id="queryAccountIdsByMedia" resultType="java.lang.Long">
+        SELECT
+            account_id
+        FROM
+            ctop_user_allocation
+        WHERE
+            media_id = 2
+          and account_status=0
     </select>
 
 </mapper>

+ 9 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -10,23 +10,22 @@
         IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where t3.material_id=t1.signature limit 1),'') AS shot,
         IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where t3.material_id=t1.signature limit 1),'') AS plan,
         t1.cover_url as converUrl,
-        t2.material_name AS materialName,
+        (select t2.material_name from ctop_material_info t2 where t2.code=t1.signature limit 1) AS materialName,
         (SELECT project_name FROM ctop_project t4 WHERE t4.id = t3.project_id) AS projectName,
-        t2.create_time as createTime,
+        (select t2.create_time from ctop_material_info t2 where t2.code=t1.signature limit 1) as createTime,
         ${filed}
         FROM
         ctop_kuaishou_report_daily_material t1
-        LEFT JOIN ctop_material_info t2 ON t1.signature = t2. CODE
         LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE
         t1.stat_date >= #{startDate}
         AND t1.stat_date &lt;= #{endDate}
         <if test="accountIds != null">
-        AND t1.account_id in
-        <foreach item="item" index="index" collection="accountIds"
-                 open="(" separator="," close=")">
-            #{item}
-        </foreach>
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         GROUP BY t1.signature
         ) t
@@ -42,7 +41,7 @@
         t1.signature,
         t1.photo_url as url,
         t1.cover_url as converUrl,
-        t2.material_name AS materialName,
+        (select t2.material_name from ctop_material_info t2 where t2.code=t1.signature limit 1) AS materialName,
         (
         SELECT
         project_name
@@ -59,11 +58,10 @@
         WHERE
         t4.id = t3.project_id limit 1
         ) AS advertiserName,
-        t2.create_time as createTime,
+        (select t2.create_time from ctop_material_info t2 where t2.code=t1.signature limit 1) as createTime,
         ${filed}
         FROM
         ctop_kuaishou_report_daily_material t1
-        left join ctop_material_info t2 on t1.signature=t2.code
         LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE t1.signature=#{signature}
         AND t1.stat_date >= #{startDate}

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

@@ -283,7 +283,7 @@
 
 
     <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
-      SELECT *FROM
+      SELECT * FROM
 		(SELECT
 			count(t1.stat_date) AS dates,
 			sum(t1.charge) AS charge,

+ 59 - 31
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml

@@ -105,20 +105,34 @@
           set account_id = #{accountId}
     </insert>
     <select id="imageCost" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVO">
-        select
-        report.cover_url as 'image_url' ,
+        select * from (select
+        report.cover_url as 'imageUrl' ,
         report.cover_id as 'signature',
-        group_concat(distinct p.project_name) AS 'project_name',
-        sum(report.charge) AS 'charge',
-        sum(report.photo_click) AS 'photo_click',
-        sum(report.photo_show) AS 'photo_show',
+        group_concat(distinct p.project_name) AS 'projectName',
+        sum(report.charge) AS 'cost',
+        sum(report.photo_click) AS 'photoClick',
+        (case when sum(report.photo_show)!=0 and sum(report.photo_click)!=0
+        then round(sum(photo_click)/sum(photo_show)*100,2)
+        else 0 end)as 'photoClickRate',
+        sum(report.photo_show) AS 'photoShow',
+        (case when sum(report.charge)!=0 and sum(report.photo_show)!=0
+        then round(sum(charge)/sum(photo_show)*1000,2)
+        else 0 end)as 'photoShowCost',
+        sum(report.aclick) as 'aclick',
+        sum(report.bclick) as 'bclick',
+        (case when sum(report.bclick)!=0 and sum(report.aclick)!=0
+        then round(sum(bclick)/sum(aclick)*100,2)
+        else 0 end)as 'bclickRate',
+        (case when sum(report.charge)!=0 and sum(report.aclick)!=0
+        then round(sum(charge)/sum(aclick)*1000,2)
+        else 0 end)as 'aclickCost',
         sum(report.activation) AS 'activation',
-        sum(report.event_register) AS 'event_register',
-        sum(report.event_pay) AS 'event_pay',
-        sum(report.form_count) AS 'form_count',
-        sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
-        sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
-        report.realname as 'user_name'
+        sum(report.event_register) AS 'eventRegister',
+        sum(report.event_pay) AS 'eventPay',
+        sum(report.form_count) AS 'formCount',
+        sum(report.event_jin_jian_app) AS 'eventJinJianApp',
+        sum(report.event_credit_grant_app) AS 'eventCreditGrantApp',
+        report.realname as 'userName'
         from ctop_kuaishou_report_daily_image report
         left join ctop_user_allocation allocation on allocation.account_id = report.account_id
         left join ctop_project p on p.id = allocation.project_id
@@ -141,31 +155,45 @@
         <if test="code!=null">
             and report.cover_id = #{code}
         </if>
-        group by report.cover_id
-        order by sum(report.charge) desc
+        group by report.cover_id)a
+        order by a.${target} ${order}
     </select>
     <select id="imageCostEntity" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity">
-        select
-        report.cover_url as 'image_url' ,
-        report.code as 'signature',
-        group_concat(distinct p.project_name) AS 'project_name',
-        sum(report.charge) AS 'charge',
-        sum(report.photo_click) AS 'photo_click',
-        sum(report.photo_show) AS 'photo_show',
+        select * from (select
+        report.cover_url as 'imageUrl' ,
+        report.cover_id as 'signature',
+        group_concat(distinct p.project_name) AS 'projectName',
+        sum(report.charge) AS 'cost',
+        sum(report.photo_click) AS 'photoClick',
+        (case when sum(report.photo_show)!=0 and sum(report.photo_click)!=0
+        then round(sum(photo_click)/sum(photo_show)*100,2)
+        else 0 end)as 'photoClickRate',
+        sum(report.photo_show) AS 'photoShow',
+        (case when sum(report.charge)!=0 and sum(report.photo_show)!=0
+        then round(sum(charge)/sum(photo_show)*1000,2)
+        else 0 end)as 'photoShowCost',
+        sum(report.aclick) as 'aclick',
+        sum(report.bclick) as 'bclick',
+        (case when sum(report.bclick)!=0 and sum(report.aclick)!=0
+        then round(sum(bclick)/sum(aclick)*100,2)
+        else 0 end)as 'bclickRate',
+        (case when sum(report.charge)!=0 and sum(report.aclick)!=0
+        then round(sum(charge)/sum(aclick)*1000,2)
+        else 0 end)as 'aclickCost',
         sum(report.activation) AS 'activation',
-        sum(report.event_register) AS 'event_register',
-        sum(report.event_pay) AS 'event_pay',
-        sum(report.form_count) AS 'form_count',
-        sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
-        sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
-        report.realname as 'user_name'
+        sum(report.event_register) AS 'eventRegister',
+        sum(report.event_pay) AS 'eventPay',
+        sum(report.form_count) AS 'formCount',
+        sum(report.event_jin_jian_app) AS 'eventJinJianApp',
+        sum(report.event_credit_grant_app) AS 'eventCreditGrantApp',
+        report.realname as 'userName'
         from ctop_kuaishou_report_daily_image report
         left join ctop_user_allocation allocation on allocation.account_id = report.account_id
         left join ctop_project p on p.id = allocation.project_id
         where
         1=1
         and
-        report.code is not null
+        report.cover_id is not null
         <if test="startDate!=null">
             and report.stat_date &gt;= #{startDate}
         </if>
@@ -179,10 +207,10 @@
             </foreach>
         </if>
         <if test="code!=null">
-            and report.code = #{code}
+            and report.cover_id = #{code}
         </if>
-        group by report.code
-        order by sum(report.charge) desc
+        group by report.cover_id)a
+        order by a.${target} ${order}
     </select>
 
     <update id="updateImageReportCode">

+ 16 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsNewGroupReportService.java

@@ -0,0 +1,16 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+public interface IKsNewGroupReportService {
+
+    List<JSONObject> getKsNewGroupGroupByAccount(JSONArray accountIds, String startDate, String endDate, String target, String order);
+
+    List<JSONObject> getKsNewGroupGroupByStatDate(JSONArray accountIds, String startDate, String endDate);
+
+    JSONObject getSumNewGroupBy(JSONArray accountIds, String startDate, String endDate);
+
+}

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

@@ -16,4 +16,7 @@ public interface IKsNewPlanReportService {
     List<JSONObject> getAllOperator();
 
     JSONArray getAccountIdsByUserId(String userId);
+
+    JSONArray getAccountIdsByMedia();
+
 }

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

@@ -0,0 +1,52 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.kuaishou.modules.report.mapper.KsNewGroupReportMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKsNewGroupReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  Created By JQ.bi on 2020.11.2
+ */
+@Slf4j
+@Service
+public class KsNewGroupReportServiceImpl implements IKsNewGroupReportService {
+
+    @Autowired
+    private KsNewGroupReportMapper NewGroupReportMapper;
+
+    @Override
+    public List<JSONObject> getKsNewGroupGroupByAccount(JSONArray accountIds, String startDate, String endDate, String target, String order) {
+        return NewGroupReportMapper.queryKsNewGroupGroupByAccount(accountIds,startDate,endDate,target,order);
+    }
+
+    @Override
+    public List<JSONObject> getKsNewGroupGroupByStatDate(JSONArray accountIds, String startDate, String endDate) {
+        List<JSONObject> resultList= new ArrayList<>();
+        try {
+            if(DateUtils.isMoreSixMonth(startDate,endDate)){
+                resultList = NewGroupReportMapper.queryKsNewGroupGroupByMonth(accountIds,startDate,endDate);
+            }
+            else {
+                resultList = NewGroupReportMapper.queryKsNewGroupGroupByStatDate(accountIds,startDate,endDate);
+            }
+        } catch (ParseException e) {
+            log.error(e.getMessage());
+        }
+        return resultList;
+    }
+
+    @Override
+    public JSONObject getSumNewGroupBy(JSONArray accountIds, String startDate, String endDate) {
+        return NewGroupReportMapper.querySumNewGroupBy(accountIds,startDate,endDate);
+    }
+
+}

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

@@ -59,4 +59,9 @@ public class KsNewPlanReportServiceImpl  implements IKsNewPlanReportService {
         return newPlanReportMapper.queryAccountIdsByUserId(userId);
     }
 
+    @Override
+    public JSONArray getAccountIdsByMedia() {
+        return newPlanReportMapper.queryAccountIdsByMedia();
+    }
+
 }

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

@@ -0,0 +1,114 @@
+package cn.com.ctop.toutiao.modules.report.controller;
+
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceNewPlanReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Created by JQ.bi on 2020.11.4
+ */
+@Slf4j
+@RestController
+@RequestMapping("/ctop/bytedance/newPlan")
+public class BytedanceNewPlanReportCtrl {
+
+    @Autowired
+    IBytedanceNewPlanReportService newPlanReportService;
+
+    /**
+     * 新建计划、有效计划 chart数据
+     */
+    @PostMapping("/report/data")
+    public Result<Map<String, Object>> getNewPlanChartReport(@RequestBody JSONObject requestBody) {
+        Result<Map<String, Object>> resultBody = new Result<>();
+        Map<String, Object> result = new HashMap<>();
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        //TODO 没有维护头条事业部负责人角色,增加判断
+        String userId = requestBody.getString("userId");
+        if (userId.equals("0c2113fb63b94941be024efce2d83369")) {
+            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");
+        try {
+            JSONObject sumData = newPlanReportService.getSumNewPlanBy(accountIds, startDate, endDate);
+            List<JSONObject> chartData = newPlanReportService.getBytedanceNewPlanGroupByStatDate(accountIds, startDate, endDate);
+            List<JSONObject> listData = newPlanReportService.getBytedanceNewPlanGroupByAccount(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) {
+            log.error(e.getMessage(), e);
+            resultBody.setSuccess(false);
+        }
+        return resultBody;
+    }
+
+    /**
+     * 查询素材报表表格数据
+     */
+    @PostMapping("/report/list")
+    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+        Result<List<JSONObject>> result = new Result<>();
+
+        JSONArray accountIds = requestBody.getJSONArray("accountIds");
+        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");
+        try {
+            List<JSONObject> listData = newPlanReportService.getBytedanceNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
+            result.setResult(listData);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+    /**
+     * 查询所有的快手运营
+     */
+    @PostMapping("/report/AllOperator")
+    public Result<List<JSONObject>> getAllOperator() {
+        Result<List<JSONObject>> result = new Result<>();
+        try {
+            List<JSONObject> listData = newPlanReportService.getAllOperator();
+            result.setResult(listData);
+            result.setSuccess(true);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.setSuccess(false);
+        }
+        return result;
+    }
+
+}

+ 25 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceNewPlanReportMapper.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.toutiao.modules.report.mapper;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface BytedanceNewPlanReportMapper {
+
+    List<JSONObject> queryBytedanceNewPlanGroupByAccount(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("target") String target, @Param("order") String order);
+
+    List<JSONObject> queryBytedanceNewPlanGroupByStatDate(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<JSONObject> queryBytedanceNewPlanGroupByMonth(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    JSONObject querySumNewPlanBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<JSONObject> queryAllOperator();
+
+    JSONArray queryAccountIdsByUserId(String userId);
+
+    JSONArray queryAccountIdsByMedia();
+
+}

+ 6 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java

@@ -35,7 +35,9 @@ public interface BytedanceReportMaterialDailyMapper extends BaseMapper<Bytedance
     List<BytedanceImageCostVO> bytedanceImageCost(@Param("startDate")String startDate,
                                                   @Param("endDate")String endDate,
                                                   @Param("accountList")JSONArray accountList,
-                                                  @Param("code")String code);
+                                                  @Param("code")String code,
+                                                  @Param("order")String order,
+                                                  @Param("target")String target);
 
     void replaceImageBatch(@Param("infos")List<BytedanceReportMaterialDaily> bytedanceReportImageDailyList);
     void updateImageReportCode();
@@ -47,5 +49,7 @@ public interface BytedanceReportMaterialDailyMapper extends BaseMapper<Bytedance
     List<BytedanceImageCostVOEntity> bytedanceImageCostEntity(@Param("startDate")String startDate,
                                                               @Param("endDate")String endDate,
                                                               @Param("accountList")JSONArray accountList,
-                                                              @Param("code")String code);
+                                                              @Param("code")String code,
+                                                              @Param("order")String order,
+                                                              @Param("target")String target);
 }

+ 294 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceNewPlanReportMapper.xml

@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.toutiao.modules.report.mapper.BytedanceNewPlanReportMapper">
+
+    <select id="queryBytedanceNewPlanGroupByAccount" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        u.project_name AS projectName,
+        u.auth_name AS authName,
+        u.user_name AS userName,
+        t.accountId,
+        COUNT(t.planId) new,
+        COUNT(IF(t.cost > 500, TRUE, NULL)) valid,
+        max(t.ad_create_time) maxCreateTime
+        FROM
+        (
+        SELECT
+        t1.account_id as accountId,
+        t1.id as planId,
+        t1.ad_create_time,
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(cost), 0)
+        FROM
+        ctop_bytedance_report_plan_daily t2
+        WHERE
+        t2.ad_id = t1.id
+        AND stat_datetime >= DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_datetime &lt;DATE_ADD(
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS cost
+        FROM
+        ctop_bytedance_advertise_plan t1
+        WHERE
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        id
+        ) t
+        LEFT JOIN ctop_user_allocation u ON t.accountId = u.account_id
+        GROUP BY
+        t.accountId
+        ORDER BY ${target} ${order}
+    </select>
+
+    <select id="queryBytedanceNewPlanGroupByMonth" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        DATE_FORMAT(t.statDate, '%Y-%m') statDate,
+        COUNT(t.planId) new,
+        COUNT(IF(t.cost > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id as accountId,
+        t1.id as planId,
+        t1.ad_create_time,
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(cost), 0)
+        FROM
+        ctop_bytedance_report_plan_daily t2
+        WHERE
+        t2.ad_id = t1.id
+        AND stat_datetime >= DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_datetime &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS cost
+        FROM
+        ctop_bytedance_advertise_plan t1
+        WHERE
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        id
+        ) t
+        GROUP BY DATE_FORMAT(t.statDate, '%Y-%m')
+        ORDER BY statDate
+    </select>
+
+    <select id="queryBytedanceNewPlanGroupByStatDate" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t.statDate,
+        COUNT(t.planId) new,
+        COUNT(IF(t.cost > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id as accountId,
+        t1.id as planId,
+        t1.ad_create_time,
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(cost), 0)
+        FROM
+        ctop_bytedance_report_plan_daily t2
+        WHERE
+        t2.ad_id = t1.id
+        AND stat_datetime >= DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_datetime &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS cost
+        FROM
+        ctop_bytedance_advertise_plan t1
+        WHERE
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        id
+        ) t
+        GROUP BY
+        statDate
+        ORDER BY statDate
+    </select>
+
+    <select id="querySumNewPlanBy" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        COUNT(t.planId) new,
+        COUNT(IF(t.cost > 500, TRUE, NULL)) valid
+        FROM
+        (
+        SELECT
+        t1.account_id as accountId,
+        t1.id as planId,
+        t1.ad_create_time,
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) AS statDate,
+        (
+        SELECT
+        ifnull(sum(cost), 0)
+        FROM
+        ctop_bytedance_report_plan_daily t2
+        WHERE
+        t2.ad_id = t1.id
+        AND stat_datetime >= DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        )
+        AND stat_datetime &lt; DATE_ADD(
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ),
+        INTERVAL '7' DAY
+        )
+        ) AS cost
+        FROM
+        ctop_bytedance_advertise_plan t1
+        WHERE
+        DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) >= #{startDate}
+        AND DATE_FORMAT(
+        t1.ad_create_time,
+        '%Y-%m-%d'
+        ) &lt;= #{endDate}
+        <if test="accountIds != null">
+            AND t1.account_id in
+            <foreach item="item" index="index" collection="accountIds"
+                     open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        GROUP BY
+        account_id,
+        id
+        ) t
+    </select>
+
+    <select id="queryAllOperator"  resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+            DISTINCT user_id,user_name
+        FROM
+            ctop_project_member
+        WHERE
+                project_id IN (
+                SELECT
+                    id
+                FROM
+                    ctop_project
+                WHERE
+                    media_id = 1
+            )
+          and
+                role_code IN (
+                              'operator',
+                              'toutiaoOperationManager',
+                              'operationAssistant'
+                )
+    </select>
+
+    <select id="queryAccountIdsByUserId" resultType="java.lang.Long">
+        SELECT
+            account_id
+        FROM
+            ctop_user_allocation
+        WHERE
+            user_id = #{userId}
+          and account_status=0
+    </select>
+
+
+    <select id="queryAccountIdsByMedia" resultType="java.lang.Long">
+        SELECT
+            account_id
+        FROM
+            ctop_user_allocation
+        WHERE
+            media_id = 1
+          and account_status=0
+    </select>
+
+
+
+</mapper>

+ 45 - 24
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -239,16 +239,27 @@
         where status = 0
     </select>
     <select id="bytedanceImageCost" resultType="cn.com.ctop.common.module.vo.BytedanceImageCostVO">
-        select round(sum(report.cost),2)                              as 'cost',
-        sum(report.click)                                             as 'click',
-        sum(report.show_material)                                     as 'show_num',
-        sum(report.convert_material)                                  as 'convert',
-        report.image_url                                           as 'image_url',
-        report.material_id                                           as 'signature',
-        group_concat(distinct report.project_name)                    as 'project_name',
-        report.stat_datetime                                          as 'stat_date',
-        report.plane_id as 'user_id',
-        report.plane_name as 'user_name'
+        select * from (
+        select
+        round(sum(report.cost), 2)                 as 'cost',
+        sum(report.click)                          as 'click',
+        (case when sum(report.show_material)!=0 and sum(report.click)!=0
+        then round(sum(report.click)/sum(report.show_material)*100,2)
+        else 0 end)                       as 'clickRate',
+        sum(report.show_material)                  as 'showNum',
+        sum(report.convert_material)               as 'convert',
+        (case when sum(report.convert_material)!=0 and sum(report.click)!=0
+        then round(sum(report.convert_material)/sum(report.click)*100,2)
+        else 0 end)                       as 'convertRate',
+        (case when sum(report.cost)!=0 and sum(report.convert_material)!=0
+        then round(sum(report.cost)/sum(report.convert_material),2)
+        else 0 end)                       as 'convertCost',
+        report.image_url                           as 'imageUrl',
+        report.material_id                         as 'signature',
+        group_concat(distinct report.project_name) as 'projectName',
+        report.stat_datetime                       as 'statDate',
+        report.plane_id                            as 'userId',
+        report.plane_name                          as 'userName'
             from ctop_bytedance_report_image_daily report
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
@@ -269,8 +280,7 @@
         <if test="code!=null">
             and report.material_id = #{code}
         </if>
-        group by report.material_id
-        order by sum(report.cost) desc
+        group by report.material_id)a order by a.${target} ${order}
     </select>
 
     <update id="updateImageReportCode">
@@ -328,17 +338,29 @@ where a.plane_id is not null and a.plane_name is null
         and end_date = #{retry.endDate}
     </update>
     <select id="bytedanceImageCostEntity" resultType="cn.com.ctop.common.module.vo.BytedanceImageCostVOEntity">
-        select round(sum(report.cost),2)                              as 'cost',
-        sum(report.click)                                             as 'click',
-        sum(report.show_material)                                     as 'show_num',
-        sum(report.convert_material)                                  as 'convert',
-        report.image_url                                           as 'image_url',
-        report.material_id                                           as 'signature',
-        group_concat(distinct report.project_name)                    as 'project_name',
-        report.stat_datetime                                          as 'stat_date',
-        report.plane_id as 'user_id',
-        report.plane_name as 'user_name'
+        select * from (
+        select
+        round(sum(report.cost), 2)                 as 'cost',
+        sum(report.click)                          as 'click',
+        (case when sum(report.show_material)!=0 and sum(report.click)!=0
+        then round(sum(report.click)/sum(report.show_material)*100,2)
+        else 0 end)                       as 'clickRate',
+        sum(report.show_material)                  as 'showNum',
+        sum(report.convert_material)               as 'convert',
+        (case when sum(report.convert_material)!=0 and sum(report.click)!=0
+        then round(sum(report.convert_material)/sum(report.click)*100,2)
+        else 0 end)                       as 'convertRate',
+        (case when sum(report.cost)!=0 and sum(report.convert_material)!=0
+        then round(sum(report.cost)/sum(report.convert_material),2)
+        else 0 end)                       as 'convertCost',
+        report.image_url                           as 'imageUrl',
+        report.material_id                         as 'signature',
+        group_concat(distinct report.project_name) as 'projectName',
+        report.stat_datetime                       as 'statDate',
+        report.plane_id                            as 'userId',
+        report.plane_name                          as 'userName'
         from ctop_bytedance_report_image_daily report
+        left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1
         and report.material_id is not null
@@ -357,8 +379,7 @@ where a.plane_id is not null and a.plane_name is null
         <if test="code!=null">
             and report.material_id = #{code}
         </if>
-        group by report.material_id
-        order by sum(report.cost) desc
+        group by report.material_id)a order by a.${target} ${order}
     </select>
 
     <insert id="replaceIntoVideoMaterialBatch">

+ 8 - 12
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -5,18 +5,17 @@
     <select id="queryVideoReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT * from (SELECT
         t1.signature,
-        t2.url,
+        t1.video_url as url,
         IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.clip_id=u.id where t3.material_id=t1.signature limit 1),'') AS clip,
         IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.shot_id=u.id where t3.material_id=t1.signature limit 1),'') AS shot,
         IFNULL((SELECT u.realname FROM ctop_material_ascription t3 LEFT JOIN sys_user u on t3.plan_id=u.id where t3.material_id=t1.signature limit 1),'') AS plan,
-        t2.cover_url as converUrl,
-        t2.material_name AS materialName,
+        (select t2.cover_url from ctop_material_info t2 where t2.code=t1.signature limit 1) AS converUrl,
+        (select t2.material_name from ctop_material_info t2 where t2.code=t1.signature limit 1) AS materialName,
         (SELECT project_name FROM ctop_project t4 WHERE t4.id = t3.project_id) AS projectName,
-        t2.create_time as createTime,
+        (select t2.create_time from ctop_material_info t2 where t2.code=t1.signature limit 1) as createTime,
         ${filed}
         FROM
         ctop_bytedance_video_report_daily t1
-        left join ctop_material_info t2 on t1.signature=t2.code
         LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE
         t1.stat_datetime >= #{startDate}
@@ -28,7 +27,6 @@
                 #{item}
             </foreach>
         </if>
-        AND t2.url!=""
         GROUP BY t1.signature
         ) t
         WHERE (t.clip LIKE '%${clip}%')
@@ -41,9 +39,9 @@
         SELECT
         t1.stat_datetime as statDate,
         t1.signature,
-        t2.url,
-        t2.cover_url as converUrl,
-        t2.material_name AS materialName,
+        t1.video_url as url,
+        (select t2.cover_url from ctop_material_info t2 where t2.code=t1.signature limit 1) AS converUrl,
+        (select t2.material_name from ctop_material_info t2 where t2.code=t1.signature limit 1) AS materialName,
         (
         SELECT
         project_name
@@ -60,11 +58,10 @@
         WHERE
         t4.id = t3.project_id limit 1
         ) AS advertiserName,
-        t2.create_time as createTime,
+        (select t2.create_time from ctop_material_info t2 where t2.code=t1.signature limit 1) as createTime,
         ${filed}
         FROM
         ctop_bytedance_video_report_daily t1
-        left join ctop_material_info t2 on t1.signature=t2.code
         LEFT JOIN ctop_user_allocation t3 ON t3.account_id=t1.account_id
         WHERE t1.signature=#{signature}
         AND t1.stat_datetime >= #{startDate}
@@ -76,7 +73,6 @@
                 #{item}
             </foreach>
         </if>
-        AND t2.url!=""
         GROUP BY t1.signature,t1.stat_datetime
     </select>
 </mapper>

+ 22 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceNewPlanReportService.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.toutiao.modules.report.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.List;
+
+public interface IBytedanceNewPlanReportService {
+
+    List<JSONObject> getBytedanceNewPlanGroupByAccount(JSONArray accountIds, String startDate, String endDate, String target, String order);
+
+    List<JSONObject> getBytedanceNewPlanGroupByStatDate(JSONArray accountIds, String startDate, String endDate);
+
+    JSONObject getSumNewPlanBy(JSONArray accountIds, String startDate, String endDate);
+
+    List<JSONObject> getAllOperator();
+
+    JSONArray getAccountIdsByUserId(String userId);
+
+    JSONArray getAccountIdsByMedia();
+
+}

+ 67 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceNewPlanReportServiceImpl.java

@@ -0,0 +1,67 @@
+package cn.com.ctop.toutiao.modules.report.service.impl;
+
+import cn.com.ctop.toutiao.modules.report.mapper.BytedanceNewPlanReportMapper;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceNewPlanReportService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *  Created By JQ.bi on 2020.11.4
+ */
+@Slf4j
+@Service
+public class BytedanceNewPlanReportServiceImpl implements IBytedanceNewPlanReportService {
+
+    @Autowired
+    private BytedanceNewPlanReportMapper newPlanReportMapper;
+
+    @Override
+    public List<JSONObject> getBytedanceNewPlanGroupByAccount(JSONArray accountIds, String startDate, String endDate, String target, String order) {
+        return newPlanReportMapper.queryBytedanceNewPlanGroupByAccount(accountIds,startDate,endDate,target,order);
+    }
+
+    @Override
+    public List<JSONObject> getBytedanceNewPlanGroupByStatDate(JSONArray accountIds, String startDate, String endDate) {
+        List<JSONObject> resultList= new ArrayList<>();
+        try {
+            if(DateUtils.isMoreSixMonth(startDate,endDate)){
+                resultList = newPlanReportMapper.queryBytedanceNewPlanGroupByMonth(accountIds,startDate,endDate);
+            }
+            else {
+                resultList = newPlanReportMapper.queryBytedanceNewPlanGroupByStatDate(accountIds,startDate,endDate);
+            }
+        } catch (ParseException e) {
+            log.error(e.getMessage());
+        }
+        return resultList;
+    }
+
+    @Override
+    public JSONObject getSumNewPlanBy(JSONArray accountIds, String startDate, String endDate) {
+        return newPlanReportMapper.querySumNewPlanBy(accountIds,startDate,endDate);
+    }
+
+    @Override
+    public List<JSONObject> getAllOperator() {
+        return newPlanReportMapper.queryAllOperator();
+    }
+
+    @Override
+    public JSONArray getAccountIdsByUserId(String userId) {
+        return newPlanReportMapper.queryAccountIdsByUserId(userId);
+    }
+
+    @Override
+    public JSONArray getAccountIdsByMedia() {
+        return newPlanReportMapper.queryAccountIdsByMedia();
+    }
+
+}