Преглед на файлове

修改预警调度任务代码

syh преди 5 години
родител
ревизия
d5ccdd3e50
променени са 38 файла, в които са добавени 805 реда и са изтрити 107 реда
  1. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 58 62
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectController.java
  4. 2 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ProjectMemberController.java
  5. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TransferAccountController.java
  6. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  7. 81 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaishouMatcostAccountMay.java
  8. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  9. 17 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaishouMatcostAccountMayMapper.java
  10. 0 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MediaReportMapper.java
  11. 33 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaishouMatcostAccountMayMapper.xml
  12. 0 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MediaReportMapper.xml
  13. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICpaBidWarningService.java
  14. 18 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IKuaishouMatcostAccountMayService.java
  15. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java
  16. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BidWarningServiceImpl.java
  17. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java
  18. 43 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaishouMatcostAccountMayServiceImpl.java
  19. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  20. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/service/impl/WpsFileServiceImpl.java
  21. 32 9
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  22. 30 0
      module-common/src/main/java/cn/com/ctop/common/module/annotation/AutoLog.java
  23. 42 0
      module-common/src/main/java/cn/com/ctop/common/module/annotation/Dict.java
  24. 25 0
      module-common/src/main/java/cn/com/ctop/common/module/annotation/PermissionData.java
  25. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  26. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMapper.java
  27. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMapper.xml
  28. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectService.java
  29. 4 4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectServiceImpl.java
  30. 1 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/entity/PangolinReportAppHour.java
  31. 1 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/entity/PangolinReportChannelDaily.java
  32. 9 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/service/impl/PangolinCrawlerServiceImpl.java
  33. 22 0
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAccountBidJob.java
  34. 23 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountBidJob.java
  35. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IKuaishouBidWarningService.java
  36. 161 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/KuaishouBidWarningServiceImpl.java
  37. 5 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceBidWarningService.java
  38. 165 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceBidWarningServiceImpl.java

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

@@ -1,7 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.ProjectMapper;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.*;
@@ -20,11 +23,8 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.entity.Advertiser;
-import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.vo.SheetInfoVo;
 import org.jeecg.modules.excelutil.entity.KuaishouXxlEntity;
 import org.jeecg.modules.system.entity.SysCategory;

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

@@ -25,10 +25,8 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -342,77 +340,75 @@ public class MaterialInfoController {
         Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfoEntity = materialInfoService.getById(materialInfo.getId());
         if (materialInfoEntity == null) {
-            result.error500("未找到对应实体");
-        } else {
-            String url = materialInfo.getUrl();
-            if (!Check.isNull(url)) {
-                if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
-                    url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
-                }
-                materialInfo.setUrl(url);
+            return result.error500("未找到对应实体");
+        }
+        String url = materialInfo.getUrl();
+        if (!Check.isNull(url)) {
+            if (!url.contains(KuaishouInterfaceConstant.HTTPS_PREFIX)) {
+                url = KuaishouInterfaceConstant.HTTPS_PREFIX + url;
             }
+            materialInfo.setUrl(url);
+        }
 
-            //  修改素材库 相关联code
-            if (!Check.isNull(materialInfo.getCode())) {
-                String code = materialInfoEntity.getCode();
-                if (!Check.isNull(code)) {
-                    MaterialTag updateMaterialTag = new MaterialTag();
-                    updateMaterialTag.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
-                    tagQueryWrapper.eq("material_id", code);
-                    materialTagService.update(updateMaterialTag, tagQueryWrapper);
-                    MaterialParameter updateParameter = new MaterialParameter();
-                    updateParameter.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                    parameterQueryWrapper.eq("material_id", code);
-                    materialParameterService.update(updateParameter, parameterQueryWrapper);
-                    MaterialAscription updateMaterialAscription = new MaterialAscription();
-                    updateMaterialAscription.setMaterialId(materialInfo.getCode());
-                    QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
-                    ascriptionQueryWrapper.eq("material_id", code);
-                    materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
-                }
+        //  修改素材库 相关联code
+        if (!Check.isNull(materialInfo.getCode())) {
+            String code = materialInfoEntity.getCode();
+            if (!Check.isNull(code)) {
+                MaterialTag updateMaterialTag = new MaterialTag();
+                updateMaterialTag.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialTag> tagQueryWrapper = new QueryWrapper<>();
+                tagQueryWrapper.eq("material_id", code);
+                materialTagService.update(updateMaterialTag, tagQueryWrapper);
+                MaterialParameter updateParameter = new MaterialParameter();
+                updateParameter.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", code);
+                materialParameterService.update(updateParameter, parameterQueryWrapper);
+                MaterialAscription updateMaterialAscription = new MaterialAscription();
+                updateMaterialAscription.setMaterialId(materialInfo.getCode());
+                QueryWrapper<MaterialAscription> ascriptionQueryWrapper = new QueryWrapper<>();
+                ascriptionQueryWrapper.eq("material_id", code);
+                materialAscriptionService.update(updateMaterialAscription, ascriptionQueryWrapper);
             }
+        }
 
-            //  审核通过自动同步到到媒体后台
-           /* Long projectId = materialInfoEntity.getProjectId();
-            Project project = projectService.getById(projectId);
-            if (!Check.isNull(projectId)) {
-                if ("2".equals(project.getMediaId())) {
-                    if (!Check.isNull(materialInfo.getStatus())) {
-                        Integer status = materialInfo.getStatus();
-                        if (status == 1) {
-                            Thread thread = new Thread() {
-                                @Override
-                                public void run() {
-                                    log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
-                                    uploadService.upload(materialInfoEntity);
-                                }
-                            };
-                            thread.start();
-                        }
+        //  审核通过自动同步到到媒体后台
+       /* Long projectId = materialInfoEntity.getProjectId();
+        Project project = projectService.getById(projectId);
+        if (!Check.isNull(projectId)) {
+            if ("2".equals(project.getMediaId())) {
+                if (!Check.isNull(materialInfo.getStatus())) {
+                    Integer status = materialInfo.getStatus();
+                    if (status == 1) {
+                        Thread thread = new Thread() {
+                            @Override
+                            public void run() {
+                                log.info("开始自动同步素材,code:{}", materialInfoEntity.getCode());
+                                uploadService.upload(materialInfoEntity);
+                            }
+                        };
+                        thread.start();
                     }
                 }
-
-            }*/
-
-            boolean ok = materialInfoService.updateById(materialInfo);
-            if (ok) {
-                result.success("修改成功!");
             }
 
-            Integer status = materialInfo.getStatus();
-            // 如果状态为2 审核拒绝 给上传人发送消息
-            if (status == 2) {
-                Project project = projectService.getById(materialInfoEntity.getProjectId());
-                String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-                sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+        }*/
 
-                String feishuText = messageTemplate.getFeishuMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
-                sendMessageService.sendFeishuMessage(materialInfoEntity.getUserId(), feishuText);
-            }
+        boolean ok = materialInfoService.updateById(materialInfo);
+        if (ok) {
+            result.success("修改成功!");
         }
 
+        Integer status = materialInfo.getStatus();
+        // 如果状态为2 审核拒绝 给上传人发送消息
+        if (status == 2) {
+            Project project = projectService.getById(materialInfoEntity.getProjectId());
+            String text = messageTemplate.getMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            sendMessageService.sendMessage(materialInfoEntity.getUserId(), text);
+
+            String feishuText = messageTemplate.getFeishuMaterialRejectTemplate(project.getProjectName(), materialInfoEntity.getMaterialName(), materialInfo.getRefuseReason());
+            sendMessageService.sendFeishuMessage(materialInfoEntity.getUserId(), feishuText);
+        }
         return result;
 
     }

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

@@ -1,7 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.ProjectMapper;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
@@ -17,14 +20,11 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.Advertiser;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.entity.TransferAccount;
-import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IAdvertiserService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
 import org.jeecg.modules.system.entity.SysCategory;
 import org.jeecg.modules.system.entity.SysUser;

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

@@ -1,8 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -16,15 +17,12 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.Cacheable;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;

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

@@ -1,8 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.IMailLogService;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
@@ -13,11 +15,9 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.entity.TransferAccount;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.ctop.service.ITransferAccountService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;

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

@@ -1,8 +1,10 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
@@ -18,11 +20,9 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 

+ 81 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaishouMatcostAccountMay.java

@@ -0,0 +1,81 @@
+package org.jeecg.modules.ctop.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import java.math.BigDecimal;
+
+@TableName("kuaishou_matcost_account_jun_12_18")
+public class KuaishouMatcostAccountMay {
+    private BigDecimal cost;
+    private Long accountId;
+    private String videoCode;
+    private String channelType;
+    private String url;
+    private String userName;
+    private String minDate;
+    private String endDate;
+
+    public BigDecimal getCost() {
+        return cost;
+    }
+
+    public void setCost(BigDecimal cost) {
+        this.cost = cost;
+    }
+
+    public Long getAccountId() {
+        return accountId;
+    }
+
+    public void setAccountId(Long accountId) {
+        this.accountId = accountId;
+    }
+
+    public String getVideoCode() {
+        return videoCode;
+    }
+
+    public void setVideoCode(String videoCode) {
+        this.videoCode = videoCode;
+    }
+
+    public String getChannelType() {
+        return channelType;
+    }
+
+    public void setChannelType(String channelType) {
+        this.channelType = channelType;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getMinDate() {
+        return minDate;
+    }
+
+    public void setMinDate(String minDate) {
+        this.minDate = minDate;
+    }
+
+    public String getEndDate() {
+        return endDate;
+    }
+
+    public void setEndDate(String endDate) {
+        this.endDate = endDate;
+    }
+}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java

@@ -1,11 +1,11 @@
 package org.jeecg.modules.ctop.job;
 
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.service.ICpaBidWarningService;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;

+ 17 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaishouMatcostAccountMayMapper.java

@@ -0,0 +1,17 @@
+package org.jeecg.modules.ctop.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.jeecg.modules.ctop.entity.KuaishouMatcostAccountMay;
+
+import java.math.BigDecimal;
+
+public interface KuaishouMatcostAccountMayMapper extends BaseMapper<KuaishouMatcostAccountMay> {
+    String getMinDateByCode(@Param(value = "code") String code);
+
+    void updateByCode(@Param(value = "code")String code, @Param(value = "minDate")String minDate);
+
+    void updateCostByCode(@Param(value = "code")String code, @Param(value = "cost")BigDecimal cost);
+
+    BigDecimal getCostByParams(@Param(value = "code")String videoCode, @Param(value = "startDate")String minDate, @Param(value = "endDate")String endDate);
+}

jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MediaReportMapper.java → jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MediaReportMapper.java


+ 33 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaishouMatcostAccountMayMapper.xml

@@ -0,0 +1,33 @@
+<?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="org.jeecg.modules.ctop.mapper.KuaishouMatcostAccountMayMapper">
+    <update id="updateByCode">
+        update kuaishou_matcost_account_jun_12_18 set min_date = #{minDate}
+        where video_code = #{code}
+    </update>
+    <update id="updateCostByCode">
+        update kuaishou_matcost_account_jun_12_18 set twcost = #{cost}
+        where video_code = #{code}
+    </update>
+    <select id="getMinDateByCode" resultType="java.lang.String">
+        SELECT
+            min(s.stat_date)
+        FROM
+            ctop_kuaishou_report_daily_creative s
+            LEFT JOIN ctop_kuaishou_creative creative2 ON s.creative_id = creative2.creative_id
+            left join ctop_kuaishou_video_get video on video.photo_id = creative2.photo_id and creative2.account_id = video.account_id
+        WHERE
+            video.signature = #{code}
+    </select>
+    <select id="getCostByParams" resultType="java.math.BigDecimal">
+        SELECT
+            sum(report.charge)
+        FROM
+        ctop_kuaishou_report_daily_creative report
+        LEFT JOIN ctop_kuaishou_creative creative2 ON report.creative_id = creative2.creative_id
+        left join ctop_kuaishou_video_get video on video.photo_id = creative2.photo_id and creative2.account_id = video.account_id
+        WHERE
+        video.signature =#{code} and report.stat_date &gt;= #{startDate} and report.stat_date &lt;= #{endDate};
+
+    </select>
+</mapper>

jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/MediaReportMapper.xml → jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/MediaReportMapper.xml


+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICpaBidWarningService.java

@@ -1,6 +1,6 @@
 package org.jeecg.modules.ctop.service;
 
-import org.jeecg.modules.ctop.entity.Project;
+import cn.com.ctop.common.module.entity.Project;
 
 public interface ICpaBidWarningService {
     void cpaBidWarning(Project project);

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IKuaishouMatcostAccountMayService.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.ctop.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.ctop.entity.KuaishouMatcostAccountMay;
+
+import java.math.BigDecimal;
+
+public interface IKuaishouMatcostAccountMayService extends IService<KuaishouMatcostAccountMay> {
+    KuaishouMatcostAccountMay getOne();
+
+    String getMinDate(String code);
+
+    void updateByCode(String code,String minDate);
+
+    void updateCostByCode(String code, BigDecimal cost);
+
+    BigDecimal getCostByParams(KuaishouMatcostAccountMay matcostAccountMay);
+}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IProjectMemberService.java

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ctop.service;
 
+import cn.com.ctop.common.module.entity.Project;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.system.entity.SysUser;
 

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

@@ -1,8 +1,10 @@
 package org.jeecg.modules.ctop.service.impl;
 
 import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.mapper.ProjectMapper;
 import cn.com.ctop.common.module.service.ICorpFeishuUserService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.BigDecimalUtil;
@@ -17,8 +19,6 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.mapper.ProjectMapper;
 import org.jeecg.modules.ctop.service.IBidWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

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

@@ -1,6 +1,7 @@
 package org.jeecg.modules.ctop.service.impl;
 
 import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.MailLogMapper;
 import cn.com.ctop.common.module.service.ICorpFeishuUserService;
@@ -16,7 +17,6 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.service.ICpaBidWarningService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

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

@@ -0,0 +1,43 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.ctop.entity.KuaishouMatcostAccountMay;
+import org.jeecg.modules.ctop.mapper.KuaishouMatcostAccountMayMapper;
+import org.jeecg.modules.ctop.service.IKuaishouMatcostAccountMayService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+
+@Service
+public class KuaishouMatcostAccountMayServiceImpl extends ServiceImpl<KuaishouMatcostAccountMayMapper, KuaishouMatcostAccountMay> implements IKuaishouMatcostAccountMayService {
+    @Autowired
+    private KuaishouMatcostAccountMayMapper kuaishouMatcostAccountMayMapper;
+    @Override
+    public KuaishouMatcostAccountMay getOne() {
+        QueryWrapper<KuaishouMatcostAccountMay>queryWrapper = new QueryWrapper<>();
+        queryWrapper.isNotNull("end_date").isNotNull("video_code").isNull("twcost").last("limit 1");
+        return this.getOne(queryWrapper);
+    }
+
+    @Override
+    public String getMinDate(String code){
+        return kuaishouMatcostAccountMayMapper.getMinDateByCode(code);
+    }
+
+    @Override
+    public void updateByCode(String code,String minDate) {
+        kuaishouMatcostAccountMayMapper.updateByCode(code,minDate);
+    }
+
+    @Override
+    public void updateCostByCode(String code, BigDecimal cost) {
+        kuaishouMatcostAccountMayMapper.updateCostByCode(code,cost);
+    }
+
+    @Override
+    public BigDecimal getCostByParams(KuaishouMatcostAccountMay matcostAccountMay) {
+        return kuaishouMatcostAccountMayMapper.getCostByParams(matcostAccountMay.getVideoCode(),matcostAccountMay.getMinDate(),matcostAccountMay.getEndDate());
+    }
+}

+ 1 - 1
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;
 
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ISysRoleService;
@@ -9,7 +10,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
 import org.jeecg.modules.ctop.mapper.ProjectMemberMapper;
 import org.jeecg.modules.ctop.service.IProjectMemberService;

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

@@ -1,6 +1,8 @@
 package org.jeecg.modules.wps.service.impl;
 
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.file.FileUtil;
+import cn.com.ctop.common.module.service.IProjectService;
 import cn.com.ctop.common.module.utils.CosUtils;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
@@ -11,8 +13,6 @@ import com.github.pagehelper.PageInfo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.ISysUserService;
 import org.jeecg.modules.wps.config.Context;

+ 32 - 9
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -5,7 +5,6 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.IBindAccountLoginService;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
-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.PangolinLoginService;
@@ -13,12 +12,16 @@ import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.ctop.entity.KuaishouMatcostAccountMay;
+import org.jeecg.modules.ctop.service.IKuaishouMatcostAccountMayService;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
@@ -114,6 +117,26 @@ public class SampleTest {
         }
     }
 
+    @Autowired
+    private IKuaishouMatcostAccountMayService matcostAccountMayService;
+    @Test
+    public void testLoadMinDate(){
+        loadData();
+    }
+
+    private void loadData(){
+        KuaishouMatcostAccountMay matcostAccountMay = matcostAccountMayService.getOne();
+        if(null!=matcostAccountMay){
+            BigDecimal cost = matcostAccountMayService.getCostByParams(matcostAccountMay);
+            if(null!=cost&&!cost.toString().trim().equals("")){
+                matcostAccountMayService.updateCostByCode(matcostAccountMay.getVideoCode(),cost);
+            }else{
+                matcostAccountMayService.updateCostByCode(matcostAccountMay.getVideoCode(),BigDecimal.ZERO);
+            }
+            loadData();
+        }
+    }
+
     @Test
     public void testPangolinData() {
         QueryWrapper<BindAccountLogin> queryWrapper = new QueryWrapper<>();
@@ -124,14 +147,14 @@ public class SampleTest {
         if (list != null && !list.isEmpty()) {
             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.getAppId()));
-                }
+                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.getAppId()));
+//                }
             }
         }
     }

+ 30 - 0
module-common/src/main/java/cn/com/ctop/common/module/annotation/AutoLog.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.common.module.annotation;
+
+import java.lang.annotation.*;
+
+/**
+ * 系统日志注解
+ *
+ * @Author scott
+ * @email jeecgos@163.com
+ * @Date 2019年1月14日
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface AutoLog {
+
+	/**
+	 * 日志内容
+	 *
+	 * @return
+	 */
+	String value() default "";
+
+	/**
+	 * 日志类型
+	 *
+	 * @return 0:操作日志;1:登录日志;2:定时任务;
+	 */
+	int logType() default 2;
+}

+ 42 - 0
module-common/src/main/java/cn/com/ctop/common/module/annotation/Dict.java

@@ -0,0 +1,42 @@
+package cn.com.ctop.common.module.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ *  类描述:  字典注解
+ * 作    者: dangzhenghui
+ * 日    期: 2019年03月17日-下午9:37:16
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Dict {
+    /**
+     * 方法描述:  数据code
+     * 作    者: dangzhenghui
+     * 日    期: 2019年03月17日-下午9:37:16
+     *
+     * @return 返回类型: String
+     */
+    String dicCode();
+
+    /**
+     * 方法描述:  数据Text
+     * 作    者: dangzhenghui
+     * 日    期: 2019年03月17日-下午9:37:16
+     *
+     * @return 返回类型: String
+     */
+    String dicText() default "";
+
+    /**
+     * 方法描述: 数据字典表
+     * 作    者: dangzhenghui
+     * 日    期: 2019年03月17日-下午9:37:16
+     *
+     * @return 返回类型: String
+     */
+    String dictTable() default "";
+}

+ 25 - 0
module-common/src/main/java/cn/com/ctop/common/module/annotation/PermissionData.java

@@ -0,0 +1,25 @@
+package cn.com.ctop.common.module.annotation;
+
+import java.lang.annotation.*;
+
+/**
+  *  数据权限注解
+ * @Author taoyan
+ * @Date 2019年4月11日
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE,ElementType.METHOD})
+@Documented
+public @interface PermissionData {
+	/**
+	 * 暂时没用
+	 * @return
+	 */
+	String value() default "";
+
+
+	/**
+	 * 配置菜单的组件路径,用于数据权限
+	 */
+	String pageComponent() default "";
+}

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java

@@ -1,5 +1,6 @@
-package org.jeecg.modules.ctop.entity;
+package cn.com.ctop.common.module.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -10,7 +11,6 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
-import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/ProjectMapper.java

@@ -1,7 +1,7 @@
-package org.jeecg.modules.ctop.mapper;
+package cn.com.ctop.common.module.mapper;
 
+import cn.com.ctop.common.module.entity.Project;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.Project;
 
 /**
  * 项目

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/ProjectMapper.xml

@@ -1,5 +1,5 @@
 <?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="org.jeecg.modules.ctop.mapper.ProjectMapper">
+<mapper namespace="cn.com.ctop.common.module.mapper.ProjectMapper">
 
-</mapper>
+</mapper>

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

@@ -1,7 +1,7 @@
-package org.jeecg.modules.ctop.service;
+package cn.com.ctop.common.module.service;
 
+import cn.com.ctop.common.module.entity.Project;
 import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.Project;
 
 /**
  * 项目

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

@@ -1,9 +1,9 @@
-package org.jeecg.modules.ctop.service.impl;
+package cn.com.ctop.common.module.service.impl;
 
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.mapper.ProjectMapper;
+import cn.com.ctop.common.module.service.IProjectService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.Project;
-import org.jeecg.modules.ctop.mapper.ProjectMapper;
-import org.jeecg.modules.ctop.service.IProjectService;
 import org.springframework.stereotype.Service;
 
 /**

+ 1 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/entity/PangolinReportAppHour.java

@@ -28,6 +28,7 @@ public class PangolinReportAppHour {
      * 类型
      */
     private String type;
+    private String accountName;
     /**
      * 数字
      */

+ 1 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/pangolin/entity/PangolinReportChannelDaily.java

@@ -24,6 +24,7 @@ public class PangolinReportChannelDaily {
      * 应用名称
      */
     private String appName;
+    private String accountName;
     /**
      * 操作系统
      */

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

@@ -208,9 +208,12 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                     pangolinReportChannelDaily.setOprateSystem(os);
                     pangolinReportChannelDaily.setRetentionRatio(retentionRatio);
                     pangolinReportChannelDaily.setTotalPrice(totalPrice);
+                    pangolinReportChannelDaily.setAccountName(bindAccountLogin.getAccountName());
                     QueryWrapper<PangolinReportChannelDaily> queryWrapper = new QueryWrapper<>();
                     queryWrapper.eq("date", pangolinReportChannelDaily.getDate());
+                    queryWrapper.eq("app_name", pangolinReportChannelDaily.getAppName());
                     queryWrapper.eq("channel_name", pangolinReportChannelDaily.getChannelName());
+                    queryWrapper.eq("account_name", bindAccountLogin.getAccountName());
                     if (pangolinReportChannelDailyService.getOne(queryWrapper) == null) {
                         pangolinReportChannelDailyService.save(pangolinReportChannelDaily);
                     } else {
@@ -269,6 +272,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                     for (int i = 0; i < size; i++) {
                         BigDecimal clickNum = clickNode.get(i).decimalValue();
                         PangolinReportAppHour pangolinReportAppHour = new PangolinReportAppHour();
+                        pangolinReportAppHour.setAccountName(bindAccountLogin.getAccountName());
                         pangolinReportAppHour.setAppId(appId);
                         pangolinReportAppHour.setDate(DateUtils.parseDate(date, "yyyy-MM-dd"));
                         pangolinReportAppHour.setNum(clickNum);
@@ -279,6 +283,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                         queryWrapper.eq("app_id", pangolinReportAppHour.getAppId());
                         queryWrapper.eq("type", pangolinReportAppHour.getType());
                         queryWrapper.eq("hour", pangolinReportAppHour.getHour());
+                        queryWrapper.eq("account_name", pangolinReportAppHour.getAccountName());
                         if (pangolinReportAppHourService.getOne(queryWrapper) == null) {
                             pangolinReportAppHourService.save(pangolinReportAppHour);
                         } else {
@@ -294,6 +299,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                     for (int i = 0; i < size; i++) {
                         BigDecimal activeNum = activeNode.get(i).decimalValue();
                         PangolinReportAppHour pangolinReportAppHour = new PangolinReportAppHour();
+                        pangolinReportAppHour.setAccountName(bindAccountLogin.getAccountName());
                         pangolinReportAppHour.setAppId(appId);
                         pangolinReportAppHour.setDate(DateUtils.parseDate(date, "yyyy-MM-dd"));
                         pangolinReportAppHour.setNum(activeNum);
@@ -304,6 +310,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                         queryWrapper.eq("app_id", pangolinReportAppHour.getAppId());
                         queryWrapper.eq("type", pangolinReportAppHour.getType());
                         queryWrapper.eq("hour", pangolinReportAppHour.getHour());
+                        queryWrapper.eq("account_name", pangolinReportAppHour.getAccountName());
                         if (pangolinReportAppHourService.getOne(queryWrapper) == null) {
                             pangolinReportAppHourService.save(pangolinReportAppHour);
                         } else {
@@ -319,6 +326,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                     for (int i = 0; i < size; i++) {
                         BigDecimal clickNum = rateNode.get(i).decimalValue();
                         PangolinReportAppHour pangolinReportAppHour = new PangolinReportAppHour();
+                        pangolinReportAppHour.setAccountName(bindAccountLogin.getAccountName());
                         pangolinReportAppHour.setAppId(appId);
                         pangolinReportAppHour.setDate(DateUtils.parseDate(date, "yyyy-MM-dd"));
                         pangolinReportAppHour.setNum(clickNum);
@@ -329,6 +337,7 @@ public class PangolinCrawlerServiceImpl implements PangolinCrawlerService {
                         queryWrapper.eq("app_id", pangolinReportAppHour.getAppId());
                         queryWrapper.eq("type", pangolinReportAppHour.getType());
                         queryWrapper.eq("hour", pangolinReportAppHour.getHour());
+                        queryWrapper.eq("account_name", pangolinReportAppHour.getAccountName());
                         if (pangolinReportAppHourService.getOne(queryWrapper) == null) {
                             pangolinReportAppHourService.save(pangolinReportAppHour);
                         } else {

+ 22 - 0
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/BytedanceAccountBidJob.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.job.bytedance.handler;
+
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceBidWarningService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BytedanceAccountBidJob {
+    @Autowired
+    private IBytedanceBidWarningService bidWarningService;
+
+    /**
+     * 出价预警
+     */
+    @XxlJob("bytedanceAccountBidJob")
+    public ReturnT<String> execute(String params) throws Exception {
+        bidWarningService.bidWarning();
+        return ReturnT.SUCCESS;
+    }
+}

+ 23 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountBidJob.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.material.service.IKuaishouBidWarningService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouAccountBidJob {
+    @Autowired
+    private IKuaishouBidWarningService bidWarningService;
+
+    /**
+     * 出价预警
+     *
+     * @param jobExecutionContext
+     * @throws JobExecutionException
+     */
+    public void execute(JobExecutionContext jobExecutionContext) {
+        bidWarningService.bidWarning();
+    }
+}

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/IKuaishouBidWarningService.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.kuaishou.modules.material.service;
+
+public interface IKuaishouBidWarningService {
+    void bidWarning();
+}

+ 161 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/material/service/impl/KuaishouBidWarningServiceImpl.java

@@ -0,0 +1,161 @@
+package cn.com.ctop.kuaishou.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.ICorpFeishuUserService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import cn.com.ctop.common.module.utils.SendMailUtil;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.kuaishou.modules.material.service.IKuaishouBidWarningService;
+import cn.com.feishu.provider.MessageProvider;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class KuaishouBidWarningServiceImpl implements IKuaishouBidWarningService {
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+
+
+    /**
+     * 预警
+     */
+
+    @Override
+    public void bidWarning() {
+        XxlJobLogger.log("快手出价预警定时任务开始");
+        long start = System.currentTimeMillis();
+        try {
+            QueryWrapper<Project> projectQueryWrapper = new QueryWrapper<>();
+            List<Project> projects = projectService.list();
+            if (Check.isNull(projects)) {
+                return;
+            }
+            for (Project project : projects) {
+                if (Check.isNull(project)) {
+                    continue;
+                }
+                Long maxBid = project.getMaxBid();
+                Long projectId = project.getId();
+                List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,null);
+                if (!Check.isNull(userAllocations)) {
+                    for (UserAllocation userAllocation : userAllocations) {
+                        if (userAllocation.getAccountStatus() == 1) {
+                            continue;
+                        }
+                        Long accountId = userAllocation.getAccountId();
+                        List<String> unitWarning = new ArrayList<>();
+                        if ("2".equals(userAllocation.getMediaId())) {
+                            unitWarning = groupMapper.selectWarningGroup(accountId, maxBid);
+                            sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                            sendFeishumessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                        }
+                    }
+                }
+            }
+            XxlJobLogger.log("出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    private void sendFeishumessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) throws Exception {
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, Integer.getInteger(mediaId));
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "\n\r";
+
+        }
+        text.append("项目出价预警").append("\n\r").append("您的项目:").append(projectName + ",").append("\n\r")
+                .append("授权名称为:" + authName + " 下的,").append("\n\r").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        JSONArray openIds = corpFeishuUserService.getOpenIdByParams(projectId);
+        if(null == openIds||openIds.isEmpty()){
+            XxlJobLogger.log("该项目下运营飞书账号尚未绑定邮箱=>projectId:{}",projectId);
+            return;
+        }
+        MessageProvider.batchSend(null,openIds,null,text.toString());
+    }
+
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
+
+    private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "<br/>";
+        }
+        text.append("项目出价预警").append("<br/>").append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("授权名称为:" + authName + " 下的,").append("<br/>").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+    }
+}

+ 5 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/IBytedanceBidWarningService.java

@@ -0,0 +1,5 @@
+package cn.com.ctop.toutiao.modules.material.service;
+
+public interface IBytedanceBidWarningService {
+    void bidWarning();
+}

+ 165 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/BytedanceBidWarningServiceImpl.java

@@ -0,0 +1,165 @@
+package cn.com.ctop.toutiao.modules.material.service.impl;
+
+import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.service.ICorpFeishuUserService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.common.module.utils.BigDecimalUtil;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CorpWexinUtils;
+import cn.com.ctop.common.module.utils.SendMailUtil;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import cn.com.ctop.toutiao.modules.material.service.IBytedanceBidWarningService;
+import cn.com.feishu.provider.MessageProvider;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.xxl.job.core.log.XxlJobLogger;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+@Slf4j
+public class BytedanceBidWarningServiceImpl implements IBytedanceBidWarningService {
+    @Autowired
+    private ICorpFeishuUserService corpFeishuUserService;
+    @Autowired
+    private IProjectService projectService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+    @Autowired
+    private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
+
+    @Override
+    public void bidWarning() {
+        XxlJobLogger.log("---------头条出价预警定时任务开始----------");
+        long start = System.currentTimeMillis();
+        try {
+            List<Project> projects = projectService.list();
+            if (Check.isNull(projects)) {
+                XxlJobLogger.log("查询所属项目为空");
+                return ;
+            }
+            for (Project project : projects) {
+                if (Check.isNull(project)) {
+                    continue;
+                }
+                Long maxBid = project.getMaxBid();
+                Long projectId = project.getId();
+                List<UserAllocation> userAllocations = userAllocationService.getByParams(projectId,null,1);
+                if (Check.isNull(userAllocations)) {
+                    continue;
+                }
+                for (UserAllocation userAllocation : userAllocations) {
+                    Long accountId = userAllocation.getAccountId();
+                    List<String> unitWarning = new ArrayList<>();
+                    if ("1".equals(userAllocation.getMediaId())) {
+                        BigDecimal bid = new BigDecimal(maxBid);
+                        BigDecimal bigDecimal = BigDecimalUtil.divideBigDecimal(bid, new BigDecimal(1000));
+                        unitWarning = byteDanceAdvertisePlanService.selectWarningGroup(accountId, bigDecimal);
+                        if (!Check.isNull(unitWarning)) {
+                            sendMessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                            sendFeishumessage(project.getMediaId(), accountId, projectId, project.getProjectName(), userAllocation.getAuthName(), unitWarning, maxBid);
+                        }
+                    }
+                }
+            }
+            XxlJobLogger.log("头条出价预警定时任务执行完毕,共耗时:{} s", (System.currentTimeMillis() - start) / 1000);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+    private void sendFeishumessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) throws Exception {
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, Integer.getInteger(mediaId));
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "\n\r";
+
+        }
+        text.append("项目出价预警").append("\n\r").append("您的项目:").append(projectName + ",").append("\n\r")
+                .append("授权名称为:" + authName + " 下的,").append("\n\r").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        JSONArray openIds = corpFeishuUserService.getOpenIdByParams(projectId);
+        if(null == openIds||openIds.isEmpty()){
+            log.error("该项目下运营飞书账号尚未绑定邮箱=>projectId:{}",projectId);
+            return;
+        }
+        MessageProvider.batchSend(null,openIds,null,text.toString());
+    }
+
+    private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, Long maxBid) {
+        String createTime = DateUtils.getNowDate("yyyy-MM-dd");
+        Integer count = mailLogMapper.selectCountByAccountIdAndDate(accountId, createTime, 1);
+        StringBuilder text = new StringBuilder();
+        String s = "";
+        for (int i = 0; i < unitWarning.size(); i++) {
+            s += unitWarning.get(i) + "," + "<br/>";
+        }
+        text.append("项目出价预警").append("<br/>").append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("授权名称为:" + authName + " 下的,").append("<br/>").append(s)
+                .append("大于项目设置的最高出价:").append(maxBid / 1000).append(" 元! 请您及时调整。");
+        if (count < 3) {
+            List<String> mailList = mailLogMapper.selectMailList(projectId);
+            String subject;
+            if ("1".equals(mediaId)) {
+                subject = "头条-广告计划出价预警";
+            } else {
+                subject = "快手-广告组出价预警";
+            }
+
+            try {
+                SendMailUtil.sendMail(mailList, subject, text.toString());
+                MailLog mailLog = new MailLog();
+                mailLog.setAccountId(accountId);
+                mailLog.setMailType(1);
+                mailLog.setContent(text.toString());
+                mailLog.setSendEmil(JSON.toJSONString(mailList));
+                mailLog.setSubject(subject);
+                mailLogMapper.insert(mailLog);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        List<String> wexinIds = mailLogMapper.selectWeiXinIdList(projectId);
+        CorpWexinUtils.sendMessage(wexinIds, text.toString());
+    }
+}