ソースを参照

Merge remote-tracking branch 'origin/master'

zhaoxian 4 年 前
コミット
8bca91e554
23 ファイル変更744 行追加132 行削除
  1. 0 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 50 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  3. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagInfoController.java
  4. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java
  5. 61 45
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  6. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysBaseApiImpl.java
  7. 86 35
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  8. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  9. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ImageCostVO.java
  10. 123 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVOEntity.java
  11. 23 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java
  12. 152 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVOEntity.java
  13. 3 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java
  14. 10 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  15. 8 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  16. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java
  17. 100 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml
  18. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java
  19. 16 7
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java
  20. 73 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  21. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceFundDailyServiceImpl.java
  22. 5 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java
  23. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

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

@@ -116,25 +116,9 @@ public class AdvertiserController {
                                                    @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize,
                                                    HttpServletRequest req) {
         Result<IPage<Advertiser>> result = new Result<>();
-        // String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
-      /*  String userId = advertiser.getUserId();
-        if (CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || roleCode.contains("sale") || "meidaManager".equals(roleCode)) {
-            advertiser.setUserId(null);
-        }*/
-
         String name = advertiser.getName();
         advertiser.setName(null);
         QueryWrapper<Advertiser> queryWrapper = QueryGenerator.initQueryWrapper(advertiser, req.getParameterMap());
-       /* if ("kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode)) {
-            QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
-            userCompanyQueryWrapper.eq("user_id", userId);
-            userCompanyQueryWrapper.orderByDesc("create_time");
-            userCompanyQueryWrapper.last("limit 1");
-            UserCompany userCompany = userCompanyMapper.selectOne(userCompanyQueryWrapper);
-            if (!Check.isNull(userCompany)) {
-                queryWrapper.eq("company_id", userCompany.getCompanyId());
-            }
-        }*/
         if (!Check.isNull(name)) {
             queryWrapper.like("name", name);
         }

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

@@ -1,11 +1,26 @@
 package org.jeecg.modules.ctop.controller;
 
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.vo.BytedanceImageCostVOEntity;
+import cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity;
+import cn.com.ctop.common.module.vo.SheetInfoVo;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportMaterialDailyService;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelWriter;
+import com.alibaba.excel.metadata.Sheet;
 import com.alibaba.fastjson.JSONObject;
+import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.ctop.service.IImageReportDailyService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
 import java.util.Map;
 
 @RestController
@@ -20,8 +35,42 @@ public class ImageCostController {
         return imageReportDailyService.bytedanceImageCost(data);
     }
 
+    @PostMapping("bytedance/cost/export")
+    public void bytedanceImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
+
+        SheetInfoVo vo = imageReportDailyService.getbytedanceImageCostVo(data);
+        OutputStream outputStream = response.getOutputStream();
+        String date = DateUtils.formatDate(new Date());
+        HttpUtils.setResponseHeader(response, "头条图片消耗报表" + date + ".xlsx");
+        ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
+        Sheet sheet = new Sheet(1, 0, BytedanceImageCostVOEntity.class);
+        sheet.setSheetName(vo.getSheetName());
+        excelWriter.write(vo.getDetails(), sheet);
+
+        excelWriter.finish();
+        outputStream.flush();
+        outputStream.close();
+    }
+
     @PostMapping("kuaishou/cost")
     public Map<String,Object> kuaishouImageCost(@RequestBody JSONObject data){
         return imageReportDailyService.kuaishouImageCost(data);
     }
+
+    @PostMapping("kuaishou/cost/export")
+    public void kuaishouImageCostExport(@RequestBody JSONObject data, HttpServletResponse response) throws IOException {
+        SheetInfoVo vo = imageReportDailyService.getkuaishouImageCostVo(data);
+        OutputStream outputStream = response.getOutputStream();
+        String date = DateUtils.formatDate(new Date());
+        HttpUtils.setResponseHeader(response, "快手图片消耗报表" + date + ".xlsx");
+        ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
+        Sheet sheet = new Sheet(1, 0, KuaishouImageCostVOEntity.class);
+        sheet.setSheetName(vo.getSheetName());
+        excelWriter.write(vo.getDetails(), sheet);
+        excelWriter.finish();
+        outputStream.flush();
+        outputStream.close();
+    }
+
+
 }

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

@@ -50,7 +50,6 @@ public class MaterialTagInfoController {
 		Result<IPage<MaterialTagInfo>> result = new Result<>();
 		QueryWrapper<MaterialTagInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialTagInfo, req.getParameterMap());
 		Page<MaterialTagInfo> page = new Page<>(pageNo, pageSize);
-		queryWrapper.eq("status",1);
 		IPage<MaterialTagInfo> pageList = materialTagInfoService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);

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

@@ -1,5 +1,6 @@
 package org.jeecg.modules.ctop.service;
 
+import cn.com.ctop.common.module.vo.SheetInfoVo;
 import com.alibaba.fastjson.JSONObject;
 
 import java.util.Map;
@@ -8,4 +9,8 @@ public interface IImageReportDailyService {
     Map<String,Object> bytedanceImageCost(JSONObject data);
 
     Map<String, Object> kuaishouImageCost(JSONObject data);
+
+    SheetInfoVo getkuaishouImageCostVo(JSONObject data);
+
+    SheetInfoVo getbytedanceImageCostVo(JSONObject data);
 }

+ 61 - 45
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java

@@ -1,11 +1,9 @@
 package org.jeecg.modules.ctop.service.impl;
 
-import cn.com.ctop.common.module.entity.MaterialImageInfo;
-import cn.com.ctop.common.module.entity.SysUser;
-import cn.com.ctop.common.module.service.IMaterialImageInfoService;
 import cn.com.ctop.common.module.utils.ResultMapUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO;
+import cn.com.ctop.common.module.vo.*;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceReportMaterialDailyMapper;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -16,13 +14,19 @@ import org.jeecg.modules.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 @Service
 public class ImageReportDailyServiceImpl implements IImageReportDailyService {
+    @Autowired
+    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
+    @Autowired
+    private ISysUserService sysUserService;
+
 
     @Override
     public Map<String,Object> bytedanceImageCost(JSONObject data) {
@@ -52,29 +56,38 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
         }
         PageHelper.startPage(pageNumber,pageSize);
-        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
-        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
-        if(null!=vos&&!vos.isEmpty()){
-            List<ImageCostVO>setVos = new ArrayList<>();
-            for(ImageCostVO vo:vos){
-                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
-                if(null!=imageInfo){
-                    vo.setUserId(imageInfo.getUserId());
-                    SysUser user = sysUserService.getById(imageInfo.getUserId());
-                    vo.setUserName(user.getUsername());
-                }else{
-                    vo.setUserName("-");
-                }
-                setVos.add(vo);
-            }
-            pageInfo.setList(setVos);
-        }
+        List<BytedanceImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code.trim());
+        PageInfo<BytedanceImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
     @Override
+    public SheetInfoVo getbytedanceImageCostVo(JSONObject data) {
+        SheetInfoVo sheetInfoVo = new SheetInfoVo<BytedanceImageCostVOEntity>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        List<BytedanceImageCostVOEntity>details = bytedanceReportMaterialDailyMapper.bytedanceImageCostEntity(startDate,endDate,accountList,code.trim());
+        sheetInfoVo.setDetails(details);
+        return sheetInfoVo;
+    }
+
+    @Override
     public Map<String, Object> kuaishouImageCost(JSONObject data) {
         Map<String,Object>result = new HashMap<>();
         String startDate = data.getString("startDate");
@@ -102,32 +115,35 @@ public class ImageReportDailyServiceImpl implements IImageReportDailyService {
             pageSize = 10;
         }
         PageHelper.startPage(pageNumber,pageSize);
-        List<ImageCostVO> vos = bytedanceReportMaterialDailyMapper.bytedanceImageCost(startDate,endDate,accountList,code,(pageNumber-1)*pageSize,pageSize);
-        PageInfo<ImageCostVO> pageInfo = new PageInfo<>(vos);
-        if(null!=vos&&!vos.isEmpty()){
-            List<ImageCostVO>setVos = new ArrayList<>();
-            for(ImageCostVO vo:vos){
-                MaterialImageInfo imageInfo = imageInfoService.getByCode(vo.getSignature());
-                if(null!=imageInfo){
-                    vo.setUserId(imageInfo.getUserId());
-                    SysUser user = sysUserService.getById(imageInfo.getUserId());
-                    vo.setUserName(user.getUsername());
-                }else{
-                    vo.setUserName("-");
-                }
-                setVos.add(vo);
-            }
-            pageInfo.setList(setVos);
-        }
+        List<KuaishouImageCostVO> vos = kuaishouReportDailyImageMapper.imageCost(startDate,endDate,accountList,code.trim());
+        PageInfo<KuaishouImageCostVO> pageInfo = new PageInfo<>(vos);
         result.put("data",pageInfo);
         ResultMapUtils.setResultMap(result, StatusCode.COMMON_SUCCESS);
         return result;
     }
 
-    @Autowired
-    private IMaterialImageInfoService imageInfoService;
-    @Autowired
-    private BytedanceReportMaterialDailyMapper bytedanceReportMaterialDailyMapper;
-    @Autowired
-    private ISysUserService sysUserService;
+    @Override
+    public SheetInfoVo getkuaishouImageCostVo(JSONObject data) {
+        SheetInfoVo sheetInfoVo = new SheetInfoVo<KuaishouImageCostVOEntity>();
+        String startDate = data.getString("startDate");
+        if(null == startDate||startDate.trim().equals("")){
+            startDate = null;
+        }
+        String endDate = data.getString("endDate");
+        if(null == endDate||endDate.trim().equals("")){
+            endDate = null;
+        }
+        JSONArray accountList = data.getJSONArray("accountList");
+        if(null==accountList||accountList.isEmpty()){
+            accountList = null;
+        }
+        String code = data.getString("code");
+        if(null == code||code.trim().equals("")){
+            code = null;
+        }
+        sheetInfoVo.setSheetName("快手图片消耗统计");
+        List<KuaishouImageCostVOEntity> details = kuaishouReportDailyImageMapper.imageCostEntity(startDate,endDate,accountList,code.trim());
+        sheetInfoVo.setDetails(details);
+        return sheetInfoVo;
+    }
 }

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

@@ -122,7 +122,7 @@ public class SysBaseApiImpl implements ISysBaseApi {
 	}
 
 	@Override
-	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
+//	@Cacheable(cacheNames=CacheConstant.SYS_USERS_CACHE, key="#username")
 	public LoginUser getUserByName(String username) {
 		if(oConvertUtils.isEmpty(username)) {
 			return null;

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

@@ -13,12 +13,13 @@ import cn.com.ctop.common.module.service.IUReportExportService;
 import cn.com.ctop.common.module.service.IUReportService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyReportTaskService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyAgentService;
-import cn.com.ctop.shiwan.modules.service.IShiwanFileUploadService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceVideoReportDailyService;
+import cn.com.ctop.toutiao.modules.report.service.IBytedanceFundDailyService;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -40,6 +41,8 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
+import static org.jeecg.common.util.DateUtils.getAnotherDay;
+
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
 @ActiveProfiles("wps")
@@ -135,13 +138,72 @@ public class SampleTest {
     public void testLoadBytedanceData() {
         List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
         for (UserAllocation allocation : allocations) {
-//            for (int i = 2; i < 10; i++) {
-            CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
-            Date getDate = DateUtils.addDay(new Date(), 0);
+            System.out.println(allocation.getAccountId());
+            for (int i = 0; i < 1; i++) {
+                CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
+                Date getDate = DateUtils.addDay(new Date(), -i);
 //                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
-//            }
+                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+
+//                reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//                reportService.getAdvertiserCampaignReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+            }
+        }
+    }
+
+    @Test
+    public void loadBytedancePlanData(){
+        CtopOauthToken token = tokenService.getTokenByAccountId(100198696723L);
+//        advertiserDataService.getAdvertiserPlan(token, "", null, null);
+        Date getDate = DateUtils.addDay(new Date(), 0);
+        reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_HOURLY);
+    }
+
+    @Autowired
+    private IBytedanceFundDailyService bytedanceFundDailyService;
+    @Test
+    public void loadFoudData() {
+        List<CtopOauthToken> tokens = tokenService.selectToutiaoToken();
+        for (CtopOauthToken token : tokens) {
+            System.out.println(token.getAccountId()+"############################");
+            for(int i=20;i<130;i++){
+                Date date = DateUtils.addDay(new Date(),-i);
+                bytedanceFundDailyService.loadFundDataByPage(token, DateUtils.formatDate(date), DateUtils.formatDate(date),1);
+                System.out.println(i+"############################");
+            }
+        }
+    }
+
+    @Autowired
+    private IKuaiShouHistoryReportTaskService reportTaskService;
+
+    /**
+     * 测试获取快手图片消耗数据任务
+     */
+    @Test
+    public void loadKuaishouImageTask(){
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        for(int i=1;i<130;i++) {
+            Date getDate = DateUtils.addDay(new Date(), -i);
+            String getDateStr = DateUtils.formatDate(getDate);
+            tokens.forEach(token -> reportTaskService.createTask(token.getAccountId(), token.getAccessToken(), getDateStr, getDateStr, CtopAdConstant.KUAISHOU_LOAD_JOB_TYPE_DAILY));
+        }
+    }
+
+    @Autowired
+    private IKuaiShouDailyReportTaskService dailyReportTaskService;
+    /**
+     * 测试获取快手图片消耗数据入库
+     */
+    @Test
+    public void loadKuaishouImageTaskFile(){
+        String nowDate = DateUtils.getDate("yyyy-MM-dd");
+        List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
+        for(int i=1;i<15;i++){
+            String statDate = getAnotherDay("yyyy-MM-dd", nowDate, -i);
+            tokens.forEach(token -> dailyReportTaskService.getTaskList(token.getAccountId(), token.getAccessToken(), statDate));
         }
+        //  查询快手token
     }
 
     @Test
@@ -180,11 +242,11 @@ public class SampleTest {
     public void loadAccountData() {
 //        List<UserAllocation> allocations = allocationService.getByParams(776L,null,0);
 //        for (UserAllocation allocation:allocations) {
-        CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
-        for (int i = 92; i < 100; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-        }
+            CtopOauthToken token = tokenService.getTokenByAccountId(93238965516L);
+            for(int i=92;i<100;i++){
+                Date getDate = DateUtils.addDay(new Date(),-i);
+                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            }
 //        }
     }
 
@@ -196,20 +258,23 @@ public class SampleTest {
     IUReportService uReportService;
 
     @Test
-    public void loadBytedanceData() {
-        List<UserAllocation> allocations = allocationService.getByParams(633L, null, 0);
-        for (int i = 0; i < allocations.size(); i++) {
+    public void loadBytedanceData(){
+        List<UserAllocation>allocations = allocationService.getByParams(289L,null,0);
+        for (int i=0;i<allocations.size();i++) {
             CtopOauthToken token = tokenService.getTokenByAccountId(allocations.get(i).getAccountId());
-            for (int j = 10; j < 110; j++) {
-                Date getDate = DateUtils.addDay(new Date(), -j);
-                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            for(int j=0;j<10;j++){
+                String getDate = DateUtils.formatDate(DateUtils.addDay(new Date(), -j));
+                bytedanceReportService.bytedanceVideoMaterialReport(token, getDate, getDate);
             }
         }
     }
 
+    @Autowired
+    private IBytedanceReportService bytedanceReportService;
+
     @Test
-    public void loaddata() {
-        for (int i = 0; i < 30; i++) {
+    public void loaddata(){
+        for(int i=0;i<30;i++){
             Date getDate = DateUtils.addDay(new Date(), -i);
             String date = DateUtils.formatDate(getDate);
             videoReportDailyService.videoInfoList(date, date);
@@ -217,14 +282,10 @@ public class SampleTest {
     }
 
     @Autowired
-    private IBytedanceReportService bytedanceReportService;
-
-    @Autowired
     private IByteDanceVideoReportDailyService videoReportDailyService;
-
     @Test
-    public void loadMatData() {
-        List<UserAllocation> allocations = allocationService.getByParams(320L, null, 0);
+    public void loadMatData(){
+        List<UserAllocation> allocations = allocationService.getByParams(289L,null,0);
         countDownLatch = new CountDownLatch(allocations.size());
         executorService = Executors.newFixedThreadPool(2);
         allocations.forEach(allocation -> {
@@ -250,14 +311,4 @@ public class SampleTest {
         }
         XxlJobLogger.log("物料数据同步完成");
     }
-
-    @Autowired
-    private IShiwanFileUploadService shiwanFileUploadService;
-
-    @Test
-    public void fileUpload() throws IOException {
-        shiwanFileUploadService.createNewZipFile(null, "6",null,null,null,null);
-    }
-
-
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -92,6 +92,10 @@ public class LoadFileUtil {
         return flag;
     }
 
+    public static void main(String[] args) throws IOException {
+        System.out.println(getMD5("D:\\data\\6ybjAGrL.mp4"));
+    }
+
     /**
      * 获取文件md5
      *

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ImageCostVO.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.report.DTO;
+package cn.com.ctop.common.module.vo;
 
 import lombok.Data;
 
@@ -6,7 +6,7 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 
 @Data
-public class ImageCostVO implements Serializable {
+public class BytedanceImageCostVO implements Serializable {
     private String statDate;
     private String signature;
     private String projectName;

+ 123 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVOEntity.java

@@ -0,0 +1,123 @@
+package cn.com.ctop.common.module.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+
+import java.math.BigDecimal;
+
+public class BytedanceImageCostVOEntity extends BaseRowModel {
+    @ExcelProperty(index = 1, value = "图片链接")
+    private String imageUrl;
+    @ExcelProperty(index = 1, value = "上传时间")
+    private String statDate;
+    @ExcelProperty(index = 1, value = "图片标识")
+    private String signature;
+    @ExcelProperty(index = 1, value = "项目名称")
+    private String projectName;
+    @ExcelProperty(index = 1, value = "消耗")
+    private BigDecimal cost;
+    @ExcelProperty(index = 1, value = "点击数")
+    private Long click;
+    @ExcelProperty(index = 1, value = "展示数")
+    private Long showNum;
+    @ExcelProperty(index = 1, value = "转化数")
+    private Long convert;
+    @ExcelProperty(index = 1, value = "平面id")
+    private String userId;
+    @ExcelProperty(index = 1, value = "平面名称")
+    private String userName;
+
+    public BytedanceImageCostVOEntity() {
+    }
+
+    public BytedanceImageCostVOEntity(BytedanceImageCostVO vo) {
+        this.imageUrl = vo.getImageUrl();
+        this.statDate = vo.getStatDate();
+        this.signature = vo.getSignature();
+        this.projectName = vo.getProjectName();
+        this.cost = vo.getCost();
+        this.click = vo.getClick();
+        this.showNum = vo.getShowNum();
+        this.convert = vo.getConvert();
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getStatDate() {
+        return statDate;
+    }
+
+    public void setStatDate(String statDate) {
+        this.statDate = statDate;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public BigDecimal getCost() {
+        return cost;
+    }
+
+    public void setCost(BigDecimal cost) {
+        this.cost = cost;
+    }
+
+    public Long getClick() {
+        return click;
+    }
+
+    public void setClick(Long click) {
+        this.click = click;
+    }
+
+    public Long getShowNum() {
+        return showNum;
+    }
+
+    public void setShowNum(Long showNum) {
+        this.showNum = showNum;
+    }
+
+    public Long getConvert() {
+        return convert;
+    }
+
+    public void setConvert(Long convert) {
+        this.convert = convert;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+}

+ 23 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.common.module.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+@Data
+public class KuaishouImageCostVO implements Serializable {
+    String imageUrl;
+    String signature;
+    String projectName;
+    BigDecimal charge;
+    Long photoClick;
+    Long photoShow;
+    Long activation;
+    Long eventRegister;
+    Long eventPay;
+    Long formCount;
+    Long eventJinJianApp;
+    Long eventCreditGrantApp;
+    String userName;
+}

+ 152 - 0
module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVOEntity.java

@@ -0,0 +1,152 @@
+package cn.com.ctop.common.module.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.metadata.BaseRowModel;
+
+import java.math.BigDecimal;
+
+public class KuaishouImageCostVOEntity extends BaseRowModel {
+    @ExcelProperty(index = 1, value = "图片url")
+    String imageUrl;
+    @ExcelProperty(index = 2, value = "图片标识")
+    String signature;
+    @ExcelProperty(index = 3, value = "所属项目")
+    String projectName;
+    @ExcelProperty(index = 4, value = "消耗")
+    BigDecimal charge;
+    @ExcelProperty(index = 5, value = "封面点击数")
+    Long photoClick;
+    @ExcelProperty(index = 6, value = "封面曝光数")
+    Long photoShow;
+    @ExcelProperty(index = 7, value = "激活数")
+    Long activation;
+    @ExcelProperty(index = 8, value = "注册数")
+    Long eventRegister;
+    @ExcelProperty(index = 9, value = "付费数")
+    Long eventPay;
+    @ExcelProperty(index = 10, value = "表单提交数")
+    Long formCount;
+    @ExcelProperty(index = 11, value = "完件数")
+    Long eventJinJianApp;
+    @ExcelProperty(index = 12, value = "授信数")
+    Long eventCreditGrantApp;
+    @ExcelProperty(index = 13, value = "所属平面id")
+    String userId;
+    @ExcelProperty(index = 14, value = "所属平面")
+    String userName;
+
+    public KuaishouImageCostVOEntity() {
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
+    public BigDecimal getCharge() {
+        return charge;
+    }
+
+    public void setCharge(BigDecimal charge) {
+        this.charge = charge;
+    }
+
+    public Long getPhotoClick() {
+        return photoClick;
+    }
+
+    public void setPhotoClick(Long photoClick) {
+        this.photoClick = photoClick;
+    }
+
+    public Long getPhotoShow() {
+        return photoShow;
+    }
+
+    public void setPhotoShow(Long photoShow) {
+        this.photoShow = photoShow;
+    }
+
+    public Long getActivation() {
+        return activation;
+    }
+
+    public void setActivation(Long activation) {
+        this.activation = activation;
+    }
+
+    public Long getEventRegister() {
+        return eventRegister;
+    }
+
+    public void setEventRegister(Long eventRegister) {
+        this.eventRegister = eventRegister;
+    }
+
+    public Long getEventPay() {
+        return eventPay;
+    }
+
+    public void setEventPay(Long eventPay) {
+        this.eventPay = eventPay;
+    }
+
+    public Long getFormCount() {
+        return formCount;
+    }
+
+    public void setFormCount(Long formCount) {
+        this.formCount = formCount;
+    }
+
+    public Long getEventJinJianApp() {
+        return eventJinJianApp;
+    }
+
+    public void setEventJinJianApp(Long eventJinJianApp) {
+        this.eventJinJianApp = eventJinJianApp;
+    }
+
+    public Long getEventCreditGrantApp() {
+        return eventCreditGrantApp;
+    }
+
+    public void setEventCreditGrantApp(Long eventCreditGrantApp) {
+        this.eventCreditGrantApp = eventCreditGrantApp;
+    }
+
+    public String getUserId() {
+        return userId;
+    }
+
+    public void setUserId(String userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+}

ファイルの差分が大きいため隠しています
+ 3 - 0
module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java


+ 10 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java

@@ -9,6 +9,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskServ
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyImageMapper;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -67,6 +68,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.eq("account_id", accountId);
         taskQueryWrapper.eq("stat_date", statDate);
+        taskQueryWrapper.eq("view_type", 7);
         taskQueryWrapper.orderByDesc("create_time");
         List<KuaiShouDailyReportTask> dailyTaskList = this.list(taskQueryWrapper);
         if (!Check.isNull(dailyTaskList)) {
@@ -155,7 +157,12 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
                     };
                     thread.start();
                 }else if(task.getViewType() == 7){
-
+                    //封面报表
+                    kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(),localPath);
+                    //清洗数据
+                    kuaishouReportDailyImageMapper.updateImageReportCode();
+                    kuaishouReportDailyImageMapper.updateImageReportUserId();
+                    kuaishouReportDailyImageMapper.updateImageReportRealname();
                 }
             }
 
@@ -168,5 +175,7 @@ public class KuaiShouDailyReportTaskServiceImpl extends ServiceImpl<KuaiShouDail
         this.updateById(task);
     }
 
+    @Autowired
+    private KuaishouReportDailyImageMapper kuaishouReportDailyImageMapper;
 
 }

+ 8 - 8
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java

@@ -156,7 +156,6 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     public void getTaskList() {
         log.info("开始历史数据文件检查下载");
         QueryWrapper<KuaiShouHistoryReportTask> taskQueryWrapper = new QueryWrapper<>();
-        taskQueryWrapper.eq("view_type",7);
         taskQueryWrapper.eq("task_status", 0);
         taskQueryWrapper.orderByDesc("create_time");
         List<KuaiShouHistoryReportTask> taskList = this.list(taskQueryWrapper);
@@ -252,6 +251,10 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
                 }else if (task.getViewType() == 7){
                     //封面报表
                     kuaishouReportDailyImageMapper.loadImageDailyReport(task.getAccountId(),localPath);
+                    //清洗数据
+                    kuaishouReportDailyImageMapper.updateImageReportCode();
+                    kuaishouReportDailyImageMapper.updateImageReportUserId();
+                    kuaishouReportDailyImageMapper.updateImageReportRealname();
                 }
 
 
@@ -273,13 +276,13 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
     private void getHistoryTypeList() {
 
         historyTypeList = new ArrayList<>();
-        historyTypeList.add(5);
         historyTypeList.add(1);
         historyTypeList.add(2);
         historyTypeList.add(3);
-        historyTypeList.add(10);
         historyTypeList.add(4);
-     //   historyTypeList.add(7);
+        historyTypeList.add(5);
+        historyTypeList.add(7);
+        historyTypeList.add(10);
 
 
     }
@@ -290,16 +293,13 @@ public class KuaiShouHistoryReportTaskServiceImpl extends ServiceImpl<KuaiShouHi
         dailyTypeList.add(3);
         dailyTypeList.add(4);
         dailyTypeList.add(5);
+        dailyTypeList.add(7);
         dailyTypeList.add(10);
-//        historyTypeList.add(7);
     }
 
 
     static ExecutorService executorService = Executors.newFixedThreadPool(30);
 
-    @Autowired
-    private ICtopOauthTokenService oauthTokenService;
-
     @Override
     public void getMd5(String statDate, Long accountId) {
         executorService.submit(new Runnable() {

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

@@ -1,8 +1,13 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.common.module.vo.KuaishouImageCostVO;
+import cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyImage;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
+import java.util.List;
+
 /**
  * 快手图片报表
  * @author: jeecg-boot
@@ -12,4 +17,14 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 public interface KuaishouReportDailyImageMapper extends BaseMapper<KuaishouReportDailyImage> {
 
     void loadImageDailyReport(Long accountId, String localPath);
+
+    List<KuaishouImageCostVO> imageCost(String startDate, String endDate, JSONArray accountList, String code);
+
+    void updateImageReportCode();
+
+    List<KuaishouImageCostVOEntity> imageCostEntity(String startDate, String endDate, JSONArray accountList, String code);
+
+    void updateImageReportUserId();
+
+    void updateImageReportRealname();
 }

+ 100 - 6
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml

@@ -7,10 +7,11 @@
 	    REPLACE INTO TABLE ctop_kuaishou_report_daily_image CHARACTER SET utf8mb4
 		FIELDS TERMINATED BY ',' enclosed by '"' LINES TERMINATED BY '\n'
 		IGNORE 1 LINES
-		(cover_id,
-		image_token,
-		cover_url,
-		@ad_scene,
+		(
+		cover_id,
+        image_token,
+        cover_url,
+        ad_scene,
         charge,
         photo_show,
         aclick,
@@ -28,13 +29,13 @@
         activation,
         submit,
         stat_date,
-        @stat_hour,
+        stat_hour,
         photo_click,
         photo_click_ratio,
         action_ratio,
         impression_1k_cost,
         photo_click_cost,
-        @click_1k_cost,
+        click_1k_cost,
         action_cost,
         event_pay_first_day,
         event_pay_purchase_amount_first_day,
@@ -103,4 +104,97 @@
         )
           set account_id = #{accountId}
     </insert>
+    <select id="imageCost" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVO">
+        select
+        report.cover_url as 'image_url' ,
+        report.code as 'signature',
+        group_concat(distinct p.project_name) AS 'project_name',
+        sum(report.charge) AS 'charge',
+        sum(report.photo_click) AS 'photo_click',
+        sum(report.photo_show) AS 'photo_show',
+        sum(report.activation) AS 'activation',
+        sum(report.event_register) AS 'event_register',
+        sum(report.event_pay) AS 'event_pay',
+        sum(report.form_count) AS 'form_count',
+        sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
+        sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
+        report.realname as 'user_name'
+        from ctop_kuaishou_report_daily_image report
+        left join ctop_user_allocation allocation on allocation.account_id = report.account_id
+        left join ctop_project p on p.id = allocation.project_id
+        where
+            1=1
+        and
+            report.code is not null
+        <if test="startDate!=null">
+            and report.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and report.stat_date &lt;= #{endDate}
+        </if>
+        <if test="accountList!=null">
+            and report.account_id in
+            <foreach item="accountId" collection="accountList" open="(" separator="," close=")">
+                #{accountId}
+            </foreach>
+        </if>
+        <if test="code!=null">
+            and report.code = #{code}
+        </if>
+        group by report.code
+        order by sum(report.charge) desc
+    </select>
+    <select id="imageCostEntity" resultType="cn.com.ctop.common.module.vo.KuaishouImageCostVOEntity">
+        select
+        report.cover_url as 'image_url' ,
+        report.code as 'signature',
+        group_concat(distinct p.project_name) AS 'project_name',
+        sum(report.charge) AS 'charge',
+        sum(report.photo_click) AS 'photo_click',
+        sum(report.photo_show) AS 'photo_show',
+        sum(report.activation) AS 'activation',
+        sum(report.event_register) AS 'event_register',
+        sum(report.event_pay) AS 'event_pay',
+        sum(report.form_count) AS 'form_count',
+        sum(report.event_jin_jian_app) AS 'event_jin_jian_app',
+        sum(report.event_credit_grant_app) AS 'event_credit_grant_app',
+        report.realname as 'user_name'
+        from ctop_kuaishou_report_daily_image report
+        left join ctop_user_allocation allocation on allocation.account_id = report.account_id
+        left join ctop_project p on p.id = allocation.project_id
+        where
+        1=1
+        and
+        report.code is not null
+        <if test="startDate!=null">
+            and report.stat_date &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and report.stat_date &lt;= #{endDate}
+        </if>
+        <if test="accountList!=null">
+            and report.account_id in
+            <foreach item="accountId" collection="accountList" open="(" separator="," close=")">
+                #{accountId}
+            </foreach>
+        </if>
+        <if test="code!=null">
+            and report.code = #{code}
+        </if>
+        group by report.code
+        order by sum(report.charge) desc
+    </select>
+
+    <update id="updateImageReportCode">
+        update ctop_kuaishou_report_daily_image a inner join  ctop_kuaishou_image_get  image on image.image_token =a.image_token  set a.code = image.signature
+        where a.code is null
+    </update>
+    <update id="updateImageReportUserId">
+        update ctop_kuaishou_report_daily_image a inner join  ctop_material_image_info  image on image.code =a.code  set a.user_id = image.user_id
+        where a.code is not null and a.user_id is null
+    </update>
+    <update id="updateImageReportRealname">
+        update ctop_kuaishou_report_daily_image a inner join  sys_user  user on user.id =a.user_id  set a.realname = user.realname
+        where a.user_id is not null and a.realname is null
+    </update>
 </mapper>

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java

@@ -216,6 +216,9 @@ public class ByteDanceAdvertisePlan {
 
     public ByteDanceAdvertisePlan(JSONObject dataObject, String accountId) {
         this.id = dataObject.getLong("id");
+        if(id == 1680967865840670L||id ==1680968574657556L||id == 1680970557193228L ){
+            System.out.println(dataObject.toJSONString());
+        }
         this.accountId = accountId;
         String name = dataObject.getString("name");
         if (null != name && !"".equals(name.trim())) {

+ 16 - 7
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java

@@ -1,7 +1,8 @@
 package cn.com.ctop.toutiao.modules.report.mapper;
 
+import cn.com.ctop.common.module.vo.BytedanceImageCostVO;
+import cn.com.ctop.common.module.vo.BytedanceImageCostVOEntity;
 import cn.com.ctop.toutiao.modules.material.vo.BytedanceVideoVo;
-import cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportVideoMaterialDaily;
@@ -31,12 +32,20 @@ public interface BytedanceReportMaterialDailyMapper extends BaseMapper<Bytedance
 
     List<BytedanceVideoVo> getVideoVoByDate(@Param("date")String date);
 
-    List<ImageCostVO> bytedanceImageCost(@Param("startDate")String startDate,
-                                         @Param("endDate")String endDate,
-                                         @Param("accountList")JSONArray accountList,
-                                         @Param("code")String code,
-                                         @Param("startIndex")Integer startIndex,
-                                         @Param("pageSize")Integer pageSize);
+    List<BytedanceImageCostVO> bytedanceImageCost(@Param("startDate")String startDate,
+                                                  @Param("endDate")String endDate,
+                                                  @Param("accountList")JSONArray accountList,
+                                                  @Param("code")String code);
 
     void replaceImageBatch(@Param("infos")List<BytedanceReportMaterialDaily> bytedanceReportImageDailyList);
+    void updateImageReportCode();
+    void updateImageReportProjectId();
+    void updateImageReportProjectName();
+    void updateImageReportPlaneId();
+    void updateImageReportPlaneName();
+
+    List<BytedanceImageCostVOEntity> bytedanceImageCostEntity(@Param("startDate")String startDate,
+                                                              @Param("endDate")String endDate,
+                                                              @Param("accountList")JSONArray accountList,
+                                                              @Param("code")String code);
 }

+ 73 - 8
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml

@@ -238,19 +238,22 @@
         ctop_bytedance_report_material_retry
         where status = 0
     </select>
-    <select id="bytedanceImageCost" resultType="cn.com.ctop.toutiao.modules.report.DTO.ImageCostVO">
+    <select id="bytedanceImageCost" resultType="cn.com.ctop.common.module.vo.BytedanceImageCostVO">
         select round(sum(report.cost),2)                              as 'cost',
         sum(report.click)                                             as 'click',
-        sum(report.show_material)                                     as 'showNum',
+        sum(report.show_material)                                     as 'show_num',
         sum(report.convert_material)                                  as 'convert',
-        imageInfo.image_url                                           as 'imageUrl',
-        imageInfo.signature                                           as 'signature',
-        group_concat(distinct report.project_name)                as 'projectName',
-        report.stat_datetime                                          as 'statDate'
+        report.image_url                                           as 'image_url',
+        report.code                                           as 'signature',
+        group_concat(distinct report.project_name)                    as 'project_name',
+        report.stat_datetime                                          as 'stat_date',
+        report.plane_id as 'user_id',
+        report.plane_name as 'user_name'
             from ctop_bytedance_report_image_daily report
             left join ctop_bytedance_image_info imageInfo on imageInfo.material_id = report.material_id
         where
         1=1
+        and report.code is not null
         <if test="startDate!=null">
             and report.stat_datetime &gt;= #{startDate}
         </if>
@@ -264,11 +267,40 @@
             </foreach>
         </if>
         <if test="code!=null">
-            and imageInfo.signature = #{code}
+            and report.code = #{code}
         </if>
-        group by imageInfo.signature
+        group by report.code
         order by sum(report.cost) desc
     </select>
+
+    <update id="updateImageReportCode">
+        update ctop_bytedance_report_image_daily a inner join ctop_bytedance_image_info image on image.material_id =a.material_id  set a.code = image.signature,a.image_url = image.image_url
+        where a.material_id is not null and a.code is null
+    </update>
+
+    <update id="updateImageReportProjectId">
+        update ctop_bytedance_report_image_daily a inner join ctop_user_allocation allocation on allocation.account_id =a.account_id  set a.project_id = allocation.project_id
+        where a.account_id is not null and a.project_id is null
+    </update>
+
+    <update id="updateImageReportProjectName">
+        update ctop_bytedance_report_image_daily a inner join ctop_project p on p.id =a.project_id  set a.project_name = p.project_name
+        where a.project_id is not null and a.project_name is null
+    </update>
+
+    <update id="updateImageReportPlaneId">
+        update ctop_bytedance_report_image_daily a inner join ctop_material_image_info image on image.code =a.code  set a.plane_id = image.user_id
+where a.code is not null and a.plane_id is null
+    </update>
+
+    <update id="updateImageReportPlaneName">
+        update ctop_bytedance_report_image_daily a inner join sys_user u on u.id =a.plane_id  set a.plane_name = u.realname
+where a.plane_id is not null and a.plane_name is null
+    </update>
+
+
+
+
     <select id="getVideoVoByDate" resultType="cn.com.ctop.toutiao.modules.material.vo.BytedanceVideoVo">
         select
             distinct video.signature as 'code',video.video_url as 'url',report.stat_datetime as 'initial_cost_date'
@@ -295,6 +327,39 @@
         and start_date = #{retry.startDate}
         and end_date = #{retry.endDate}
     </update>
+    <select id="bytedanceImageCostEntity" resultType="cn.com.ctop.common.module.vo.BytedanceImageCostVOEntity">
+        select round(sum(report.cost),2)                              as 'cost',
+        sum(report.click)                                             as 'click',
+        sum(report.show_material)                                     as 'show_num',
+        sum(report.convert_material)                                  as 'convert',
+        report.image_url                                           as 'image_url',
+        report.code                                           as 'signature',
+        group_concat(distinct report.project_name)                    as 'project_name',
+        report.stat_datetime                                          as 'stat_date',
+        report.plane_id as 'user_id',
+        report.plane_name as 'user_name'
+        from ctop_bytedance_report_image_daily report
+        where
+        1=1
+        and report.code is not null
+        <if test="startDate!=null">
+            and report.stat_datetime &gt;= #{startDate}
+        </if>
+        <if test="endDate!=null">
+            and report.stat_datetime &lt;= #{endDate}
+        </if>
+        <if test="accountList!=null">
+            and report.account_id in
+            <foreach item="accountId" collection="accountList" open="(" separator="," close=")">
+                #{accountId}
+            </foreach>
+        </if>
+        <if test="code!=null">
+            and report.code = #{code}
+        </if>
+        group by report.code
+        order by sum(report.cost) desc
+    </select>
 
     <insert id="replaceIntoVideoMaterialBatch">
         REPLACE INTO ctop_bytedance_report_video_material_daily

+ 3 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceFundDailyServiceImpl.java

@@ -30,6 +30,9 @@ public class BytedanceFundDailyServiceImpl extends ServiceImpl<BytedanceFundDail
     public void loadFundDataByPage(CtopOauthToken token, String startDate, String endDate, Integer pageNum) {
         Integer pageSize = 100;
         JSONObject result = getAdvertiserFundDailyStat(token, startDate, endDate, pageNum, pageSize);
+        if(null == result||result.isEmpty()){
+            return;
+        }
         var code = result.getInteger("code");
         var message = result.getString("message");
         if (null == code || code != 0) {

+ 5 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

@@ -740,7 +740,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         log.info("头条素材报表重试结束 当前accountId:{}  {}~{},type:{},code:{}" , accountId, startDate,endDate,type,code);
         return code;
     }
-
     @Override
     public int bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate) {
         Long accountId = token.getAccountId();
@@ -758,6 +757,11 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
             retry.setType(1);
             bytedanceReportMaterialDailyMapper.replaceMaterialRetry(retry);
         }
+        bytedanceReportMaterialDailyMapper.updateImageReportCode();
+        bytedanceReportMaterialDailyMapper.updateImageReportProjectId();
+        bytedanceReportMaterialDailyMapper.updateImageReportProjectName();
+        bytedanceReportMaterialDailyMapper.updateImageReportPlaneId();
+        bytedanceReportMaterialDailyMapper.updateImageReportPlaneName();
         log.info("头条素材报表结束 当前accountId为:{}  {}~{}" , accountId, startDate,endDate);
         return code;
     }

+ 1 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -82,6 +82,7 @@ public class ReportServiceImpl implements IReportService {
         config.propertyNamingStrategy = PropertyNamingStrategy.SnakeCase;
         JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(conditions, config));
         JSONObject getObject = getAdvertiserStat(token, jsonObject);
+        System.out.println(getObject);
         if(null == getObject){
             XxlJobLogger.log("头条广告主数据获取异常");
             return;