Преглед изворни кода

Merge remote-tracking branch 'origin/master'

syh пре 4 година
родитељ
комит
21e79ee205

+ 4 - 3
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java

@@ -20,7 +20,7 @@ public class WechatAttendanceJob {
     private IWechatUserListService wechatUserInfoService;
 
     /**
-     * 考勤数据入库
+     * 每日考勤和人员数据入库
      * 员工打卡明细表 每日凌晨2点统计前一天的考勤数据 cron:0 0 2 * * ?
      * <p>
      * 人员信息表 每日凌晨2点统计前一天的人员数据 cron:0 0 2 * * ?
@@ -29,15 +29,16 @@ public class WechatAttendanceJob {
      */
     @XxlJob("wechatAttendanceJob")
     public ReturnT<String> execute(String params) throws Exception {
-        XxlJobLogger.log("--------考勤数据入库 start ");
+        XxlJobLogger.log("--------考勤和人员数据入库 start ");
         String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()));
         long starttime = DateUtils.timeToStamp(beforeDay + " 00:00:00");
         long endtime = DateUtils.timeToStamp(beforeDay + " 23:59:59");
         //更新员工打卡明细表
         wechatCheckinDataService.getCheckinData(String.valueOf(starttime), String.valueOf(endtime));
+        XxlJobLogger.log("--------考勤数据入库 end ");
         //更新人员信息表
         wechatUserInfoService.getUserList();
-        XxlJobLogger.log("--------考勤数据入库 end ");
+        XxlJobLogger.log("--------人员数据入库 end ");
         return ReturnT.SUCCESS;
     }
 }

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

@@ -2325,4 +2325,28 @@ public class BatchController {
     }
 
 
+    @GetMapping(value = "/getCreativeWordStyles")
+    public Result<JSONArray> getCreativeWordStyles(Long accountId) {
+        Result<JSONArray> result = new Result<>();
+        try {
+            if (Check.isNull(accountId)) {
+                throw new Exception("入参为空");
+            }
+            CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);
+            if (Check.isNull(oauthToken)) {
+                throw new Exception("未获取到账户信息");
+            }
+
+            JSONArray data = batchService.getCreativeWordStyles(accountId, oauthToken.getAccessToken());
+            result.setSuccess(true);
+            result.setResult(data);
+        } catch (Exception e) {
+            e.printStackTrace();
+            result.setSuccess(false);
+            result.setResult(null);
+            result.setMessage(e.getMessage());
+        }
+
+        return result;
+    }
 }

+ 9 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouProgramCreativeController.java

@@ -101,8 +101,8 @@ public class KuaishouProgramCreativeController {
      */
 
     @PostMapping(value = "/createProgramCreative")
-    public Result<KuaishouProgramCreative> createProgramCreative(@RequestBody JSONObject requestJson) {
-        Result<KuaishouProgramCreative> result = new Result<>();
+    public Result<JSONObject> createProgramCreative(@RequestBody JSONObject requestJson) {
+        Result<JSONObject> result = new Result<>();
         try {
             if (Check.isNull(requestJson)) {
                 throw new Exception("创建程序化创意参数不能为空");
@@ -119,7 +119,13 @@ public class KuaishouProgramCreativeController {
 
 
             JSONObject returnJson = kuaishouProgramCreativeService.createProgramCreative(oauthToken, requestJson);
-            result.success("添加成功!");
+            if (returnJson.getBoolean("isTrueOrFalse")) {
+                result.setSuccess(true);
+                result.setMessage("创建成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage(returnJson.getString("message"));
+            }
 
         } catch (Exception e) {
             result.setSuccess(false);

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IBatchService.java

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 
 import java.math.BigDecimal;
@@ -148,4 +149,13 @@ public interface IBatchService {
      * @return
      */
     JSONObject getWhiteList(Long accountId, String accessToken);
+
+    /**
+     * 获取可选的贴纸样式
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    JSONArray getCreativeWordStyles(Long accountId, String accessToken);
 }

+ 60 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/BatchServiceImpl.java

@@ -1438,13 +1438,36 @@ public class BatchServiceImpl implements IBatchService {
 
             JSONObject unitJson = new JSONObject();
             unitJson.put("advertiser_id", token.getAccountId());
+            QueryWrapper<KuaiShouGroup> queryWrapper = new QueryWrapper();
+            queryWrapper.eq("account_id", token.getAccountId());
+
 
             Long unitId = requestJson.getLong("unitId");
             if (Check.isNull(unitId)) {
                 throw new Exception("请选择广告组");
             }
 
+
             unitJson.put("unit_id", unitId);
+
+
+            queryWrapper.eq("unit_id", unitId);
+            queryWrapper.last("limit 1");
+            KuaiShouGroup kuaiShouGroup = groupMapper.selectOne(queryWrapper);
+            if (Check.isNull(kuaiShouGroup)) {
+                throw new Exception("未获取到组信息");
+
+            }
+
+            String sceneId = kuaiShouGroup.getSceneId();
+            if (Check.isNull(sceneId)) {
+                throw new Exception("未获取资源位置");
+            }
+
+
+            //  JSONObject jsonObject = JSONArr(sceneId);
+            Integer scene = (Integer) JSONArray.parseArray(sceneId).get(0);
+
             // 广告组名称
             if (!Check.isNull(requestJson.getString("unitName"))) {
                 unitJson.put("unit_name", requestJson.getString("unitName"));
@@ -1456,7 +1479,6 @@ public class BatchServiceImpl implements IBatchService {
                 unitJson.put("scene_id", scene_id);
             }
 
-            Integer sceneId = Integer.valueOf(scene_id.get(0).toString());
 
             // 出价
             if (!Check.isNull(requestJson.getLong("bid"))) {
@@ -1575,11 +1597,7 @@ public class BatchServiceImpl implements IBatchService {
             }
 
 
-            //设备品牌
-            if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
-                targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
-            }
-            if (sceneId != 5) {
+            if (scene != 5) {
                 //设备价格
                 if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
                     targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
@@ -1600,10 +1618,10 @@ public class BatchServiceImpl implements IBatchService {
                 if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
                     targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
                 }
-                // APP行为-按分类
-                if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
-                    targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
-                }
+            }
+            // APP行为-按分类
+            if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
+                targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
             }
             // APP行为-按APP名称
             if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
@@ -1618,7 +1636,7 @@ public class BatchServiceImpl implements IBatchService {
                 targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
             }
 
-            if (sceneId != 5) {
+            if (scene != 5) {
                 JSONObject intelliExtendJson = new JSONObject();
 
                 // 开启智能扩量
@@ -1642,6 +1660,7 @@ public class BatchServiceImpl implements IBatchService {
                 }
             }
 
+
             unitJson.put("target", targetJson);
 
             returnJson = updateService.updateUnit(token.getAccessToken(), unitJson);
@@ -1761,6 +1780,36 @@ public class BatchServiceImpl implements IBatchService {
     }
 
 
+    /**
+     * 获取可选的贴纸样式
+     *
+     * @param accountId
+     * @param accessToken
+     * @return
+     */
+    @Override
+    public JSONArray getCreativeWordStyles(Long accountId, String accessToken) {
+        String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/creative_word/styles";
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", accessToken);
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("advertiser_id", accountId);
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        log.info("获取贴纸样式,accountId:{},data:{}", accountId, resultJson);
+        if (!Check.isNull(resultJson)) {
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                return resultJson.getJSONArray("data");
+            }
+
+        }
+        return null;
+    }
+
+
 }
 
 

+ 21 - 10
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouProgramCreativeServiceImpl.java

@@ -100,7 +100,7 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
         }
 
         this.saveOrUpdateBatch(programCreativeList);
-    //    getProgramCreative(accountId, unitId, accessToken, startDate, endDate, page + 1);
+        //    getProgramCreative(accountId, unitId, accessToken, startDate, endDate, page + 1);
 
 
     }
@@ -115,6 +115,8 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
 
     @Override
     public JSONObject createProgramCreative(CtopOauthToken oauthToken, JSONObject requestJson) {
+
+        JSONObject returnJson = new JSONObject();
         try {
 
 
@@ -176,13 +178,6 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
                             imageToken = uploadService.kuauiShouImageUpload(imageUrl, signature, oauthToken.getAccountId(), oauthToken.getAccessToken());
                         }
                         cover_image_tokens.add(imageToken);
-                        /*if (Check.isNull(imageToken)) {
-                            JSONObject failJson = new JSONObject();
-                            failJson.put("creativeName", name);
-                            failJson.put("failMessage", "获取图片文件失败");
-                            failArr.add(failJson);
-                            continue;
-                        }*/
                     }
 
 
@@ -194,14 +189,30 @@ public class KuaishouProgramCreativeServiceImpl extends ServiceImpl<KuaishouProg
             pramsJson.put("cover_image_tokens", cover_image_tokens);
 
             String result = HttpUtils.kuaiShouhttpPostRequest(url, pramsJson.toJSONString(), headers);
-            System.err.println(result);
+            JSONObject jsonObject = JSONObject.parseObject(result);
+            log.info("创建程序化创意返回结果:{}", jsonObject);
+            if (!Check.isNull(jsonObject)) {
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    returnJson.put("isTrueOrFalse", true);
+                    returnJson.put("message", "创建成功");
+                } else {
+                    log.error("创建失败:入参:{}",pramsJson);
+                    returnJson.put("isTrueOrFalse", false);
+                    returnJson.put("message", jsonObject.getString("message"));
+                }
+
+
+            }
 
         } catch (Exception e) {
             e.printStackTrace();
+            returnJson.put("isTrueOrFalse", false);
+            returnJson.put("message", "系统错误");
 
         }
 
 
-        return null;
+        return returnJson;
     }
 }

+ 243 - 230
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -537,14 +537,15 @@
         group by stat_date
     </select>
 
-    <select id="getKuaishouAccountInfoByProjectId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+    <select id="getKuaishouAccountInfoByProjectId"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
         select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
         a.account_id as 'accountId',
         b.auth_name as 'authName',
         b.project_id as 'projectId',
-        b.project_name as 'projectName',
+        (select  project_name from ctop_project where  id = b.project_id) as 'projectName',
         round(sum(a.charge),2) as 'charge',
         sum(a.photo_show) as 'photoShow', -- 封面曝光数
         sum(a.photo_click) as 'photoClick', -- 封面点击数
@@ -557,7 +558,7 @@
         ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
         case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
         'photoClickRatio', -- 封面点击率
-        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',
         (case
         when sum(a.photo_show) != 0
         then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
@@ -594,14 +595,14 @@
         ) as 'eventNextDayStayCost' -- 次日留存成本
         from
         ctop_kuaishou_report_daily_account a
-        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        left join  ctop_user_allocation b on a.account_id = b.account_id
         where
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
         <if test="projectId !=null ">
-        and
-        b.project_id = #{projectId}
+            and
+            b.project_id = #{projectId}
         </if>
 
         <if test="projectList !=null ">
@@ -624,106 +625,112 @@
     </select>
 
     <select id="getKuaishouProjectInfo" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
-             select
-            #{yn} as 'yn',
-            concat(#{startDate}, '~' , #{endDate}) as 'statDate',
-            (select project_id from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectId',
-            (select project_name from ctop_user_allocation where account_id = a.account_id limit 1) as 'projectName',
-            (select advertiser_name from ctop_project where id = (select project_id from ctop_user_allocation where
-                                account_id = a.account_id limit 1
-                        )) as 'advertiserName',
-            (select responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where
-                                account_id = a.account_id limit 1
-                        )) as 'responsibleName',
-            (select design_responsible_name from ctop_project where id = (select project_id from ctop_user_allocation where account_id = a.account_id limit 1
-                        )) as 'designResponsibleName',
-            ifnull(round(sum(a.charge),2),0) as 'charge',
-            ifnull(sum(a.photo_show),0) as 'photoShow',  -- 封面曝光数
-            ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
-            ifnull(sum(a.aclick),0) as 'aclick',  -- 素材曝光数
-            ifnull(sum(a.bclick),0) as 'bclick',  -- 行为数
-            ifnull(sum(a.activation),0) as 'activation',  -- 激活数
-            ifnull(sum(a.submit),0) as 'submit',   -- 提交按钮点击数
-            ifnull(sum(a.event_register),0) as 'eventRegister',   -- 注册数
-            ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay',  -- 次日留存数
-            ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
-            case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',   -- 封面点击率
-            case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate',  -- 行为率
-            (case
-            when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
-            then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
-            else 0
-            end
-            ) as 'impression1kCost', -- 均千次封面曝光花费
-            (case
-            when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
-            then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
-            else 0
-            end
-            ) as 'photoClickCost', -- 平均封面点击单价
-            (CASE
-            WHEN ( sum(a.bclick) is not null and sum(a.bclick) != 0)
-            THEN round(sum(a.charge) / sum(a.bclick),2)
-            ELSE 0
-            end
-            ) as 'actionCost', -- 平均行为单价
-            ifnull(sum(a.photo_share),0) as 'photoShare',  -- 分享数
-            ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
-            ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
-            ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
-            ifnull(sum(a.report),0) as 'report', -- 举报数
-            ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
-            ifnull(sum(a.block),0) as 'block', -- 拉黑数
-            ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
-            ifnull(sum(a.download_started),0) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
-            ifnull(sum(a.download_completed),0) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
-            (CASE
-            WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
-            THEN round(  ifnull(sum(a.charge),0) / sum(a.event_next_day_stay)  ,2)
-            ELSE 0
-            end
-            ) as 'eventNextDayStayCost'  -- 次日留存成本
-            from
-            ctop_kuaishou_report_daily_account a
-            left join  (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
-            where
-            a.stat_date &gt;= #{startDate}
-            and
-            a.stat_date &lt;= #{endDate}
-            and
-            b.project_id in
-            <foreach collection="projectList" item="item" separator=","
-                     open="(" close=")">
-                #{item}
-            </foreach>
-            group by b.project_id
-            order by sum(a.charge) desc
+        select
+        concat(#{startDate}, '~' , #{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        (SELECT project_name FROM ctop_project where id = b.project_id) as 'projectName',
+        (select name from ctop_advertiser where id = b.advertiser_id) as 'advertiserName',
+        (
+        select realname from sys_user where id = (
+        select responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'responsibleName',
+        (
+        select realname from sys_user where id = (
+        select design_responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'designResponsibleName',
+        ifnull(round(sum(a.charge),3),0) as 'charge',
+        ifnull(sum(a.photo_show),0) as 'photoShow', -- 封面曝光数
+        ifnull(sum(a.photo_click),0) as 'photoClick', -- 封面点击数
+        ifnull(sum(a.aclick),0) as 'aclick', -- 素材曝光数
+        ifnull(sum(a.bclick),0) as 'bclick', -- 行为数
+        ifnull(sum(a.activation),0) as 'activation', -- 激活数
+        ifnull(sum(a.submit),0) as 'submit', -- 提交按钮点击数
+        ifnull(sum(a.event_register),0) as 'eventRegister', -- 注册数
+        ifnull(sum(event_next_day_stay),0) as 'eventNextDayStay', -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
+        case when (sum(a.photo_show) is not null and sum(a.photo_show)!=0) then
+        concat(round(ifnull(sum(a.photo_click),0)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRate',
+        case when (sum(a.aclick) is not null and sum(a.aclick)!=0) then
+        concat(round(ifnull(sum(a.bclick),0)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'bclickRate', -- 行为率
+        (case
+        when (sum(a.photo_show) is not null and sum(a.photo_show) != 0)
+        then round((ifnull(sum(a.charge),0) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when (sum(a.photo_click) is not null and sum(a.photo_click) != 0)
+        then round( ifnull(sum(a.charge),0) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN ( sum(a.bclick) is not null and sum(a.bclick) != 0)
+        THEN round(sum(a.charge) / sum(a.bclick),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        ifnull(sum(a.photo_share),0) as 'photoShare', -- 分享数
+        ifnull(sum(a.photo_comment),0) as 'photoComment', -- 评论数
+        ifnull(sum(a.photo_like),0) as 'photoLike', -- 点赞数
+        ifnull(sum(a.follow),0) as 'follow', -- 新增关注数
+        ifnull(sum(a.report),0) as 'report', -- 举报数
+        ifnull(sum(a.cancel_follow),0) as 'cancelFollow', -- 取消关注数
+        ifnull(sum(a.block),0) as 'block', -- 拉黑数
+        ifnull(sum(a.negative),0) as 'nagative', -- 减少此类作品数
+        ifnull(sum(a.download_started),0) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
+        ifnull(sum(a.download_completed),0) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN ( sum(a.event_next_day_stay) is not null and sum(a.event_next_day_stay) != 0)
+        THEN round( ifnull(sum(a.charge),0) / sum(a.event_next_day_stay) ,2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost' -- 次日留存成本
+        from
+        ctop_kuaishou_report_daily_account a
+        left join ctop_user_allocation b
+        on a.account_id = b.account_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
+        and
+        b.project_id in
+        <foreach collection="projectList" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+        group by b.project_id
     </select>
 
     <!-- 计划汇总 -->
-    <select id="getKuaishouCampaignInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+    <select id="getKuaishouCampaignInfoByAccountId"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        -- select * from(
         select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
         b.project_id as 'projectId',
-        b.project_name as 'projectName',
+        (select  project_name  from ctop_project where  id = b.project_id) as 'projectName',
         b.auth_name as 'authName',
         a.account_id as 'accountId',
-        a.campaign_id as 'campaignId',  -- 计划id
-        a.campaign_name as 'campaignName',   -- 计划名称
+        a.campaign_id as 'campaignId', -- 计划id
+        a.campaign_name as 'campaignName', -- 计划名称
         round(sum(a.charge),2) as 'charge',
-        sum(a.photo_show) as 'photoShow',  -- 封面曝光数
+        sum(a.photo_show) as 'photoShow', -- 封面曝光数
         sum(a.photo_click) as 'photoClick', -- 封面点击数
-        sum(a.aclick) as 'aclick',  -- 素材曝光数
-        sum(a.bclick) as 'bclick',  -- 行为数
-        sum(a.activation) as 'activation',  -- 激活数
-        sum(a.submit) as 'submit',   -- 提交按钮点击数
-        sum(a.event_register) as 'eventRegister',   -- 注册数
-        sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
-        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
-        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
-        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
+        sum(a.aclick) as 'aclick', -- 素材曝光数
+        sum(a.bclick) as 'bclick', -- 行为数
+        sum(a.activation) as 'activation', -- 激活数
+        sum(a.submit) as 'submit', -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister', -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
+        'photoClickRatio', -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', --
         (case
         when sum(a.photo_show) != 0
         then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
@@ -742,7 +749,7 @@
         ELSE 0
         end
         ) as 'actionCost', -- 平均行为单价
-        sum(a.photo_share) as 'photoShare',  -- 分享数
+        sum(a.photo_share) as 'photoShare', -- 分享数
         sum(a.photo_comment) as 'photoComment', -- 评论数
         sum(a.photo_like) as 'photoLike', -- 点赞数
         sum(a.follow) as 'follow', -- 新增关注数
@@ -750,17 +757,17 @@
         sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
         sum(a.block) as 'block', -- 拉黑数
         sum(a.negative) as 'nagative', -- 减少此类作品数
-        sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
-        sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
+        sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
         (CASE
         WHEN sum(a.event_next_day_stay) != 0
         THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
         ELSE 0
         end
-        ) as 'eventNextDayStayCost'  -- 次日留存成本
+        ) as 'eventNextDayStayCost' -- 次日留存成本
         from
         ctop_kuaishou_report_daily_campaign a
-        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        left join ctop_user_allocation b on a.account_id = b.account_id
         where
         a.stat_date &gt;= #{startDate}
         and
@@ -777,7 +784,7 @@
             </foreach>
         </if>
         <if test="projectList!=null">
-        and
+            and
             b.project_id in
             <foreach collection="projectList" item="item" separator=","
                      open="(" close=")">
@@ -786,22 +793,23 @@
         </if>
         group by a.campaign_id
         order by sum(a.charge) desc
-<!--        ) m-->
+        <!--        ) m-->
 
-<!--        <if test="yn = 1">-->
-<!--            where-->
-<!--            m.charge != 0-->
-<!--        </if>-->
+        <!--        <if test="yn = 1">-->
+        <!--            where-->
+        <!--            m.charge != 0-->
+        <!--        </if>-->
     </select>
 
     <!-- 根据计划id获取组信息 -->
-    <select id="getKuaishouUnitInfoByCampaignId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+    <select id="getKuaishouUnitInfoByCampaignId"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        -- select * from (
         select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
         b.project_id as 'projectId',
-        b.project_name as 'projectName',
+        (select  project_name  from ctop_project where  id = b.project_id) as 'projectName',
         a.account_id as 'accountId',
         b.auth_name as 'authName',
         a.campaign_id as 'campaignId', -- 计划id
@@ -820,7 +828,7 @@
         ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
         case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
         'photoClickRatio', -- 封面点击率
-        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate', -- 行为率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',
         (case
         when sum(a.photo_show) != 0
         then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
@@ -857,23 +865,23 @@
         ) as 'eventNextDayStayCost' -- 次日留存成本
         from
         ctop_kuaishou_report_daily_group a
-        left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
+        left join ctop_user_allocation b on a.account_id = b.account_id
         -- left join ctop_kuaishou_campaign c on a.campaign_id = c.campaign_id
         where
         a.stat_date &gt;= #{startDate}
         and
         a.stat_date &lt;= #{endDate}
-            <if test="campaignId != null and campaignId != ''">
+        <if test="campaignId != null and campaignId != ''">
             and
-                a.campaign_id = #{campaignId}
-            </if>
-            <if test="accountIds !=null">
-                and a.account_id in
-                <foreach collection="accountIds" item="item" separator=","
-                         open="(" close=")">
-                    #{item}
-                </foreach>
-            </if>
+            a.campaign_id = #{campaignId}
+        </if>
+        <if test="accountIds !=null">
+            and a.account_id in
+            <foreach collection="accountIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="projectList!=null">
             and
             b.project_id in
@@ -882,13 +890,13 @@
                 #{item}
             </foreach>
         </if>
-            group by unit_id
-            order by sum(a.charge) desc
-<!--            ) m-->
-<!--        <if test="yn = 1">-->
-<!--            where-->
-<!--            m.charge != 0-->
-<!--        </if>-->
+        group by unit_id
+        order by sum(a.charge) desc
+        <!--            ) m-->
+        <!--        <if test="yn = 1">-->
+        <!--            where-->
+        <!--            m.charge != 0-->
+        <!--        </if>-->
     </select>
 
     <select id="queryProjectMemberByUserId" resultType="long">
@@ -910,9 +918,9 @@
         select
         distinct c.id as projectId
         -- c.project_name as projectName,
-        --         a.advertiser_id as advertiserId,
+        -- a.advertiser_id as advertiserId,
         -- c.advertiser_name as advertiserName,
-        --         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
+        -- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
         -- c.responsible_name as responsibleName,
         -- c.design_responsible_name as designResponsibleName,
         -- c.sale_id as saleId,
@@ -932,19 +940,19 @@
     <select id="queryProjectMemberByIds" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
         select
         distinct id as projectId,
-                project_name as projectName,
-        --         a.advertiser_id as advertiserId,
-                advertiser_name as advertiserName,
-        --         (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
-                responsible_name as responsibleName,
-                design_responsible_name as designResponsibleName
+        project_name as projectName,
+        -- a.advertiser_id as advertiserId,
+        advertiser_name as advertiserName,
+        -- (SELECT media_id from ctop_project c where c.id=a.project_id limit 1) as mediaId,
+        responsible_name as responsibleName,
+        design_responsible_name as designResponsibleName
         from ctop_project
         where
         id in
-            <foreach collection="projectIds" item="item" separator=","
-                     open="(" close=")">
-                #{item}
-            </foreach>
+        <foreach collection="projectIds" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
         order by create_time desc
     </select>
 
@@ -976,90 +984,92 @@
         order by create_time desc
     </select>
 
-    <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
-            select
+    <select id="getKuaishouCreativeInfoByUnitId"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
+        -- select * from (
+        select
         #{yn} as 'yn',
-            concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
-            b.project_id as 'projectId',
-            b.project_name as 'projectName',
-            a.account_id as 'accountId',
-            b.auth_name as 'authName',
-            a.creative_id as 'creativeId',
-            a.creative_name as 'creativeName',
-            a.campaign_id as 'campaignId',  -- 计划id
-            a.campaign_name as 'campaignName',  -- 计划名称
-            a.unit_id as 'unitId',  -- 组id,
-            a.unit_name as 'unitName',  -- 组名称
-            round(sum(a.charge),2) as 'charge',
-            sum(a.photo_show) as 'photoShow',  -- 封面曝光数
-            sum(a.photo_click) as 'photoClick', -- 封面点击数
-            sum(a.aclick) as 'aclick',  -- 素材曝光数
-            sum(a.bclick) as 'bclick',  -- 行为数
-            sum(a.activation) as 'activation',  -- 激活数
-            sum(a.submit) as 'submit',   -- 提交按钮点击数
-            sum(a.event_register) as 'eventRegister',   -- 注册数
-            sum(event_next_day_stay) as 'eventNextDayStay',  -- 次日留存数
-            ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost',   -- 激活成本
-            case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as 'photoClickRatio',   -- 封面点击率
-            case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',  -- 行为率
-            (case
-            when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
-            then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
-            else 0
-            end
-            ) as 'impression1kCost', -- 均千次封面曝光花费
-            (case
-            when sum(a.photo_click) != 0
-            then round(sum(a.charge) / sum(a.photo_click),2)
-            else 0
-            end
-            ) as 'photoClickCost', -- 平均封面点击单价
-            (CASE
-            WHEN sum(a.bclick) != 0
-            THEN round(sum(a.charge) / sum(a.bclick),2)
-            ELSE 0
-            end
-            ) as 'actionCost', -- 平均行为单价
-            sum(a.photo_share) as 'photoShare',  -- 分享数
-            sum(a.photo_comment) as 'photoComment', -- 评论数
-            sum(a.photo_like) as 'photoLike', -- 点赞数
-            sum(a.follow) as 'follow', -- 新增关注数
-            sum(a.report) as 'report', -- 举报数
-            sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
-            sum(a.block) as 'block', -- 拉黑数
-            sum(a.negative) as 'nagative', -- 减少此类作品数
-            sum(a.download_started) as 'downloadStarted',  -- 应用下载数据-安卓下载开始数
-            sum(a.download_completed) as 'downloadCompleted',  -- 应用下载数据-安卓下载完成数
-            (CASE
-            WHEN sum(a.event_next_day_stay) != 0
-            THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
-            ELSE 0
-            end
-            ) as 'eventNextDayStayCost',  -- 次日留存成本
-            (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
-            (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl,
-            (select material_type from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as materialType
-            from
-            ctop_kuaishou_report_daily_creative a
-            left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
-            left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
-            where
-            a.stat_date &gt;= #{startDate}
-            and
-            a.stat_date &lt;= #{endDate}
+        concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
+        b.project_id as 'projectId',
+        (select  project_name  from ctop_project where  id = b.project_id) as 'projectName',
+        a.account_id as 'accountId',
+        b.auth_name as 'authName',
+        a.creative_id as 'creativeId',
+        a.creative_name as 'creativeName',
+        a.campaign_id as 'campaignId', -- 计划id
+        a.campaign_name as 'campaignName', -- 计划名称
+        a.unit_id as 'unitId', -- 组id,
+        a.unit_name as 'unitName', -- 组名称
+        round(sum(a.charge),2) as 'charge',
+        sum(a.photo_show) as 'photoShow', -- 封面曝光数
+        sum(a.photo_click) as 'photoClick', -- 封面点击数
+        sum(a.aclick) as 'aclick', -- 素材曝光数
+        sum(a.bclick) as 'bclick', -- 行为数
+        sum(a.activation) as 'activation', -- 激活数
+        sum(a.submit) as 'submit', -- 提交按钮点击数
+        sum(a.event_register) as 'eventRegister', -- 注册数
+        sum(event_next_day_stay) as 'eventNextDayStay', -- 次日留存数
+        ROUND(IFNULL(sum(a.charge)/sum(a.activation),0),2) as 'activationCost', -- 激活成本
+        case when photo_show!=0 then concat(round(sum(a.photo_click)/sum(a.photo_show) * 100 ,2),'%') else 0 end as
+        'photoClickRatio', -- 封面点击率
+        case when aclick!=0 then concat(round(sum(a.bclick)/sum(a.aclick) * 100 ,2),'%') else 0 end as 'actionRate',
+        (case
+        when sum(a.photo_show) != 0 and sum(a.photo_show) is not null
+        then round((sum(a.charge) / sum(a.photo_show)) * 1000,2)
+        else 0
+        end
+        ) as 'impression1kCost', -- 均千次封面曝光花费
+        (case
+        when sum(a.photo_click) != 0
+        then round(sum(a.charge) / sum(a.photo_click),2)
+        else 0
+        end
+        ) as 'photoClickCost', -- 平均封面点击单价
+        (CASE
+        WHEN sum(a.bclick) != 0
+        THEN round(sum(a.charge) / sum(a.bclick),2)
+        ELSE 0
+        end
+        ) as 'actionCost', -- 平均行为单价
+        sum(a.photo_share) as 'photoShare', -- 分享数
+        sum(a.photo_comment) as 'photoComment', -- 评论数
+        sum(a.photo_like) as 'photoLike', -- 点赞数
+        sum(a.follow) as 'follow', -- 新增关注数
+        sum(a.report) as 'report', -- 举报数
+        sum(a.cancel_follow) as 'cancelFollow', -- 取消关注数
+        sum(a.block) as 'block', -- 拉黑数
+        sum(a.negative) as 'nagative', -- 减少此类作品数
+        sum(a.download_started) as 'downloadStarted', -- 应用下载数据-安卓下载开始数
+        sum(a.download_completed) as 'downloadCompleted', -- 应用下载数据-安卓下载完成数
+        (CASE
+        WHEN sum(a.event_next_day_stay) != 0
+        THEN round(sum(a.charge) / sum(a.event_next_day_stay),2)
+        ELSE 0
+        end
+        ) as 'eventNextDayStayCost', -- 次日留存成本
+        (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
+        (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl,
+        (select material_type from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as materialType
+        from
+        ctop_kuaishou_report_daily_creative a
+        left join ctop_user_allocation  b on a.account_id = b.account_id
+        left join ctop_kuaishou_creative c on a.creative_id = c.creative_id
+        where
+        a.stat_date &gt;= #{startDate}
+        and
+        a.stat_date &lt;= #{endDate}
 
-            <if test="unitId != null and unitId !='' ">
-                and
-                a.unit_id = #{unitId}
-            </if>
-            <if test="accountIds !=null">
-                and a.account_id in
-                <foreach collection="accountIds" item="item" separator=","
-                         open="(" close=")">
-                    #{item}
-                </foreach>
-            </if>
+        <if test="unitId != null and unitId !='' ">
+            and
+            a.unit_id = #{unitId}
+        </if>
+        <if test="accountIds !=null">
+            and a.account_id in
+            <foreach collection="accountIds" item="item" separator=","
+                     open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
         <if test="projectList!=null">
             and
             b.project_id in
@@ -1068,12 +1078,12 @@
                 #{item}
             </foreach>
         </if>
-            group by a.creative_id
-            order by sum(a.charge) desc
-<!--        )m-->
-<!--        <if test="yn=1">-->
-<!--            where m.charge != 0-->
-<!--        </if>-->
+        group by a.creative_id
+        order by sum(a.charge) desc
+        <!--        )m-->
+        <!--        <if test="yn=1">-->
+        <!--            where m.charge != 0-->
+        <!--        </if>-->
     </select>
 
     <!-- 获取项目成员所在所有项目下的所有账户id -->
@@ -1091,14 +1101,14 @@
         select
         a.account_id
         from
-        (select project_id,account_id,media_id from ctop_user_allocation  group by account_id) a
+        (select project_id,account_id,media_id from ctop_user_allocation group by account_id) a
         left join ctop_project_member b on a.project_id=b.project_id
         where
         a.media_id in (2,4)
         and user_id = #{userId}
         order by create_time desc
         <if test="yn==1">
-        limit 50
+            limit 50
         </if>
     </select>
 
@@ -1111,7 +1121,7 @@
         where
         b.media_id in (2,4)
         <if test="yn==1">
-        limit 50
+            limit 50
         </if>
     </select>
 
@@ -1119,14 +1129,14 @@
         select
         a.account_id
         from
-        (select project_id,account_id,media_id,create_time from ctop_user_allocation  group by account_id) a
+        (select project_id,account_id,media_id,create_time from ctop_user_allocation group by account_id) a
         left join ctop_project b on a.project_id=b.id
         where
         b.sale_id = #{userId}
         and b.media_id in (2,4)
         order by a.create_time desc
         <if test="yn==1">
-        limit 50
+            limit 50
         </if>
     </select>
 

+ 1 - 1
module-kuaishou/src/main/resources/json_template/kuaishou_filed_mapping.json

@@ -160,7 +160,7 @@
     "comment": "次留成本"
   },
   "nextDayOpenRate": {
-    "filed": "CASE WHEN sum(t1.event_next_day_stay) / sum(t1.bclick) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.bclick)*100,2),'%') end as nextDayOpenRate ",
+    "filed": "CASE WHEN sum(t1.event_next_day_stay) / sum(t1.activation) IS NULL THEN 0 ELSE concat(round(sum(t1.event_next_day_stay) / sum(t1.activation)*100,2),'%') end as nextDayOpenRate ",
     "comment": "次留率"
   },
   "eventJinJianLandingPage": {

+ 1 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatCheckinDataServiceImpl.java

@@ -120,7 +120,7 @@ public class WechatCheckinDataServiceImpl extends ServiceImpl<WechatCheckinDataM
                         }
                     }
                 } else {
-                    log.error("获取打卡数据异常,数据-> {}",resultJson);
+                    log.error("获取打卡数据异常,返回数据-> {} ;入参-> {}", resultJson, params.toJSONString());
                 }
             }
         } catch (Exception e) {

+ 103 - 77
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml

@@ -4,15 +4,15 @@
 
     <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(cost),2) cost,
-          sum(show_num) showNum,
-          sum(click) click,
-          sum(convert_num) as convertNum,
-          max(stat_hour) maxHour
+        ROUND(sum(cost),2) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) as convertNum,
+        max(stat_hour) maxHour
         FROM
-          ctop_bytedance_report_advertiser_hourly
+        ctop_bytedance_report_advertiser_hourly
         WHERE
-          stat_datetime = #{statDate}
+        stat_datetime = #{statDate}
         AND advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -35,13 +35,13 @@
 
     <select id="queryTodaySumByHourGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          t2.account_id as accountId,
-          t2.auth_name as authName,
-          ${filed}
+        t2.account_id as accountId,
+        t2.auth_name as authName,
+        ${filed}
         FROM ctop_bytedance_report_advertiser_hourly t1
         left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
         WHERE t1.stat_datetime = #{statDate}
-          and t1.stat_hour &lt;= #{hour}
+        and t1.stat_hour &lt;= #{hour}
         AND t1.advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
@@ -53,14 +53,14 @@
 
     <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(cost),2) cost,
-          sum(show_num) showNum,
-          sum(click) click,
-          sum(convert_num) as convertNum
+        ROUND(sum(cost),2) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) as convertNum
         FROM
-          ctop_bytedance_report_advertiser_hourly
+        ctop_bytedance_report_advertiser_hourly
         WHERE
-          stat_datetime = #{statDate}
+        stat_datetime = #{statDate}
         and stat_hour &lt;= #{hour}
         AND advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
@@ -71,11 +71,11 @@
 
     <select id="querySumByHour" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ${filed}
+        ${filed}
         FROM
-          ctop_bytedance_report_advertiser_hourly t1
+        ctop_bytedance_report_advertiser_hourly t1
         WHERE
-          t1.stat_datetime = #{statDate}
+        t1.stat_datetime = #{statDate}
         and t1.stat_hour &lt;= #{hour}
         AND t1.advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
@@ -86,29 +86,29 @@
 
     <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(cost),2) cost,
-          sum(show_num) showNum,
-          sum(click) click,
-          sum(convert_num) as convertNum,
-          stat_hour as statHour
+        ROUND(sum(cost),2) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) as convertNum,
+        stat_hour as statHour
         FROM
-            ctop_bytedance_report_advertiser_hourly
+        ctop_bytedance_report_advertiser_hourly
         WHERE
-            stat_datetime = #{statDate}
+        stat_datetime = #{statDate}
         AND advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
         </foreach>
         GROUP BY
-            stat_hour
+        stat_hour
         ORDER BY
-            stat_hour ASC
+        stat_hour ASC
     </select>
 
     <select id="queryAllSumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ${filed}
+        ${filed}
         FROM ctop_bytedance_report_advertiser_daily t1
         WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
         AND t1.stat_datetime &gt;= #{startDate}
@@ -121,8 +121,8 @@
 
     <select id="querySumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT ROUND(sum(cost), 2) cost,
-        sum(show_num)       showNum,
-        sum(click)          click,
+        sum(show_num) showNum,
+        sum(click) click,
         sum(convert_num) as convertNum
         FROM ctop_bytedance_report_advertiser_daily t1
         WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
@@ -136,15 +136,15 @@
 
     <select id="querySumByDateGroupAccount" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          DATE_FORMAT(t1.stat_datetime,'%Y-%m-%d') as statDate,
-          t2.account_id as accountId,
-          t2.auth_name as authName,
-          ${filed}
+        DATE_FORMAT(t1.stat_datetime,'%Y-%m-%d') as statDate,
+        t2.account_id as accountId,
+        t2.auth_name as authName,
+        ${filed}
         FROM
         ctop_bytedance_report_advertiser_daily t1
         left join ctop_user_allocation t2 on t1.advertiser_id=t2.account_id
         WHERE
-            t1.stat_datetime &lt;= #{endDate} '00:00:00'
+        t1.stat_datetime &lt;= #{endDate} '00:00:00'
         AND t1.stat_datetime &gt;= #{startDate}
         AND t1.advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
@@ -178,35 +178,35 @@
 
     <select id="queryDetailByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(cost),2) cost,
-          sum(show_num) showNum,
-          sum(click) click,
-          sum(convert_num) convertNum,
-          DATE_FORMAT(stat_datetime, '%Y-%m-%d') statDate
+        ROUND(sum(cost),2) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) convertNum,
+        DATE_FORMAT(stat_datetime, '%Y-%m-%d') statDate
         FROM
-           ctop_bytedance_report_advertiser_daily
+        ctop_bytedance_report_advertiser_daily
         WHERE stat_datetime &lt;= #{endDate} '00:00:00'
-          AND stat_datetime &gt;= #{startDate}
-          AND advertiser_id in
-          <foreach item="item" index="index" collection="accountIds"
+        AND stat_datetime &gt;= #{startDate}
+        AND advertiser_id in
+        <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
-          </foreach>
+        </foreach>
         group by stat_datetime
         order by stat_datetime asc
     </select>
 
     <select id="queryDetailGroupMonthByDate" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-          ROUND(sum(cost),2) cost,
-          sum(show_num) showNum,
-          sum(click) click,
-          sum(convert_num) convertNum,
-          DATE_FORMAT(t1.stat_datetime, '%Y-%m') statDate
+        ROUND(sum(cost),2) cost,
+        sum(show_num) showNum,
+        sum(click) click,
+        sum(convert_num) convertNum,
+        DATE_FORMAT(t1.stat_datetime, '%Y-%m') statDate
         FROM ctop_bytedance_report_advertiser_daily t1
         WHERE t1.stat_datetime &lt;= #{endDate} '00:00:00'
-          AND t1.stat_datetime &gt;= #{startDate}
-          AND t1.advertiser_id in
+        AND t1.stat_datetime &gt;= #{startDate}
+        AND t1.advertiser_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">
             #{item}
@@ -299,23 +299,35 @@
         else 0 end                               as activeRegisterCost               -- 应用下载广告数据-注册成本  总花费/注册数,当天数据可能会有波动,次日早8点后稳定。
     </sql>
 
-    <select id="getBytedanceAccountInfoByProjectId" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+    <select id="getBytedanceAccountInfoByProjectId"
+            resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
         select * from (
         select
         concat(#{startDate},'~',#{endDate}) as statDate,
         a.advertiser_id as 'accountId',
         c.advertiser_id as 'advertiserId',
-        c.advertiser_name as 'advertiserName',
-        c.responsible_name as 'responsibleName',
-        c.design_responsible_name as 'designResponsibleName',
+        (select name from ctop_advertiser where id = c.advertiser_id) as 'advertiserName',
+        (
+        select realname from sys_user where id = (
+        select responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'responsibleName',
+
+        (
+        select realname from sys_user where id = (
+        select design_responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'designResponsibleName',
+
+
         b.auth_name as 'authName',
         b.project_id as 'projectId',
-        b.project_name as 'projectName',
+        (select project_name from ctop_project where id = b.project_id) as 'projectName',
         c.media_id as 'mediaId',
         <include refid="selectSql"></include>
         from
         ctop_bytedance_report_advertiser_daily a
-        left join (select * from ctop_user_allocation group by account_id) b on a.advertiser_id = b.account_id
+        left join ctop_user_allocation b on a.advertiser_id = b.account_id
         left join ctop_project c on b.project_id = c.id
         where
         date_format(a.stat_datetime,'%Y-%m-%d') &gt;= #{startDate}
@@ -341,23 +353,33 @@
         </if>
     </select>
 
-    <select id="getBytedanceProjectInfo" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+    <select id="getBytedanceProjectInfo"
+            resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
         select * from (
         select
         concat(#{startDate},'~',#{endDate}) as statDate,
         a.advertiser_id as 'accountId',
         c.advertiser_id as 'advertiserId',
-        c.advertiser_name as 'advertiserName',
-        c.responsible_name as 'responsibleName',
-        c.design_responsible_name as 'designResponsibleName',
+        (select name from ctop_advertiser where id = c.advertiser_id) as 'advertiserName',
+
+        (
+        select realname from sys_user where id = (
+        select responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'responsibleName',
+        (
+        select realname from sys_user where id = (
+        select design_responsible_id from ctop_project where id = b.project_id
+        )
+        ) as 'designResponsibleName',
         b.auth_name as 'authName',
         b.project_id as 'projectId',
-        b.project_name as 'projectName',
+        (select project_name from ctop_project where id = b.project_id) as 'projectName',
         c.media_id as 'mediaId',
         <include refid="selectSql"></include>
         from
         ctop_bytedance_report_advertiser_daily a
-        left join (select * from ctop_user_allocation group by account_id) b on a.advertiser_id = b.account_id
+        left join ctop_user_allocation b on a.advertiser_id = b.account_id
         left join ctop_project c on b.project_id = c.id
         where
         date_format(a.stat_datetime, '%Y-%m-%d') &gt;= #{startDate}
@@ -424,19 +446,23 @@
         </foreach>
     </select>
 
-    <select id="queryProjectMemberByIds" resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
+    <select id="queryProjectMemberByIds"
+            resultType="cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO">
         select
-        distinct id as projectId,
-        project_name as projectName,
-        advertiser_id as advertiserId,
-        advertiser_name as advertiserName,
-        media_id as mediaId,
-        responsible_name as responsibleName,
-        design_responsible_name as designResponsibleName
-        from
-        left join ctop_project
+        t1.id as projectId,
+        t1.project_name as projectName,
+        t1.advertiser_id as advertiserId,
+        t1.advertiser_name as advertiserName,
+        t1.media_id as mediaId,
+        (
+        select realname from sys_user where id = t1.responsible_id
+        ) as 'responsibleName',
+        (
+        select realname from sys_user where id = t1.design_responsible_id
+        ) as 'designResponsibleName'
+        from ctop_project t1
         where
-        id in
+        t1.id in
         <foreach collection="projectIds" item="item" separator=","
                  open="(" close=")">
             #{item}