Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/master'

syh 4 anni fa
parent
commit
1a952fbe50
30 ha cambiato i file con 760 aggiunte e 69 eliminazioni
  1. 3 3
      jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java
  2. 54 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  3. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  4. 2 2
      jeecg-boot-module-system/src/main/resources/application.yml
  5. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialInfo.java
  6. 6 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java
  7. 2 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java
  8. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml
  9. 7 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml
  10. 23 1
      module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java
  11. 64 22
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java
  12. 37 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java
  13. 2 1
      module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java
  14. 28 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyZombieJob.java
  15. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouCreativeMapper.java
  16. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaiShouReportDailyMaterialMapper.java
  17. 24 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml
  18. 10 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouReportDailyMaterialMapper.xml
  19. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouReportDailyMaterialService.java
  20. 25 4
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CollectionSlogansServiceImpl.java
  21. 81 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouZombieCreative.java
  22. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  23. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouZombieCreativeMapper.java
  24. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml
  25. 24 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  26. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouZombieCreativeMapper.xml
  27. 22 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouZombieCreativeService.java
  28. 296 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouZombieCreativeServiceImpl.java
  29. 1 1
      module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java
  30. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

+ 3 - 3
jeecg-boot-base-common/src/main/java/org/jeecg/common/util/DateUtils.java

@@ -1513,14 +1513,14 @@ public class DateUtils extends PropertyEditorSupport {
     }
 
     /**
-     * 获取前一天的日期
+     * 以time为节点,获取前几天的日期 yyyy-MM-dd
      *
      * @param
      * @return java.lang.String
      * @throws
      * @author ZHAOXA
      */
-    public static String getLastDay(String time) {
+    public static String getLastDay(String time, int days) {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
         Calendar calendar = Calendar.getInstance();
         Date date = null;
@@ -1532,7 +1532,7 @@ public class DateUtils extends PropertyEditorSupport {
         calendar.setTime(date);
         int day = calendar.get(Calendar.DATE);
         //                      此处修改为+1则是获取后一天
-        calendar.set(Calendar.DATE, day - 1);
+        calendar.set(Calendar.DATE, day - days);
 
         String lastDay = sdf.format(calendar.getTime());
         return lastDay;

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

@@ -2,13 +2,33 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
 import cn.com.ctop.common.module.constant.CtopRoleCodeConstant;
-import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.entity.ByteDanceCleanMaterialReport;
+import cn.com.ctop.common.module.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.entity.Project;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
-import cn.com.ctop.common.module.service.*;
+import cn.com.ctop.common.module.service.IByteDanceCleanMaterialReportService;
+import cn.com.ctop.common.module.service.IKuaiShouCleanMaterialReportService;
+import cn.com.ctop.common.module.service.IMaterialAscriptionService;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialParameterService;
+import cn.com.ctop.common.module.service.IMaterialTagService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouReportDailyMaterialService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -25,13 +45,24 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.net.URLDecoder;
 import java.text.ParseException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 素材信息
@@ -65,6 +96,8 @@ public class MaterialInfoController {
     private IProjectMemberService memberService;
     @Autowired
     private IMaterialImageInfoService iMaterialImageInfoService;
+    @Autowired
+    private IKuaiShouReportDailyMaterialService kuaiShouReportDailyMaterialService;
 
 
     @GetMapping("/supplierWatermark")
@@ -309,40 +342,40 @@ public class MaterialInfoController {
     }
 
     @GetMapping(value = "/listV2")
-    public Map<String,Object> queryPageList(String type,Integer status,Long projectId,String materialName,String code,
-                                                     String startDate,String endDate,String tagCode,
-                                                     @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                     @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
+    public Map<String, Object> queryPageList(String type, Integer status, Long projectId, String materialName, String code,
+                                             String startDate, String endDate, String tagCode,
+                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-        List<Long>projectIds = null;
+        List<Long> projectIds = null;
         String userId = user.getId();
         String roleCode = roleService.getRoleCodeByUserId(userId);
-        if(null == tagCode||tagCode.trim().equals("")){
+        if (null == tagCode || tagCode.trim().equals("")) {
             tagCode = null;
         }
-        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")){
+        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "operator".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "operationAssistant".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale")) {
             //查询所有
-            if(null!=projectId&&projectId!=0){
+            if (null != projectId && projectId != 0) {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
-        }else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)){
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+        } else if ("designTeamLeader".equals(roleCode) || "planeLeader".equals(roleCode) || "plane".equals(roleCode) || "plan".equals(roleCode) || "shot".equals(roleCode)) {
             //查询自己所在项目下的数据
-            if(null == projectId||projectId == 0){
+            if (null == projectId || projectId == 0) {
                 projectIds = memberService.selectProjectsByUserId(userId);
-            }else{
+            } else {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,null,pageNo,pageSize);
-        }else{
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, null, pageNo, pageSize);
+        } else {
             //查询自己上传的视频
-            if(null!=projectId&&projectId!=0){
+            if (null != projectId && projectId != 0) {
                 projectIds = new ArrayList<>();
                 projectIds.add(projectId);
             }
-            return materialInfoService.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate,userId,pageNo,pageSize);
+            return materialInfoService.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId, pageNo, pageSize);
         }
     }
 
@@ -726,4 +759,5 @@ public class MaterialInfoController {
         result.setResult(pageList);
         return result;
     }
+
 }

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

@@ -149,7 +149,6 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         temp.put("project", projectMember);
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("project_id", projectMember.getProjectId());
-        queryWrapper.eq("account_status", 0);
         queryWrapper.isNotNull("account_id");
         List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
         if (userAllocations.isEmpty()) {

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application.yml

@@ -1,7 +1,7 @@
 spring:
   profiles:
-    active: wps
-#    active: @activatedProperties@
+#    active: wps
+    active: @activatedProperties@
 
 swagger:
   production: false

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

@@ -152,6 +152,9 @@ public class MaterialInfo {
     private BigDecimal cost;
 
     @TableField(exist = false)
+    private BigDecimal bytedanceCost;
+
+    @TableField(exist = false)
     private String realname;
 
     @TableField(exist = false)

+ 6 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialParameterMapper.java

@@ -1,7 +1,9 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.MaterialParameter;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 素材归属标
@@ -12,4 +14,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface MaterialParameterMapper extends BaseMapper<MaterialParameter> {
 
+    JSONObject getMaterialTotalCharge(@Param("signature") String signature);
+
+    JSONObject getByteDanceMaterialTotalCharge(@Param("signature") String signature);
+
 }

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -18,6 +18,8 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
 
     String queryAdvertiserId(@Param("accountId") Long accountId);
 
+    String queryUserIdByAccountId(@Param("accountId") Long accountId);
+
     List<JSONObject> getAccountListByProject(@Param("projectId") Long projectId);
 
     List<JSONObject> getUserIdListByProjectId(@Param("projectId") Long projectId);

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialParameterMapper.xml

@@ -2,4 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.MaterialParameterMapper">
 
+    <select id="getMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(charge) as charges
+        FROM ctop_kuaishou_report_daily_material
+        WHERE signature = #{signature}
+    </select>
+
+    <select id="getByteDanceMaterialTotalCharge" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        signature,
+        sum(cost) as charges
+        FROM ctop_bytedance_video_report_daily
+        WHERE signature = #{signature}
+    </select>
 </mapper>

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -21,6 +21,13 @@
             ctop_user_allocation
         where account_id=#{accountId}
     </select>
+    <select id="queryUserIdByAccountId" resultType="String">
+        select
+            distinct user_id
+        from
+            ctop_user_allocation
+        where account_id=#{accountId}
+    </select>
 
     <select id="getAccountListByProject" resultType="com.alibaba.fastjson.JSONObject">
        select

+ 23 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/IMessageTemplate.java

@@ -1,5 +1,7 @@
 package cn.com.ctop.common.module.service;
 
+import com.alibaba.fastjson.JSONObject;
+
 public interface IMessageTemplate {
 
     String getMaterialSyncTemplate(String projectName, String accountId, String accountName, String materialName, String reason);
@@ -24,5 +26,25 @@ public interface IMessageTemplate {
 
     String getFeishuMaterialRejectTemplate(String projectName, String materialName, String refuseReason);
 
-    String getCreativeOverRunMessage(Long accountId, Integer creativeCount,String authName);
+    String getCreativeOverRunMessage(Long accountId, Integer creativeCount, String authName);
+
+    /**
+     * 获取僵尸创意提醒通知模板
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    String getZombieCreativeRemindTemplate(JSONObject obj);
+
+    /**
+     * 获取僵尸创意关停通知模板
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    String getZombieCreativeShutDownTemplate(JSONObject obj);
 }

+ 64 - 22
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialInfoServiceImpl.java

@@ -1,14 +1,39 @@
 package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.constant.CosConstant;
-import cn.com.ctop.common.module.entity.*;
+import cn.com.ctop.common.module.entity.MaterialAscription;
+import cn.com.ctop.common.module.entity.MaterialCutFrame;
+import cn.com.ctop.common.module.entity.MaterialImageInfo;
+import cn.com.ctop.common.module.entity.MaterialInfo;
+import cn.com.ctop.common.module.entity.MaterialParameter;
+import cn.com.ctop.common.module.entity.MaterialTag;
+import cn.com.ctop.common.module.entity.MaterialTagInfo;
+import cn.com.ctop.common.module.entity.Project;
+import cn.com.ctop.common.module.entity.SupplierWatermark;
+import cn.com.ctop.common.module.entity.TagInfo;
+import cn.com.ctop.common.module.entity.TencentWatermarkTemplate;
+import cn.com.ctop.common.module.entity.VideoWatermarkTask;
 import cn.com.ctop.common.module.enums.MaterialSupplierEnum;
 import cn.com.ctop.common.module.mapper.MaterialAscriptionMapper;
 import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
 import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.mapper.MaterialTagMapper;
-import cn.com.ctop.common.module.service.*;
-import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.common.module.service.IMaterialCutFrameService;
+import cn.com.ctop.common.module.service.IMaterialImageInfoService;
+import cn.com.ctop.common.module.service.IMaterialInfoService;
+import cn.com.ctop.common.module.service.IMaterialTagInfoService;
+import cn.com.ctop.common.module.service.IProjectService;
+import cn.com.ctop.common.module.service.ISupplierWatermarkService;
+import cn.com.ctop.common.module.service.ITagInfoService;
+import cn.com.ctop.common.module.service.ITencentWatermarkTemplateService;
+import cn.com.ctop.common.module.service.IVideoWatermarkTaskService;
+import cn.com.ctop.common.module.utils.AesEncryptUtil;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CloudVideoProcessUtil;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.common.module.utils.ResultMapUtils;
+import cn.com.ctop.common.module.utils.StatusCode;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -32,7 +57,11 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.net.URLDecoder;
 import java.nio.channels.FileChannel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -589,13 +618,13 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
             materialTagInfoService.deleteByCode(code);
             JSONArray modalityTagList = json.getJSONArray("modalityTagList");
-            insertTagList(code,userId,modalityTagList);
+            insertTagList(code, userId, modalityTagList);
             JSONArray contentTagList = json.getJSONArray("contentTagList");
-            insertTagList(code,userId,contentTagList);
+            insertTagList(code, userId, contentTagList);
             JSONArray senceTagList = json.getJSONArray("senceTagList");
-            insertTagList(code,userId,senceTagList);
+            insertTagList(code, userId, senceTagList);
             JSONArray modTagList = json.getJSONArray("modTagList");
-            insertTagList(code,userId,modTagList);
+            insertTagList(code, userId, modTagList);
             getFile(info, project.getMediaId());
             ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         } catch (Exception e) {
@@ -605,17 +634,18 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
         return resultMap;
     }
 
-    private void insertTagList(String code,String userId,JSONArray tagList){
-        if(null!=tagList&&!tagList.isEmpty()){
-            for(int m=0;m<tagList.size();m++){
+    private void insertTagList(String code, String userId, JSONArray tagList) {
+        if (null != tagList && !tagList.isEmpty()) {
+            for (int m = 0; m < tagList.size(); m++) {
                 Long tagId = tagList.getLong(m);
                 TagInfo tagInfo = tagInfoService.getById(tagId);
-                MaterialTagInfo setTag= new MaterialTagInfo(code,tagInfo,userId);
+                MaterialTagInfo setTag = new MaterialTagInfo(code, tagInfo, userId);
                 setTag.setCategoryId(tagInfo.getTagCategoryId());
                 materialTagInfoService.save(setTag);
             }
         }
     }
+
     @Autowired
     private ITagInfoService tagInfoService;
     @Autowired
@@ -676,14 +706,14 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
     }
 
     @Override
-    public Map<String,Object> getListByParams(String tagCode,String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
-        Map<String,Object> result = new HashMap<>();
-        PageHelper.startPage(pageNo,pageSize);
-        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode,type,status,projectIds,materialName,code,startDate,endDate, userId);
+    public Map<String, Object> getListByParams(String tagCode, String type, Integer status, List<Long> projectIds, String materialName, String code, String startDate, String endDate, String userId, Integer pageNo, Integer pageSize) {
+        Map<String, Object> result = new HashMap<>();
+        PageHelper.startPage(pageNo, pageSize);
+        List<MaterialInfo> dailyList = materialInfoMapper.getListByParams(tagCode, type, status, projectIds, materialName, code, startDate, endDate, userId);
         List<MaterialInfo> setList = new ArrayList<>();
         PageInfo<MaterialInfo> pageInfo = new PageInfo<>(dailyList);
-        if(null!=dailyList&&!dailyList.isEmpty()){
-            for(MaterialInfo info:dailyList){
+        if (null != dailyList && !dailyList.isEmpty()) {
+            for (MaterialInfo info : dailyList) {
                 MaterialInfo materialInfo = materialInfoMapper.selectById(info.getId());
                 //判断是否已经同步到快手平台
                 Integer kuaishouMaterialUpCount = this.getKuaishouUpVideoCount(info.getCode());
@@ -699,8 +729,20 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
                 } else {
                     materialInfo.setToutiaoVideoIsUp(0);
                 }
-
-                //TODO 消耗统计
+                //统计快手总消耗数据
+                JSONObject kuaishous = materialParameterMapper.getMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(kuaishous)) {
+                    materialInfo.setCost(kuaishous.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setCost(new BigDecimal(0));
+                }
+                //统计抖音总消耗数据
+                JSONObject bytedances = materialParameterMapper.getByteDanceMaterialTotalCharge(info.getCode());
+                if (!Check.isNull(bytedances)) {
+                    materialInfo.setBytedanceCost(bytedances.getBigDecimal("charges"));
+                } else {
+                    materialInfo.setBytedanceCost(new BigDecimal(0));
+                }
 
                 Project project = projectService.getById(info.getProjectId());
                 if (!Check.isNull(project)) {
@@ -722,8 +764,8 @@ public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, Mat
             }
         }
         pageInfo.setList(setList);
-        result.put("data",pageInfo);
-        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
+        result.put("data", pageInfo);
+        ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 }

+ 37 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MessageTemplateImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.common.module.service.impl;
 
 import cn.com.ctop.common.module.service.IMessageTemplate;
 import cn.com.ctop.common.module.utils.Check;
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.stereotype.Service;
 
 @Service
@@ -108,4 +109,40 @@ public class MessageTemplateImpl implements IMessageTemplate {
                 .append("如有疑问,请联系产品:吴永前。");
         return text.toString();
     }
+
+    @Override
+    public String getZombieCreativeRemindTemplate(JSONObject obj) {
+        StringBuilder text = new StringBuilder();
+        text.append("即将成为僵尸创意预警").append("<br/>")
+                .append("您的项目:").append(obj.getString("projectName"))
+                .append("(").append(obj.getString("projectId")).append(")").append("<br/>")
+                .append("广告计划:").append(obj.getString("campaignName"))
+                .append("(").append(obj.getString("campaignId")).append(")").append("<br/>")
+                .append("广告组:").append(obj.getString("unitName"))
+                .append("(").append(obj.getString("unitId")).append(")").append("<br/>")
+                .append("广告创意:").append(obj.getString("creativeName"))
+                .append("(").append(obj.getString("creativeId")).append(")").append("<br/>")
+                .append("当前创意0消耗即将超过5天").append("<br/>")
+                .append("即将变为僵尸创意").append("<br/>")
+                .append("请您及时查看!");
+        return text.toString();
+    }
+
+    @Override
+    public String getZombieCreativeShutDownTemplate(JSONObject obj) {
+        StringBuilder text = new StringBuilder();
+        text.append("已经成为僵尸创意预警").append("<br/>")
+                .append("您的项目:").append(obj.getString("projectName"))
+                .append("(").append(obj.getString("projectId")).append(")").append("<br/>")
+                .append("广告计划:").append(obj.getString("campaignName"))
+                .append("(").append(obj.getString("campaignId")).append(")").append("<br/>")
+                .append("广告组:").append(obj.getString("unitName"))
+                .append("(").append(obj.getString("unitId")).append(")").append("<br/>")
+                .append("广告创意:").append(obj.getString("creativeName"))
+                .append("(").append(obj.getString("creativeId")).append(")").append("<br/>")
+                .append("当前创意0消耗已经超过5天").append("<br/>")
+                .append("已经变为僵尸创意,且已被关停").append("<br/>")
+                .append("请您及时查看!");
+        return text.toString();
+    }
 }

+ 2 - 1
module-job-bytedance/src/main/java/cn/com/ctop/job/bytedance/handler/WechatAttendanceJob.java

@@ -4,6 +4,7 @@ package cn.com.ctop.job.bytedance.handler;
 import cn.com.ctop.oa.modules.service.IWechatCheckinDataService;
 import cn.com.ctop.oa.modules.service.IWechatUserListService;
 import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.enums.NoEn;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.xxl.job.core.log.XxlJobLogger;
 import org.jeecg.common.util.DateUtils;
@@ -30,7 +31,7 @@ public class WechatAttendanceJob {
     @XxlJob("wechatAttendanceJob")
     public ReturnT<String> execute(String params) throws Exception {
         XxlJobLogger.log("--------考勤和人员数据入库 start ");
-        String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()));
+        String beforeDay = DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO1.valueInt());
         long starttime = DateUtils.timeToStamp(beforeDay + " 00:00:00");
         long endtime = DateUtils.timeToStamp(beforeDay + " 23:59:59");
         //更新员工打卡明细表

+ 28 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyZombieJob.java

@@ -0,0 +1,28 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouZombieCreativeService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 更新僵尸计划数据
+ *
+ * @author jeecg-boot
+ */
+@Component
+public class KuaishouDailyZombieJob {
+    @Autowired
+    private IKuaishouZombieCreativeService kuaishouZombieCreativeService;
+
+    @XxlJob("kuaishouDailyZombie")
+    public ReturnT<String> execute(String param) throws Exception {
+        XxlJobLogger.log("更新僵尸计划数据 start");
+        kuaishouZombieCreativeService.checkZombieProject();
+        XxlJobLogger.log("更新僵尸计划数据 end");
+        return ReturnT.SUCCESS;
+    }
+
+}

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

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.batch.mapper;
 
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -19,4 +20,6 @@ public interface KuaiShouCreativeMapper extends BaseMapper<KuaiShouCreative> {
     Integer checkCreativeCount(@Param("accountId") Long accountId, @Param("unitId") Long unitId);
 
     Integer getCreateCount(Long accountId, String startTime);
+
+    List<JSONObject> checkZombieProject(String date);
 }

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

@@ -23,4 +23,5 @@ public interface KuaiShouReportDailyMaterialMapper extends BaseMapper<KuaiShouRe
     VideoGetvo getVideoGetByPhotoId(@Param("photoId") Long photoId);
 
     List<KuaiShouReportDailyMaterialVo> getPhotoListByDate(@Param("statDate") String statDate);
+
 }

+ 24 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaiShouCreativeMapper.xml

@@ -103,5 +103,28 @@
    AND create_channel = 1;
     </select>
 
-
+    <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.id,
+        t1.account_id AS accountId,
+        t1.creative_id AS creativeId,
+        t1.creative_name AS creativeName,
+        t1.campaign_id AS campaignId,
+        t4.campaign_name AS campaignName,
+        t1.unit_id AS unitId,
+        t5.unit_name AS unitName,
+        t3.id AS projectId,
+        t3.project_name AS projectName,
+        t2.user_id AS userId
+        FROM
+        ctop_kuaishou_creative t1
+        LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+        LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        LEFT JOIN ctop_kuaishou_campaign t4 ON t1.campaign_id = t4.campaign_id
+        LEFT JOIN ctop_kuaishou_group t5 ON t1.unit_id = t5.unit_id
+        WHERE
+        creative_create_time &lt;= #{date}
+        AND t1. STATUS = 42
+        and t1.put_status = 1
+    </select>
 </mapper>

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

@@ -108,16 +108,16 @@
     </insert>
 
     <select id="getPhotoList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterialVo">
-           select
-           id as id,
-           photo_id as photoId
-           from
-           ctop_kuaishou_report_daily_material
-           where account_id = #{accountId}
-           <if test="statDate != null and statDate != '' ">
-               and stat_date = #{statDate}
-           </if>
-           group by photo_id
+        select
+        id as id,
+        photo_id as photoId
+        from
+        ctop_kuaishou_report_daily_material
+        where account_id = #{accountId}
+        <if test="statDate != null and statDate != '' ">
+            and stat_date = #{statDate}
+        </if>
+        group by photo_id
 
     </select>
 
@@ -143,5 +143,4 @@
       limit 1
     </select>
 
-
 </mapper>

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

@@ -1,8 +1,11 @@
 package cn.com.ctop.kuaishou.modules.batch.service;
 
 import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouReportDailyMaterial;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 素材
  * @Author: jeecg-boot

+ 25 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/CollectionSlogansServiceImpl.java

@@ -30,14 +30,16 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
         CollectionSlogans co = new CollectionSlogans();
         String userId = requestJson.getString("userId");
         Long accountId = requestJson.getLong("accountId");
-        if (!Check.isNull(requestJson.getJSONArray("coverSlogansList"))) {
+        JSONArray coverSlogansList = requestJson.getJSONArray("coverSlogansList");
+        JSONArray captionsList = requestJson.getJSONArray("captionsList");
+        if (!Check.isNull(coverSlogansList)) {
             //封面广告语
             co.setType(NoEn.NO1.valueStr());
-            co.setValue(requestJson.getJSONArray("coverSlogansList").toString());
+            co.setValue(coverSlogansList.toString());
         }
-        if (!Check.isNull(requestJson.getJSONArray("captionsList"))) {
+        if (!Check.isNull(captionsList)) {
             co.setType(NoEn.NO2.valueStr());
-            co.setValue(requestJson.getJSONArray("captionsList").toString());
+            co.setValue(captionsList.toString());
         }
         co.setAccountId(accountId);
         co.setUserId(userId);
@@ -45,6 +47,25 @@ public class CollectionSlogansServiceImpl extends ServiceImpl<CollectionSlogansM
         if (!Check.isNull(slogansJson)) {
             QueryWrapper<CollectionSlogans> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("id", slogansJson.getInteger("id"));
+            //如果入参中type为delete,则只做修改操作,否则需要判断已有数据和入参数据不能重复
+            if (!"delete".equals(requestJson.getString("type"))) {
+                JSONArray value = slogansJson.getJSONArray("value");
+                if (NoEn.NO1.valueStr().equals(co.getType())) {
+                    for (int i = 0; i < coverSlogansList.size(); i++) {
+                        if (!value.contains(coverSlogansList.get(i))) {
+                            value.add(coverSlogansList.get(i));
+                        }
+                    }
+                    co.setValue(value.toString());
+                } else {
+                    for (int i = 0; i < captionsList.size(); i++) {
+                        if (!value.contains(captionsList.get(i))) {
+                            value.add(captionsList.get(i));
+                        }
+                    }
+                    co.setValue(value.toString());
+                }
+            }
             collectionSlogansMapper.update(co, queryWrapper);
         } else {
             collectionSlogansMapper.insert(co);

+ 81 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouZombieCreative.java

@@ -0,0 +1,81 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-14
+ */
+@Data
+@TableName("ctop_kuaishou_zombie_creative")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_zombie_creative对象", description = "僵尸计划记录")
+public class KuaishouZombieCreative {
+
+    /**
+     * 编号
+     */
+    @TableId(type = IdType.INPUT)
+    @ApiModelProperty(value = "编号")
+    private Integer id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 创意ID
+     */
+    @Excel(name = "创意ID", width = 15)
+    @ApiModelProperty(value = "创意ID")
+    private Long creativeId;
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称", width = 15)
+    @ApiModelProperty(value = "创意名称")
+    private String creativeName;
+    /**
+     * 记录时间
+     */
+    private String recordTime;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+    /**
+     * 状态 0-是僵尸计划,1-无效,不是
+     */
+    @Excel(name = "状态 0-待确认,1-是僵尸计划,2-不是僵尸计划", width = 15)
+    @ApiModelProperty(value = "状态 0-待确认,1-是僵尸计划,2-不是僵尸计划")
+    private String status;
+}

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

@@ -20,4 +20,6 @@ public interface KuaishouReportDailyCreativeMapper extends BaseMapper<KuaishouRe
     KuaiShouCleanMaterialReport calculationMaterialReport(@Param("signature") String signature);
 
     void loadProgramCreativeDailyReport(@Param("accountId") Long accountId, @Param("localPath") String localPath);
+
+    List<JSONObject> checkZombieProject(@Param("date") String date);
 }

+ 15 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouZombieCreativeMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author: jeecg-boot
+ * @date: 2020-10-14
+ * @cersion: V1.0
+ */
+public interface KuaishouZombieCreativeMapper extends BaseMapper<KuaishouZombieCreative> {
+
+}

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KsVideoReportMapper.xml

@@ -32,7 +32,7 @@
         GROUP BY t1.signature
         ) t
         WHERE t.clip like '%${clip}%'
-        AND t.shot like '%${shot}%'
+        AND (t.shot LIKE '%%' or t.shot is null)
         AND t.plan like '%${plan}%'
         ORDER BY ${target} ${order}
     </select>

+ 24 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml

@@ -281,4 +281,28 @@
         signature = #{signature}
     </select>
 
+
+    <select id="checkZombieProject" resultType="com.alibaba.fastjson.JSONObject">
+      SELECT *FROM
+		(SELECT
+			count(t1.stat_date) AS dates,
+			sum(t1.charge) AS charge,
+			t1.account_id AS accountId,
+			t1.creative_id AS creativeId,
+			t1.creative_name AS creativeName,
+			t1.campaign_id AS campaignId,
+			t1.campaign_name AS campaignName,
+			t1.unit_id AS unitId,
+			t1.unit_name AS unitName,
+			t3.id AS projectId,
+			t3.project_name AS projectName,
+			t2.user_id as userId
+		FROM
+			ctop_kuaishou_report_daily_creative t1
+		LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+		LEFT JOIN ctop_project t3 ON t2.project_id = t3.id
+        where stat_date >= #{date}
+        GROUP BY t1.account_id,t1.creative_id) as t
+      WHERE t.dates = 5 and t.charge = 0
+    </select>
 </mapper>

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouZombieCreativeMapper.xml

@@ -0,0 +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="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouZombieCreativeMapper">
+
+</mapper>

+ 22 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouZombieCreativeService.java

@@ -0,0 +1,22 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 僵尸计划记录
+ * @Author: jeecg-boot
+ * @Date: 2020-10-14
+ * @Version: V1.0
+ */
+public interface IKuaishouZombieCreativeService extends IService<KuaishouZombieCreative> {
+    /**
+     * 统计僵尸计划
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    void checkZombieProject();
+}

+ 296 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouZombieCreativeServiceImpl.java

@@ -0,0 +1,296 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.entity.CtopOauthToken;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.service.IMessageTemplate;
+import cn.com.ctop.common.module.service.ISendMessageService;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCreativeMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouUpdateService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouZombieCreative;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouZombieCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouZombieCreativeService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.xxl.job.core.enums.NoEn;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 僵尸计划记录
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-14
+ */
+@Service
+public class KuaishouZombieCreativeServiceImpl extends ServiceImpl<KuaishouZombieCreativeMapper, KuaishouZombieCreative> implements IKuaishouZombieCreativeService {
+    @Autowired
+    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
+    @Autowired
+    private KuaishouZombieCreativeMapper kuaishouZombieCreativeMapper;
+    @Autowired
+    private KuaiShouCreativeMapper kuaiShouCreativeMapper;
+    @Autowired
+    private ISendMessageService sendMessageService;
+    @Autowired
+    private IMessageTemplate messageTemplate;
+    @Autowired
+    private UserAllocationMapper userAllocationMapper;
+    @Autowired
+    private ICtopOauthTokenService oauthTokenService;
+    @Autowired
+    private IKuaiShouUpdateService kuaiShouUpdateService;
+
+    /**
+     * 筛选僵尸计划
+     * 逻辑简述:
+     * 1、以当天时间为节点,往前取五天的数据,若创意消耗(花费)都为0,则获取其数据,并insert为待确认状态的僵尸创意。
+     * 2、获取前一天存储的待确认僵尸计划
+     * 3、步骤二和步骤一的数据作比对筛选,若两组数据都含有该创意时,并且为了保证数据的准确性,还需调用API接口获取当天实时消耗明细,
+     * 若消耗不为0,则表明为真正的僵尸创意,3.1关停创意;3.2然后发送“关停通知”消息;3.3最后更新其状态。
+     * 4、步骤二存在,步骤一不存在说明创意已经活跃,更新其状态为“2”已活跃、反之则是新的待确认僵尸创意,作insert操作
+     * 5、insert操作时,考虑到数据重复的问题,需先查询全部僵尸计划,作筛选比对,已有则更新,否则就新增。
+     * **凡insert数据皆为状态0,待确认僵尸创意,且要发送“提醒通知”。
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+
+    @Override
+    public void checkZombieProject() {
+        //获取五天前的日期 yyyy-MM-dd
+        String date = DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO5.valueInt());
+        //查询五天内花费都为0的数据集
+        List<JSONObject> list = kuaishouReportDailyCreativeMapper.checkZombieProject(date);
+        //查询审核未通过且超过5天的创意集
+        List<JSONObject> olist = kuaiShouCreativeMapper.checkZombieProject(date);
+        if (Check.isNull(list) && Check.isNull(olist)) {
+            return;
+        } else {
+            list.addAll(olist);
+        }
+        //查询数据库中前一天存储的待确认僵尸创意集
+        Map<String, Object> map = new HashMap<>();
+        map.put("record_time", DateUtils.getLastDay(DateUtils.formatDate(new Date()), NoEn.NO1.valueInt()));
+        map.put("status", NoEn.NO0.valueStr());
+        List<KuaishouZombieCreative> zombieCreatives = kuaishouZombieCreativeMapper.selectByMap(map);
+        if (!Check.isNull(zombieCreatives)) {
+            List<KuaishouZombieCreative> zombiePlans = new ArrayList<>();
+            List<JSONObject> zombieList = new ArrayList<>();
+            //通过账户和创意ID,筛选出确认的僵尸计划账户
+            zombieCreatives.forEach(zombie -> {
+                list.forEach(obj -> {
+                    if (zombie.getAccountId() - obj.getInteger("accountId") == 0 && zombie.getCreativeId() - obj.getInteger("creativeId") == 0) {
+                        QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                        wrapper.eq("id", zombie.getId());
+                        CtopOauthToken token = oauthTokenService.getTokenByAccountId(zombie.getAccountId());
+                        //校验当天是不是依旧不活跃,是则关停,否则更新激活状态
+                        if (isActivation(token, zombie.getCreativeId())) {
+                            //3.1关停创意
+                            Map<String, Object> updateMap = kuaiShouUpdateService.updateCreativeStatus(token.getAccessToken(), zombie.getAccountId(), zombie.getCreativeId(), NoEn.NO2.valueInt(), obj.getString("userId"));
+                            if (!Check.isNull(updateMap) && (boolean) updateMap.get("success")) {
+                                //3.2发送创意关停通知
+                                sendMsg(NoEn.NO2.valueStr(), obj);
+                            }
+                            zombie.setStatus(NoEn.NO1.valueStr());
+                            //记录已确认的僵尸计划集
+                            zombiePlans.add(zombie);
+                            zombieList.add(obj);
+                        } else {
+                            zombie.setStatus(NoEn.NO2.valueStr());
+                        }
+                        //3.3更新状态
+                        kuaishouZombieCreativeMapper.update(zombie, wrapper);
+                        //校验数据为审核未通过数据,并将投放状态设为“暂停”
+                        if (Check.isNull(obj.getInteger("dates"))) {
+                            QueryWrapper<KuaiShouCreative> creativeWrapper = new QueryWrapper<>();
+                            creativeWrapper.eq("id", obj.getString("id"));
+                            KuaiShouCreative creative = new KuaiShouCreative();
+                            //投放状态 1:投放中;2:暂停
+                            creative.setPutStatus(NoEn.NO2.valueInt());
+                            kuaiShouCreativeMapper.update(creative, creativeWrapper);
+                        }
+                    }
+                });
+            });
+            //过滤掉已确认的僵尸数据,剩余活跃的计划
+            zombieCreatives.removeAll(zombiePlans);
+            //更新计划状态为已活跃
+            zombieCreatives.forEach(zom -> {
+                QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                wrapper.eq("id", zom.getId());
+                //状态 0-待确认,1-是僵尸计划,2-已活跃,不是僵尸计划
+                zom.setStatus(NoEn.NO2.valueStr());
+                kuaishouZombieCreativeMapper.update(zom, wrapper);
+            });
+            //过滤掉已确认的数据,新增新一批的僵尸计划
+            list.removeAll(zombieList);
+            insertorUpdate(list);
+        } else {
+            insertorUpdate(list);
+        }
+    }
+
+    /**
+     * 筛选僵尸计划数据,新增或更新操作
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void insertorUpdate(List<JSONObject> list) {
+        //查询库中已有的全部数据
+        List<KuaishouZombieCreative> kuaishouZombieCreatives = kuaishouZombieCreativeMapper.selectList(null);
+        if (!Check.isNull(kuaishouZombieCreatives)) {
+            List<KuaishouZombieCreative> updateList = new ArrayList<>();
+            List<JSONObject> toBeDeleted = new ArrayList<>();
+            //待新增的和库中数据对比筛选,选出相同账户和相同创意的数据
+            list.forEach(obj -> {
+                kuaishouZombieCreatives.forEach(zom -> {
+                    if (zom.getAccountId() - obj.getInteger("accountId") == 0 && zom.getCreativeId() - obj.getInteger("creativeId") == 0) {
+                        updateList.add(zom);
+                        toBeDeleted.add(obj);
+                    }
+                });
+            });
+            //已有的数据作更新操作
+            if (!Check.isNull(updateList)) {
+                updateList.forEach(zom -> {
+                    QueryWrapper<KuaishouZombieCreative> wrapper = new QueryWrapper<>();
+                    wrapper.eq("id", zom.getId());
+                    zom.setStatus(NoEn.NO0.valueStr());
+                    zom.setRecordTime(DateUtils.getNowDate(DateUtils.WEB_FORMAT));
+                    kuaishouZombieCreativeMapper.update(zom, wrapper);
+                });
+            }
+            //去除已有的数据,新的数据作insert
+            list.removeAll(toBeDeleted);
+            insert(list);
+        } else {
+            insert(list);
+        }
+    }
+
+    /**
+     * 新增待确认僵尸数据,并发送消息通知
+     * userAllocation
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void insert(List<JSONObject> list) {
+        list.forEach(obj -> {
+            KuaishouZombieCreative create = new KuaishouZombieCreative();
+            create.setAccountId(obj.getLong("accountId"));
+            create.setCreativeId(obj.getLong("creativeId"));
+            create.setCreativeName(obj.getString("creativeName"));
+            create.setRecordTime(DateUtils.getNowDate(DateUtils.WEB_FORMAT));
+            //状态 0-待确认,1-是僵尸计划,2-已活跃,不是僵尸计划
+            create.setStatus(NoEn.NO0.valueStr());
+            kuaishouZombieCreativeMapper.insert(create);
+            sendMsg(NoEn.NO1.valueStr(), obj);
+        });
+    }
+
+    /**
+     * 发送消息通知
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void sendMsg(String type, JSONObject obj) {
+        String userId = userAllocationMapper.queryUserIdByAccountId(obj.getLong("accountId"));
+        String message = "";
+        if (NoEn.NO1.valueStr().equals(type)) {
+            //提醒通知
+            message = messageTemplate.getZombieCreativeRemindTemplate(obj);
+        } else {
+            //关停通知
+            message = messageTemplate.getZombieCreativeShutDownTemplate(obj);
+        }
+        sendMessageService.sendMessage(userId, message);
+    }
+
+    /**
+     * 检查创意是否激活
+     *
+     * @param
+     * @return boolean
+     * @throws
+     * @author ZHAOXA
+     */
+    private boolean isActivation(CtopOauthToken oauthToken, long creativeId) {
+        boolean flag = true;
+        try {
+            JSONArray creativeIds = new JSONArray();
+            creativeIds.add(creativeId);
+            JSONObject info = getAdvertiserCreativeReportDailyInfo(oauthToken, new Date(), new Date(), creativeIds);
+            if (!Check.isNull(info) && !Check.isNull(info.getBigDecimal("charge"))) {
+                flag = false;
+            }
+        } catch (Exception e) {
+            log.error("校验创意是否激活,异常", e);
+            //异常时,默认为激活状态
+            flag = false;
+        }
+        return flag;
+    }
+
+    private JSONObject getAdvertiserCreativeReportDailyInfo(CtopOauthToken token, Date startDate, Date endDate, JSONArray creativeIds) throws Exception {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.CREATIVE_REPORT;
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+        Map<String, Object> param = new HashMap<String, Object>();
+        if (!Check.isNull(startDate)) {
+            param.put("start_date", DateUtils.formatDate(startDate));
+        }
+        if (!Check.isNull(endDate)) {
+            param.put("end_date", DateUtils.formatDate(endDate));
+        }
+        if (!Check.isNull(creativeIds) && creativeIds.size() > 0) {
+            param.put("creative_ids", creativeIds);
+
+        }
+        param.put("advertiser_id", token.getAccountId());
+        param.put("temporal_granularity", "DAILY");
+
+        String result = HttpUtils.httpPostRequest(url, param, headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+        Integer code = resultJson.getInteger("code");
+        String message = resultJson.getString("message");
+        if (null == code || code != 0) {
+            throw new Exception("获取快手广告创意分天报表异常:" + message + ",accountId:" + token.getAccountId());
+        }
+        JSONArray details = resultJson.getJSONObject("data").getJSONArray("details");
+        if (null == details || details.size() <= 0) {
+            return null;
+        }
+        return (JSONObject) details.get(0);
+    }
+
+
+}

+ 1 - 1
module-oa/src/main/java/cn/com/ctop/oa/modules/service/impl/WechatNoListServiceImpl.java

@@ -356,7 +356,7 @@ public class WechatNoListServiceImpl extends ServiceImpl<WechatNoListMapper, Wec
                 Integer dur = Integer.valueOf(attendance.getStateDuration().replace(" min", ""));
                 if (dur - 60 >= 0) {
                     String checkinDate = attendance.getCheckinDate();
-                    String lastDay = DateUtils.getLastDay(checkinDate);
+                    String lastDay = DateUtils.getLastDay(checkinDate, NoEn.NO1.valueInt());
                     Map<String, Object> map = new HashMap<>();
                     map.put("userId", attendance.getUserId());
                     map.put("checkinDate", lastDay);

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceVideoReportMapper.xml

@@ -32,7 +32,7 @@
         GROUP BY t1.signature
         ) t
         WHERE t.clip like '%${clip}%'
-        AND t.shot like '%${shot}%'
+        AND (t.shot LIKE '%%' or t.shot is null)
         AND t.plan like '%${plan}%'
         ORDER BY ${target} ${order}
     </select>