Quellcode durchsuchen

Merge remote-tracking branch 'origin/master' into master_v2

jiequan.bi vor 4 Jahren
Ursprung
Commit
a223f06c23
41 geänderte Dateien mit 2038 neuen und 147 gelöschten Zeilen
  1. 7 0
      jeecg-boot-module-system/pom.xml
  2. 4 3
      jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java
  3. 0 16
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  4. 50 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ImageCostController.java
  5. 0 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagInfoController.java
  6. 5 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IImageReportDailyService.java
  7. 61 45
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ImageReportDailyServiceImpl.java
  8. 3 0
      jeecg-boot-module-system/src/main/resources/application-dev.yml
  9. 4 0
      jeecg-boot-module-system/src/main/resources/application-prod.yml
  10. 4 0
      jeecg-boot-module-system/src/main/resources/application-prod2.yml
  11. 6 2
      jeecg-boot-module-system/src/main/resources/application-test.yml
  12. 3 0
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  13. 0 1
      jeecg-boot-module-system/src/main/resources/application.yml
  14. 68 42
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  15. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  16. 2 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/DTO/ImageCostVO.java
  17. 123 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/BytedanceImageCostVOEntity.java
  18. 23 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVO.java
  19. 152 0
      module-common/src/main/java/cn/com/ctop/common/module/vo/KuaishouImageCostVOEntity.java
  20. 3 3
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/DouyinMusicService.java
  21. 3 0
      module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/impl/DouyinMusicServiceImpl.java
  22. 10 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouDailyReportTaskServiceImpl.java
  23. 8 8
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouHistoryReportTaskServiceImpl.java
  24. 7 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java
  25. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyImageMapper.java
  26. 100 6
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyImageMapper.xml
  27. 64 0
      module-shiwan/pom.xml
  28. 332 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java
  29. 314 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/controller/ShiwanFileUploadController.java
  30. 111 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/entity/ShiwanFileUpload.java
  31. 23 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/mapper/ShiwanFileUploadMapper.java
  32. 40 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/mapper/xml/ShiwanFileUploadMapper.xml
  33. 348 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/service/ShiwanFileUploadServiceImpl.java
  34. 39 0
      module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/service/impl/IShiwanFileUploadService.java
  35. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java
  36. 16 7
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/BytedanceReportMaterialDailyMapper.java
  37. 73 8
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceReportMaterialDailyMapper.xml
  38. 3 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceFundDailyServiceImpl.java
  39. 5 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java
  40. 1 0
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java
  41. 1 0
      pom.xml

+ 7 - 0
jeecg-boot-module-system/pom.xml

@@ -106,6 +106,13 @@
         </dependency>
 
         <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-shiwan</artifactId>
+            <version>2.0.2</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
             <groupId>com.aliyun.oss</groupId>
             <artifactId>aliyun-sdk-oss</artifactId>
             <version>3.5.0</version>

+ 4 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -155,9 +155,9 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/test/getGroupData/**", "anon");
         filterChainDefinitionMap.put("/test/getVideoAndImage/**", "anon");
         filterChainDefinitionMap.put("/test/gerCreative/**", "anon");
-        filterChainDefinitionMap.put("/test/testdouyinmusic","anon");
-        filterChainDefinitionMap.put("/test/syncDouyinMusic","anon");
-        filterChainDefinitionMap.put("/test/parseDouyinMusic","anon");
+        filterChainDefinitionMap.put("/test/testdouyinmusic", "anon");
+        filterChainDefinitionMap.put("/test/syncDouyinMusic", "anon");
+        filterChainDefinitionMap.put("/test/parseDouyinMusic", "anon");
         filterChainDefinitionMap.put("/report/kuaishouReportDailyAgent/get", "anon");
 
         filterChainDefinitionMap.put("/appium/appiumTask/run/login", "anon");
@@ -174,6 +174,7 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/rest/script/*", "anon");
         filterChainDefinitionMap.put("/ctop/checkTaskList/*", "anon");
         filterChainDefinitionMap.put("/ctop/report/bytedance/*", "anon");
+        filterChainDefinitionMap.put("/shiwan/shiwanFileUpload/*", "anon");
 
         // 添加自己的过滤器并且取名为jwt
         Map<String, Filter> filterMap = new HashMap<>(1);

+ 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);
+        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);
+        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);
+        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);
+        sheetInfoVo.setDetails(details);
+        return sheetInfoVo;
+    }
 }

+ 3 - 0
jeecg-boot-module-system/src/main/resources/application-dev.yml

@@ -226,3 +226,6 @@ oss:
     replace-old-value: oss-cn-beijing
     download: D:\mnt\file\video
 
+zip:
+  local:
+    download-path: /data/unzip/

+ 4 - 0
jeecg-boot-module-system/src/main/resources/application-prod.yml

@@ -196,3 +196,7 @@ oss:
     replace-value: oss-cn-beijing
     replace-old-value: oss-cn-beijing
     download: /data/file/video/
+
+zip:
+  local:
+    download-path: /data/unzip/

+ 4 - 0
jeecg-boot-module-system/src/main/resources/application-prod2.yml

@@ -188,3 +188,7 @@ oss:
     replace-value: oss-cn-beijing
     replace-old-value: oss-cn-beijing
     download: /data/file/video/
+
+zip:
+  local:
+    download-path: /data/unzip/

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

@@ -125,8 +125,8 @@ mybatis-plus:
       id-type: 4
       # 默认数据库表下划线命名
       table-underline: true
-#  configuration:
-#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+  #  configuration:
+  #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
   #  map-underscore-to-camel-case: false
   #分页pageHelper
 pagehelper:
@@ -187,3 +187,7 @@ oss:
     replace-value: oss-cn-beijing
     replace-old-value: oss-cn-beijing
     download: /mnt/file/video/
+
+zip:
+  local:
+    download-path: /data/unzip/

+ 3 - 0
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -182,3 +182,6 @@ oss:
     replace-value: oss-cn-beijing-internal
     replace-old-value: oss-cn-beijing
     download: D://mnt//image//
+zip:
+  local:
+    download-path: D://mnt//data//

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

@@ -2,7 +2,6 @@ spring:
   profiles:
 #    active: wps
     active: @activatedProperties@
-
 swagger:
   production: false
   basic:

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

@@ -1,19 +1,18 @@
 package org.jeecg;
 
-import cn.com.ctop.check.component.execute.GroovyScriptExecutor;
-import cn.com.ctop.check.entity.CtopCheckTaskList;
-import cn.com.ctop.check.service.ICtopCheckTaskListService;
 import cn.com.ctop.common.module.entity.BindAccountLogin;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.message.handle.impl.EmailSendMsgHandle;
 import cn.com.ctop.common.module.service.*;
 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.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;
@@ -34,6 +33,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")
@@ -60,16 +61,9 @@ public class SampleTest {
         List<CtopOauthToken> list = oauthTokenService.list(queryWrapper);
         for (CtopOauthToken token : list) {
             kuaiShouHistoryReportTaskService.createTask(token.getAccountId(), token.getAccessToken(), "2020-09-20", "2020-09-20", "daily");
-
         }
     }
 
-    @Test
-    public void getTaskList() {
-        kuaiShouHistoryReportTaskService.getTaskList();
-    }
-
-
     @Autowired
     private IBindAccountLoginService bindAccountLoginService;
     @Autowired
@@ -129,13 +123,68 @@ 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++) {
+            System.out.println(allocation.getAccountId());
+            for (int i = 0; i < 1; i++) {
                 CtopOauthToken token = oauthTokenService.getTokenByAccountId(allocation.getAccountId());
-                Date getDate = DateUtils.addDay(new Date(), 0);
-//                reportService.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+                Date getDate = DateUtils.addDay(new Date(), -i);
                 reportService.getAdvertiserReport(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
@@ -155,20 +204,6 @@ public class SampleTest {
         }
     }
 
-    @Autowired
-    private GroovyScriptExecutor groovyScriptExecutor;
-
-    @Autowired
-    private ICtopCheckTaskListService checkTaskListService;
-
-    @Test
-    public void checkDataStateJobTest() {
-        //查询需要检查的任务列表
-        List<CtopCheckTaskList> ctopCheckTaskList = checkTaskListService.queryExecuteList("checkDataStateJob");
-        if (ctopCheckTaskList != null) {
-            ctopCheckTaskList.forEach(it -> groovyScriptExecutor.execute(it));
-        }
-    }
 
     @Test
     public void loadAccountData() {
@@ -191,25 +226,16 @@ public class SampleTest {
 
     @Test
     public void loadBytedanceData(){
-        List<UserAllocation>allocations = allocationService.getByParams(633L,null,0);
+        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);
             }
         }
     }
 
-    @Test
-    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);
-        }
-    }
-
     @Autowired
     private IBytedanceReportService bytedanceReportService;
 
@@ -217,7 +243,7 @@ public class SampleTest {
     private IByteDanceVideoReportDailyService videoReportDailyService;
     @Test
     public void loadMatData(){
-        List<UserAllocation> allocations = allocationService.getByParams(320L,null,0);
+        List<UserAllocation> allocations = allocationService.getByParams(289L,null,0);
         countDownLatch = new CountDownLatch(allocations.size());
         executorService = Executors.newFixedThreadPool(2);
         allocations.forEach(allocation -> {

+ 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 - 3
module-crawler/src/main/java/cn/com/ctop/crawler/modules/douyin/service/DouyinMusicService.java

@@ -3,7 +3,7 @@ package cn.com.ctop.crawler.modules.douyin.service;
 import cn.com.ctop.common.module.entity.MusicInfo;
 
 public interface DouyinMusicService {
-    public void getHotMusicList();
-    public MusicInfo getMusicInfo(MusicInfo musicInfo);
-    public void parseTag(MusicInfo musicInfo);
+    void getHotMusicList();
+    MusicInfo getMusicInfo(MusicInfo musicInfo);
+    void parseTag(MusicInfo musicInfo);
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 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() {

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouUpdateServiceImpl.java

@@ -520,6 +520,13 @@ public class KuaiShouUpdateServiceImpl implements IKuaiShouUpdateService {
                     returnMap.put("code", -1);
                     returnMap.put("success", false);
                     returnMap.put("message", resultJson.getString("message"));
+                    if (resultJson.getString("message").equals("该账户下创意不存在")) {
+                        Map<String, Object> deleteMap = new HashMap<>();
+                        deleteMap.put("creative_id", creativeId);
+                        creativeMapper.deleteByMap(deleteMap);
+                    }
+
+
                 }
             } else {
                 log.error("修改广告创意返回结果为空,advertiserId:{},creativeId:{}", advertiserId, creativeId);

+ 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>

+ 64 - 0
module-shiwan/pom.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>jeecg-boot-parent</artifactId>
+        <groupId>org.jeecgframework.boot</groupId>
+        <version>2.0.2</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>cn.com.ctop</groupId>
+    <artifactId>module-shiwan</artifactId>
+
+    <name>module-shiwan</name>
+    <url>http://www.example.com</url>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-common</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.com.ctop</groupId>
+            <artifactId>module-crawler</artifactId>
+            <version>2.0.2</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.googlecode.plist</groupId>
+            <artifactId>dd-plist</artifactId>
+            <version>1.16</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.tony19</groupId>
+            <artifactId>apktool-lib</artifactId>
+            <version>1.4.4-3</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <!-- 解决MyBatis配置文件引入问题 -->
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <include>**/*.xml</include>
+                </includes>
+                <!-- 是否替换资源中的属性-->
+                <filtering>false</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+            </resource>
+        </resources>
+    </build>
+</project>

+ 332 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/FileUtil.java

@@ -0,0 +1,332 @@
+package cn.com.ctop.shiwan.modules;
+
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.disk.DiskFileItemFactory;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * TODO
+ *
+ * @ClassName ZipUtil
+ * @Author ZHAOXA
+ * @date 2020-10-23 10:05
+ */
+@Slf4j
+public class FileUtil {
+
+    /**
+     * 转MultipartFile格式文件
+     *
+     * @param
+     * @return org.springframework.web.multipart.MultipartFile
+     * @throws
+     * @author ZHAOXA
+     */
+    public static MultipartFile getMulFileByPath(String picPath) {
+        FileItem fileItem = createFileItem(picPath);
+        MultipartFile mfile = new CommonsMultipartFile(fileItem);
+        return mfile;
+    }
+
+    private static FileItem createFileItem(String filePath) {
+        FileItemFactory factory = new DiskFileItemFactory(16, null);
+        String textFieldName = "textField";
+        int num = filePath.lastIndexOf("/");
+        String fileName = filePath.substring(num);
+        FileItem item = factory.createItem(textFieldName, "text/plain", true,
+                fileName);
+        File newfile = new File(filePath);
+        int bytesRead = 0;
+        byte[] buffer = new byte[8192];
+        try {
+            FileInputStream fis = new FileInputStream(newfile);
+            OutputStream os = item.getOutputStream();
+            while ((bytesRead = fis.read(buffer, 0, 8192))
+                    != -1) {
+                os.write(buffer, 0, bytesRead);
+            }
+            os.close();
+            fis.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return item;
+    }
+
+
+    /**
+     * 下载文件到本地
+     *
+     * @param locationPath 本地路径
+     * @param fileUrl      文件下载路径
+     * @param fileName     下载后的名称含后缀
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String writeFiles(String locationPath, String fileUrl, String fileName) {
+        InputStream is = null;
+        OutputStream os = null;
+        Date date = new Date();
+        String realPath = null;
+        try {
+            URL url = new URL(fileUrl);
+            is = url.openStream();
+            File file = new File(locationPath);
+            if (!file.exists()) {
+                boolean mkdirFlag = file.mkdirs();
+                if (!mkdirFlag) {
+                    log.error("[ ========== 下载,创建临时文件夹失败 ========== ]");
+                    return null;
+                }
+            }
+            realPath = locationPath.concat(fileName);
+            os = new FileOutputStream(realPath);
+            int bytesRead = 0;
+            byte[] buffer = new byte[8192];
+            while ((bytesRead = is.read(buffer, 0, 8192)) != -1) {
+                os.write(buffer, 0, bytesRead);
+                os.flush();
+            }
+            os.close();
+            is.close();
+        } catch (Exception e) {
+            log.error(" ========== 文件下载到本地异常:", e);
+            return null;
+        }
+        return realPath;
+    }
+
+
+    /**
+     * //创建zip方法,其中的参数ZipFileName是压缩后文件,inputFile要压缩的文件。
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    public static void zip(String ZipFileName, File inputFile) throws IOException {
+        ZipOutputStream out = new ZipOutputStream(new FileOutputStream(ZipFileName));//创建了输出流,这里ZipOutputStream()的参数是FileOutPutStream的原因是因为ZIP压缩的对象是文件。
+        zip(out, inputFile, "");//调用zip方法,实现了zip的重载。这次的参数是本方法中定义过的输出流out,要压缩的文件:inputFile以及文件最后的存储目录base
+        log.info("压缩中....");
+        out.close();
+        log.info("压缩完成!");
+    }
+
+    public static void zip(ZipOutputStream out, File f, String base) throws IOException {//方法重载
+        if (f.isDirectory()) {//判断要压缩的文件是否是文件夹
+            File[] fl = f.listFiles();//如果是文件夹就对把该文件夹中的文件的路径以文件数组的形式获得
+            if (base.length() != 0) {//判断最后要存储的路径是否已存在
+                out.putNextEntry(new ZipEntry(base + "/"));//如果已经存在,写入此目录的entry
+            }
+            for (int i = 0; i < fl.length; i++) {//遍历文件数组
+                zip(out, fl[i], base + fl[i]);//将文件数组中的文件添加到已经创建的ZIP中。
+            }
+        } else {
+            out.putNextEntry(new ZipEntry(base));//如果base为空。那么就创建新的进入点
+            //创建FileInputStream对象
+            FileInputStream in = new FileInputStream(f);//创建该输入流的原因是为了后边判断该流是否到达尾部
+            int b;
+            System.out.println(base);
+            while ((b = in.read()) != -1) {
+                out.write(b);//在没有到达尾部的情况下向已经创建的ZIP中添加
+            }
+            in.close();//关闭流
+        }
+    }
+
+    /**
+     * 文件压缩方法
+     *
+     * @param list
+     * @param zipfilename
+     * @param basePath
+     * @param vid
+     * @throws
+     * @Title: listToZip
+     * @date 2020年1月20日
+     */
+    public static String listToZip(List<String> list, String localPath, String zipfilename) {
+        long start = System.currentTimeMillis();
+        FileInputStream is = null;
+        ZipOutputStream zos = null;
+        String realPath = localPath + "/newFiles/" + zipfilename;
+        try {
+            if (list != null && list.size() > 0) {
+                File f = new File(localPath, "newFiles");
+                if (!f.exists()) {
+                    boolean mkdirFlag = f.mkdirs();
+                    if (!mkdirFlag) {
+                        log.error(" ==========压缩, 创建临时文件夹失败 ========== ");
+                        return null;
+                    }
+                }
+                // 创建zip文件输出流
+                zos = new ZipOutputStream(new FileOutputStream(new File(realPath)));
+                File file = null;
+                String path = "";
+                for (int i = 0; i < list.size(); i++) {
+                    path = list.get(i);
+                    // file 拿到待压缩文件
+                    file = new File(path);
+                    if (file.exists()) {
+                        // 创建源文件输入流
+                        is = new FileInputStream(file);
+                        zos.putNextEntry(new ZipEntry(file.getName()));
+                        byte[] buf = new byte[2048];
+                        int length = -1;
+                        while ((length = is.read(buf)) != -1) {
+                            zos.write(buf, 0, length);
+                            zos.flush();
+                        }
+                        zos.closeEntry();
+                        is.close();
+                    } else {
+                        log.warn("[ ======= {} 源文件不存在 ======= ]", path);
+                        return null;
+                    }
+                }
+            }
+        } catch (Exception e) {
+            log.error("[ ==========压缩文件异常 ========== ]", e);
+            return null;
+        } finally {
+            try {
+                if (is != null) {
+                    is.close();
+                }
+                if (zos != null) {
+                    zos.close();
+                }
+            } catch (IOException e) {
+                log.error("[ ==========关闭IO流失败========== ]", e);
+            }
+        }
+        long end = System.currentTimeMillis();
+        log.info("文件压缩完成,耗时:{} ms", (end - start));
+        return realPath;
+    }
+
+
+    /**
+     * 通过MultipartFile获取本地下载路径
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    public static String approvalFile(MultipartFile filecontent, String path) {
+        OutputStream os = null;
+        InputStream inputStream = null;
+        String fileName = filecontent.getOriginalFilename();
+        try {
+            inputStream = filecontent.getInputStream();
+        } catch (IOException e) {
+            log.error("获取文件流异常");
+        }
+        try {
+            byte[] bs = new byte[1024];
+            // 读取到的数据长度
+            int len;
+            // 输出的文件流保存到本地文件
+            File tempFile = new File(path);
+            if (!tempFile.exists()) {
+                tempFile.mkdirs();
+            }
+            os = new FileOutputStream(tempFile.getPath() + "/" + File.separator + fileName);
+            // 开始读取
+            while ((len = inputStream.read(bs)) != -1) {
+                os.write(bs, 0, len);
+            }
+        } catch (Exception e) {
+            log.error("获取文件的本地路径失败", e);
+        } finally {
+            // 完毕,关闭所有链接
+            try {
+                os.close();
+                inputStream.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return path + fileName;
+    }
+
+
+    /**
+     * @param zipSavePath 压缩好的zip包存放路径
+     * @param sourceFile  待压缩的文件(单个文件或者整个文件目录)
+     * @return
+     * @Description
+     * @author xukaixun
+     */
+    public static String zipCompress(String zipPath, File sourceFile) {
+        try {
+            //创建zip输出流
+            ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipPath));
+            File[] fileList = sourceFile.listFiles();
+            if (fileList.length != 0) {
+                for (File file : fileList) {
+                    //根据filename判断是否要最外层文件夹
+                    compress(zos, file, file.getName());
+                }
+                zos.close();
+            }
+        } catch (Exception e) {
+            log.error("压缩文件异常: {}, zipSavePath={}, sourceFile={}", e, zipPath, sourceFile.getName());
+        }
+        return zipPath;
+    }
+
+    private static void compress(ZipOutputStream zos, File sourceFile, String fileName) throws Exception {
+        if (sourceFile.isDirectory()) {
+            //如果是文件夹,取出文件夹中的文件(或子文件夹)
+            File[] fileList = sourceFile.listFiles();
+            if (fileList.length == 0)//如果文件夹为空,则只需在目的地zip文件中写入一个目录进入点
+            {
+                zos.putNextEntry(new ZipEntry(fileName + "/"));
+            } else//如果文件夹不为空,则递归调用compress,文件夹中的每一个文件(或文件夹)进行压缩
+            {
+                for (File file : fileList) {
+                    compress(zos, file, fileName + "/" + file.getName());
+                }
+            }
+        } else {
+            if (!sourceFile.exists()) {
+                zos.putNextEntry(new ZipEntry("/"));
+                zos.closeEntry();
+            } else {
+                //单个文件,直接将其压缩到zip包中
+                zos.putNextEntry(new ZipEntry(fileName));
+                FileInputStream fis = new FileInputStream(sourceFile);
+                byte[] buf = new byte[1024];
+                int len;
+                //将源文件写入到zip文件中
+                while ((len = fis.read(buf)) != -1) {
+                    zos.write(buf, 0, len);
+                }
+                zos.closeEntry();
+                fis.close();
+            }
+        }
+    }
+
+}

+ 314 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/controller/ShiwanFileUploadController.java

@@ -0,0 +1,314 @@
+package cn.com.ctop.shiwan.modules.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload;
+import cn.com.ctop.shiwan.modules.service.IShiwanFileUploadService;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xxl.job.core.enums.NoEn;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+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.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 试玩平台,文件信息
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-21
+ */
+@Slf4j
+@Api(tags = "试玩平台,文件信息")
+@RestController
+@RequestMapping("/shiwan/shiwanFileUpload")
+public class ShiwanFileUploadController {
+    @Autowired
+    private IShiwanFileUploadService shiwanFileUploadService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param shiwanFileUpload
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-分页列表查询")
+    @ApiOperation(value = "试玩平台,文件信息-分页列表查询", notes = "试玩平台,文件信息-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ShiwanFileUpload>> queryPageList(ShiwanFileUpload shiwanFileUpload,
+                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                         HttpServletRequest req) {
+        Result<IPage<ShiwanFileUpload>> result = new Result<>();
+        //父级为0,是zip文件,其他为zip内部文件
+        shiwanFileUpload.setParentId((long) 0);
+        //状态为1,文件有效未被删除
+        shiwanFileUpload.setFileStatus(NoEn.NO1.valueStr());
+        QueryWrapper<ShiwanFileUpload> queryWrapper = QueryGenerator.initQueryWrapper(shiwanFileUpload, req.getParameterMap());
+        Page<ShiwanFileUpload> page = new Page<ShiwanFileUpload>(pageNo, pageSize);
+        IPage<ShiwanFileUpload> pageList = shiwanFileUploadService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @PostMapping("/saveOrUpdateFile")
+    public Result<Object> saveOrUpdateFile(@RequestBody MultipartFile file, String userId, Long accountId, String fileType, HttpServletRequest request) {
+        Result<Object> result = new Result<>();
+        try {
+            ShiwanFileUpload entity = shiwanFileUploadService.saveOrUpdateFile(file, userId, accountId, fileType, null, null);
+            if (Check.isNull(entity)) {
+                result = Result.error("上传失败");
+            }
+            Object obj = entity;
+            result = Result.ok(obj);
+        } catch (Exception e) {
+            log.error("试玩素材上传COS异常", e);
+            result = Result.error(-1, "上传失败");
+        }
+        return result;
+    }
+
+
+    @PostMapping("/createNewZipFile")
+    public Result<Object> createNewZipFile(@RequestBody MultipartFile file, String id, String updateName, String userId, Long accountId, String fileType) {
+        Result<Object> result = new Result<>();
+        try {
+            ShiwanFileUpload entity = shiwanFileUploadService.createNewZipFile(file, id, updateName, userId, accountId, fileType);
+            if (Check.isNull(entity)) {
+                result = Result.error("上传失败");
+            }
+            Object obj = entity;
+            result = Result.ok(obj);
+        } catch (Exception e) {
+            log.error("生成新的试玩素材ZIP包异常", e);
+            result = Result.error(-1, "上传失败");
+        }
+        return result;
+    }
+
+    @GetMapping("/selectListByParentId")
+    public Result<List<ShiwanFileUpload>> selectListByParentId(String id) {
+        Result<List<ShiwanFileUpload>> result = new Result<List<ShiwanFileUpload>>();
+        ShiwanFileUpload shiwanFileUploadEntity = shiwanFileUploadService.getById(id);
+        if (shiwanFileUploadEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            List<ShiwanFileUpload> list = shiwanFileUploadService.selectListByParentId(id);
+            if (!Check.isNull(list)) {
+                result.success("查询成功!");
+                result.setResult(list);
+            } else {
+                result.error(-1, "查询失败");
+            }
+        }
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param shiwanFileUpload
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-添加")
+    @ApiOperation(value = "试玩平台,文件信息-添加", notes = "试玩平台,文件信息-添加")
+    @PostMapping(value = "/add")
+    public Result<ShiwanFileUpload> add(@RequestBody ShiwanFileUpload shiwanFileUpload) {
+        Result<ShiwanFileUpload> result = new Result<>();
+        try {
+            shiwanFileUploadService.save(shiwanFileUpload);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param shiwanFileUpload
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-编辑")
+    @ApiOperation(value = "试玩平台,文件信息-编辑", notes = "试玩平台,文件信息-编辑")
+    @PostMapping(value = "/edit")
+    public Result<ShiwanFileUpload> edit(@RequestBody ShiwanFileUpload shiwanFileUpload) {
+        Result<ShiwanFileUpload> result = new Result<ShiwanFileUpload>();
+        ShiwanFileUpload shiwanFileUploadEntity = shiwanFileUploadService.getById(shiwanFileUpload.getId());
+        if (shiwanFileUploadEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = shiwanFileUploadService.updateById(shiwanFileUpload);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-通过id删除")
+    @ApiOperation(value = "试玩平台,文件信息-通过id删除", notes = "试玩平台,文件信息-通过id删除")
+    @GetMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            shiwanFileUploadService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-批量删除")
+    @ApiOperation(value = "试玩平台,文件信息-批量删除", notes = "试玩平台,文件信息-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<ShiwanFileUpload> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<ShiwanFileUpload> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.shiwanFileUploadService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "试玩平台,文件信息-通过id查询")
+    @ApiOperation(value = "试玩平台,文件信息-通过id查询", notes = "试玩平台,文件信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ShiwanFileUpload> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<ShiwanFileUpload> result = new Result<>();
+        ShiwanFileUpload shiwanFileUpload = shiwanFileUploadService.getById(id);
+        if (shiwanFileUpload == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(shiwanFileUpload);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<ShiwanFileUpload> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                ShiwanFileUpload shiwanFileUpload = JSON.parseObject(deString, ShiwanFileUpload.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(shiwanFileUpload, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<ShiwanFileUpload> pageList = shiwanFileUploadService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "试玩平台,文件信息列表");
+        mv.addObject(NormalExcelConstants.CLASS, ShiwanFileUpload.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("试玩平台,文件信息列表数据", "导出人:Jeecg", "导出信息"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
+        return mv;
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
+        Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
+        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
+            MultipartFile file = entity.getValue();
+            ImportParams params = new ImportParams();
+            params.setTitleRows(2);
+            params.setHeadRows(1);
+            params.setNeedSave(true);
+            try {
+                List<ShiwanFileUpload> listShiwanFileUploads = ExcelImportUtil.importExcel(file.getInputStream(), ShiwanFileUpload.class, params);
+                shiwanFileUploadService.saveBatch(listShiwanFileUploads);
+                return Result.ok("文件导入成功!数据行数:" + listShiwanFileUploads.size());
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
+                return Result.error("文件导入失败:" + e.getMessage());
+            } finally {
+                try {
+                    file.getInputStream().close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        return Result.ok("文件导入失败!");
+    }
+
+}

+ 111 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/entity/ShiwanFileUpload.java

@@ -0,0 +1,111 @@
+package cn.com.ctop.shiwan.modules.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-21
+ */
+@Data
+@TableName("ctop_shiwan_file_upload")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_shiwan_file_upload对象", description = "试玩平台,文件信息")
+public class ShiwanFileUpload {
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "主键")
+    private Long id;
+    /**
+     * 文件类型
+     */
+    @Excel(name = "文件类型", width = 15)
+    @ApiModelProperty(value = "文件类型")
+    private String fileType;
+    /**
+     * 文件级别
+     */
+    @Excel(name = "文件级别", width = 15)
+    @ApiModelProperty(value = "文件级别")
+    private Integer fileLevel;
+    /**
+     * 文件名称
+     */
+    @Excel(name = "文件名称", width = 15)
+    @ApiModelProperty(value = "文件名称")
+    private String fileName;
+    /**
+     * 存储路径
+     */
+    @Excel(name = "存储路径", width = 15)
+    @ApiModelProperty(value = "存储路径")
+    private String fileUrl;
+    /**
+     * 文件状态,0-无效,1有效
+     */
+    @Excel(name = "文件状态,0-无效,1有效", width = 15)
+    @ApiModelProperty(value = "文件状态,0-无效,1有效")
+    private String fileStatus;
+    /**
+     * 文件大小
+     */
+    @Excel(name = "文件大小", width = 15)
+    @ApiModelProperty(value = "文件大小")
+    private String fileSize;
+    /**
+     * 上传时间
+     */
+    @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 uploadTime;
+
+    private Date createTime;
+
+    private Date updateTime;
+    /**
+     * 操作人
+     */
+    @Excel(name = "操作人", width = 15)
+    @ApiModelProperty(value = "操作人")
+    private String userId;
+    /**
+     * remake
+     */
+    @Excel(name = "remake", width = 15)
+    @ApiModelProperty(value = "remake")
+    private String remake;
+    /**
+     * 文件后缀
+     */
+    private String fileSuffix;
+
+    private String cfileName;
+    /**
+     * MD5签名
+     */
+    private String signature;
+
+    private Long accountId;
+
+    private Long parentId;
+}

+ 23 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/mapper/ShiwanFileUploadMapper.java

@@ -0,0 +1,23 @@
+package cn.com.ctop.shiwan.modules.mapper;
+
+import cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+import java.util.List;
+
+/**
+ * 试玩平台,文件信息
+ *
+ * @author: jeecg-boot
+ * @date: 2020-10-21
+ * @cersion: V1.0
+ */
+public interface ShiwanFileUploadMapper extends BaseMapper<ShiwanFileUpload> {
+
+    ShiwanFileUpload selectEntity(JSONObject job);
+
+    void deleteByParentId(Long id);
+
+    List<ShiwanFileUpload> selectListByParentId(String id);
+}

+ 40 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/mapper/xml/ShiwanFileUploadMapper.xml

@@ -0,0 +1,40 @@
+<?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.shiwan.modules.mapper.ShiwanFileUploadMapper">
+
+    <select id="selectEntity" resultType="cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload">
+        SELECT
+        *
+        FROM ctop_shiwan_file_upload
+        WHERE
+        file_status = 1
+        <if test="fileName != null and fileName != '' ">
+            and file_name = #{fileName}
+        </if>
+        <if test="fileType != null and fileType != '' ">
+            and file_type = #{fileType}
+        </if>
+        <if test="accountId != null and accountId != '' ">
+            and account_id = #{accountId}
+        </if>
+        <if test="userId != null and userId != '' ">
+            and user_id = #{userId}
+        </if>
+        <if test="parentId != null and parentId != '' ">
+            and parent_id = #{parentId}
+        </if>
+    </select>
+    <select id="selectListByParentId" resultType="cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload">
+        SELECT
+        *
+        FROM ctop_shiwan_file_upload
+        WHERE file_status = 1
+        AND parent_id=#{id}
+    </select>
+
+    <delete id="deleteByParentId" parameterType="java.lang.Long">
+        delete from ctop_shiwan_file_upload
+    where parent_id = #{parentId}
+    </delete>
+
+</mapper>

+ 348 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/service/ShiwanFileUploadServiceImpl.java

@@ -0,0 +1,348 @@
+package cn.com.ctop.shiwan.modules.service;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.CosUtils;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
+import cn.com.ctop.common.module.vo.ResFileDTO;
+import cn.com.ctop.shiwan.modules.FileUtil;
+import cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload;
+import cn.com.ctop.shiwan.modules.mapper.ShiwanFileUploadMapper;
+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 lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * 试玩平台,文件信息
+ * try-play
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-10-21
+ */
+@Slf4j
+@Service
+public class ShiwanFileUploadServiceImpl extends ServiceImpl<ShiwanFileUploadMapper, ShiwanFileUpload> implements cn.com.ctop.shiwan.modules.service.IShiwanFileUploadService {
+
+    @Autowired
+    private ShiwanFileUploadMapper shiwanFileUploadMapper;
+    @Value("${zip.local.download-path}")
+    private String downloadPath;
+
+    @Override
+    public ShiwanFileUpload saveOrUpdateFile(MultipartFile file, String userId, Long accountId, String fileType, Long parentId, String uuid) {
+        ShiwanFileUpload existFiles = getExistFiles(userId, accountId, file.getOriginalFilename(), fileType, parentId);
+        StringBuffer path = new StringBuffer();
+        path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.WEB_FORMAT)).append("/").append(UUID.randomUUID().toString()).append("/");
+        log.info("----------下载到服务器地址:{}", path.toString());
+        ShiwanFileUpload shiwanFileUpload = null;
+        String newFileUrl = FileUtil.approvalFile(file, path.toString());
+        String md5 = null;
+        try {
+            md5 = LoadFileUtil.getMD5(newFileUrl);
+        } catch (IOException e) {
+            log.error("获取MD5签名失败", e);
+        }
+        if (!Check.isNull(existFiles)) {
+            existFiles.setSignature(md5);
+            shiwanFileUpload = updateFile(file, existFiles);
+            if (!Check.isNull(shiwanFileUpload)) {
+                List<String> urlList = unzipFiles(shiwanFileUpload, path.toString(), newFileUrl);
+                saveInnerFiles(shiwanFileUpload, urlList);
+            }
+        } else {
+            ShiwanFileUpload fileUpload = new ShiwanFileUpload();
+            fileUpload.setSignature(md5);
+            fileUpload.setUserId(userId);
+            fileUpload.setAccountId(accountId);
+            fileUpload.setFileType(fileType);
+            fileUpload.setParentId(parentId);
+            shiwanFileUpload = saveFile(file, fileUpload, uuid);
+            if (!Check.isNull(shiwanFileUpload)) {
+                List<String> urlList = unzipFiles(shiwanFileUpload, path.toString(), newFileUrl);
+                saveInnerFiles(shiwanFileUpload, urlList);
+            }
+        }
+        return shiwanFileUpload;
+    }
+
+    /**
+     * 更新数据并上传文件到COS
+     *
+     * @param
+     * @return cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload
+     * @throws
+     * @author ZHAOXA
+     */
+    private ShiwanFileUpload updateFile(MultipartFile file, ShiwanFileUpload existFiles) {
+        ResFileDTO resultFile = null;
+        String url = "";
+        ShiwanFileUpload fileUpload = new ShiwanFileUpload();
+        if (existFiles.getParentId() != 0) {
+            url = "try-play/inner-file/";
+        } else {
+            url = "try-play/zip/";
+        }
+        try {
+            resultFile = CosUtils.uploadDetailInputStreamV2(file.getInputStream(), existFiles.getCfileName(), existFiles.getFileSuffix(), file.getSize(), url);
+        } catch (IOException e) {
+            log.error("更新文件,上传COS失败", e);
+        }
+        QueryWrapper<ShiwanFileUpload> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("id", existFiles.getId());
+        existFiles.setFileSize(resultFile.getFileSize() + "b");
+        existFiles.setUploadTime(new Date());
+        shiwanFileUploadMapper.update(existFiles, queryWrapper);
+        shiwanFileUploadMapper.deleteByParentId(existFiles.getId());
+        return existFiles;
+    }
+
+    /**
+     * 存储数据并上传文件到COS
+     *
+     * @param
+     * @return cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload
+     * @throws
+     * @author ZHAOXA
+     */
+    private ShiwanFileUpload saveFile(MultipartFile file, ShiwanFileUpload fileUpload, String uuid) {
+        String filename = file.getOriginalFilename();
+        ResFileDTO resultFile = null;
+        String url = "";
+        if (Check.isNull(fileUpload.getParentId())) {
+            url = "try-play/zip/";
+            fileUpload.setParentId((long) NoEn.NO0.valueInt());
+        } else {
+            url = "try-play/inner-file/".concat(uuid).concat("/");
+        }
+        String fileSuffix = filename.substring(filename.lastIndexOf(".") + 1).toLowerCase();
+        try {
+            resultFile = CosUtils.uploadDetailInputStream(file.getInputStream(), filename, fileSuffix, file.getSize(), url);
+        } catch (IOException e) {
+            log.error("上传COS异常", e);
+        }
+        if (!Check.isNull(resultFile)) {
+            fileUpload.setCfileName(resultFile.getCFileName());
+            fileUpload.setFileName(filename);
+            fileUpload.setFileSuffix(fileSuffix);
+            if ("zip".equals(fileSuffix)) {
+                fileUpload.setFileLevel(NoEn.NO0.valueInt());
+            } else {
+                fileUpload.setFileLevel(NoEn.NO1.valueInt());
+            }
+            fileUpload.setFileStatus(NoEn.NO1.valueStr());
+            fileUpload.setFileSize(resultFile.getFileSize() + "b");
+            fileUpload.setFileUrl(resultFile.getFileUrl());
+            fileUpload.setUploadTime(new Date());
+            shiwanFileUploadMapper.insert(fileUpload);
+        }
+        return shiwanFileUploadMapper.selectById(fileUpload.getId());
+    }
+
+
+    @Override
+    public ShiwanFileUpload createNewZipFile(MultipartFile file, String id, String updateName, String userId, Long accountId, String fileType) throws IOException {
+        ShiwanFileUpload fileUpload = shiwanFileUploadMapper.selectById(id);
+        StringBuffer path = new StringBuffer();
+        String uuid = UUID.randomUUID().toString();
+        path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.WEB_FORMAT)).append("/").append(uuid).append("/");
+        log.info("----------服务器下载地址:{}", path.toString());
+        //解压zip文件
+        List<String> urlList = unzipFiles(fileUpload, path.toString(), null);
+        String newFilePath = "";
+        if (null != urlList && urlList.size() > 0) {
+            Iterator it = urlList.iterator();
+            while (it.hasNext()) {
+                String url = it.next().toString();
+                String fileName = url.substring(url.lastIndexOf("/") + 1);
+                if (updateName.equals(fileName)) {
+                    newFilePath = url.substring(0, url.lastIndexOf("/") + 1);
+                    //移除被替换的对象
+                    it.remove();
+                    deletelocalFiles(url);
+                    break;
+                }
+            }
+        }
+        //添加上新的对象
+        String newUrl = FileUtil.approvalFile(file, newFilePath);
+        urlList.add(newUrl);
+        //压缩zip文件
+        String newFileName = DateUtils.getNowDate(DateUtils.LONG_FORMAT).concat("_COPY-FROM_").concat(fileUpload.getFileName());
+        return createNewZipFiles(urlList, path.toString(), newFileName, updateName, userId, accountId, fileType);
+    }
+
+    @Override
+    public List<ShiwanFileUpload> selectListByParentId(String id) {
+        return shiwanFileUploadMapper.selectListByParentId(id);
+    }
+
+    /**
+     * 解压文件
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private List<String> unzipFiles(ShiwanFileUpload fileUpload, String path, String innerZipPath) {
+        List<String> urlList = new ArrayList<>();
+        //下载到本地服务器
+        if (Check.isNull(innerZipPath)) {
+            innerZipPath = FileUtil.writeFiles(path.concat("oldZip/"), fileUpload.getFileUrl(), fileUpload.getCfileName());
+        }
+        try {
+            log.info("----------zip包下载地址:{}", innerZipPath);
+            ZipFile zipFile = new ZipFile(innerZipPath, Charset.forName("GBK"));
+            Enumeration<?> enumeration = zipFile.entries();
+            ZipEntry zipEntry = null;
+            String innerPath = path.concat("innerFiles/");
+            while (enumeration.hasMoreElements()) {
+                zipEntry = (ZipEntry) enumeration.nextElement();
+                // 如果是文件夹,就创建个文件夹
+                if (zipEntry.isDirectory()) {
+                    String dirPath = innerPath + zipEntry.getName();
+                    File dir = new File(dirPath);
+                    dir.mkdirs();
+                } else {
+                    String url = innerPath + zipEntry.getName();
+                    // 如果是文件,就先创建一个文件,然后用io流把内容copy过去
+                    File targetFile = new File(url);
+                    // 保证这个文件的父文件夹必须要存在
+                    if (!targetFile.getParentFile().exists()) {
+                        targetFile.getParentFile().mkdirs();
+                    }
+                    targetFile.createNewFile();
+                    // 将压缩文件内容写入到这个文件中
+                    InputStream is = zipFile.getInputStream(zipEntry);
+                    FileOutputStream fos = new FileOutputStream(targetFile);
+                    int len;
+                    byte[] buf = new byte[2048];
+                    while ((len = is.read(buf)) != -1) {
+                        fos.write(buf, 0, len);
+                    }
+                    // 关流顺序,先打开的后关闭
+                    fos.close();
+                    is.close();
+                    urlList.add(url);
+                }
+            }
+        } catch (IOException e) {
+            log.error("解压原zip文件失败 ", e);
+        }
+        deletelocalFiles(innerZipPath);
+        return urlList;
+    }
+
+    /**
+     * 压缩ZIP文件,并存储数据到本地
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private ShiwanFileUpload createNewZipFiles(List<String> list, String path, String zipfilename, String updateName, String userId, Long accountId, String fileType) throws IOException {
+        String zipUrl = FileUtil.zipCompress(path.concat(zipfilename), new File(path.concat("innerFiles/")));
+        ShiwanFileUpload shiwanFileUpload = new ShiwanFileUpload();
+        shiwanFileUpload.setUserId(userId);
+        shiwanFileUpload.setAccountId(accountId);
+        shiwanFileUpload.setFileType(fileType);
+        try {
+            shiwanFileUpload.setSignature(LoadFileUtil.getMD5(zipUrl));
+        } catch (IOException e) {
+            log.error("获取MD5签名失败", e);
+        }
+        //存储新ZIP包
+        ShiwanFileUpload newZipEntity = saveFile(FileUtil.getMulFileByPath(zipUrl), shiwanFileUpload, null);
+        deletelocalFiles(zipUrl);
+        if (!Check.isNull(newZipEntity)) {
+            saveInnerFiles(newZipEntity, list);
+        }
+        return newZipEntity;
+    }
+
+    /**
+     * 存储zip内部文件
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void saveInnerFiles(ShiwanFileUpload newZipEntity, List<String> list) {
+        MultipartFile mulFileByPath = null;
+        for (String url : list) {
+            ShiwanFileUpload shiwanFileUpload = new ShiwanFileUpload();
+            shiwanFileUpload.setUserId(newZipEntity.getUserId());
+            shiwanFileUpload.setAccountId(newZipEntity.getAccountId());
+            shiwanFileUpload.setFileType(newZipEntity.getFileType());
+            shiwanFileUpload.setParentId(newZipEntity.getId());
+            try {
+                shiwanFileUpload.setSignature(LoadFileUtil.getMD5(url));
+            } catch (IOException e) {
+                log.error("获取MD5签名失败", e);
+            }
+            mulFileByPath = FileUtil.getMulFileByPath(url);
+            saveFile(mulFileByPath, shiwanFileUpload, newZipEntity.getCfileName());
+            deletelocalFiles(url);
+        }
+    }
+
+    /**
+     * 删除本地文件
+     *
+     * @param
+     * @return void
+     * @throws
+     * @author ZHAOXA
+     */
+    private void deletelocalFiles(String filePath) {
+        File file = new File(filePath);
+        if (file.exists()) {
+            file.delete();
+        }
+    }
+
+    /**
+     * 查询现有的文件
+     *
+     * @param
+     * @return cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload
+     * @throws
+     * @author ZHAOXA
+     */
+    private ShiwanFileUpload getExistFiles(String userId, Long accountId, String fileName, String fileType, Long parentId) {
+        JSONObject job = new JSONObject();
+        job.put("useId", userId);
+        job.put("accountId", accountId);
+        job.put("fileName", fileName);
+        job.put("fileType", fileType);
+        job.put("parentId", parentId);
+        ShiwanFileUpload fileEntity = shiwanFileUploadMapper.selectEntity(job);
+        if (Check.isNull(fileEntity)) {
+            return null;
+        }
+        return fileEntity;
+    }
+}

+ 39 - 0
module-shiwan/src/main/java/cn/com/ctop/shiwan/modules/service/impl/IShiwanFileUploadService.java

@@ -0,0 +1,39 @@
+package cn.com.ctop.shiwan.modules.service;
+
+import cn.com.ctop.shiwan.modules.entity.ShiwanFileUpload;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * @Description: 试玩平台,文件信息
+ * @Author: jeecg-boot
+ * @Date: 2020-10-21
+ * @Version: V1.0
+ */
+public interface IShiwanFileUploadService extends IService<ShiwanFileUpload> {
+
+    /**
+     * 上传或更新文件(同名同账户同操作人同类型的文件会被新文件更新覆盖)
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    ShiwanFileUpload saveOrUpdateFile(MultipartFile file, String userId, Long accountId, String fileType, Long parentId, String uuid);
+
+    /**
+     * 创建新的zip文件
+     *
+     * @param
+     * @return java.lang.String
+     * @throws
+     * @author ZHAOXA
+     */
+    ShiwanFileUpload createNewZipFile(MultipartFile file, String id, String updateName, String userId, Long accountId, String fileType) throws IOException;
+
+    List<ShiwanFileUpload> selectListByParentId(String id);
+}

+ 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;

+ 1 - 0
pom.xml

@@ -21,6 +21,7 @@
         <module>module-crawler</module>
         <module>module-kuaishou</module>
         <module>module-toutiao</module>
+        <module>module-shiwan</module>
         <module>module-media</module>
         <module>module-ctop</module>
         <module>performance-appraisal</module>