Quellcode durchsuchen

Merge remote-tracking branch 'origin/master'

syh vor 4 Jahren
Ursprung
Commit
90a676ebb9
21 geänderte Dateien mit 1119 neuen und 11 gelöschten Zeilen
  1. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/ICtopOauthTokenService.java
  2. 1 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/CtopOauthTokenServiceImpl.java
  3. 2 2
      module-job-kuaishou/src/main/resources/application-prod.yml
  4. 118 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/CrossAccountBatchController.java
  5. 4 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  6. 114 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewGroupReportCtrl.java
  7. 0 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KsNewPlanReportCtrl.java
  8. 18 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewGroupReportMapper.java
  9. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KsNewPlanReportMapper.java
  10. 248 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewGroupReportMapper.xml
  11. 11 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsNewPlanReportMapper.xml
  12. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  13. 16 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsNewGroupReportService.java
  14. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKsNewPlanReportService.java
  15. 52 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsNewGroupReportServiceImpl.java
  16. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KsNewPlanReportServiceImpl.java
  17. 114 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java
  18. 25 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceNewPlanReportMapper.java
  19. 294 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceNewPlanReportMapper.xml
  20. 22 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceNewPlanReportService.java
  21. 67 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceNewPlanReportServiceImpl.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);

+ 2 - 2
module-job-kuaishou/src/main/resources/application-prod.yml

@@ -98,7 +98,7 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 127.0.0.1
+    host: 172.30.0.17
     lettuce:
       pool:
         max-active: 8   #最大连接数据库连接数,设 0 为没有限制
@@ -106,7 +106,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: foobared
     port: 6379
 #mybatis plus 设置
 mybatis-plus:

+ 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();
+
 }

+ 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>

+ 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,

+ 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();
+
+}

+ 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>

+ 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();
+    }
+
+}