Browse Source

Merge remote-tracking branch 'origin/master'

yumeng 2 năm trước cách đây
mục cha
commit
f0b30203be
15 tập tin đã thay đổi với 371 bổ sung101 xóa
  1. 16 9
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BytedanceAccountReportDailyDwMapper.xml
  2. 4 1
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml
  3. 23 6
      jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java
  4. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java
  5. 23 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml
  6. 2 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/ISendMessageService.java
  7. 10 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/SendMessageServiceImpl.java
  8. 4 3
      jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentApplicationServiceImpl.java
  9. 4 5
      jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentRechargeApplicationServiceImpl.java
  10. 2 2
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/WarningOperationServiceImpl.java
  11. 7 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java
  12. 238 70
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml
  13. 6 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/NewMonitorService.java
  14. 25 0
      jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java
  15. 5 5
      jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

+ 16 - 9
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/BytedanceAccountReportDailyDwMapper.xml

@@ -149,7 +149,10 @@
         </if>
         ) t7 ON t1.project_id = t7.project_id
         LEFT JOIN (
-        SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
+        SELECT project_id,
+               IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',
+               SUM(new_cpd_project_num) as 'projectNum'
+        FROM
         application.app_bytedance_account_base_info_d
         WHERE stat_date =DATE_FORMAT(DATE_SUB(#{startTime}, INTERVAL 1 DAY ), '%Y%m%d')
         AND company_id in ('5e46b5dea3d740eeb8ff1a2895015a4b' , 'd57fecdcf7a94d009736d9c850731582')
@@ -242,7 +245,11 @@
         </if>
         ) t6 ON t1.project_id = t6.project_id
         LEFT JOIN (
-        SELECT project_id , SUM(new_ad_num) as 'unitNum',SUM(new_cpd_project_num) as 'projectNum' FROM
+        SELECT
+               project_id,
+               IFNULL(SUM(new_ad_num),0)+IFNULL(SUM(promotion_num),0) as 'unitNum',
+               SUM(new_cpd_project_num) as 'projectNum'
+        FROM
         application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startTime}
         AND stat_date &lt;= #{endTime}
@@ -331,7 +338,7 @@
 
     <select id="getToutiaoOperateInfoHourly" resultType="com.alibaba.fastjson.JSONObject">
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
-        COUNT(DISTINCT t.project_id) 'projectNum',
+        COUNT(DISTINCT t.project_id) 'projectNums',
         SUM(t.cost) 'totalCost',
         t.user_id as 'userId',
         t2.realname as 'userName',
@@ -383,7 +390,7 @@
 
     <select id="getToutiaoOperateInfo" resultType="com.alibaba.fastjson.JSONObject">
         SELECT COUNT(DISTINCT t.account_id) 'accountNum',
-        COUNT(DISTINCT t.project_id) 'projectNum',
+        COUNT(DISTINCT t.project_id) 'projectNums',
         SUM(t.cost) 'totalCost',
         t.user_id as 'userId',
         t2.realname as 'userName',
@@ -413,7 +420,7 @@
         ) t3 ON t.user_id = t3.user_id
         LEFT JOIN (
         SELECT user_id,
-        IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(trust_unit_num),0) as 'newUnitNum',
+        IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(trust_unit_num),0) + IFNULL(SUM(promotion_num),0)  as 'newUnitNum',
         IFNULL(SUM(new_campaign_num),0) as 'newCampaignNum',
         SUM(new_cpd_project_num) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
@@ -447,7 +454,7 @@
         SELECT
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
-        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNum',
+        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNums',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         t3.lastCost,
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
@@ -501,7 +508,7 @@
         </if>
         ) t3 ON 1 = 1
         LEFT JOIN (
-        SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
+        SELECT IFNULL(SUM(new_ad_num),0) +IFNULL(SUM(promotion_num),0)  as 'unitNum',
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startDate}
@@ -520,7 +527,7 @@
         SELECT
         IFNULL( count( t1.user_id ), 0 ) AS 'operationNum',
         IFNULL( SUM( t1.accountNum ), 0 ) AS 'accountNum',
-        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNum',
+        IFNULL( SUM( t1.projectNum ), 0 ) AS 'projectNums',
         IFNULL( SUM( t1.totalCost ), 0 ) AS 'totalCost',
         t3.lastCost,
         CONCAT( CAST( IFNULL( ROUND(( SUM( t1.totalCost ) - t3.lastCost )/ t3.lastCost * 100, 2 ), 0 ) AS CHAR ), '%' )
@@ -572,7 +579,7 @@
         </if>
         ) t3 ON 1 = 1
         LEFT JOIN (
-        SELECT IFNULL(SUM(new_ad_num),'-') as 'unitNum',
+        SELECT IFNULL(SUM(new_ad_num),0) + IFNULL(SUM(promotion_num),0)  as 'unitNum',
         IFNULL(SUM(new_cpd_project_num),0) as 'projectNum'
         FROM application.app_bytedance_account_base_info_d
         WHERE stat_date >= #{startDate}

+ 4 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/mapper/xml/MaterialStareMapper.xml

@@ -323,7 +323,8 @@
         IFNULL(SUM( abi.new_video_num ),0) AS newVideoNum,
         IFNULL(SUM( abi.new_hot_num ),0) AS newHotNum,
         IFNULL(SUM( abi.new_cpd_project_num ),0) AS newCpdProjectNum,
-        IFNULL(SUM( abi.new_ad_num ),0) AS newUnitNum
+        IFNULL(SUM( abi.new_ad_num ),0) AS newUnitNum,
+        IFNULL(SUM( abi.promotion_num ),0) AS newUnitNum2
         from application.app_bytedance_account_base_info_d abi,
         `jeecg-boot`.ctop_user_allocation u
         WHERE abi.account_id = u.account_id
@@ -1832,6 +1833,8 @@
         FROM application.`app_user_manage`
         WHERE manage_id = #{learderId}
           AND type = 1
+        UNION ALL
+        SELECT #{learderId}
     </select>
 
 

+ 23 - 6
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/impl/MaterialStareServiceImpl.java

@@ -496,7 +496,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
-                    operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum") + newUnitNumNow);//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    operate.setNewUnitNum(newUnitNumNow);//组
                     operate.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//组
 
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
@@ -609,7 +612,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(ids, null, null, startDate, entDate);
                     //operate.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     operate.setNewCampaignNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCampaignNum"));//计划
-                    operate.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum") + newUnitNumNow);//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    operate.setNewUnitNum(newUnitNumNow);//组
 
                     //List<KuaiShouOperateVo> userOperate = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,userSet);
                     List<KuaiShouOperateVo> userOperate = materialStareMapper.getBytedanceOperateInfo(lastTimeStart, lastTimeEnd, ids);
@@ -755,7 +761,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
-                    projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     projectInfo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
 
@@ -937,7 +946,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
                     //projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
                     projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
-                    projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
+                    projectInfo.setNewUnitNum(newUnitNumNow);//基建数
                     //projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
 
 
@@ -1576,7 +1588,9 @@ public class MaterialStareServiceImpl implements MaterialStareService {
 
                 if (mediaType.equals("1")) {
                     JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, startDate, entDate);
-                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                    Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                    newUnitNumNow = Math.addExact(unitNum,unitNum1);
                     groupVo.setNewProjectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newCpdProjectNum"));
                 } else {
                     //查询 历史上新组
@@ -1728,11 +1742,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     if (mediaType.equals("1")) {
                         //查询 当天有效 上新计划 上新组
                         newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
+                        Integer unitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                        Integer unitNum1 = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum2");//组
+                        newUnitNumNow = Math.addExact(unitNum,unitNum1);
                     } else {
                         //查询 当天有效 上新计划 上新组
                         newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds, null, null, nowDate, nowDate);
+                        newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                     }
-                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                 }
 
                 if (mediaType.equals("1")) {

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/MailLogMapper.java

@@ -27,4 +27,6 @@ public interface MailLogMapper extends BaseMapper<MailLog> {
     String getUserNameByUserId(@Param("userId") String transferor);
 
     JSONObject getWeChatByMail(@Param("mail") String mail);
+
+    List<JSONObject> getWChatIdByAccountId(@Param("accountId") Long accountId);
 }

+ 23 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/mapper/xml/MailLogMapper.xml

@@ -51,6 +51,29 @@
 
     </select>
 
+
+    <select id="getWChatIdByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = (select ctop_user_allocation.user_id
+                         from ctop_user_allocation
+                         where account_id = #{accountId} limit 1)
+        union all
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = (select leader_id
+                         from sys_user
+                         where id = (SELECT ctop_user_allocation.user_id
+                                     FROM ctop_user_allocation
+                                     WHERE account_id = #{accountId}
+            LIMIT 1))
+        union all
+        select wexin_id, corp_id, wexin_name
+        from ctop_corp_wexin_user
+        where user_id = 'f6a6843879c949618e4a859140c8a127';
+
+    </select>
+
     <select id="getUserNameByUserId" resultType="java.lang.String">
     select
     realname

+ 2 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/ISendMessageService.java

@@ -2,4 +2,6 @@ package cn.com.ctop.common.module.service;
 
 public interface ISendMessageService {
     void sendMessage(String id, String text);
+
+    void sendMessageByAccountId(Long accountId, String text);
 }

+ 10 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/common/module/service/impl/SendMessageServiceImpl.java

@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Slf4j
 @Service
 public class SendMessageServiceImpl implements ISendMessageService {
@@ -25,4 +27,12 @@ public class SendMessageServiceImpl implements ISendMessageService {
             log.info("消息发送成功,userId:{}", userId);
         }
     }
+
+    @Override
+    public void sendMessageByAccountId(Long accountId, String text) {
+        List<JSONObject> list = mailLogMapper.getWChatIdByAccountId(accountId);
+        for (JSONObject jsonObject : list) {
+            corpWexinUtils.sendMessageByWeChatId(jsonObject, text);
+        }
+    }
 }

+ 4 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentApplicationServiceImpl.java

@@ -73,12 +73,13 @@ public class FinancePaymentApplicationServiceImpl extends ServiceImpl<FinancePay
         }
         //获取审核人
         getRevieweder(application);
-        //添加申请记录 0 创建
-        insertRecord(application.getId(), application.getApplicanterId(), "0", null, application.getFiles(), new Date());
-        Thread.sleep(100);
+        Date createTime = new Date();
+        Thread.sleep(200);
         //添加申请
         this.save(application);
         //消息通知内容
+        //添加申请记录 0 创建
+        insertRecord(application.getId(), application.getApplicanterId(), "0", null, application.getFiles(), createTime);
         String message = messageTemplate.getFinancePaymentApplicationMessage(application);
         //审核人为 财务审核角色
         if ("financialReview".equals(application.getReviewederId())) {

+ 4 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/finance/payment/service/impl/FinancePaymentRechargeApplicationServiceImpl.java

@@ -112,15 +112,14 @@ public class FinancePaymentRechargeApplicationServiceImpl extends ServiceImpl<Fi
                 recharge.setProjectName(project.getProjectName());
                 data.put("projectName", project.getProjectName());
             }
+            Date createTime = new Date();
+            Thread.sleep(200);
             //判断审核人和状态
             getReviewedRole(recharge);
             recharge.setPoolId(pool.getId());
-            //添加申请记录
-            insertRecord(recharge.getId(), recharge.getApplicanterId(), "0", null, recharge.getFiles(), new Date());
-
-            Thread.sleep(100);
-
             this.save(recharge);
+            //添加申请记录
+            insertRecord(recharge.getId(), recharge.getApplicanterId(), "0", null, recharge.getFiles(), createTime);
             //添加充值账户信息
             List<FinancePaymentRechargeAccount> accountList = new ArrayList<>();
             String accountIds = "";

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/WarningOperationServiceImpl.java

@@ -70,7 +70,7 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
         warningOperationLogService.save(warningOperationLog);
         log.info("出价方式预警,暂停组成功,accountId:{},unitId:{}", advertiserId, unitId);
         try {
-            sendMessageService.sendMessage(userId, text);
+            sendMessageService.sendMessageByAccountId(advertiserId, text);
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -103,7 +103,7 @@ public class WarningOperationServiceImpl implements IWarningOperationService {
         warningOperationLogService.save(warningOperationLog);
         log.info("出价过高预警,暂停组成功,accountId:{},unitId:{}", advertiserId, unitId);
         try {
-            sendMessageService.sendMessage(userId, text);
+            sendMessageService.sendMessageByAccountId(advertiserId, text);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 7 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/NewMonitorMapper.java

@@ -58,4 +58,11 @@ public interface NewMonitorMapper {
     List<JSONObject> getPlanMessageGroup(@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("group") String group, @Param("project") String project);
 
     List<NewMonitorInfo> getOperator(@Param("userId") String userId);
+
+    JSONObject getPlanSumBytedance(@Param("userId") String userId, @Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+
+    List<JSONObject> getPlanMessageGroupBytedance(@Param("userId") String userId,@Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("group") String group, @Param("project") String project);
+
+    List<JSONObject> getPlanMessageBytedance(@Param("userId") String userId, @Param("array") JSONArray array, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("project") String project);
+
 }

+ 238 - 70
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/NewMonitorMapper.xml

@@ -2,7 +2,7 @@
 <!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.NewMonitorMapper">
     <resultMap id="BaseResultMap" type="cn.com.ctop.kuaishou.modules.report.entity.NewMonitorInfo">
-        <id  column="id"  property="user_id" />
+        <id column="id" property="user_id"/>
         <result column="realname" property="user_name"/>
         <result column="leader_id" property="parent_id"/>
         <collection property="children" ofType="cn.com.ctop.kuaishou.modules.report.entity.NewMonitorInfo"
@@ -10,137 +10,174 @@
         </collection>
     </resultMap>
 
-    <select id="getOperator" resultMap="BaseResultMap"  parameterType="String">
-        SELECT id,realname,leader_id
+    <select id="getOperator" resultMap="BaseResultMap" parameterType="String">
+        SELECT id, realname, leader_id
         FROM sys_user
-        WHERE leader_id=#{userId};
+        WHERE leader_id = #{userId};
     </select>
 
     <select id="getAllAccountId" resultType="Long">
-        SELECT DISTINCT t.account_id  as 'accountId' from ctop_user_allocation t where  account_status=0 and media_id=#{type}
+        SELECT DISTINCT t.account_id as 'accountId'
+        from ctop_user_allocation t
+        where account_status = 0
+          and media_id = #{type}
     </select>
     <select id="getKuaiShouGroup" resultType="Map">
-    SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as 'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-     from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_group t on t1.account_id=t.account_id
-     <where>
-         and t.account_id=#{accountId}
-         <choose>
-             <when test="date!= null and date!=''">
-                 and  t.group_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
-             </when>
-             <otherwise>
-                 and  t.group_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
-             </otherwise>
-         </choose>
-     </where>
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as
+        'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_group t on t1.account_id=t.account_id
+        <where>
+            and t.account_id=#{accountId}
+            <choose>
+                <when test="date!= null and date!=''">
+                    and t.group_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
+                </when>
+                <otherwise>
+                    and t.group_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
+                </otherwise>
+            </choose>
+        </where>
     </select>
 
     <select id="getKuaiShouGroupNow" resultType="Map">
-        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as 'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-        from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_group t on t1.account_id=t.account_id
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.unit_id as
+        'unitId',t.group_create_time as 'groupCreatTime',DATE_FORMAT(DATE_ADD(t.group_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_group t on t1.account_id=t.account_id
         <where>
             and t.account_id=#{accountId}
-            and  t.group_create_time &gt;= #{date}
+            and t.group_create_time &gt;= #{date}
         </where>
     </select>
 
     <select id="getKuaiShouCampaign" resultType="Map">
-        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-        from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_campaign t on t1.account_id=t.account_id
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as
+        'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_campaign t on t1.account_id=t.account_id
         <where>
             and t.account_id=#{accountId}
             <choose>
                 <when test="date != null and date !=''">
-                    and  t.put_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
+                    and t.put_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
                 </when>
                 <otherwise>
-                    and  t.put_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
+                    and t.put_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
                 </otherwise>
             </choose>
         </where>
     </select>
 
     <select id="getKuaiShouCampaignNow" resultType="Map">
-        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as 'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-        from ctop_user_allocation t1 LEFT JOIN  ctop_kuaishou_campaign t on t1.account_id=t.account_id
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.campaign_id as
+        'campaignId',t.put_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.put_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_kuaishou_campaign t on t1.account_id=t.account_id
         <where>
             and t.account_id=#{accountId}
-            and  t.put_create_time &gt;=#{date}
+            and t.put_create_time &gt;=#{date}
         </where>
     </select>
 
     <select id="getTouTiaoCampaign" resultType="Map">
-        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-        from ctop_user_allocation t1 LEFT JOIN  ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as
+        'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
         <where>
             and t.account_id=#{accountId}
             <choose>
                 <when test="date != null and date !=''">
-                    and  t.ad_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
+                    and t.ad_create_time &gt;= DATE_SUB(#{date},INTERVAL 7 DAY)
                 </when>
                 <otherwise>
-                    and  t.ad_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
+                    and t.ad_create_time &gt;= DATE_FORMAT(DATE_SUB(NOW(),INTERVAL 1 YEAR),'%Y-%m-%d')
                 </otherwise>
             </choose>
         </where>
     </select>
 
     <select id="getTouTiaoCampaignNow" resultType="Map">
-        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as 'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7 DAY),'%Y-%m-%d') as 'afterTime'
-        from ctop_user_allocation t1 LEFT JOIN  ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
+        SELECT t1.account_id as 'accountId',t1.auth_name as 'accountName',t1.user_name as 'userName',t.id as
+        'campaignId',t.ad_create_time as 'campaignCreatTime',DATE_FORMAT(DATE_ADD(t.ad_create_time,INTERVAL 7
+        DAY),'%Y-%m-%d') as 'afterTime'
+        from ctop_user_allocation t1 LEFT JOIN ctop_bytedance_advertise_plan t on t1.account_id=t.account_id
         <where>
             and t.account_id=#{accountId}
-            and  t.ad_create_time &gt;= #{date}
+            and t.ad_create_time &gt;= #{date}
         </where>
     </select>
 
     <select id="getGroupCharge" resultType="java.math.BigDecimal">
 
-        select sum(charge) from ctop_kuaishou_report_daily_group t where t.stat_date &lt; #{afterDate} and t.unit_id=#{unitId}
+        select sum(charge)
+        from ctop_kuaishou_report_daily_group t
+        where t.stat_date &lt; #{afterDate}
+          and t.unit_id = #{unitId}
     </select>
 
     <select id="getCampaignCharge" resultType="java.math.BigDecimal">
 
-        select sum(charge) from ctop_kuaishou_report_daily_campaign t where t.stat_date &lt; #{afterDate} and t.campaign_id=#{campaignId}
+        select sum(charge)
+        from ctop_kuaishou_report_daily_campaign t
+        where t.stat_date &lt; #{afterDate}
+          and t.campaign_id = #{campaignId}
     </select>
 
     <select id="getCampaignChargeTouTiao" resultType="java.math.BigDecimal">
 
-        select sum(cost) from ctop_bytedance_report_plan_daily t where t.stat_datetime &lt; #{afterDate} and t.ad_id=#{campaignId}
+        select sum(cost)
+        from ctop_bytedance_report_plan_daily t
+        where t.stat_datetime &lt; #{afterDate}
+          and t.ad_id = #{campaignId}
     </select>
 
     <insert id="saveMonitorGroup">
-        insert into  ctop_new_monitor_group(account_id,account_name,operating_name,unit_id,create_time,project_type,effective) values
-        (#{accountId},#{accountName},#{operatingName},#{unitId},#{createTime},#{projectType},#{effective})
+        insert into ctop_new_monitor_group(account_id, account_name, operating_name, unit_id, create_time, project_type,
+                                           effective)
+        values (#{accountId}, #{accountName}, #{operatingName}, #{unitId}, #{createTime}, #{projectType}, #{effective})
     </insert>
 
     <insert id="saveMonitorCampaign">
-        insert into ctop_new_monitor_campaign (account_id,account_name,operating_name,campaign_id,create_time,project_type,effective) values
-        (#{accountId},#{accountName},#{operatingName},#{campaignId},#{createTime},#{projectType},#{effective})
+        insert into ctop_new_monitor_campaign (account_id, account_name, operating_name, campaign_id, create_time,
+                                               project_type, effective)
+        values (#{accountId}, #{accountName}, #{operatingName}, #{campaignId}, #{createTime}, #{projectType},
+                #{effective})
     </insert>
 
-    <select id="getMonitorGroupByUnitId" resultType="String" >
-        select  t.effective from ctop_new_monitor_group t where t.unit_id=#{unitId}
+    <select id="getMonitorGroupByUnitId" resultType="String">
+        select t.effective
+        from ctop_new_monitor_group t
+        where t.unit_id = #{unitId}
     </select>
 
-    <select id="getMonitorPlanByCampaignId" resultType="String" >
-        select  t.effective from ctop_new_monitor_campaign t where t.campaign_id=#{campaignId}
+    <select id="getMonitorPlanByCampaignId" resultType="String">
+        select t.effective
+        from ctop_new_monitor_campaign t
+        where t.campaign_id = #{campaignId}
     </select>
 
-    <update id="updateMonitorGroupByUnitId" >
-        update ctop_new_monitor_group  t set t.effective=#{effective} where  t.unit_id=#{unitId}
+    <update id="updateMonitorGroupByUnitId">
+        update ctop_new_monitor_group t
+        set t.effective=#{effective}
+        where t.unit_id = #{unitId}
     </update>
 
-    <update id="updateMonitorPlanByCampaignId" >
-        update ctop_new_monitor_campaign  t set t.effective=#{effective} where  t.campaign_id=#{campaignId}
+    <update id="updateMonitorPlanByCampaignId">
+        update ctop_new_monitor_campaign t
+        set t.effective=#{effective}
+        where t.campaign_id = #{campaignId}
     </update>
 
     <select id="getKuaiShouGroupMessage" resultType="com.alibaba.fastjson.JSONObject">
-        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as 'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL))  as 'valid',count(effective) as 'new',operating_name as 'userName','' as 'projectName'
-         from ctop_new_monitor_group  where ( create_time between #{startDate}  and #{endDate})
+        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
+        'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
+        'userName','' as 'projectName'
+        from ctop_new_monitor_group where ( create_time between #{startDate} and #{endDate})
         and account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
-               #{item}
+            #{item}
         </foreach>
         GROUP BY account_id
         order by account_id desc
@@ -148,8 +185,11 @@
 
 
     <select id="getPlanMessage" resultType="com.alibaba.fastjson.JSONObject">
-        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as 'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL))  as 'valid',count(effective) as 'new',operating_name as 'userName','' as 'projectName'
-        from ctop_new_monitor_campaign  where ( create_time between #{startDate}  and #{endDate}) and project_type=#{project}
+        select account_id as 'accountId',account_name as 'authName',MAX(create_time) as
+        'maxCreateTime',COUNT(IF(effective ='1', TRUE, NULL)) as 'valid',count(effective) as 'new',operating_name as
+        'userName','' as 'projectName'
+        from ctop_new_monitor_campaign where ( create_time between #{startDate} and #{endDate}) and
+        project_type=#{project}
         and account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
             #{item}
@@ -159,8 +199,9 @@
     </select>
 
     <select id="getKuaiShouGroupSum" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective)  as 'new' from ctop_new_monitor_group t
-        where  create_time between #{startDate}  and #{endDate}
+        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
+        ctop_new_monitor_group t
+        where create_time between #{startDate} and #{endDate}
         and t.account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
             #{item}
@@ -168,16 +209,17 @@
     </select>
 
     <select id="getPlanSum" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective)  as 'new' from ctop_new_monitor_campaign t
-        where  (create_time between #{startDate}  and #{endDate}) and project_type=#{project}
+        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective) as 'new' from
+        ctop_new_monitor_campaign t
+        where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
         and t.account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
             #{item}
         </foreach>
     </select>
 
-    <select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject" >
-    SELECT
+    <select id="getKuaiShouGroupMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
         <choose>
             <when test='group=="1"'>
                 DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
@@ -186,23 +228,23 @@
                 DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
             </otherwise>
         </choose>
-     COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL))  as 'valid' from ctop_new_monitor_group t
-     where  (create_time between #{startDate}  and #{endDate}) and t.account_id in
+        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_group t
+        where (create_time between #{startDate} and #{endDate}) and t.account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
             #{item}
         </foreach>
         <choose>
             <when test='group=="1"'>
-                GROUP BY  DATE_FORMAT(t.create_time,'%Y-%m')
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
             </when>
             <otherwise>
-                GROUP BY  DATE_FORMAT(t.create_time,'%Y-%m-%d')
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
             </otherwise>
         </choose>
         order by t.create_time asc
     </select>
 
-    <select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject" >
+    <select id="getPlanMessageGroup" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
         <choose>
             <when test='group=="1"'>
@@ -212,22 +254,148 @@
                 DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
             </otherwise>
         </choose>
-        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL))  as 'valid' from ctop_new_monitor_campaign t
-        where project_type=#{project} and  (create_time between #{startDate}  and #{endDate}) and t.account_id in
+        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
+        where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
         <foreach item="item" collection="array" separator="," open="(" close=")" index="">
             #{item}
         </foreach>
         <choose>
             <when test='group=="1"'>
-                GROUP BY  DATE_FORMAT(t.create_time,'%Y-%m')
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
             </when>
             <otherwise>
-                GROUP BY  DATE_FORMAT(t.create_time,'%Y-%m-%d')
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
             </otherwise>
         </choose>
         order by t.create_time asc
     </select>
 
+    <select id="getPlanSumBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid',COUNT(t.effective)+
+        (
+        SELECT
+        IFNULL(SUM(promotion_num),0)
+        FROM application.app_bytedance_account_base_info_d
+        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
+        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND user_id = #{userId}
+        ) as 'new'
+        from ctop_new_monitor_campaign t
+        where (create_time between #{startDate} and #{endDate}) and project_type=#{project}
+        and t.account_id in
+        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+    </select>
+
 
+    <select id="getPlanMessageGroupBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.statDate,
+        t1.promotionNum +IFNULL(t2.new,0) as 'new',
+        IFNULL(t2.valid,0) as 'valid'
+        FROM
+        (
+        SELECT
+        <choose>
+            <when test='group=="1"'>
+                DATE_FORMAT(stat_date,'%Y-%m') as 'statDate',
+            </when>
+            <otherwise>
+                DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
+            </otherwise>
+        </choose>
+        IFNULL(SUM(promotion_num),0) as 'promotionNum'
+        FROM application.app_bytedance_account_base_info_d
+        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
+        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND user_id = #{userId}
+        <choose>
+            <when test='group=="1"'>
+                GROUP BY DATE_FORMAT(stat_date,'%Y-%m')
+            </when>
+            <otherwise>
+                GROUP BY stat_date
+            </otherwise>
+        </choose>
+        ) t1
+        LEFT JOIN (
+        SELECT
+        <choose>
+            <when test='group=="1"'>
+                DATE_FORMAT(t.create_time,'%Y-%m') as 'statDate',
+            </when>
+            <otherwise>
+                DATE_FORMAT(t.create_time,'%Y-%m-%d') as 'statDate',
+            </otherwise>
+        </choose>
+        COUNT(t.effective) as 'new',COUNT(IF(t.effective ='1', TRUE, NULL)) as 'valid' from ctop_new_monitor_campaign t
+        where project_type=#{project} and (create_time between #{startDate} and #{endDate}) and t.account_id in
+        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+        <choose>
+            <when test='group=="1"'>
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m')
+            </when>
+            <otherwise>
+                GROUP BY DATE_FORMAT(t.create_time,'%Y-%m-%d')
+            </otherwise>
+        </choose>
+        ) t2 ON t1.statDate = t2.statDate
+        WHERE t1.promotionNum +IFNULL(t2.new,0) >0
+        ORDER BY `statDate`
+    </select>
+
+
+    <select id="getPlanMessageBytedance" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT * FROM (
+        SELECT
+        IFNULL(t2.account_id,t1.account_id) as 'accountId',
+        IFNULL(t2.authName,t1.account_name) as 'authName',
+        IFNULL(t2.maxCreateTime,statDate) as 'maxCreateTime',
+        t1.promotionNum+IFNULL(t2.new,0) as 'new',
+        IFNULL(t2.userName,t1.user_name) as 'userName',
+        IFNULL(t2.valid ,0) as 'valid'
+        FROM
+        (
+        SELECT
+        account_id,
+        account_name,
+        user_name,
+        DATE_FORMAT(stat_date,'%Y-%m-%d') as 'statDate',
+        IFNULL(SUM(promotion_num),0) as 'promotionNum'
+        FROM application.app_bytedance_account_base_info_d
+        WHERE stat_date >= DATE_FORMAT(#{startDate},'%Y%m%d')
+        AND stat_date &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
+        AND user_id = #{userId}
+        GROUP BY account_id
+        ) t1
+        LEFT JOIN (
+        SELECT
+        account_id,
+        account_name AS 'authName',
+        MAX( create_time ) AS 'maxCreateTime',
+        COUNT(
+        IF
+        ( effective = '1', TRUE, NULL )) AS 'valid',
+        count( effective ) AS 'new',
+        operating_name AS 'userName',
+        '' AS 'projectName'
+        FROM
+        ctop_new_monitor_campaign
+        WHERE
+        (create_time between #{startDate} and #{endDate})
+        and project_type=#{project}
+        AND account_id IN
+        <foreach item="item" collection="array" separator="," open="(" close=")" index="">
+            #{item}
+        </foreach>
+        GROUP BY
+        account_id
+        ) t2 ON t1.account_id = t2.account_id
+        ) t
+        WHERE new >0
+        ORDER BY maxCreateTime desc
+    </select>
 
 </mapper>

+ 6 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/NewMonitorService.java

@@ -24,4 +24,10 @@ public interface NewMonitorService {
     List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate, String project);
 
     List<JSONObject> getOperator(String userId, String userName);
+
+    JSONObject getPlanSumBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String s);
+
+    List<JSONObject> getPlanMessageGroupBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String s);
+
+    List<JSONObject> getPlanMessageBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String target, String s);
 }

+ 25 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/NewMonitorServiceImpl.java

@@ -297,6 +297,31 @@ public class NewMonitorServiceImpl implements NewMonitorService {
         return list;
     }
 
+    @Override
+    public JSONObject getPlanSumBytedance(String userId, JSONArray accountIds, String startDate, String endDate, String project) {
+        return newMonitorMapper.getPlanSumBytedance(userId,accountIds, startDate, endDate, project);
+    }
+
+    @Override
+    public List<JSONObject> getPlanMessageGroupBytedance(String userId, JSONArray array, String startDate, String endDate, String project) {
+        String group = "0";
+        List<JSONObject> planGroupMessageGroup = new ArrayList<>();
+        try {
+            if (DateUtils.isMoreSixMonth(startDate, endDate)) {
+                group = "1";
+            }
+            planGroupMessageGroup = newMonitorMapper.getPlanMessageGroupBytedance(userId,array, startDate, endDate, group, project);
+        } catch (Exception e) {
+            log.info("查询数据错误:{}", e.toString());
+        }
+        return planGroupMessageGroup;
+    }
+
+    @Override
+    public List<JSONObject> getPlanMessageBytedance(String userId, JSONArray array, String startDate, String endDate, String target, String project) {
+        return newMonitorMapper.getPlanMessageBytedance(userId,array, startDate, endDate, project);
+    }
+
     List<JSONObject> getAllNode(List<NewMonitorInfo> operator) {
         List<JSONObject> objects = new ArrayList<>();
         if (!operator.isEmpty()) {

+ 5 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceNewPlanReportCtrl.java

@@ -61,7 +61,7 @@ public class BytedanceNewPlanReportCtrl {
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
         startDate=startDate+" 00:00:00";
-        endDate=endDate+" 59:59:59";
+        endDate=endDate+" 23:59:59";
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         try {
@@ -69,9 +69,9 @@ public class BytedanceNewPlanReportCtrl {
             List<JSONObject> chartData = newPlanReportService.getBytedanceNewPlanGroupByStatDate(accountIds, startDate, endDate);
             List<JSONObject> listData = newPlanReportService.getBytedanceNewPlanGroupByAccount(accountIds, startDate, endDate, target, order);
 */
-            JSONObject sumData = newMonitorService.getPlanSum(accountIds, startDate, endDate, "0");
-            List<JSONObject> chartData = newMonitorService.getPlanMessageGroup(accountIds, startDate, endDate, "0");
-            List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDate, endDate, target, "0");
+            JSONObject sumData = newMonitorService.getPlanSumBytedance(userId,accountIds, startDate, endDate, "0");
+            List<JSONObject> chartData = newMonitorService.getPlanMessageGroupBytedance(userId,accountIds, startDate, endDate, "0");
+            List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(userId,accountIds, startDate, endDate, target, "0");
             result.put("sumData", sumData);
             result.put("chartData", chartData);
             result.put("listData", listData);
@@ -108,7 +108,7 @@ public class BytedanceNewPlanReportCtrl {
         endDate=endDate+" 59:59:59";
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
-        List<JSONObject> listData = newMonitorService.getPlanMessage(accountIds, startDate, endDate, target, "0");
+        List<JSONObject> listData = newMonitorService.getPlanMessageBytedance(userId,accountIds, startDate, endDate, target, "0");
 
         List<List<Object>> excelList = new ArrayList<>();
         listData.forEach(data -> {