Browse Source

修改穿山甲爬虫调用机制

syh 5 years ago
parent
commit
c042f204e7
14 changed files with 97 additions and 99 deletions
  1. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 7 9
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/PangolinController.java
  4. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  5. 2 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  6. 3 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  7. 1 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinDataJob.java
  8. 22 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  9. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  10. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/constant/CtopRoleCodeConstant.java
  11. 2 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/PangolinCrawlerService.java
  12. 13 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java
  13. 0 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java
  14. 32 62
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -78,7 +79,7 @@ public class AdvertiserController {
         try {
         try {
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             QueryWrapper<Advertiser> queryWrapper = new QueryWrapper<>();
             QueryWrapper<Advertiser> queryWrapper = new QueryWrapper<>();
-            if (!"admin".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
                 QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
                 QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
                 userCompanyQueryWrapper.eq("user_id", userId);
                 userCompanyQueryWrapper.eq("user_id", userId);
                 userCompanyQueryWrapper.orderByDesc("create_time");
                 userCompanyQueryWrapper.orderByDesc("create_time");
@@ -115,7 +116,7 @@ public class AdvertiserController {
         Result<IPage<Advertiser>> result = new Result<>();
         Result<IPage<Advertiser>> result = new Result<>();
         String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
         String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
         String userId = advertiser.getUserId();
         String userId = advertiser.getUserId();
-        if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
             advertiser.setUserId(null);
             advertiser.setUserId(null);
         }
         }
         String industryId = advertiser.getIndustryId();
         String industryId = advertiser.getIndustryId();

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
@@ -169,7 +170,7 @@ public class MaterialInfoController {
         materialInfo.setCreateTime(null);
         materialInfo.setCreateTime(null);
         if (!Check.isNull(materialInfo.getUserId())) {
         if (!Check.isNull(materialInfo.getUserId())) {
             String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
             String roleCode = materialInfoService.getRoleCodeByUserId(materialInfo.getUserId());
-            if ("admin".equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
+            if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
                 materialInfo.setUserId(null);
                 materialInfo.setUserId(null);
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
                 queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
             } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {

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

@@ -1,6 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
-import cn.com.ctop.common.module.service.IBindAccountLoginService;
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -34,15 +34,13 @@ public class PangolinController {
     private PangolinChannelService pangolinChannelService;
     private PangolinChannelService pangolinChannelService;
     @Autowired
     @Autowired
     private ISysRoleService sysRoleService;
     private ISysRoleService sysRoleService;
-    @Autowired
-    private IBindAccountLoginService bindAccountLoginService;
 
 
     @PostMapping("api/channel/list")
     @PostMapping("api/channel/list")
     public Map<String, Object> channelList(@RequestBody JSONObject data) {
     public Map<String, Object> channelList(@RequestBody JSONObject data) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
             userId = null;
         }
         }
         return pangolinChannelService.getListByUserId(userId);
         return pangolinChannelService.getListByUserId(userId);
@@ -53,7 +51,7 @@ public class PangolinController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
             userId = null;
         }
         }
         return pangolinAppService.getListByUserId(userId,data);
         return pangolinAppService.getListByUserId(userId,data);
@@ -67,7 +65,7 @@ public class PangolinController {
             LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
             String userId = user.getId();
             String userId = user.getId();
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if (null!=roleCode&&"admin".equals(roleCode)) {
+            if (null!=roleCode&&CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
                 userId = null;
                 userId = null;
             }
             }
             resultMap = pangolinAppService.getMemberList(userId);
             resultMap = pangolinAppService.getMemberList(userId);
@@ -87,7 +85,7 @@ public class PangolinController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
             userId = null;
         }
         }
         return pangolinReportAppHourService.getRealTimeData(userId,data);
         return pangolinReportAppHourService.getRealTimeData(userId,data);
@@ -101,7 +99,7 @@ public class PangolinController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
             userId = null;
         }
         }
         return pangolinReportChannelDailyService.getActivationList(userId, data);
         return pangolinReportChannelDailyService.getActivationList(userId, data);
@@ -116,7 +114,7 @@ public class PangolinController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = user.getId();
         String userId = user.getId();
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-        if(null!=roleCode&&(roleCode.equals("admin"))){
+        if(null!=roleCode&&(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN))){
             userId = null;
             userId = null;
         }
         }
         PageInfo<PangolinReportAppMonthVO> pageInfo = pangolinReportBillMonthService.checkAppList(userId, data);
         PageInfo<PangolinReportAppMonthVO> pageInfo = pangolinReportBillMonthService.checkAppList(userId, data);

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -100,7 +101,7 @@ public class ProjectController {
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         String roleCode = sysRoleService.getRoleCodeByUserId(userId);
         QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
         QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
         List<Project> projects = new ArrayList<>();
         List<Project> projects = new ArrayList<>();
-        if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
             if ("designTeamLeader".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "planeLeader".equals(roleCode)) {
             if ("designTeamLeader".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "planeLeader".equals(roleCode)) {
                 QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
                 QueryWrapper<ProjectMember> memberQueryWrapper = new QueryWrapper<>();
                 memberQueryWrapper.eq("user_id", userId);
                 memberQueryWrapper.eq("user_id", userId);
@@ -178,7 +179,7 @@ public class ProjectController {
         Page<Project> page = new Page<>(pageNo, pageSize);
         Page<Project> page = new Page<>(pageNo, pageSize);
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
         String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
-        if (!("admin".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode))) {
+        if (!(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode))) {
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.eq("user_id", sysUser.getId());
             queryWrapper.orderByDesc("create_time");
             queryWrapper.orderByDesc("create_time");
         }
         }

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
@@ -91,7 +92,7 @@ public class ProjectMemberController {
         try {
         try {
             QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
             QueryWrapper<ProjectMember> queryWrapper = new QueryWrapper<>();
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"sale".equals(roleCode) && !"saleDirector".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
                 queryWrapper.eq("user_id", userId);
             }
             }
             queryWrapper.groupBy("project_id");
             queryWrapper.groupBy("project_id");

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.controller;
 package org.jeecg.modules.ctop.controller;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
@@ -154,7 +155,7 @@ public class UserAllocationController {
             }*/
             }*/
 
 
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-            if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
                 queryWrapper.eq("user_id", userId);
             }
             }
             queryWrapper.orderByDesc("create_time");
             queryWrapper.orderByDesc("create_time");
@@ -223,7 +224,7 @@ public class UserAllocationController {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
         String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
-        if (!"admin".equals(roleCode)) {
+        if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.orderByDesc("id");
             queryWrapper.orderByDesc("id");
         }
         }

+ 1 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/PangolinDataJob.java

@@ -2,11 +2,8 @@ package org.jeecg.modules.ctop.job;
 
 
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
-import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
-import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.jeecg.common.util.DateUtils;
 import org.quartz.Job;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.quartz.JobExecutionException;
@@ -18,8 +15,6 @@ public class PangolinDataJob implements Job {
     @Autowired
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
     @Autowired
-    private PangolinAppService pangolinAppService;
-    @Autowired
     private PangolinCrawlerService pangolinCrawlerService;
     private PangolinCrawlerService pangolinCrawlerService;
 
 
     @Override
     @Override
@@ -31,15 +26,7 @@ public class PangolinDataJob implements Job {
         List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
         List<BindAccountLogin> list = bindAccountLoginService.list(queryWrapper);
         if (list != null && !list.isEmpty()) {
         if (list != null && !list.isEmpty()) {
             for (BindAccountLogin bindAccountLogin : list) {
             for (BindAccountLogin bindAccountLogin : list) {
-                pangolinCrawlerService.getChannelList(bindAccountLogin);
-                pangolinCrawlerService.getActivationList(bindAccountLogin, DateUtils.getNowDate("yyyy-MM-dd"), 1);
-                pangolinCrawlerService.getCheckList(bindAccountLogin);
-                QueryWrapper<PangolinApp> queryWrapper1 = new QueryWrapper<>();
-                queryWrapper1.eq("account_name", bindAccountLogin.getAccountName());
-                List<PangolinApp> appList = pangolinAppService.list(queryWrapper1);
-                if (appList != null && !appList.isEmpty()) {
-                    appList.forEach(pangolinApp -> pangolinCrawlerService.getRealTimeList(bindAccountLogin, pangolinApp.getId()));
-                }
+                pangolinCrawlerService.getNowData(bindAccountLogin);
             }
             }
         }
         }
     }
     }

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

@@ -5,6 +5,8 @@ import cn.com.ctop.common.module.mapper.BindAccountLoginMapper;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
 import cn.com.ctop.crawler.modules.core.util.FateadmHttpUtil;
 import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
 import cn.com.ctop.crawler.modules.core.util.FateadmUtil;
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
+import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -33,6 +35,10 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
     private String chromeDriver;
     private String chromeDriver;
     @Autowired
     @Autowired
     private BindAccountLoginMapper bindAccountLoginMapper;
     private BindAccountLoginMapper bindAccountLoginMapper;
+    @Autowired
+    private PangolinLoginService pangolinLoginService;
+    @Autowired
+    private PangolinCrawlerService pangolinCrawlerService;
 
 
     @Override
     @Override
     public Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
     public Map<String, Object> bindLogin(Long projectId,String advertiserId, String accountName, String password, String loginType, String userId, String advertiserName) {
@@ -49,7 +55,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         if (null != loginType && loginType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_PY)) {
         if (null != loginType && loginType.equals(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_PY)) {
             Map<String, Object> result = this.checkAccountPassword(accountName, password);
             Map<String, Object> result = this.checkAccountPassword(accountName, password);
             Boolean checkSuccess = (Boolean) result.get("success");
             Boolean checkSuccess = (Boolean) result.get("success");
-            if (!checkSuccess) {
+            if (Boolean.FALSE.equals(checkSuccess)) {
                 returnMap.put("success", false);
                 returnMap.put("success", false);
                 returnMap.put("message", "账号验证失败");
                 returnMap.put("message", "账号验证失败");
                 return returnMap;
                 return returnMap;
@@ -67,6 +73,20 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         int i = bindAccountLoginMapper.insert(bindAccountLogin);
         int i = bindAccountLoginMapper.insert(bindAccountLogin);
         if (i > 0) {
         if (i > 0) {
             log.info("登录账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
             log.info("登录账号绑定成功,广告主id:{}", bindAccountLogin.getAdvertiserId());
+            if(null!=loginType&&loginType.equals(CtopAdConstant.PLATFORM_TYPE_PANGOLIN_PY)){
+                //穿山甲账户绑定
+                Thread thread = new Thread(){
+                    @Override
+                    public void run() {
+                        //1:登录
+                        pangolinLoginService.pangolinLogin(bindAccountLogin.getAccountName(), bindAccountLogin.getPassword());
+                        //2:拉取数据
+                        pangolinCrawlerService.getNowData(bindAccountLogin);
+                    }
+                };
+                thread.start();
+            }
+
             returnMap.put("success", true);
             returnMap.put("success", true);
             returnMap.put("accountUd", password);
             returnMap.put("accountUd", password);
         }
         }
@@ -164,7 +184,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 }
                 }
             }
             }
         } catch (Exception e) {
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error(e.getMessage(),e);
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SERVER_ERROR.getCode());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SERVER_ERROR.getCode());
         } finally {
         } finally {
             //清除所有的缓存
             //清除所有的缓存

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.service.impl;
 package org.jeecg.modules.ctop.service.impl;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -13,7 +14,6 @@ import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -78,7 +78,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
             projectMemberList = memberMapper.designProjects(userId, mediaIds);
         }else if( roleCode.equals("designTeamLeader")){
         }else if( roleCode.equals("designTeamLeader")){
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaIds);
             projectMemberList = memberMapper.designLeaderProjects(companyId, mediaIds);
-        }else if(roleCode.equals("admin")){
+        }else if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             projectMemberList = memberMapper.adminProjects(mediaIds);
             projectMemberList = memberMapper.adminProjects(mediaIds);
         }else if(roleCode.equals("operator") || roleCode.equals("operationAssistant") || roleCode.equals("touTiaoOperationManager")){
         }else if(roleCode.equals("operator") || roleCode.equals("operationAssistant") || roleCode.equals("touTiaoOperationManager")){
             projectMemberList = memberMapper.operationProjects(userId, mediaIds);
             projectMemberList = memberMapper.operationProjects(userId, mediaIds);

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/constant/CtopRoleCodeConstant.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.common.module.constant;
+
+public class CtopRoleCodeConstant {
+    public static final String COMMON_ROLE_CODE_ADMIN = "admin";
+}

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

@@ -10,4 +10,6 @@ public interface PangolinCrawlerService {
     void getActivationList(BindAccountLogin bindAccountLogin, String date, int page);
     void getActivationList(BindAccountLogin bindAccountLogin, String date, int page);
 
 
     void getRealTimeList(BindAccountLogin bindAccountLogin, Long appId);
     void getRealTimeList(BindAccountLogin bindAccountLogin, Long appId);
+
+    void getNowData(BindAccountLogin bindAccountLogin);
 }
 }

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

@@ -341,4 +341,17 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
             e.printStackTrace();
             e.printStackTrace();
         }
         }
     }
     }
+
+    @Override
+    public void getNowData(BindAccountLogin bindAccountLogin) {
+        getChannelList(bindAccountLogin);
+        getActivationList(bindAccountLogin, DateUtils.getNowDate("yyyy-MM-dd"), 1);
+        getCheckList(bindAccountLogin);
+        QueryWrapper<PangolinApp> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("account_name", bindAccountLogin.getAccountName());
+        List<PangolinApp> appList = pangolinAppService.list(queryWrapper1);
+        if (appList != null && !appList.isEmpty()) {
+            appList.forEach(pangolinApp -> getRealTimeList(bindAccountLogin, pangolinApp.getId()));
+        }
+    }
 }
 }

+ 0 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/ByteDanceVideoReportDailyMapper.java

@@ -43,8 +43,6 @@ public interface ByteDanceVideoReportDailyMapper extends BaseMapper<ByteDanceVid
 
 
     List<ByteDanceVideoReportDaily> videoInfoListDetailOperator(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);
     List<ByteDanceVideoReportDaily> videoInfoListDetailOperator(@Param("companyId") String companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("signature") String signature, @Param("accountIds") List<Long> accountIds);
 
 
-    //List<ByteDanceVideoReportDaily> bytedanceVideoInfoList(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("role") String role, @Param("userId") String userId, @Param("signature") String signature, @Param("companyId") String companyId, @Param("cost") BigDecimal cost);
-
     List<AccountVideoDTO> accountVideoMap();
     List<AccountVideoDTO> accountVideoMap();
 
 
     void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList")List<AccountVideoDTO> accountVideoDTOList);
     void replaceIntoAccountVideoMapBatch(@Param("accountVideoDTOList")List<AccountVideoDTO> accountVideoDTOList);

+ 32 - 62
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceVideoReportDailyServiceImpl.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.modules.report.service.impl;
 package cn.com.ctop.toutiao.modules.report.service.impl;
 
 
+import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
 import cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO;
 import cn.com.ctop.toutiao.modules.report.DTO.AccountVideoDTO;
 import cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily;
 import cn.com.ctop.toutiao.modules.report.entity.ByteDanceVideoReportDaily;
 import cn.com.ctop.toutiao.modules.report.mapper.ByteDanceVideoReportDailyMapper;
 import cn.com.ctop.toutiao.modules.report.mapper.ByteDanceVideoReportDailyMapper;
@@ -17,11 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
-import java.util.logging.Logger;
 
 
 /**
 /**
  * 视频按时间段统计
  * 视频按时间段统计
@@ -36,6 +35,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
     @Autowired
     @Autowired
     private ByteDanceVideoReportDailyMapper byteDanceVideoReportDailyMapper;
     private ByteDanceVideoReportDailyMapper byteDanceVideoReportDailyMapper;
 
 
+    @Override
     public void videoInfoList(String startDate, String endDate){
     public void videoInfoList(String startDate, String endDate){
         //华南
         //华南
         videoInfoListByCompanyId(startDate, endDate, "6608ed13c0dd42de93c790dbdf124234");
         videoInfoListByCompanyId(startDate, endDate, "6608ed13c0dd42de93c790dbdf124234");
@@ -59,6 +59,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
     }
     }
 
 
     //根据accountId和时间清洗头条素材为头条视频报表数据
     //根据accountId和时间清洗头条素材为头条视频报表数据
+    @Override
     public void videoInfoListByAccountId(String startDate, String endDate, Long accountId){
     public void videoInfoListByAccountId(String startDate, String endDate, Long accountId){
         QueryWrapper<ByteDanceVideoReportDaily> wrapper = new QueryWrapper<>();
         QueryWrapper<ByteDanceVideoReportDaily> wrapper = new QueryWrapper<>();
         wrapper.ge("stat_datetime",startDate);
         wrapper.ge("stat_datetime",startDate);
@@ -76,6 +77,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
     }
     }
 
 
     //视频按天列表
     //视频按天列表
+    @Override
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListDaily(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
@@ -94,11 +96,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             PageHelper.startPage(pageNo,pageSize,sort);
             PageHelper.startPage(pageNo,pageSize,sort);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 PageHelper.startPage(pageNo,pageSize,sort);
                 PageHelper.startPage(pageNo,pageSize,sort);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
             }else{
             }else{
@@ -139,12 +141,12 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             m.setHuanbi(huanbi);
             m.setHuanbi(huanbi);
         }
         }
 
 
-        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
-        return pageInfo;
+        return new PageInfo<>(mList);
     }
     }
 
 
 
 
     //视频报表月列表
     //视频报表月列表
+    @Override
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListMonth(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
@@ -163,11 +165,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             PageHelper.startPage(pageNo,pageSize,sort);
             PageHelper.startPage(pageNo,pageSize,sort);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 PageHelper.startPage(pageNo,pageSize,sort);
                 PageHelper.startPage(pageNo,pageSize,sort);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
             }else{
             }else{
@@ -204,16 +206,15 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
             if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
                 huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
                 huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
             }
             }
-
             m.setHuanbi(huanbi);
             m.setHuanbi(huanbi);
         }
         }
 
 
-        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
-        return pageInfo;
+        return new PageInfo<>(mList);
     }
     }
 
 
 
 
     //视频总报表列表
     //视频总报表列表
+    @Override
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost , Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListTotal(String startDate, String endDate, String signature, BigDecimal cost , Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
@@ -232,11 +233,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             PageHelper.startPage(pageNo,pageSize,sort);
             PageHelper.startPage(pageNo,pageSize,sort);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 PageHelper.startPage(pageNo,pageSize,sort);
                 PageHelper.startPage(pageNo,pageSize,sort);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
             }else{
             }else{
@@ -276,30 +277,16 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
 
 
             m.setHuanbi(huanbi);
             m.setHuanbi(huanbi);
         }
         }
-
-        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
-        return pageInfo;
+        return new PageInfo<>(mList);
     }
     }
 
 
     //视频总报表列表导出excel
     //视频总报表列表导出excel
+    @Override
     public List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost , Long[] accountIds, String sort){
     public List<ByteDanceVideoReportDaily> videoInfoListTotalExcel(String startDate, String endDate, String signature, BigDecimal cost , Long[] accountIds, String sort){
-        //LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        //String userId = sysUser.getId();
-        //String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
-        //String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
-        //
-        //List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListWeek(startDate, endDate, roleCode, userId, signature, companyId, cost);
-
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
-
-        if(StringUtils.isBlank(sort)){
-            sort = "cost-";
-        }
-        sort = sort.replace("-", " desc,").replace("+", " asc,");  //sort=id-name+age+
-        sort = sort.substring(0, sort.length() - 1);
         List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
         List<ByteDanceVideoReportDaily> mList = new ArrayList<>();
 
 
         List<Long> accountIdsList = null;
         List<Long> accountIdsList = null;
@@ -307,10 +294,10 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
             }else{
             }else{
                 List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
                 List<Long> accoutnIds= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
@@ -327,26 +314,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         }else if(roleCode.equals("designTeamLeader")){
         }else if(roleCode.equals("designTeamLeader")){
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupdesignTeamLeader(startDate, endDate, companyId, accountIdsList, signature, cost);
         }
         }
-
-        //计算环比
-        //for(ByteDanceVideoReportDaily m:mList){
-        //    Integer datediff = DateUtils.dateDiff(startDate, endDate);
-        //    String startMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-(datediff + 1) ) );
-        //    String endMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-1));
-        //
-        //    BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(startMonthDate,endMonthDate,m.getSignature(),accountIdsList);
-        //
-        //    BigDecimal huanbi =BigDecimal.ZERO;
-        //    if(costBefore != null && costBefore.compareTo(BigDecimal.ZERO)>0){
-        //        huanbi = m.getCost().subtract(costBefore).divide(costBefore,7, BigDecimal.ROUND_HALF_UP);
-        //    }
-        //
-        //    m.setHuanbi(huanbi);
-        //}
         return mList;
         return mList;
     }
     }
 
 
     //视频报表周列表
     //视频报表周列表
+    @Override
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
     public PageInfo<ByteDanceVideoReportDaily> videoInfoListWeek(String startDate, String endDate, String signature, BigDecimal cost, Integer pageNo, Integer pageSize, Long[] projectIds, Long[] accountIds, String sort){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
@@ -365,11 +337,11 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             PageHelper.startPage(pageNo,pageSize,sort);
             PageHelper.startPage(pageNo,pageSize,sort);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
             mList = byteDanceVideoReportDailyMapper.videoInfoListGroupAdmin(startDate, endDate, accountIdsList, signature, cost);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 PageHelper.startPage(pageNo,pageSize,sort);
                 PageHelper.startPage(pageNo,pageSize,sort);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListGroupOperator(startDate,endDate,accountIdsList,signature,cost);
             }else{
             }else{
@@ -410,18 +382,16 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             m.setHuanbi(huanbi);
             m.setHuanbi(huanbi);
         }
         }
 
 
-        PageInfo<ByteDanceVideoReportDaily> pageInfo = new PageInfo<>(mList);
-
-        return pageInfo;
+        return new PageInfo<>(mList);
     }
     }
 
 
+    @Override
     public List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds){
     public List<ByteDanceVideoReportDaily> videoInfoListDetail(String startDate, String endDate, String signature, Long[] accountIds){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
         String companyId = byteDanceVideoReportDailyMapper.getCompanyIdByUserId(userId);
 
 
-        //List<ByteDanceVideoReportDaily> mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, roleCode);
         List<ByteDanceVideoReportDaily> mList =new ArrayList<>();
         List<ByteDanceVideoReportDaily> mList =new ArrayList<>();
 
 
         List<Long> accountIdsList = null;
         List<Long> accountIdsList = null;
@@ -429,10 +399,10 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
             accountIdsList = Arrays.asList(accountIds);
             accountIdsList = Arrays.asList(accountIds);
         }
         }
         //admin能看所有视频
         //admin能看所有视频
-        if(roleCode.equals("admin")){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)){
             mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, accountIdsList);
             mList = byteDanceVideoReportDailyMapper.videoInfoListDetail(companyId, startDate, endDate, signature, accountIdsList);
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
         }else if(roleCode.equals("touTiaoOperationManager") || roleCode.equals("operator") || roleCode.equals("operationAssistant")) {
-            if (accountIdsList != null && accountIdsList.size() != 0){
+            if (accountIdsList != null && !accountIdsList.isEmpty()){
                 mList = byteDanceVideoReportDailyMapper.videoInfoListDetailOperator(companyId, startDate,endDate,signature, accountIdsList);
                 mList = byteDanceVideoReportDailyMapper.videoInfoListDetailOperator(companyId, startDate,endDate,signature, accountIdsList);
             }else{
             }else{
                 accountIdsList= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
                 accountIdsList= byteDanceVideoReportDailyMapper.getAccountIdsByOperatorIdAndMediaId(1,userId);
@@ -457,11 +427,7 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
 
 
         //计算环比
         //计算环比
         for(ByteDanceVideoReportDaily m:mList){
         for(ByteDanceVideoReportDaily m:mList){
-            //Integer datediff = DateUtils.dateDiff(startDate, endDate);
-            //String startMonthDate = DateUtils.formatDate(DateUtils.addDay(startDate,-(datediff + 1) ) );
             String beforeDate = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
             String beforeDate = DateUtils.formatDate(DateUtils.addDay(m.getStatDatetime(),-1));
-            //List<Long> accountIdsList = new ArrayList<>();
-            //accountIdsList.add(m.getAccountId());
             BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(beforeDate,beforeDate,m.getSignature(),accountIdsList);
             BigDecimal costBefore = byteDanceVideoReportDailyMapper.getVideoReportDailyByDateAndSignature(beforeDate,beforeDate,m.getSignature(),accountIdsList);
 
 
             BigDecimal huanbi =BigDecimal.ZERO;
             BigDecimal huanbi =BigDecimal.ZERO;
@@ -475,12 +441,14 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         return mList;
         return mList;
     }
     }
 
 
+    @Override
     public String getColumnJson(Integer columnType){
     public String getColumnJson(Integer columnType){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
         return byteDanceVideoReportDailyMapper.getJsonByUserIdAndColumnType(columnType, userId);
         return byteDanceVideoReportDailyMapper.getJsonByUserIdAndColumnType(columnType, userId);
     }
     }
 
 
+    @Override
     public void saveOrUpdateColumnJson(Integer columnType, String json){
     public void saveOrUpdateColumnJson(Integer columnType, String json){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
@@ -493,21 +461,23 @@ public class ByteDanceVideoReportDailyServiceImpl extends ServiceImpl<ByteDanceV
         }
         }
     }
     }
 
 
+    @Override
     public int videoInfoListTotalExportExcelPermission(){
     public int videoInfoListTotalExportExcelPermission(){
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         String userId = sysUser.getId();
         String userId = sysUser.getId();
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
         String roleCode = byteDanceVideoReportDailyMapper.getRoleCodeByUserId(userId);
 
 
-        if(roleCode.equals("admin")  || roleCode.equals("designTeamLeader") ){
+        if(roleCode.equals(CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN)  || roleCode.equals("designTeamLeader") ){
             return 1;
             return 1;
         }else{
         }else{
             return 0;
             return 0;
         }
         }
     }
     }
 
 
+    @Override
     public void accountVideoMap(){
     public void accountVideoMap(){
-        List<AccountVideoDTO> accountVideoDTOList = byteDanceVideoReportDailyMapper.accountVideoMap();
-        byteDanceVideoReportDailyMapper.replaceIntoAccountVideoMapBatch(accountVideoDTOList);
+        List<AccountVideoDTO> accountVideos = byteDanceVideoReportDailyMapper.accountVideoMap();
+        byteDanceVideoReportDailyMapper.replaceIntoAccountVideoMapBatch(accountVideos);
     }
     }
 
 
 }
 }