Forráskód Böngészése

盯盘运营经理-项目维度列表-导出

yangzian 3 éve
szülő
commit
0e6d7d9fda

+ 37 - 6
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/controller/KuaiShouMaterialStareController.java

@@ -1,5 +1,8 @@
 package org.jeecg.ctop.material.controller;
 
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
@@ -12,12 +15,11 @@ import org.apache.poi.ss.util.CellRangeAddress;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.ctop.material.constants.Check;
 import org.jeecg.ctop.material.entity.vo.KuaiShouOperateAccountVo;
+import org.jeecg.ctop.material.entity.vo.KuaiShouOperateGroupVo;
 import org.jeecg.ctop.material.entity.vo.KuaiShouOperateProjectVo;
 import org.jeecg.ctop.material.mapper.MaterialStareMapper;
 import org.jeecg.ctop.material.service.MaterialStareService;
 import org.jeecg.ctop.material.service.impl.MaterialStareServiceImpl;
-import org.jeecgframework.poi.excel.ExcelExportUtil;
-import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -347,12 +349,15 @@ public class KuaiShouMaterialStareController {
 
 
     @GetMapping("/exportKuaiShouOperateProjectInfo")
-    public Result<JSONObject> exportKuaiShouOperateProjectInfo(@RequestParam(name="startTime") String startTime,
+    public Result<JSONObject> exportKuaiShouOperateProjectInfo(
+            @RequestParam(name="mediaType") String mediaType,
+            @RequestParam(name="startTime") String startTime,
                                                             @RequestParam(name="endTime") String endTime,
                                                             @RequestParam(name="userId") String userId,HttpServletResponse response) {
 
         try {
-            JSONObject jsonObject = materialStareMapper.getColumnInfo(userId,"101");
+            //默认
+            JSONObject jsonObject = materialStareMapper.getColumnInfo("e9ca23d68d884d4ebb19d07889727dae","3001");
             if (Check.isNull(jsonObject)){
                 return Result.errorMsg("暂无自定义列。");
             }
@@ -388,10 +393,36 @@ public class KuaiShouMaterialStareController {
                 cell.setCellStyle(style);          //内容居中
             }
 
-            List< KuaiShouOperateProjectVo > resultList = materialStareService.exportKuaiShouOperateProjectInfo(startTime, endTime, userId);
+            List< KuaiShouOperateProjectVo > resultList = materialStareService.exportKuaiShouOperateProjectInfo(mediaType,startTime, endTime, userId);
 
             for (int j = 0; j < resultList.size(); j++) {
                 KuaiShouOperateProjectVo projectVo = resultList.get(j);
+                //分版位
+                if (!Check.isNull(projectVo.getAdSceneDate())){
+                    for (JSONObject jObj : projectVo.getAdSceneDate()) {
+                        String name = jObj.get("adSceneName")+"";
+                        if (name.contains("激励")){
+                            projectVo.setJiLishiPin(jObj.get("adSceneCost")+"");
+                        }
+                        if (name.contains("开屏")){
+                            projectVo.setKaiPing(jObj.get("adSceneCost")+"");
+                        }
+                        if (name.contains("搜索")){
+                            projectVo.setSouSuo(jObj.get("adSceneCost")+"");
+                        }
+                        if (name.contains("上下")){
+                            projectVo.setShangXiaHua(jObj.get("adSceneCost")+"");
+                        }
+                        if (name.contains("联盟")){
+                            projectVo.setLianMeng(jObj.get("adSceneCost")+"");
+                        }
+                        if (name.contains("信息流")){
+                            projectVo.setXinxiLiu(jObj.get("adSceneCost")+"");
+                        }
+
+                    }
+                }
+
                 Map project = Check.parseObj2Map(projectVo);
 
                 //创建行 (表头占0-1行 所以 从 2开始)
@@ -400,7 +431,7 @@ public class KuaiShouMaterialStareController {
                     JSONObject json = (JSONObject)array.get(k);
                     String fieldName = KuaiShouOperateProjectVo.class.getDeclaredField(json.getString("dataIndex")).getName();
                     project.get(fieldName);
-                    row.createCell(k).setCellValue(project.get(fieldName).toString());
+                    row.createCell(k).setCellValue(project.get(fieldName)+"");
                 }
             }
 

+ 17 - 0
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/entity/vo/KuaiShouOperateProjectVo.java

@@ -17,15 +17,19 @@ import java.util.List;
 public class KuaiShouOperateProjectVo {
 
 
+    @Excel(name = "账户数量")
     @ApiModelProperty(value = "账户数量")
     private Integer accountNum;
 
+    @Excel(name = "总花费")
     @ApiModelProperty(value = "总花费")
     private Double totalCost;
 
     private String projectId;
+    @Excel(name = "项目名称")
     private String projectName;
 
+    @Excel(name = "运营人员")
     @ApiModelProperty(value = "用户数量")
     private Integer userNum;
     private String userId;
@@ -100,26 +104,39 @@ public class KuaiShouOperateProjectVo {
     private Integer newHotNum;
 
 
+    @Excel(name = "花费环比")
     @ApiModelProperty(value = "环比")
     private String yearOnYear;
 
+    @Excel(name = "花费同比")
     @ApiModelProperty(value = "同比")
     private String equallyRate;
 
 
+    @Excel(name = "托管基建数")
     @ApiModelProperty(value = "智能托管")
     private Integer trustUnitNum;
 
 
+    @Excel(name = "基建数")
     @ApiModelProperty(value = "基建数")
     private Integer newUnitNum;
 
+    @Excel(name = "上传助手素材数")
     @ApiModelProperty(value = "上传助手素材数")
     private long adspNum;
+
     @ApiModelProperty(value = "上传媒体素材数")
     private long mediaNum;
+
     @ApiModelProperty(value = "版位数据")
     private List<JSONObject> adSceneDate;
+    private String jiLishiPin;
+    private String kaiPing;
+    private String souSuo;
+    private String shangXiaHua;
+    private String lianMeng;
+    private String xinxiLiu;
 
 
 

+ 1 - 1
jeecg-boot-material-view/src/main/java/org/jeecg/ctop/material/service/MaterialStareService.java

@@ -29,7 +29,7 @@ public interface MaterialStareService {
     Result exportKuaiShouOperateInfo(String startTime, String endTime, String userId, HttpServletResponse response);
 
     Result getKuaiShouOperateProjectInfo(Integer pageNum,int pageSize,String mediaType,String startTime, String endTime, String userId);
-    List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String startTime, String endTime, String userId);
+    List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String mediaType,String startTime, String endTime, String userId);
 
     Result getKuaiShouOperateAccountInfo(Integer pageNum,int pageSize,String startTime, String endTime, String projectId,String userId);
     List<KuaiShouOperateAccountVo> exportKuaiShouOperateAccountInfo(String startTime, String endTime, String projectId, String userId);

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

@@ -658,7 +658,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
 */
                     //查询 有效 上新计划 上新组
-                    JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
+                    JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
                     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"));//爆款
@@ -688,9 +688,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                     }
                     projectInfo.setEquallyRate(equallyRate);
                 }
-
-
-
             }
             //快手
             if (mediaType.equals("2")){
@@ -762,8 +759,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 }
             }
 
-
-
             PageInfo<KuaiShouOperateProjectVo> pageInfo = new PageInfo<>(listOperate);
             return Result.successMsg("运营项目列表数据查询成功。",pageInfo);
         }catch (Exception e){
@@ -774,9 +769,11 @@ public class MaterialStareServiceImpl implements MaterialStareService {
 
 
 
-    public List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String startTime, String endTime, String userId) {
+    public List<KuaiShouOperateProjectVo> exportKuaiShouOperateProjectInfo(String mediaType,String startTime, String endTime, String userId) {
         DecimalFormat decimalFormat = new DecimalFormat("0.00%");
         long now = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
+        List<KuaiShouOperateProjectVo> listOperate = new ArrayList<>();
+
         try {
             //查询当前人员所有下级
             Set<String> operatorUserIds = getAffiliateId(userId);
@@ -798,72 +795,149 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 endEqually = DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(endTime)), -7));
             }
 
-            //查询运营数据-项目维度
-            List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
-            for (KuaiShouOperateProjectVo projectInfo : listOperate) {
-                String projectId = projectInfo.getProjectId();
+            //头条
+            if (mediaType.equals("1")){
+                //查询运营数据-项目维度
+                listOperate = materialStareMapper.getBytedanceOperateProjectInfo(startDate,entDate,null,operatorUserIds);
+                for (KuaiShouOperateProjectVo projectInfo : listOperate) {
+                    String projectId = projectInfo.getProjectId();
+                    //环比 = (当前 - 上阶段 ) / 上阶段
+                    String yearOnYear = "0";
+                    //当天
+                    int newUnitNumNow = 0;
+                    int trustUnitNum = 0;
+                    if (startDate == now || entDate == now){
 
-                //环比 = (当前 - 上阶段 ) / 上阶段
-                String yearOnYear = "0";
+                        //查询当天数据
 
-                //当天
-                int newUnitNumNow = 0;
-                int trustUnitNum = 0;
-                if (startDate == now || entDate == now){
-                    //查询 当天有效 上新计划 上新组
-                    JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
-                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
-                    trustUnitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum");//智能托管
 
-                    //时报 消费
-                    //环比 = (当前 - 上阶段 ) / 上阶段
-                    int hour = DateUtils.getNowHour();
-                    List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getKuaiShouOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
-                    List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getKuaiShouOperateProjectInfoHour(lastTimeStart,lastTimeEnd,hour,projectId,operatorUserIds);
-                    if (!Check.isNull(projectYearOnYearInfoNow) && !Check.isNull(projectYearOnYearInfoLast)){
-                        Double yearOnYearD = (projectYearOnYearInfoNow.get(0).getTotalCost() - projectYearOnYearInfoLast.get(0).getTotalCost()) / projectYearOnYearInfoNow.get(0).getTotalCost();
-                        yearOnYear = decimalFormat.format(yearOnYearD);
+                        //时报 消费
+                        //环比 = (当前 - 上阶段 ) / 上阶段
+                        int hour = DateUtils.getNowHour();
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getBytedanceOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getBytedanceOperateProjectInfoHour(lastTimeStart,lastTimeEnd,hour,projectId,operatorUserIds);
+                        if (!Check.isNull(projectYearOnYearInfoNow) && !Check.isNull(projectYearOnYearInfoLast)){
+                            Double yearOnYearD = (projectYearOnYearInfoNow.get(0).getTotalCost() - projectYearOnYearInfoLast.get(0).getTotalCost()) / projectYearOnYearInfoNow.get(0).getTotalCost();
+                            yearOnYear = decimalFormat.format(yearOnYearD);
+                        }
+                        projectInfo.setYearOnYear(yearOnYear);
+                    }else {
+                        //环比 日报
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getBytedanceOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
+                        if (!Check.isNull(projectYearOnYearInfo)){
+                            Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
+                            yearOnYear = decimalFormat.format(yearOnYearD);
+                        }
+                        projectInfo.setYearOnYear(yearOnYear);
                     }
-                    projectInfo.setYearOnYear(yearOnYear);
-                }else {
-                    //环比 日报
-                    List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
-                    if (!Check.isNull(projectYearOnYearInfo)){
-                        Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
-                        yearOnYear = decimalFormat.format(yearOnYearD);
+
+                    //查询 有效 上新视频 爆款视频
+                   /* JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
+                    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")+newUnitNumNow);//基建数
+                    projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
+*/
+                    //查询 有效 上新计划 上新组
+                    JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
+                    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"));//基建数
+                    projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
+
+
+                    /*
+
+                    //查看 上传到助手、媒体的素材数量 分版位花费
+                    List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
+                    projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
+                    projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
+                    //分版位
+                    List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
+                    projectInfo.setAdSceneDate(adSceneDate);
+*/
+
+                    //同比 日期超过 7 天 则不显示
+                    String equallyRate = "-";
+                    if (daysBetween <= 7){
+                        List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getBytedanceOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
+                        if (!Check.isNull(projectEquallyInfo)){
+                            Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
+                            equallyRate = decimalFormat.format(equallyRateD);
+                        }
                     }
-                    projectInfo.setYearOnYear(yearOnYear);
+                    projectInfo.setEquallyRate(equallyRate);
                 }
+            }
+            //快手
+            if (mediaType.equals("2")){
+                //查询运营数据-项目维度
+                listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
+                for (KuaiShouOperateProjectVo projectInfo : listOperate) {
+                    String projectId = projectInfo.getProjectId();
+                    //环比 = (当前 - 上阶段 ) / 上阶段
+                    String yearOnYear = "0";
+                    //当天
+                    int newUnitNumNow = 0;
+                    int trustUnitNum = 0;
+                    if (startDate == now || entDate == now){
+                        //查询 当天有效 上新计划 上新组
+                        JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
+                        newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
+                        trustUnitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum");//智能托管
 
-                //查询 有效 上新视频 爆款视频
-                JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
-                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"));//爆款
+                        //时报 消费
+                        //环比 = (当前 - 上阶段 ) / 上阶段
+                        int hour = DateUtils.getNowHour();
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getKuaiShouOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getKuaiShouOperateProjectInfoHour(lastTimeStart,lastTimeEnd,hour,projectId,operatorUserIds);
+                        if (!Check.isNull(projectYearOnYearInfoNow) && !Check.isNull(projectYearOnYearInfoLast)){
+                            Double yearOnYearD = (projectYearOnYearInfoNow.get(0).getTotalCost() - projectYearOnYearInfoLast.get(0).getTotalCost()) / projectYearOnYearInfoNow.get(0).getTotalCost();
+                            yearOnYear = decimalFormat.format(yearOnYearD);
+                        }
+                        projectInfo.setYearOnYear(yearOnYear);
+                    }else {
+                        //环比 日报
+                        List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
+                        if (!Check.isNull(projectYearOnYearInfo)){
+                            Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
+                            yearOnYear = decimalFormat.format(yearOnYearD);
+                        }
+                        projectInfo.setYearOnYear(yearOnYear);
+                    }
 
-                projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
-                projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
+                    //查询 有效 上新视频 爆款视频
+                    JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
+                    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"));//爆款
 
-                //查看 上传到助手、媒体的素材数量 分版位花费
-                List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
+                    projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
+                    projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
 
-                projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
-                projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
+                    //查看 上传到助手、媒体的素材数量 分版位花费
+                    List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
 
-                //分版位
-                List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
-                projectInfo.setAdSceneDate(adSceneDate);
+                    projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
+                    projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
 
-                //同比 日期超过 7 天 则不显示
-                String equallyRate = "-";
-                if (daysBetween <= 7){
-                    List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
-                    if (!Check.isNull(projectEquallyInfo)){
-                        Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
-                        equallyRate = decimalFormat.format(equallyRateD);
+                    //分版位
+                    List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
+                    projectInfo.setAdSceneDate(adSceneDate);
+
+                    //同比 日期超过 7 天 则不显示
+                    String equallyRate = "-";
+                    if (daysBetween <= 7){
+                        List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
+                        if (!Check.isNull(projectEquallyInfo)){
+                            Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
+                            equallyRate = decimalFormat.format(equallyRateD);
+                        }
                     }
+                    projectInfo.setEquallyRate(equallyRate);
                 }
-                projectInfo.setEquallyRate(equallyRate);
             }
 
             return listOperate;
@@ -1340,7 +1414,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 //下级员工
                 Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
                 //有消耗的账户
-
                 if (mediaType.equals("1")){
                     operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
 
@@ -1371,7 +1444,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 }else {
                     if (daysBetween <= 1){
                         //时报
-                        listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
+                        listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
                     }else {
 
                         listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
@@ -1504,7 +1577,12 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 //下级员工
                 Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
                 //有消耗的账户
-                operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
+                if (mediaType.equals("1")){
+                    operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
+                }else {
+                    operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
+                }
+
 
                 if (Check.isNull(operatorUserIds) || operatorUserIds.size() < 1){
                     continue;
@@ -1517,12 +1595,22 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 //查询账户数据
                 List<KuaiShouOperateVo> listOperate= new ArrayList<>();
 
-                if (daysBetween <= 1){
-                    //时报
-                    listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
+                if (mediaType.equals("1")){
+                    if (daysBetween <= 1){
+                        //时报
+                        listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
+                    }else {
+
+                        listOperate = materialStareMapper.getBytedanceOperateInfo(startDate,entDate,operatorUserIds);
+                    }
                 }else {
+                    if (daysBetween <= 1){
+                        //时报
+                        listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
+                    }else {
 
-                    listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
+                        listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
+                    }
                 }
 
                 //总花费
@@ -1545,8 +1633,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 //平均账户消耗 总花费/账户数量
                 Double aveAccount = accountNum.intValue() == 0 ? 0 : totalCost/accountNum;
                 groupVo.setAverageAccountCost(new BigDecimal(aveAccount).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
+
                 //环比 = (当前 - 上阶段 ) / 上阶段
-                List<KuaiShouOperateVo> yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
+                List<KuaiShouOperateVo> yearOnYearInfo = new ArrayList<>();
+                if (mediaType.equals("1")){
+                    yearOnYearInfo = materialStareMapper.getBytedanceOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
+                }else {
+                    yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
+                }
                 String yearOnYear = "0";
                 if (!Check.isNull(yearOnYearInfo)){
                     Double lastTotalCost = Check.isNull(yearOnYearInfo) ? 0 : yearOnYearInfo.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
@@ -1559,16 +1653,28 @@ public class MaterialStareServiceImpl implements MaterialStareService {
                 //当天
                 int newUnitNumNow = 0;
                 if (startDate == nowDate || entDate == nowDate){
-                    //查询 当天有效 上新计划 上新组
-                    JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
+                    JSONObject newEffect = new JSONObject();
+                    if (mediaType.equals("1")){
+                        //查询 当天有效 上新计划 上新组
+                        newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
+                    }else {
+                        //查询 当天有效 上新计划 上新组
+                        newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
+                    }
                     newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
                 }
 
-                //查询 历史上新组
-                JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
+                if (mediaType.equals("1")){
+                }else {
+                    //查询 历史上新组
+                    JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
+                    newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow;
+                }
+
                 //基建数量
-                groupVo.setUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//组
+                groupVo.setUnitNum(newUnitNumNow);//组
             }
+
             Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("运营组数据详情", "运营组数据"), KuaiShouOperateGroupVo.class, operationManagerList);
             response.setCharacterEncoding("UTF-8");
             response.setHeader("content-Type", "application/vnd.ms-excel");