Procházet zdrojové kódy

穿山甲数据报表数据接口统计

syh před 5 roky
rodič
revize
c1c4699c0f
23 změnil soubory, kde provedl 612 přidání a 75 odebrání
  1. 42 12
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java
  2. 6 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  3. 1 0
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  4. 4 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IOceanEngineService.java
  5. 347 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java
  6. 4 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinAppMapper.java
  7. 4 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinChannelMapper.java
  8. 2 4
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportAppHourMapper.java
  9. 2 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportBillMonthMapper.java
  10. 2 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportChannelDailyMapper.java
  11. 13 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinAppMapper.xml
  12. 13 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinChannelMapper.xml
  13. 79 26
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportAppHourMapper.xml
  14. 9 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportBillMonthMapper.xml
  15. 14 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportChannelDailyMapper.xml
  16. 3 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinAppService.java
  17. 3 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinChannelService.java
  18. 17 2
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinAppServiceImpl.java
  19. 17 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinChannelServiceImpl.java
  20. 1 9
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java
  21. 17 12
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportAppHourServiceImpl.java
  22. 5 1
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportBillMonthServiceImpl.java
  23. 7 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportChannelDailyServiceImpl.java

+ 42 - 12
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java

@@ -3,12 +3,12 @@ package org.jeecg.modules.ctop.controller;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportAppHourService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportBillMonthService;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportChannelDailyService;
+import cn.com.ctop.crawler.modules.pangolin.service.*;
 import cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppMonthVO;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
+import org.apache.shiro.SecurityUtils;
+import org.jeecg.common.system.vo.LoginUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -28,15 +28,45 @@ public class PangolinController {
     @Autowired
     private PangolinReportBillMonthService pangolinReportBillMonthService;
     @Autowired
+    private PangolinAppService pangolinAppService;
+    @Autowired
+    private PangolinChannelService pangolinChannelService;
+    @Autowired
     private ISysRoleService sysRoleService;
+    @PostMapping("api/channel/list")
+    public Map<String, Object> channelList(@RequestBody JSONObject data) {
+//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        String userId = user.getId();
+        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals("admin"))){
+            userId = null;
+        }
+        return pangolinChannelService.getListByUserId(userId);
+    }
+
+
+    @PostMapping("api/app/list")
+    public Map<String, Object> appList() {
+//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+//        String userId = user.getId();
+        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if(null!=roleCode&&(roleCode.equals("admin"))){
+            userId = null;
+        }
+        return pangolinAppService.getListByUserId(userId);
+    }
+
+
     /**
      * 实时数据
      */
     @PostMapping("api/realtime")
     public Map<String, Object> realTime(@RequestBody JSONObject data) {
-//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;
@@ -49,9 +79,9 @@ public class PangolinController {
      */
     @PostMapping("api/activation/list")
     public Map<String, Object> activationList(@RequestBody JSONObject data) {
-//        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;
@@ -65,9 +95,9 @@ public class PangolinController {
     @PostMapping("/api/checkApps/list")
     public Map<String,Object> checkAppList(@RequestBody JSONObject data) {
         Map<String,Object> result = new HashMap<>();
-        //        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = user.getId();
-        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = user.getId();
+//        String userId = "6b4c821adc414dc8b7718ab63ccbfcaf";
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         if(null!=roleCode&&(roleCode.equals("admin"))){
             userId = null;

+ 6 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -81,6 +81,12 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             returnMap.put("accountUd", password);
             return returnMap;
         }
+        if(loginType.trim().equals("pangolin")){
+            log.info("穿山甲账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
+            returnMap.put("success", false);
+            returnMap.put("accountUd", password);
+            return returnMap;
+        }
         return returnMap;
     }
 

+ 1 - 0
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -108,6 +108,7 @@ public class SampleTest {
             e.printStackTrace();
         }
     }
+
 }
 
 

+ 4 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/IOceanEngineService.java

@@ -0,0 +1,4 @@
+package cn.com.ctop.crawler.modules.oceanengine.service;
+
+public interface IOceanEngineService {
+}

+ 347 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/oceanengine/service/impl/OceanEngineServiceImpl.java

@@ -0,0 +1,347 @@
+//package cn.com.ctop.crawler.modules.oceanengine.service.impl;
+//
+//import cn.com.ctop.common.module.utils.Base64Utils;
+//import cn.com.ctop.common.module.utils.HttpUtils2;
+//import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
+//import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
+//import cn.com.ctop.crawler.modules.oceanengine.entity.DouyinHot;
+//import cn.com.ctop.crawler.modules.oceanengine.entity.EffectCase;
+//import cn.com.ctop.crawler.modules.oceanengine.entity.HotMaterial;
+//import cn.com.ctop.crawler.modules.oceanengine.service.IOceanEngineService;
+//import com.fasterxml.jackson.core.type.TypeReference;
+//import com.fasterxml.jackson.databind.DeserializationFeature;
+//import com.fasterxml.jackson.databind.JsonNode;
+//import com.fasterxml.jackson.databind.ObjectMapper;
+//import org.apache.http.impl.cookie.BasicClientCookie;
+//import org.bytedeco.javacv.FFmpegFrameGrabber;
+//import org.bytedeco.javacv.Frame;
+//import org.bytedeco.javacv.Java2DFrameConverter;
+//import org.openqa.selenium.Cookie;
+//import org.openqa.selenium.WebDriver;
+//import org.openqa.selenium.chrome.ChromeDriver;
+//import org.openqa.selenium.chrome.ChromeOptions;
+//import org.quartz.JobExecutionContext;
+//import org.quartz.JobExecutionException;
+//import org.springframework.stereotype.Service;
+//
+//import javax.imageio.ImageIO;
+//import java.awt.*;
+//import java.awt.image.BufferedImage;
+//import java.io.ByteArrayOutputStream;
+//import java.net.HttpURLConnection;
+//import java.net.URL;
+//import java.util.*;
+//import java.util.List;
+//
+//@Service
+//public class OceanEngineServiceImpl implements IOceanEngineService {
+//    public static String getVideoUrlByVid(String vid) {
+//        String url = "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=" + vid + "&line=0";
+//        return getRealVideoUrl(url);
+//    }
+//
+//    public static String getRealVideoUrl(String url) {
+//        try {
+//            URL serverUrl = new URL(url);
+//            HttpURLConnection conn = (HttpURLConnection) serverUrl
+//                    .openConnection();
+//            conn.setRequestMethod("GET");
+//            // 必须设置false,否则会自动redirect到Location的地址
+//            conn.setInstanceFollowRedirects(false);
+//            conn.addRequestProperty("User-Agent",
+//                    "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.8) Firefox/3.6.8");
+//            conn.connect();
+//            String location = conn.getHeaderField("Location");
+//            return location;
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//        return null;
+//    }
+//    private void hotMaterialHandler(int page,int appCode,String appName){
+//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_material/list?material_type=3&order_by=convert_show_rate&period_type=3&aggr_app_code="+appCode+"&page="+page+"&limit=20");
+//        ObjectMapper mapper = new ObjectMapper();
+//        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+//        try {
+//            JsonNode node = mapper.readTree(result);
+//            int code = node.get("code").asInt();
+//            if (code == 0) {
+//                if (node.get("data") != null&&node.get("data").get("materials")!=null) {
+//                    String dataJson = node.get("data").get("materials").toString();
+//                    List<HotMaterial> list = mapper.readValue(dataJson,new TypeReference<List<HotMaterial>>() {});
+//                    if(list != null && list.size() > 0){
+//                        for (HotMaterial material : list){
+//                            material.setAppCode(appCode);
+//                            material.setAppName(appName);
+//                            material.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+material.getVid()+"&line=0"));
+//                            if(material.getVideoUrl() == null){
+//                                material.setVideoUrl(getVideoUrl(material.getVid()));
+//                            }
+////                            material.setVideoUrl(getVideoUrl(material.getVid()));
+//                            material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
+//                            if(material.getCoverImage() == null){
+//                                Thread.sleep(1000);
+//                                material.setCoverImage(getVideoFirstImage(material.getVideoUrl()));
+//                            }
+//                            hotMaterialService.saveOrUpdate(material);
+//                        }
+//                        hotMaterialHandler(page+1,appCode,appName);
+//                    }
+//                }
+//            }
+//        }catch (Exception e){
+//            e.printStackTrace();
+//        }
+//    }
+//
+//    public static String getVideoUrl(String vid) throws Exception {
+//        String url = "http://i.snssdk.com/video/urls/1/toutiao/mp4/"+vid;
+//        String result = HttpUtils2.httpGetRequest(url);
+//        ObjectMapper mapper = new ObjectMapper();
+//        if(result != null){
+//            JsonNode node = mapper.readTree(result);
+//            String mainUrl = node.get("data").get("video_list").get("video_1").get("main_url").asText();
+//            return Base64Utils.decode(mainUrl);
+//        }
+//        return null;
+//    }
+//    private void effectCaseHandler(int page){
+//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case_list?industry=0&style=0&mode=0&page="+page+"&limit=20");
+//        ObjectMapper mapper = new ObjectMapper();
+//        mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+//        try {
+//            JsonNode node = mapper.readTree(result);
+//            int code = node.get("code").asInt();
+//            if(code == 0) {
+//                if (node.get("data") != null) {
+//                    String dataJson = node.get("data").get("effect_cases").toString();
+//                    List<EffectCase> list = mapper.readValue(dataJson,new TypeReference<List<EffectCase>>() {});
+//                    if (list != null && list.size() > 0) {
+//                        for (EffectCase effectCase:list){
+//                            String resultDetail = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/case/effect_case/"+effectCase.getId());
+//                            JsonNode detailNode = mapper.readTree(resultDetail);
+//                            int detailCode = detailNode.get("code").asInt();
+//                            if(detailCode == 0){
+//                                if(detailNode.get("data") != null){
+////                                    String detailJson = node.get("data").get("effect_cases").toString();
+////                                    EffectCase effectCase1 = mapper.readValue(detailJson,EffectCase.class);
+//                                    effectCase.setAuthor(detailNode.get("data").get("effect_case").get("author").asText());
+//                                    effectCase.setCreateDate(detailNode.get("data").get("effect_case").get("create_date").asText());
+//                                    effectCase.setCreativeId(detailNode.get("data").get("effect_case").get("creative_id").asLong());
+//                                    effectCase.setCreativeScore(detailNode.get("data").get("effect_case").get("creative_score").asText());
+//                                    effectCase.setEffect(detailNode.get("data").get("effect_case").get("effect").toString());
+//                                    effectCase.setMethods(detailNode.get("data").get("effect_case").get("methods").toString());
+//                                    effectCase.setVideoUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+effectCase.getVid()+"&line=0"));
+//                                    if (effectCase.getVideoUrl() == null){
+//                                        effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
+//                                    }
+////                                    effectCase.setVideoUrl(getVideoUrl(effectCase.getVid()));
+//                                    effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
+//                                    if (effectCase.getCoverImage() == null){
+//                                        Thread.sleep(1000);
+//                                        effectCase.setCoverImage(getVideoFirstImage(effectCase.getVideoUrl()));
+//                                    }
+//                                    effectCase.setCreativeLabel(detailNode.get("data").get("effect_case").get("creative_label").toString());
+//                                }
+//                            }
+//                            effectCaseService.saveOrUpdate(effectCase);
+//                        }
+//                        effectCaseHandler(page+1);
+//                    }
+//                }
+//            }
+//        }catch (Exception e){
+//            e.printStackTrace();
+//        }
+//    }
+//
+//    private String getVideoFirstImage(String url){
+//        try {
+//            FFmpegFrameGrabber ff = new FFmpegFrameGrabber(url);
+//            ff.start();
+//            int lenght = ff.getLengthInFrames();
+//            int i = 0;
+//            Frame f = null;
+//            while (i < lenght) {
+//// 过滤前5帧,避免出现全黑的图片,依自己情况而定
+//                f = ff.grabFrame();
+//                if ((i > 5) && (f.image != null)) {
+//                    break;
+//                }
+//                i++;
+//            }
+////            opencv_core.IplImage img = f.image;
+//            int owidth = f.imageWidth;
+//            int oheight = f.imageHeight;
+//            Java2DFrameConverter converter =new Java2DFrameConverter();
+//            BufferedImage fecthedImage =converter.getBufferedImage(f);
+//// 对截取的帧进行等比例缩放
+//            int width = 800;
+//            int height = (int) (((double) width / owidth) * oheight);
+//            BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
+//            bi.getGraphics().drawImage(fecthedImage.getScaledInstance(width, height, Image.SCALE_SMOOTH),
+//                    0, 0, null);
+//            ByteArrayOutputStream baos = new ByteArrayOutputStream();//io流
+//            ImageIO.write(bi, "jpg", baos);
+//            byte[] bytes = baos.toByteArray();//转换成字节
+//            String png_base64 = Base64.getEncoder().encodeToString(bytes).trim();//转换成base64串
+//            png_base64 = png_base64.replaceAll("\n", "").replaceAll("\r", "");//删除 \r\n
+//            //        ImageIO.write(bufferedImage, "png", new File("D:/qrcode1.png"));
+//            baos.close();
+//            ff.close();
+//            return "data:image/jpg;base64,"+png_base64;
+//        }catch (Exception e){
+//            e.printStackTrace();
+//            return null;
+//        }
+//
+//    }
+//    private void douyinHotHandler(int page,int listType){
+//        String result = HttpUtils2.httpGetRequest("https://cc.oceanengine.com/creative_center_server/api/hot_video/user_side/list?page="+page+"&limit=20&list_type="+listType+"&aggr_duration_type=-1");
+//        ObjectMapper mapper = new ObjectMapper();
+//        try {
+//            JsonNode node = mapper.readTree(result);
+//            int code = node.get("code").asInt();
+//            if(code == 0){
+//                if(node.get("data")!= null){
+//                    String dataJson = node.get("data").get("items").toString();
+//                    List<DouyinHot> list = mapper.readValue(dataJson,new TypeReference<List<DouyinHot>>() {});
+//                    if (list != null && list.size() > 0){
+//                        for (DouyinHot douyinHot : list){
+//                            douyinHot.setUrl(getRealVideoUrl("https://aweme.snssdk.com/aweme/v1/playwm/?video_id="+douyinHot.getVideoId()+"&line=0"));
+//                            if(douyinHot.getUrl() == null){
+//                                douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
+//                            }
+////                            douyinHot.setUrl(getVideoUrl(douyinHot.getVideoId()));
+//                            douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
+//                            if(douyinHot.getCoverImage() == null){
+//                                Thread.sleep(1000);
+//                                douyinHot.setCoverImage(getVideoFirstImage(douyinHot.getUrl()));
+//                            }
+//                            douyinHotService.saveOrUpdate(douyinHot);
+//                        }
+//                        douyinHotHandler(page+1,listType);
+//                    }else {
+//                        if(listType < 4){
+//                            douyinHotHandler(1,listType+1);
+//                        }
+//                    }
+//                }
+//            }
+//        }catch (Exception e){
+//            e.printStackTrace();
+//        }
+//
+//    }
+//    @Override
+//    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+//        String account="3248395570@qq.com";
+//        String password = "Ydxq-704127411";
+//        login(account,password);
+//        douyinHotHandler(1,1);
+//        effectCaseHandler(1);
+//        hotMaterialHandler(1,1,"西瓜");
+//        hotMaterialHandler(1,3,"火山");
+//        hotMaterialHandler(1,4,"抖音");
+//        hotMaterialHandler(1,8,"头条");
+//        hotMaterialHandler(1,9,"穿山甲");
+//        log.info("巨量创意抓取完成");
+//    }
+//
+//    private void login(String account,String password){
+//        String url = "https://cc.oceanengine.com/login";
+//        System.getProperties().setProperty("webdriver.chrome.driver", chromeDriver);
+//        ChromeOptions chromeOptions = new ChromeOptions();
+//        chromeOptions.addArguments("--headless");
+//        chromeOptions.addArguments("--no-sandbox");
+//        chromeOptions.addArguments("--window-size=1920,1080");
+//        chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
+//        chromeOptions.setAcceptInsecureCerts(true);
+//        WebDriver webDriver = new ChromeDriver(chromeOptions);
+//        //清除所有的缓存
+//        webDriver.manage().deleteAllCookies();
+//        try {
+//            //获取登录页面
+//            webDriver.get(url);
+//            for (Cookie cookie : webDriver.manage().getCookies()) {
+//                BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
+//                ck.setDomain("oceanengine.com");
+//                ck.setExpiryDate(cookie.getExpiry());
+//                ck.setPath(cookie.getPath());
+//                HttpUtils2.cookieStore.addCookie(ck);
+//            }
+//            Map<String, String> header = new HashMap<>();
+//            header.put("Accept", "*/*");
+//            header.put("Connection", "keep-alive");
+//            header.put("Host", "sso.toutiao.com");
+//            header.put("Content-Type", "application/x-www-form-urlencoded");
+//            header.put("Origin", "https://cc.oceanengine.com");
+//            header.put("Referer", "https://cc.oceanengine.com/login");
+//            Map<String, Object> param = new HashMap<>();
+//            param.put("mobile", "");
+//            param.put("code", "");
+//            param.put("account", account);
+//            param.put("password", password);
+//            param.put("captcha", "hqde");
+//            param.put("is_30_days_no_login", "true");
+//            param.put("service", "https://cc.oceanengine.com");
+//            String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+//            ObjectMapper mapper = new ObjectMapper();
+//            mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+//            JsonNode jsonNode = mapper.readTree(res);
+//            //errorcode == 1102 验证码错误,请重新输入验证码
+//            //errorcode == 1101 验证码为空
+//
+//            Integer errorCode = jsonNode.get("error_code").asInt();
+//            String orderId = null;
+//            while (errorCode != 0) {
+//                //用户名或者密码错误
+//                if (null != errorCode && errorCode == 1009) {
+//                    return;
+//                }
+//                FateadmUtil fateadmUtil = new FateadmUtil();
+//                fateadmUtil.init();
+//                if (orderId != null) {
+//                    fateadmUtil.justice(orderId);
+//                }
+//                String captcha = jsonNode.get("captcha").asText();
+//                Base64.Decoder decoder = Base64.getDecoder();
+//                FateadmHttpUtil.HttpResp resp = fateadmUtil.Predict("30400", decoder.decode(captcha));
+//                param.put("captcha", resp.predResl);
+//                orderId = resp.reqId;
+//                res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
+//                jsonNode = mapper.readTree(res);
+//                errorCode = jsonNode.get("error_code").asInt();
+//            }
+//            if (errorCode == 0) {
+//                //表示登录成功
+//                List<org.apache.http.cookie.Cookie> cookies = HttpUtils2.cookieStore.getCookies();
+//                for (org.apache.http.cookie.Cookie ck : cookies) {
+//                    Cookie cookie = new Cookie(ck.getName(), ck.getValue(), "." + ck.getDomain(), ck.getPath(), ck.getExpiryDate());
+//                    webDriver.manage().addCookie(cookie);
+//                }
+//                String redirectUrl = jsonNode.get("redirect_url").asText();
+//                webDriver.get(redirectUrl);
+//                //登录成功 进入推广页面
+//                webDriver.get("https://cc.oceanengine.com/inspiration/douyin-rank-list");
+//                Thread.sleep(3000);
+//                for (Cookie cookie : webDriver.manage().getCookies()) {
+//                    BasicClientCookie ck = new BasicClientCookie(cookie.getName(), cookie.getValue());
+//                    ck.setDomain("cc.oceanengine.com");
+//                    ck.setExpiryDate(cookie.getExpiry());
+//                    ck.setPath(cookie.getPath());
+//                    HttpUtils2.cookieStore.addCookie(ck);
+//                }
+//
+//            }
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        } finally {
+//            //获得cookie
+//            Set<Cookie> coo = webDriver.manage().getCookies();
+//            //清除所有的缓存
+//            webDriver.manage().deleteAllCookies();
+//            webDriver.quit();
+//        }
+//    }
+//}

+ 4 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinAppMapper.java

@@ -2,6 +2,10 @@ package cn.com.ctop.crawler.modules.pangolin.mapper;
 
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface PangolinAppMapper extends BaseMapper<PangolinApp> {
+    List<PangolinApp> getListByUserId(@Param(value = "userId") String userId);
 }

+ 4 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinChannelMapper.java

@@ -2,6 +2,10 @@ package cn.com.ctop.crawler.modules.pangolin.mapper;
 
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinChannel;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 public interface PangolinChannelMapper extends BaseMapper<PangolinChannel> {
+    List<PangolinChannel> getListByUserId(@Param(value = "userId") String userId);
 }

+ 2 - 4
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportAppHourMapper.java

@@ -1,12 +1,10 @@
 package cn.com.ctop.crawler.modules.pangolin.mapper;
 
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinReportAppHour;
-import cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppHourVO;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
-import java.util.List;
-
 public interface PangolinReportAppHourMapper extends BaseMapper<PangolinReportAppHour> {
-    List<PangolinReportAppHourVO> getRealTimeData(@Param(value = "userId") String userId, @Param(value = "date") String date);
+    JSONObject getComparedDate(@Param(value = "appId") Integer appId,@Param(value = "hour") Integer hour, @Param(value = "userId")String userId, @Param(value = "type")String type, @Param(value = "today")String today, @Param(value = "yesterday")String yesterday, @Param(value = "sevenDaysAgo")String sevenDaysAgo, @Param(value = "compareTime1")String compareTime1, @Param(value = "compareTime2")String compareTime2);
 }

+ 2 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportBillMonthMapper.java

@@ -8,6 +8,6 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface PangolinReportBillMonthMapper extends BaseMapper<PangolinReportBillMonth> {
-    List<PangolinReportAppMonthVO> checkAppList(@Param(value = "userId") String userId, @Param(value = "startDate") String startDate,
-                                                @Param(value = "endDate") String endDate,@Param(value = "operateSystem") String operateSystem);
+    List<PangolinReportAppMonthVO> checkAppList(@Param(value = "appId") Integer appId, @Param(value = "userId") String userId, @Param(value = "startDate") String startDate,
+                                                @Param(value = "endDate") String endDate, @Param(value = "operateSystem") String operateSystem);
 }

+ 2 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/PangolinReportChannelDailyMapper.java

@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface PangolinReportChannelDailyMapper extends BaseMapper<PangolinReportChannelDaily> {
-    Integer sumAppList(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "userId") String userId, @Param(value = "type") String type);
+    Integer sumAppList(@Param(value = "appId") Integer appId,@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "userId") String userId, @Param(value = "type") String type);
 
-    List<PangolinReportChannelDaily> getActivationList(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "userId") String userId, @Param(value = "type") String type);
+    List<PangolinReportChannelDaily> getActivationList(@Param(value = "appId") Integer appId,@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "userId") String userId, @Param(value = "type") String type);
 }

+ 13 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinAppMapper.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.crawler.modules.pangolin.mapper.PangolinAppMapper">
+    <select id="getListByUserId" resultType="cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp">
+        select app.*
+            from ctop_pangolin_app app
+        left join ctop_bind_account_login login on login.account_name = app.account_name
+        where 1=1
+        <if test="userId!=null">
+            and login.user_id = #{userId}
+        </if>
+    </select>
+</mapper>

+ 13 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinChannelMapper.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.crawler.modules.pangolin.mapper.PangolinChannelMapper">
+    <select id="getListByUserId" resultType="cn.com.ctop.crawler.modules.pangolin.entity.PangolinChannel">
+        select channel.*
+from ctop_pangolin_channel channel
+         left join ctop_bind_account_login login on login.account_name = channel.account_name
+         where 1=1
+         <if test="userId!=null">
+             and login.user_id = #{userId}
+         </if>
+    </select>
+</mapper>

+ 79 - 26
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportAppHourMapper.xml

@@ -1,36 +1,89 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.crawler.modules.pangolin.mapper.PangolinReportAppHourMapper">
-    <select id="getRealTimeData" resultType="cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppHourVO">
-        select appHourActive.date as 'date',
-        appHourActive.hour as 'hour',
-        appHourActive.app_id as 'appId',
-        appHourActive.num as 'activeNum',
-        (select appHourRate.num
-        from ctop_pangolin_report_app_hour appHourRate
-        where appHourRate.date = appHourActive.date
-        and appHourRate.hour = appHourActive.hour
-        and appHourRate.type = 'rate') as 'activeRate',
-        (select appHourClick.num
-        from ctop_pangolin_report_app_hour appHourClick
-        where appHourClick.date = appHourActive.date
-        and appHourClick.hour = appHourActive.hour
-        and appHourClick.type = 'click') as 'clickNum'
-        from ctop_pangolin_report_app_hour appHourActive
-        left join ctop_pangolin_app app on app.id = appHourActive.app_id
-        left join ctop_bind_account_login login on login.account_name = app.account_name
-        where
-        1=1
+    <select id="getComparedDate" resultType="com.alibaba.fastjson.JSONObject">
+        select
+        <if test="compareTime1!=null">
+            sum(if(date = '${compareTime1}',num,0)) as '${compareTime1}',
+        </if>
+        <if test="compareTime2!=null">
+            sum(if(date = '${compareTime2}',num,0)) as '${compareTime2}',
+        </if>
+            sum(if(date = '${today}',num,0)) as 'today',
+            sum(if(date = '${yesterday}',num,0)) as 'yesterday',
+            sum(if(date = '${sevenDaysAgo}',num,0)) as 'sevendaysAgo',
+            hour
+       from (select num,date,hour
+from ctop_pangolin_report_app_hour appHourActive
+         left join ctop_pangolin_app app on app.id = appHourActive.app_id
+         left join ctop_bind_account_login login on login.account_name = app.account_name
+where appHourActive.type = #{type}
+and date =  #{today} and hour = #{hour}
+<if test="appId!=null">
+    and app.id = #{appId}
+</if>
+<if test="userId!=null">
+    and login.user_id = #{userId}
+</if>
+group by appHourActive.date, appHourActive.hour
+union all select num,date,hour
+from ctop_pangolin_report_app_hour appHourActive
+         left join ctop_pangolin_app app on app.id = appHourActive.app_id
+         left join ctop_bind_account_login login on login.account_name = app.account_name
+where appHourActive.type = #{type}
+        and date =  #{yesterday} and hour = #{hour}
+        <if test="appId!=null">
+            and app.id = #{appId}
+        </if>
         <if test="userId!=null">
             and login.user_id = #{userId}
         </if>
-        and appHourActive.date = #{date}
-        and appHourActive.type = 'active'
-        group by
+        group by appHourActive.date, appHourActive.hour
+union all select num,date,hour
+from ctop_pangolin_report_app_hour appHourActive
+         left join ctop_pangolin_app app on app.id = appHourActive.app_id
+         left join ctop_bind_account_login login on login.account_name = app.account_name
+where appHourActive.type = #{type}
+        and date =  #{sevenDaysAgo} and hour = #{hour}
+        <if test="appId!=null">
+            and app.id = #{appId}
+        </if>
         <if test="userId!=null">
-            login.user_id,
+            and login.user_id = #{userId}
+        </if>
+        group by appHourActive.date, appHourActive.hour
+<if test="compareTime1!=null">
+    union all
+    select num,date,hour
+    from ctop_pangolin_report_app_hour appHourActive
+    left join ctop_pangolin_app app on app.id = appHourActive.app_id
+    left join ctop_bind_account_login login on login.account_name = app.account_name
+    where appHourActive.type = #{type}
+    and date =  #{compareTime1} and hour = #{hour}
+    <if test="appId!=null">
+        and app.id = #{appId}
+    </if>
+    <if test="userId!=null">
+        and login.user_id = #{userId}
+    </if>
+    group by appHourActive.date, appHourActive.hour
+</if>
+        <if test="compareTime2!=null">
+            union all
+            select num,date,hour
+            from ctop_pangolin_report_app_hour appHourActive
+            left join ctop_pangolin_app app on app.id = appHourActive.app_id
+            left join ctop_bind_account_login login on login.account_name = app.account_name
+            where appHourActive.type = #{type}
+            and date =  #{compareTime2} and hour = #{hour}
+            <if test="appId!=null">
+                and app.id = #{appId}
+            </if>
+            <if test="userId!=null">
+                and login.user_id = #{userId}
+            </if>
+            group by appHourActive.date, appHourActive.hour
         </if>
-        appHourActive.date,appHourActive.hour
-        order by appHourActive.hour
+        )a group by hour
     </select>
 </mapper>

+ 9 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportBillMonthMapper.xml

@@ -4,7 +4,12 @@
     <select id="checkAppList" resultType="cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppMonthVO">
         select
        bill.date,
-       app.name as 'app_name',
+        <if test="appId == null">
+            '-' as 'app_name',
+        </if>
+        <if test="appId != null">
+            app.name as 'app_name',
+        </if>
        bill.os as 'operate_system',
        sum(bill.sum_internal_activations) as 'sum_internal_activations',
        sum(bill.estimated_total_price) as 'estimated_total_price',
@@ -17,6 +22,9 @@ from ctop_pangolin_report_bill_month bill
          <if test="userId!=null">
              and login.user_id = #{userId}
          </if>
+         <if test="appId!=null">
+             and app.id = #{appId}
+         </if>
         <if test="startDate!=null">
             and bill.date &gt;= #{startDate}
         </if>

+ 14 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/mapper/xml/PangolinReportChannelDailyMapper.xml

@@ -7,7 +7,12 @@
         select
             daily.date,
             channel.name as 'channel_name',
-            daily.app_name,
+            <if test="appId == null">
+                '-' as 'app_name',
+            </if>
+            <if test="appId != null">
+                daily.app_name,
+            </if>
             daily.oprate_system,
             sum(daily.external_activation) as 'external_activation',
             sum(daily.total_price)as 'total_price'
@@ -15,10 +20,14 @@
         ctop_pangolin_report_channel_daily daily
         left join ctop_pangolin_channel channel on channel.name = daily.channel_name
         left join ctop_bind_account_login login on login.account_name = channel.account_name
+        left join ctop_pangolin_app app on app.account_name = channel.account_name
         where 1=1
         <if test="userId!=null">
             and login.user_id = #{userId}
         </if>
+        <if test="appId!=null">
+            and app.id = #{appId}
+        </if>
         <if test="startDate!=null">
             and daily.date &gt;= #{startDate}
         </if>
@@ -37,10 +46,14 @@
         ctop_pangolin_report_channel_daily daily
         left join ctop_pangolin_channel channel on channel.name = daily.channel_name
         left join ctop_bind_account_login login on login.account_name = channel.account_name
+        left join ctop_pangolin_app app on app.account_name = channel.account_name
         where 1=1
         <if test="userId!=null">
             and login.user_id = #{userId}
         </if>
+        <if test="appId!=null">
+            and app.id = #{appId}
+        </if>
         <if test="startDate!=null">
             and daily.date &gt;= #{startDate}
         </if>

+ 3 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinAppService.java

@@ -3,5 +3,8 @@ package cn.com.ctop.crawler.modules.pangolin.service;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Map;
+
 public interface PangolinAppService extends IService<PangolinApp> {
+    Map<String, Object> getListByUserId(String userId);
 }

+ 3 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinChannelService.java

@@ -3,5 +3,8 @@ package cn.com.ctop.crawler.modules.pangolin.service;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinChannel;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.Map;
+
 public interface PangolinChannelService extends IService<PangolinChannel> {
+    Map<String, Object> getListByUserId(String userId);
 }

+ 17 - 2
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinAppServiceImpl.java

@@ -1,13 +1,28 @@
 package cn.com.ctop.crawler.modules.pangolin.service.impl;
 
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.mapper.PangolinAppMapper;
-import cn.com.ctop.crawler.modules.pangolin.mapper.PangolinChannelMapper;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class PangolinAppServiceImpl extends ServiceImpl<PangolinAppMapper, PangolinApp> implements PangolinAppService {
-
+    @Autowired
+    private PangolinAppMapper pangolinAppMapper;
+    @Override
+    public Map<String, Object> getListByUserId(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        List<PangolinApp>appList = pangolinAppMapper.getListByUserId(userId);
+        result.put("data",appList);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }

+ 17 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinChannelServiceImpl.java

@@ -1,11 +1,28 @@
 package cn.com.ctop.crawler.modules.pangolin.service.impl;
 
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinChannel;
 import cn.com.ctop.crawler.modules.pangolin.mapper.PangolinChannelMapper;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinChannelService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 @Service
 public class PangolinChannelServiceImpl extends ServiceImpl<PangolinChannelMapper, PangolinChannel> implements PangolinChannelService {
+    @Autowired
+    private PangolinChannelMapper pangolinChannelMapper;
+    @Override
+    public Map<String, Object> getListByUserId(String userId) {
+        Map<String,Object>result = new HashMap<>();
+        List<PangolinChannel>channelList = pangolinChannelMapper.getListByUserId(userId);
+        result.put("data",channelList);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
+        return result;
+    }
 }

+ 1 - 9
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java

@@ -79,15 +79,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                     pangolinReportBillMonth.setSumInternalActivations(sumInternalActivations);
                     pangolinReportBillMonth.setYear(Integer.parseInt(date.split("-")[0]));
                     pangolinReportBillMonth.setMonth(Integer.parseInt(date.split("-")[1]));
-                    String getDate = date.split("-")[0];
-                    if(Integer.parseInt(date.split("-")[1])<10){
-                        getDate+= "-0";
-                        getDate+= date.split("-")[1];
-                    }else{
-                        getDate+= "-";
-                        getDate+= date.split("-")[1];
-                    }
-                    pangolinReportBillMonth.setDate(getDate);
+                    pangolinReportBillMonth.setDate(date);
                     QueryWrapper<PangolinReportBillMonth> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("os", pangolinReportBillMonth.getOs());
                     queryWrapper.eq("app_id", pangolinReportBillMonth.getAppId());

+ 17 - 12
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportAppHourServiceImpl.java

@@ -5,13 +5,13 @@ import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.crawler.modules.pangolin.entity.PangolinReportAppHour;
 import cn.com.ctop.crawler.modules.pangolin.mapper.PangolinReportAppHourMapper;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinReportAppHourService;
-import cn.com.ctop.crawler.modules.pangolin.vo.PangolinReportAppHourVO;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -26,21 +26,26 @@ public class PangolinReportAppHourServiceImpl extends ServiceImpl<PangolinReport
 
         Map<String, Object> resultMap = new HashMap<>();
         String today = DateUtils.formatDate();
+        String yesterday = DateUtils.addDay(today,-1);
+        String sevenDaysAgo = DateUtils.addDay(today,-7);
         String type = data.getString("type");
-        //1:查询当天的数据
-        List<PangolinReportAppHourVO> todayList = this.getRealTimeData(userId, today);
-        resultMap.put("today", todayList);
-        //2:查询昨天的数据
-        List<PangolinReportAppHourVO> yestodyList = this.getRealTimeData(userId, DateUtils.addDay(today, -1));
-        resultMap.put("yesterday", yestodyList);
-        //3:查询七天前的数据
-        List<PangolinReportAppHourVO> lastSevenList = this.getRealTimeData(userId, DateUtils.addDay(today, -7));
-        resultMap.put("sevenDaysAgo", lastSevenList);
+        String compareTime1 = data.getString("compareTime1");
+        String compareTime2 = data.getString("compareTime2");
+        Integer appId = data.getInteger("appId");
+        if(null == appId||appId == 0){
+            appId = null;
+        }
+        List<JSONObject> dataList = new ArrayList<>();
+        for(int i=0;i<24;i++){
+            JSONObject getData = this.getComparedDate(appId,i,userId,type,today,yesterday,sevenDaysAgo,compareTime1,compareTime2);
+            dataList.add(getData);
+        }
+        resultMap.put("data",dataList);
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS);
         return resultMap;
     }
 
-    private List<PangolinReportAppHourVO> getRealTimeData(String userId, String date) {
-        return pangolinReportAppHourMapper.getRealTimeData(userId, date);
+    private JSONObject getComparedDate(Integer appId,Integer hour,String userId,String type,String today, String yesterday, String sevenDaysAgo, String compareTime1, String compareTime2) {
+        return pangolinReportAppHourMapper.getComparedDate(appId,hour,userId,type,today, yesterday,sevenDaysAgo,compareTime1,compareTime2);
     }
 }

+ 5 - 1
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportBillMonthServiceImpl.java

@@ -28,6 +28,10 @@ public class PangolinReportBillMonthServiceImpl extends ServiceImpl<PangolinRepo
         if(null == pageSize||pageSize == 0){
             pageSize = 10;
         }
+        Integer appId = data.getInteger("appId");
+        if(null == appId||appId == 0){
+            appId = null;
+        }
         String startDate = data.getString("startDate");
         String endDate = data.getString("endDate");
         String operateSystem = data.getString("operateSystem");
@@ -35,7 +39,7 @@ public class PangolinReportBillMonthServiceImpl extends ServiceImpl<PangolinRepo
             operateSystem = null;
         }
         PageHelper.startPage(pageNo,pageSize);
-        List<PangolinReportAppMonthVO> list = pangolinReportBillMonthMapper.checkAppList(userId,startDate,endDate,operateSystem);
+        List<PangolinReportAppMonthVO> list = pangolinReportBillMonthMapper.checkAppList(appId,userId,startDate,endDate,operateSystem);
         PageInfo<PangolinReportAppMonthVO> pageInfo = new PageInfo<>(list);
         return pageInfo;
     }

+ 7 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinReportChannelDailyServiceImpl.java

@@ -23,7 +23,7 @@ public class PangolinReportChannelDailyServiceImpl extends ServiceImpl<PangolinR
     private PangolinReportChannelDailyMapper pangolinReportChannelDailyMapper;
 
     @Override
-    public Map<String, Object> getActivationList(String userId, JSONObject data) {
+    public Map<String, Object>  getActivationList(String userId, JSONObject data) {
         Map<String, Object> result = new HashMap<>();
         Integer pageNo = data.getInteger("pageNo");
         if(null == pageNo||pageNo == 0){
@@ -37,13 +37,17 @@ public class PangolinReportChannelDailyServiceImpl extends ServiceImpl<PangolinR
         if(null!=operateSystem&&operateSystem.trim().equals("all")){
             operateSystem = null;
         }
+        Integer appId = data.getInteger("appId");
+        if(null == appId||appId == 0){
+            appId = null;
+        }
         String startDate = data.getString("startDate");
         String endDate = data.getString("endDate");
         PageHelper.startPage(pageNo,pageSize);
-        List<PangolinReportChannelDaily> dailyList = pangolinReportChannelDailyMapper.getActivationList(startDate, endDate, userId, operateSystem);
+        List<PangolinReportChannelDaily> dailyList = pangolinReportChannelDailyMapper.getActivationList(appId,startDate, endDate, userId, operateSystem);
         PageInfo<PangolinReportChannelDaily> pageInfo = new PageInfo<>(dailyList);
         result.put("data", pageInfo);
-        Integer totalActive = pangolinReportChannelDailyMapper.sumAppList(startDate,endDate,userId,operateSystem);
+        Integer totalActive = pangolinReportChannelDailyMapper.sumAppList(appId,startDate,endDate,userId,operateSystem);
         Long totalDays = 1L;
         if(!startDate.equals(endDate)){
             totalDays = DateUtils.getDiscrepantDays(startDate,endDate)+1;