Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

syh 5 лет назад
Родитель
Сommit
b69853987f
25 измененных файлов с 424 добавлено и 24 удалено
  1. 22 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  2. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/Project.java
  3. 68 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/AccountCpaBidJob.java
  4. 9 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/ICpaBidWarningService.java
  5. 138 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CpaBidWarningServiceImpl.java
  6. 55 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java
  7. 13 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java
  8. 1 1
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  9. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  10. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java
  11. 17 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml
  12. 5 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java
  13. 10 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  14. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/BigDecimalUtil.java
  15. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java
  16. 10 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml
  17. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/ByteDanceAdvertisePlan.java
  18. 2 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/ByteDanceAdvertisePlanMapper.java
  19. 12 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceAdvertisePlanMapper.xml
  20. 8 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertisePlanService.java
  21. 6 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  22. 6 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  23. 2 0
      module-toutiao/src/main/resources/bytedance_config.properties
  24. 14 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/PerformanceTimeDTO.java
  25. 1 0
      performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

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

@@ -46,8 +46,6 @@ import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
 
 /**
  * 素材信息
@@ -192,6 +190,28 @@ public class MaterialInfoController {
 
         Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
         IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
+
+        List<MaterialInfo> materialInfoList = pageList.getRecords();
+
+        if (materialInfoList.size() != 0){
+            for (MaterialInfo material:materialInfoList){
+                //判断是否已经同步到快手平台
+                Integer kuaishouMaterialUpCount = materialInfoService.getKuaishouUpVideoCount(material.getCode());
+                if (kuaishouMaterialUpCount>0){
+                    material.setKuaishouVideoIsUp(1);
+                }else{
+                    material.setKuaishouVideoIsUp(0);
+                }
+                //判断是否已经同步到抖音平台
+                Integer toutiaoMaterialUpCount = materialInfoService.getToutiaoUpVideoCount(material.getCode());
+                if(toutiaoMaterialUpCount >0){
+                    material.setToutiaoVideoIsUp(1);
+                }else{
+                    material.setToutiaoVideoIsUp(0);
+                }
+            }
+        }
+
         result.setSuccess(true);
         result.setResult(pageList);
         return result;

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

@@ -12,6 +12,7 @@ import lombok.experimental.Accessors;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -92,6 +93,10 @@ public class Project {
      */
     private Long maxBid;
     /**
+     * 最高深度转化出价
+     */
+    private BigDecimal maxDeepCpaBid;
+    /**
      * 创建时间
      */
     @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

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

@@ -0,0 +1,68 @@
+package org.jeecg.modules.ctop.job;
+
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+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;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+/**
+ * 深度转化出价预警
+ */
+public class AccountCpaBidJob implements Job {
+    @Autowired
+    private ICpaBidWarningService cpaBidWarningService;
+    @Autowired
+    private ICtopOauthTokenService tokenService;
+    static ExecutorService executorService = null;
+    @Autowired
+    private IProjectService projectService;
+
+    /**
+     * 出价预警
+     *
+     * @param jobExecutionContext
+     * @throws JobExecutionException
+     */
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) {
+        Thread thread = new Thread() {
+
+
+            @Override
+            public void run() {
+                executorService = Executors.newFixedThreadPool(4);
+                QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+                List<Project> projects = projectService.list(queryWrapper);
+                if (!Check.isNull(projects)) {
+                    for (Project project : projects) {
+                        if (BigDecimalUtil.compareToDecimal(project.getMaxDeepCpaBid(), new BigDecimal(0)) <= 0) {
+                            continue;
+                        }
+                        executorService.submit(new Runnable() {
+                            @Override
+                            public void run() {
+                                cpaBidWarningService.CpaBidWarning(project);
+                            }
+
+                        });
+                    }
+
+                }
+            }
+        };
+        thread.start();
+
+    }
+}

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

@@ -0,0 +1,9 @@
+package org.jeecg.modules.ctop.service;
+
+import org.jeecg.modules.ctop.entity.Project;
+
+public interface ICpaBidWarningService {
+    void CpaBidWarning(Project project);
+
+
+}

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

@@ -0,0 +1,138 @@
+package org.jeecg.modules.ctop.service.impl;
+
+import cn.com.ctop.common.module.entity.MailLog;
+import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.mapper.MailLogMapper;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+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.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
+import cn.com.ctop.toutiao.service.IByteDanceAdvertisePlanService;
+import com.alibaba.fastjson.JSON;
+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.ICpaBidWarningService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * 出价预警
+ */
+@Slf4j
+@Service
+public class CpaBidWarningServiceImpl implements ICpaBidWarningService {
+
+    @Autowired
+    private ProjectMapper projectMapper;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+    @Autowired
+    private KuaiShouGroupMapper groupMapper;
+    @Autowired
+    private MailLogMapper mailLogMapper;
+    @Autowired
+    private IByteDanceAdvertisePlanService byteDanceAdvertisePlanService;
+
+
+    /**
+     * 预警
+     */
+
+    @Override
+    public void CpaBidWarning(Project project) {
+        try {
+
+            BigDecimal maxDeepCpaBid = project.getMaxDeepCpaBid();
+
+
+            List<UserAllocation> userAllocations = getUserAllocationsByProjectId(project.getId());
+            if (!Check.isNull(userAllocations)) {
+                for (UserAllocation userAllocation : userAllocations) {
+                    Long accountId = userAllocation.getAccountId();
+                    List<String> unitWarning = new ArrayList<>();
+                    if ("1".equals(userAllocation.getMediaId())) {
+                        BigDecimal deepBid = BigDecimalUtil.divideBigDecimal(maxDeepCpaBid, new BigDecimal(1000));
+                        unitWarning = byteDanceAdvertisePlanService.selectWarningCpaBid(accountId, deepBid);
+                    } else if ("2".equals(userAllocation.getMediaId())) {
+                        unitWarning = groupMapper.selectWarningCpaBid(accountId, maxDeepCpaBid);
+                    }
+
+                    if (!Check.isNull(unitWarning)) {
+                        sendMessage(project.getMediaId(), accountId, project.getId(), project.getProjectName(), userAllocation.getAuthName(), unitWarning,maxDeepCpaBid );
+                    }
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+    private List<UserAllocation> getUserAllocationsByProjectId(Long projectId) {
+        QueryWrapper<UserAllocation> userAllocationQueryWrapper = new QueryWrapper<>();
+        userAllocationQueryWrapper.eq("project_id", projectId);
+        List<UserAllocation> userAllocations = userAllocationMapper.selectList(userAllocationQueryWrapper);
+        return userAllocations;
+    }
+
+
+    private void sendMessage(String mediaId, Long accountId, Long projectId, String projectName, String authName, List<String> unitWarning, BigDecimal maxCpaBid) {
+
+        BigDecimal maxBid = BigDecimalUtil.divideBigDecimal(maxCpaBid, new BigDecimal(1000));
+
+        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).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());
+
+
+    }
+
+
+}

+ 55 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/PerformanceController2.java

@@ -2,6 +2,7 @@ package org.jeecg.modules.system.controller;
 
 import cn.com.ctop.performanceappraisal.entity.Performance;
 import cn.com.ctop.userefficientvideomap.entity.DesignMaterialInfo;
+import cn.com.ctop.userefficientvideomap.entity.PerformanceTimeDTO;
 import cn.com.ctop.userefficientvideomap.entity.UserDto2;
 import cn.com.ctop.userefficientvideomap.mapper.UserEfficientVideoMapMapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -318,8 +319,8 @@ public class PerformanceController2 {
 
     @AutoLog(value = "获取快手绩效时时数据接口")
     @ApiOperation(value = "获取快手绩效时时数据接口", notes = "获取快手绩效时时数据接口")
-    @GetMapping(value = "/kuaishouPererformanceInfoNow")
-    public Result<List<UserDto2>> kuaishouPererformanceInfoNow(HttpServletRequest req) {
+    @GetMapping(value = "/kuaishouPerformanceInfoNow")
+    public Result<List<UserDto2>> kuaishouPerformanceInfoNow(HttpServletRequest req) {
         Result<List<UserDto2>> result = new Result<List<UserDto2>>();
         List<UserDto2> userDto2List = performanceService.kuaishouPerformanceInfoNow();
         result.setSuccess(true);
@@ -340,11 +341,17 @@ public class PerformanceController2 {
 
     @AutoLog(value = "获取快手绩效周报表")
     @ApiOperation(value = "获取快手绩效周报表", notes = "获取快手绩效周报表")
-    @GetMapping(value = "/kuaishouWeekReport")
-    public Result<List<UserDto2>> kuaishouWeekReport(@RequestParam(name = "startDate") String startDate,
-                                                     @RequestParam(name = "endDate") String endDate,
+    @PostMapping(value = "/kuaishouWeekReport")
+    public Result<List<UserDto2>> kuaishouWeekReport(@RequestBody PerformanceTimeDTO dto,
                                                      HttpServletRequest req) {
         Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+            return result;
+        }
         List<UserDto2> userDto2List = performanceService.kuaishouWeekReport(startDate, endDate);
         result.setSuccess(true);
         result.setResult(userDto2List);
@@ -353,11 +360,17 @@ public class PerformanceController2 {
 
     @AutoLog(value = "获取头条绩效周报表")
     @ApiOperation(value = "获取头条绩效周报表", notes = "获取头条绩效周报表")
-    @GetMapping(value = "/toutiaoWeekReport")
-    public Result<List<UserDto2>> toutiaoWeekReport(@RequestParam(name = "pageNo") String startDate,
-                                                    @RequestParam(name = "pageNo") String endDate,
+    @PostMapping(value = "/toutiaoWeekReport")
+    public Result<List<UserDto2>> toutiaoWeekReport(@RequestBody PerformanceTimeDTO dto,
                                                     HttpServletRequest req) {
         Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        String startDate = dto.getStartDate();
+        String endDate = dto.getEndDate();
+        if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+            return result;
+        }
         List<UserDto2> userDto2List = performanceService.toutiaoWeekReport(startDate, endDate);
         result.setSuccess(true);
         result.setResult(userDto2List);
@@ -366,11 +379,16 @@ public class PerformanceController2 {
 
     @AutoLog(value = "获取快手季度绩效报表")
     @ApiOperation(value = "获取快手季度绩效报表", notes = "获取快手季度绩效报表")
-    @GetMapping(value = "/kuaishouQuarterReport")
-    public Result<List<UserDto2>> kuaishouQuarterReport(@RequestParam(name = "pageNo") Integer year,
-                                                        @RequestParam(name = "pageNo") Integer quarter,
+    @PostMapping(value = "/kuaishouQuarterReport")
+    public Result<List<UserDto2>> kuaishouQuarterReport(@RequestBody PerformanceTimeDTO dto,
                                                         HttpServletRequest req) {
         Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        if(year==null || quarter == null){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+        }
         List<UserDto2> userDto2List = performanceService.kuaishouQuarterReport(year, quarter);
         result.setSuccess(true);
         result.setResult(userDto2List);
@@ -379,15 +397,38 @@ public class PerformanceController2 {
 
     @AutoLog(value = "获取头条季度绩效报表")
     @ApiOperation(value = "获取头条季度绩效报表", notes = "获取头条季度绩效报表")
-    @GetMapping(value = "/toutiaoQuarterReport")
-    public Result<List<UserDto2>> toutiaoQuarterReport(@RequestParam(name = "pageNo") Integer year,
-                                                       @RequestParam(name = "pageNo") Integer quarter,
+    @PostMapping(value = "/toutiaoQuarterReport")
+    public Result<List<UserDto2>> toutiaoQuarterReport(@RequestBody PerformanceTimeDTO dto,
                                                        HttpServletRequest req) {
         Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+        Integer year = dto.getYear();
+        Integer quarter = dto.getQuarter();
+        if(year==null || quarter == null){
+            result.setSuccess(false);
+            result.setMessage("时间不能为空");
+        }
         List<UserDto2> userDto2List = performanceService.toutiaoQuarterReport(year, quarter);
         result.setSuccess(true);
         result.setResult(userDto2List);
         return result;
     }
 
+    //@AutoLog(value = "获取相关有效视频列表")
+    //@ApiOperation(value = "获取相关有效视频列表", notes = "获取相关有效视频列表")
+    //@PostMapping(value = "/toutiaoQuarterReport")
+    //public Result<List<UserDto2>> getEffiVideoList(@RequestBody PerformanceTimeDTO dto,
+    //                                                   HttpServletRequest req) {
+    //    Result<List<UserDto2>> result = new Result<List<UserDto2>>();
+    //    Integer year = dto.getYear();
+    //    Integer quarter = dto.getQuarter();
+    //    if(year==null || quarter == null){
+    //        result.setSuccess(false);
+    //        result.setMessage("时间不能为空");
+    //    }
+    //    List<UserDto2> userDto2List = performanceService.toutiaoQuarterReport(year, quarter);
+    //    result.setSuccess(true);
+    //    result.setResult(userDto2List);
+    //    return result;
+    //}
+
 }

+ 13 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/PerformanceServiceImpl2.java

@@ -1700,7 +1700,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
-    //获取快手绩效时时数据接口
+    //快手绩效时时数据接口
     @Override
     public List<UserDto2> kuaishouWeekReport(String startDate, String endDate) {
         //1 获取快手下所有人
@@ -1713,7 +1713,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             //2.2 获取有效视频总数
             Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
             //2.3 总消耗
-            BigDecimal cost = BigDecimal.ZERO;
+            BigDecimal cost = null;
             if ("clip".equals(roleCode)) {
                 cost = userEfficientVideoMapMapper.getTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
             } else if ("plan".equals(roleCode)) {
@@ -1721,6 +1721,9 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             } else if ("shot".equals(roleCode)) {
                 cost = userEfficientVideoMapMapper.getTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
             }
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
@@ -1729,7 +1732,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
-    //获取头条绩效实时数据
+    //头条绩效实时数据
     public List<UserDto2> toutiaoWeekReport(String startDate, String endDate) {
         //1 获取头条所有人
         List<UserDto2> userDto2List = userEfficientVideoMapMapper.getToutiaoDepartUserInfo();
@@ -1741,7 +1744,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             //2.2 获取视频总数
             Integer videoCount = userEfficientVideoMapMapper.getQuarterMaterialCountByUserId(userDto.getRoleCode(), startDate, endDate, userDto.getUserId());
             //2.3 总消耗
-            BigDecimal cost = BigDecimal.ZERO;
+            BigDecimal cost = null;
             if ("clip".equals(roleCode)) {
                 cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
             } else if ("plan".equals(roleCode)) {
@@ -1749,6 +1752,10 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
             } else if ("shot".equals(roleCode)) {
                 cost = userEfficientVideoMapMapper.toutiaoGetTotalCostByPlanId(userDto.getUserId(), startDate, endDate);
             }
+
+            if(cost == null){
+                cost = BigDecimal.ZERO;
+            }
             userDto.setCost(cost);
             userDto.setVideoCount(videoCount);
             userDto.setEffiVideoCount(effiVideoCount);
@@ -1756,7 +1763,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
-    //获取快手季度绩效报表
+    //快手季度绩效报表
     @Override
     public List<UserDto2> kuaishouQuarterReport(Integer year, Integer quarter) {
         //0 获取当季度的开始和结束时间
@@ -1789,7 +1796,7 @@ public class PerformanceServiceImpl2 extends ServiceImpl<PerformanceMapper, Perf
         return userDto2List;
     }
 
-    //获取快手季度绩效报表
+    //头条季度绩效报表
     @Override
     public List<UserDto2> toutiaoQuarterReport(Integer year, Integer quarter) {
         //0 获取当季度的开始和结束时间

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

@@ -227,7 +227,7 @@ public class SampleTest {
         }
         tokens.forEach(token -> {
             //3:获取广告计划信息数据
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+            advertiserDataService.getAdvertiserPlan(token, "", null, null);
         });
     }
 

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java

@@ -123,4 +123,10 @@ public class MaterialInfo {
 
     private Integer kuaishouEffiType; //判断是否为快手有效素材0否_1是
 
+    @TableField(exist = false)
+    private Integer kuaishouVideoIsUp;  //判断是否已经同步到快手平台0否_1是
+
+    @TableField(exist = false)
+    private Integer toutiaoVideoIsUp;  //判断是否已经同步到头条平台0否_1是
+
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialInfoMapper.java

@@ -20,4 +20,8 @@ public interface MaterialInfoMapper extends BaseMapper<MaterialInfo> {
     Integer selectCountByMap(Map<String, Object> requestMap);
 
     String getRoleCodeByUserId(@Param("userId") String userId);
+
+    Integer getKuaishouUpVideoCount(@Param("code")String code);
+
+    Integer getToutiaoUpVideoCount(@Param("code")String code);
 }

+ 17 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialInfoMapper.xml

@@ -40,5 +40,22 @@
     )
     </select>
 
+    <select id="getKuaishouUpVideoCount" resultType="java.lang.Integer">
+        select
+        count(1)
+        from
+        ctop_kuaishou_video_get v
+        where
+        v.signature = #{code}
+    </select>
+
+    <select id="getToutiaoUpVideoCount" resultType="java.lang.Integer">
+        select
+        count(1)
+        from
+        ctop_bytedance_video_info v
+        where
+        v.signature = #{code}
+    </select>
 
 </mapper>

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialInfoService.java

@@ -3,6 +3,7 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.Map;
 
@@ -33,4 +34,8 @@ public interface IMaterialInfoService extends IService<MaterialInfo> {
     void getFile(MaterialInfo materialInfo);
 
     void setExcellent(String id, Integer excellent);
+
+    Integer getKuaishouUpVideoCount(@Param("code")String code);
+
+    Integer getToutiaoUpVideoCount(@Param("code")String code);
 }

+ 10 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -412,4 +412,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         info.setExcellent(excellent);
         this.updateById(info);
     }
+
+    @Override
+    public Integer getKuaishouUpVideoCount(String code) {
+        return materialInfoMapper.getKuaishouUpVideoCount(code);
+    }
+
+    @Override
+    public Integer getToutiaoUpVideoCount(String code) {
+        return materialInfoMapper.getToutiaoUpVideoCount(code);
+    }
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/BigDecimalUtil.java

@@ -127,6 +127,7 @@ public class BigDecimalUtil {
      * @param v1
      * @param v2
      * @return
+     * -1 小于 0 等于 1 大于
      */
     public static int compareToDecimal(BigDecimal v1, BigDecimal v2) {
         int i = v1.compareTo(v2);

+ 3 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouGroupMapper.java

@@ -4,6 +4,7 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -16,4 +17,6 @@ public interface KuaiShouGroupMapper extends BaseMapper<KuaiShouGroup> {
     void replaceBatch(@Param(value = "groups") List<KuaiShouGroup> groups);
 
     List<String> selectWarningGroup(@Param("accountId") Long accountId, @Param("maxBid") Long maxBid);
+
+    List<String> selectWarningCpaBid(@Param("accountId") Long accountId, @Param("maxBid") BigDecimal maxDeepCapBid);
 }

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouGroupMapper.xml

@@ -79,4 +79,14 @@
     </select>
 
 
+    <select id="selectWarningCpaBid" resultType="java.lang.String">
+   SELECT
+   unit_name
+   FROM ctop_kuaishou_group
+   WHERE account_id = #{accountId}
+   and deep_conversion_bid &gt; #{maxDeepCpaBid}
+   group by unit_id
+    </select>
+
+
 </mapper>

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/entity/ByteDanceAdvertisePlan.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.toutiao.entity;
 
+import cn.com.ctop.common.module.utils.Check;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -188,6 +189,7 @@ public class ByteDanceAdvertisePlan {
     @Excel(name = "ocpc广告转化出价", width = 15)
     @ApiModelProperty(value = "ocpc广告转化出价")
     private BigDecimal cpaBid;
+    private BigDecimal deepCpabid;  // 深度优化出价
     /**
      * ocpc广告是否跳过第一阶段
      */
@@ -502,6 +504,10 @@ public class ByteDanceAdvertisePlan {
         if (null != externalUrl && !"".equals(externalUrl.trim())) {
             this.externalUrl = externalUrl;
         }
+
+
+
+
     }
 
     public ByteDanceAdvertisePlan() {

+ 2 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/ByteDanceAdvertisePlanMapper.java

@@ -16,4 +16,6 @@ import java.util.List;
 public interface ByteDanceAdvertisePlanMapper extends BaseMapper<ByteDanceAdvertisePlan> {
 
     List<String> selectWarningGroup(@Param("accountId") Long accountId, @Param("maxBid") BigDecimal maxBid);
+
+    List<String> selectWarningCpaBid(@Param("accountId") Long accountId, @Param("maxCpaBid") BigDecimal maxCpaBid);
 }

+ 12 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/mapper/xml/ByteDanceAdvertisePlanMapper.xml

@@ -10,4 +10,16 @@
    and (cpa_bid &gt; #{maxBid} or bid &gt; #{maxBid})
    and toutiao_status = 'AD_STATUS_DELIVERY_OK'
     </select>
+
+
+    <select id="selectWarningCpaBid" resultType="java.lang.String">
+   SELECT
+   name
+   FROM ctop_bytedance_advertise_plan
+   WHERE advertiser_id = #{accountId}
+   and deep_cpabid &gt; #{maxCpaBid}
+   and toutiao_status = 'AD_STATUS_DELIVERY_OK'
+    </select>
+
+
 </mapper>

+ 8 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/IByteDanceAdvertisePlanService.java

@@ -31,4 +31,12 @@ public interface IByteDanceAdvertisePlanService extends IService<ByteDanceAdvert
      * @return
      */
     List<String> selectWarningGroup(Long accountId, BigDecimal maxBid);
+
+    /**
+     * 查询需要预警的深度转化出价
+     * @param accountId
+     * @param maxCapBid
+     * @return
+     */
+    List<String> selectWarningCpaBid(Long accountId, BigDecimal maxCapBid);
 }

+ 6 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertisePlanServiceImpl.java

@@ -193,9 +193,14 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
 
     @Override
     public List<String> selectWarningGroup(Long accountId, BigDecimal maxBid) {
-        return  byteDanceAdvertisePlanMapper.selectWarningGroup(accountId, maxBid);
+        return byteDanceAdvertisePlanMapper.selectWarningGroup(accountId, maxBid);
 
     }
 
+    @Override
+    public List<String> selectWarningCpaBid(Long accountId, BigDecimal maxCapBid) {
+        return byteDanceAdvertisePlanMapper.selectWarningCpaBid(accountId, maxCapBid);
+    }
+
 
 }

+ 6 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -125,6 +125,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
             ByteDanceAdvertisePlan advertisePlan = new ByteDanceAdvertisePlan(dataObject, String.valueOf(token.getAccountId()));
+            BigDecimal deepCpabid = dataObject.getBigDecimal("deep_cpabid");
+            if (null != deepCpabid) {
+                advertisePlan.setDeepCpabid(deepCpabid);
+            }
+
+
             advertisePlanService.saveOrUpdate(advertisePlan);
         }
         getAd(token, pageNum + 1, ids, date, updateDate);

+ 2 - 0
module-toutiao/src/main/resources/bytedance_config.properties

@@ -5,6 +5,8 @@ bytedance_secret=0c51523e90d6166418fc8421a4896808e90e26f4
 # bytedance_secret=34bc59f53955c66871ce111a1f15a6051cfa3f12
 #release
 bytedance_api_url=https://ad.oceanengine.com/open_api
+bytedance_auth_url=https://ad.oceanengine.com/openapi
+
 #sandbox
 #bytedance_api_url=https://test-ad.toutiao.com/open_api
 #bytedance_auth_url=https://test-ad.toutiao.com/open_api

+ 14 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/entity/PerformanceTimeDTO.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.userefficientvideomap.entity;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class PerformanceTimeDTO implements Serializable {
+    private String StartDate;
+    private String endDate;
+    private Integer year;
+    private Integer quarter;
+}

+ 1 - 0
performance-appraisal/src/main/java/cn/com/ctop/userefficientvideomap/mapper/xml/UserEfficientVideoMapMapper.xml

@@ -573,6 +573,7 @@
         quarter = #{quarter}
         and
         app_type = #{appType}
+        limit 1
     </select>
 
     <select id="getOrgCodeByProjectId" resultType="string">