Browse Source

合并creative代码

syh 5 năm trước cách đây
mục cha
commit
2fa36e6b62
43 tập tin đã thay đổi với 525 bổ sung2091 xóa
  1. 7 24
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/AdvertiserController.java
  2. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/BindAccountLoginController.java
  3. 6 136
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java
  4. 11 53
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java
  5. 6 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java
  6. 23 35
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java
  7. 0 13
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/CleanMaterialMapper.java
  8. 0 51
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/CleanMaterialMapper.xml
  9. 0 14
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/IKuaiShouCleanMaterialReportService.java
  10. 0 52
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CleanMaterialServiceImpl.java
  11. 0 20
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  12. 4 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ProjectMemberServiceImpl.java
  13. 15 0
      module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java
  14. 95 33
      module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java
  15. 0 18
      module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/IMaterialUploadService.java
  16. 0 295
      module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/impl/MaterialUploadServiceImpl.java
  17. 121 58
      module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java
  18. 7 94
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouActionBarTextController.java
  19. 7 91
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAdvertiserBaseInfoController.java
  20. 7 92
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppCreateController.java
  21. 7 92
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppInfoController.java
  22. 7 92
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppListController.java
  23. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouCampaignController.java
  24. 0 90
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java
  25. 26 123
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouAccountBudgetController.java
  26. 3 3
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/KuaiShouCleanMaterialReportController.java
  27. 1 1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaiShouCleanMaterialReport.java
  28. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/KuaiShouCleanMaterialReportMapper.java
  29. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyCreativeMapper.java
  30. 2 2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/mapper/xml/KuaiShouCleanMaterialReportMapper.xml
  31. 21 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyCreativeMapper.xml
  32. 29 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaiShouCleanMaterialReportService.java
  33. 41 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaiShouCleanMaterialReportServiceImpl.java
  34. 6 90
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertisePlanController.java
  35. 7 92
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertiserController.java
  36. 7 91
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java
  37. 7 91
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java
  38. 7 91
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeMaterialController.java
  39. 7 91
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceVideoInfoController.java
  40. 20 29
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java
  41. 1 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java
  42. 1 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ByteDanceCleanMaterialReportServiceImpl.java
  43. 7 5
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceReportServiceImpl.java

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

@@ -1,12 +1,9 @@
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.ResultMapUtils;
-import cn.com.ctop.common.module.utils.StatusCode;
-import cn.com.ctop.common.module.utils.StringUtils;
-import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
+import cn.com.ctop.common.module.utils.*;
 import com.alibaba.excel.EasyExcelFactory;
 import com.alibaba.excel.ExcelWriter;
 import com.alibaba.excel.metadata.Sheet;
@@ -42,7 +39,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.nio.charset.StandardCharsets;
 import java.util.*;
 
 /**
@@ -63,7 +59,7 @@ public class AdvertiserController {
     @Autowired
     private UserCompanyMapper userCompanyMapper;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ProjectMapper projectMapper;
     @Autowired
@@ -82,7 +78,7 @@ public class AdvertiserController {
     public Result<List<Advertiser>> getAdvertiserByCompany(String userId) {
         Result<List<Advertiser>> result = new Result<>();
         try {
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             QueryWrapper<Advertiser> queryWrapper = new QueryWrapper<>();
             if (!"admin".equals(roleCode)) {
                 QueryWrapper<UserCompany> userCompanyQueryWrapper = new QueryWrapper<>();
@@ -120,7 +116,7 @@ public class AdvertiserController {
                                                    HttpServletRequest req) {
 
         Result<IPage<Advertiser>> result = new Result<>();
-        String roleCode = materialReportMapper.getRoleCodeByUserId(advertiser.getUserId());
+        String roleCode = sysRoleService.getRoleCodeByUserId(advertiser.getUserId());
         String userId = advertiser.getUserId();
         if ("admin".equals(roleCode) || "kuaishouOperationManager".equals(roleCode) || "touTiaoOperationManager".equals(roleCode) || "sale".equals(roleCode) || "saleDirector".equals(roleCode)) {
             advertiser.setUserId(null);
@@ -348,7 +344,7 @@ public class AdvertiserController {
         String endDate = data.getString("endDate");
         List<SheetInfoVo> vos = advertiserService.getYdStatisticInfo(projectId, startDate, endDate);
         OutputStream outputStream = response.getOutputStream();
-        this.setResponseHeader(response, "伊对" + startDate + "至" + endDate + "周报.xls");
+        HttpUtils.setResponseHeader(response, "伊对" + startDate + "至" + endDate + "周报.xls");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         for (int i = 0; i < vos.size(); i++) {
             Sheet sheet = new Sheet(i + 1, 0, KuaishouXxlEntity.class);
@@ -431,7 +427,7 @@ public class AdvertiserController {
 
         OutputStream outputStream = response.getOutputStream();
         String date = DateUtils.formatDate(new Date());
-        this.setResponseHeader(response, "爱上消消消日报" + date + ".xls");
+        HttpUtils.setResponseHeader(response, "爱上消消消日报" + date + ".xls");
         ExcelWriter excelWriter = EasyExcelFactory.getWriter(outputStream);
         for (int i = 0; i < sheets.size(); i++) {
             Sheet sheet = new Sheet(i + 1, 0, KuaishouXxlEntity.class);
@@ -442,17 +438,4 @@ public class AdvertiserController {
         outputStream.flush();
         outputStream.close();
     }
-
-    //发送响应流方法
-    public void setResponseHeader(HttpServletResponse response, String fileName) {
-        try {
-            fileName = new String(fileName.getBytes(), StandardCharsets.ISO_8859_1);
-            response.setContentType("application/octet-stream;charset=ISO8859-1");
-            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
-            response.addHeader("Pargam", "no-cache");
-            response.addHeader("Cache-Control", "no-cache");
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-    }
 }

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

@@ -69,7 +69,7 @@ public class BindAccountLoginController {
         String accountName = json.getString("accountName");
         Map<String, Object> stringObjectMap = createInternalService.bindLogin(advertiserId, accountName, password, loginType, userId, advertiserName);
         Boolean trueOrFalse = (Boolean) stringObjectMap.get("success");
-        if (trueOrFalse) {
+        if (Boolean.TRUE.equals(trueOrFalse)) {
             Map<String, Object> deleteMap = new HashMap<>();
             deleteMap.put("account_name", accountName);
             deleteMap.put("user_id", userId);

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

@@ -7,9 +7,10 @@ import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.JsonUtil;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
 import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
 import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -24,27 +25,13 @@ import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.common.util.oConvertUtils;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
+import org.jeecg.modules.ctop.service.IKuaiShouUploadService;
 import org.jeecg.modules.ctop.service.IProjectMemberService;
 import org.jeecg.modules.ctop.service.IProjectService;
-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.*;
-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.text.ParseException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -143,11 +130,10 @@ public class MaterialInfoController {
                                                      @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                      HttpServletRequest req) {
         Result<IPage<MaterialInfo>> result = new Result<>();
-        QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
         Object createTime = materialInfo.getCreateTime();
         materialInfo.setCreateTime(null);
         materialInfo.setExcellent(1);
-        queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
+        QueryWrapper<MaterialInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
         if (!Check.isNull(createTime)) {
             try {
                 String dateString = DateUtils.getDateString(String.valueOf(createTime));
@@ -321,13 +307,9 @@ public class MaterialInfoController {
         } catch (Exception e) {
             result.setSuccess(false);
         }
-
-
         return result;
-
     }
 
-
     /**
      * 编辑
      *
@@ -397,7 +379,7 @@ public class MaterialInfoController {
     @AutoLog(value = "素材信息-通过id删除")
     @ApiOperation(value = "素材信息-通过id删除", notes = "素材信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             materialInfoService.removeById(id);
             Map<String, Object> deleteMap = new HashMap<>();
@@ -446,7 +428,7 @@ public class MaterialInfoController {
     @ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<MaterialInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<MaterialInfo> result = new Result<MaterialInfo>();
+        Result<MaterialInfo> result = new Result<>();
         MaterialInfo materialInfo = materialInfoService.getById(id);
         if (materialInfo == null) {
             result.error500("未找到对应实体");
@@ -456,116 +438,4 @@ public class MaterialInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<MaterialInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                MaterialInfo materialInfo = JSON.parseObject(deString, MaterialInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<MaterialInfo> pageList = materialInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "素材信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, MaterialInfo.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<MaterialInfo> listMaterialInfos = ExcelImportUtil.importExcel(file.getInputStream(), MaterialInfo.class, params);
-                materialInfoService.saveBatch(listMaterialInfos);
-                return Result.ok("文件导入成功!数据行数:" + listMaterialInfos.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("文件导入失败!");
-    }
-
-    @AutoLog(value = "获取有效素材")
-    @ApiOperation(value = "获取有效素材", notes = "获取有效素材")
-    @GetMapping(value = "/effiMaterialInfo")
-    public Result<IPage<MaterialInfo>> effiMaterialInfo(MaterialInfo materialInfo,
-                                                        @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
-                                                        @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
-                                                        HttpServletRequest req) {
-        Result<IPage<MaterialInfo>> result = new Result<>();
-        QueryWrapper<MaterialInfo> queryWrapper = new QueryWrapper<>();
-
-        List<String> effiList = materialInfoService.getEffiCode();
-        Object createTime = materialInfo.getCreateTime();
-        materialInfo.setCreateTime(null);
-        queryWrapper.in("code", effiList);
-        queryWrapper.groupBy("code");
-        //queryWrapper = QueryGenerator.initQueryWrapper(materialInfo, req.getParameterMap());
-
-        Page<MaterialInfo> page = new Page<>(pageNo, pageSize);
-        IPage<MaterialInfo> pageList = materialInfoService.page(page, queryWrapper);
-
-        List<MaterialInfo> materialInfoList = pageList.getRecords();
-        if (materialInfoList.size() != 0) {
-            for (MaterialInfo material : materialInfoList) {
-                //判断是否已经同步到快手平台
-                Integer kuaishouMaterialUpCount = materialInfoService.getKuaishouUpVideoCount(material.getCode());
-                if (kuaishouMaterialUpCount > 0) {
-                    material.setKuaishouVideoIsUp(1);
-                } else {
-                    material.setKuaishouVideoIsUp(0);
-                }
-                //判断是否已经同步到抖音平台
-                Integer toutiaoMaterialUpCount = materialInfoService.getToutiaoUpVideoCount(material.getCode());
-                if (toutiaoMaterialUpCount > 0) {
-                    material.setToutiaoVideoIsUp(1);
-                } else {
-                    material.setToutiaoVideoIsUp(0);
-                }
-            }
-        }
-        result.setSuccess(true);
-        result.setResult(pageList);
-        return result;
-    }
 }

+ 11 - 53
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -21,8 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
-import org.jeecg.modules.ctop.service.ICleanMaterialService;
-import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -45,8 +43,6 @@ import static org.jeecg.common.util.DateUtils.getAnotherDay;
 @Slf4j
 public class TestController {
     @Autowired
-    private ICreateInternalService createInternalService;
-    @Autowired
     private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
 
     @Autowired
@@ -66,7 +62,7 @@ public class TestController {
 
     @GetMapping(value = "/t")
     public String test() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
             String requestId = UUID.randomUUID().toString();
             String img = kuaishouWebInterfaceService.qrLogin(requestId);
@@ -196,7 +192,7 @@ public class TestController {
 
     @GetMapping(value = "/getHistoryData")
     public String getHistoryData() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
             String endDateStr = DateUtils.getDate("yyyy-MM-dd");
             String startDate = DateUtils.addMonth(endDateStr, -6);
@@ -219,14 +215,11 @@ public class TestController {
 
     @GetMapping(value = "/getTaskList")
     public String getTaskList() {
-        Result<String> result = new Result<String>();
+        Result<String> result = new Result<>();
         try {
-            String endDateStr = DateUtils.getDate("yyyy-MM-dd");
-            String startDate = DateUtils.addMonth(endDateStr, -6);
             QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
             tokenQueryWrapper.eq("media_id", 2);
             historyReportTaskService.getTaskList();
-
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);
@@ -244,7 +237,6 @@ public class TestController {
         List<CtopOauthToken> ctopOauthTokens = tokenMapper.selectList(tokenQueryWrapper);
         for (CtopOauthToken token : ctopOauthTokens) {
 
-
             for (int i = 0; i < 7; i++) {
                 Date getStartDate = DateUtils.addDay(endDate, -i);
                 //3:获取广告组信息数据
@@ -344,13 +336,6 @@ public class TestController {
     @Autowired
     private IUserAllocationService userAllocationService;
 
-
-    public static void main(String[] args) throws ParseException {
-        String date = DateUtils.getDate("yyyy-MM-dd");
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", date, -1);
-    }
-
-
     @GetMapping(value = "/getPlanAndGroupByAccount")
     public void getPlanAndGroupByAccount(Long accountId) {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();
@@ -365,8 +350,6 @@ public class TestController {
         } catch (Exception e) {
             e.printStackTrace();
         }
-
-
     }
 
 
@@ -407,7 +390,7 @@ public class TestController {
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("project_id", 215);
         List<UserAllocation> allocations = userAllocationService.list(queryWrapper);
-        if (null == allocations || allocations.size() <= 0) {
+        if (null == allocations || allocations.isEmpty()) {
             log.info("定时获取头条数据异常:获取用户信息失败");
         }
         Date finalGetDate = getDate;
@@ -429,7 +412,7 @@ public class TestController {
                     .eq("stat_datetime", dateString)
             ;
             List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(reportQueryWrapper);
-            if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+            if (null != bytedancePlanDailyReports && !bytedancePlanDailyReports.isEmpty()) {
                 bytedancePlanDailyReports.forEach(report -> {
                     String adName = report.getAdName();
                     String[] tags = adName.split("-");
@@ -470,8 +453,10 @@ public class TestController {
         Map<String, Object> result = new HashMap<>();
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("定时获取头条数据异常:为获取到可用的token");
+            ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
+            return result;
         }
         tokens.forEach(token -> {
             advertiserDataService.getMaterialList(token);
@@ -491,13 +476,11 @@ public class TestController {
             allocations.forEach(allocation -> {
                 //根据accountId和时间,查询相关的日报表信息
                 QueryWrapper<BytedancePlanDailyReport> queryWrapper = new QueryWrapper<>();
-                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
-//                String dateString = dateFormat.format(getDate)+" 00:00:00";
                 queryWrapper.eq("advertiser_id", allocation.getAccountId())
 //                        .eq("stat_datetime",dateString)
                 ;
                 List<BytedancePlanDailyReport> bytedancePlanDailyReports = planDailyReportService.list(queryWrapper);
-                if (null != bytedancePlanDailyReports && bytedancePlanDailyReports.size() > 0) {
+                if (null != bytedancePlanDailyReports && !bytedancePlanDailyReports.isEmpty()) {
                     bytedancePlanDailyReports.forEach(report -> {
                         String adName = report.getAdName();
                         String[] tags = adName.split("-");
@@ -547,7 +530,7 @@ public class TestController {
         }
         //1:查询当日数据
         List<CtopOauthToken> tokens = tokenService.getTokenListByType(CtopAdConstant.PLATFORM_TYPE_BYTEDANCE);
-        if (null == tokens || tokens.size() <= 0) {
+        if (null == tokens || tokens.isEmpty()) {
             log.info("定时获取头条小时数据异常:未获取到可用的token");
             ResultMapUtils.setResultMap(result, StatusCode.COMMON_PARAM_ERROR);
             return result;
@@ -667,7 +650,7 @@ public class TestController {
             Date getDate = DateUtils.addDay(new Date(), -i);
             log.info(DateUtils.formatDate(getDate) + "头条创意日报数据开始获取");
             //查询当日数据
-            if (null == tokens || tokens.size() <= 0) {
+            if (null == tokens || tokens.isEmpty()) {
                 log.info("定时获取头条数据异常:为获取到可用的token");
                 continue;
             }
@@ -732,31 +715,6 @@ public class TestController {
         return result;
     }
 
-
-    @Autowired
-    private ICleanMaterialService cleanMaterialService;
-
-    @GetMapping("testReport")
-    public void testReport() {
-        List<String> signatureList = cleanMaterialService.getSignature();
-        if (Check.isNull(signatureList)) {
-            log.error("素材数据获取为空");
-            return;
-        }
-        executorService = Executors.newFixedThreadPool(5);
-        for (int i = 0; i < signatureList.size(); i++) {
-            String signature = signatureList.get(i);
-            executorService.submit(new Runnable() {
-                @Override
-                public void run() {
-                    cleanMaterialService.calculationReport(signature);
-                }
-            });
-        }
-
-
-    }
-
     @GetMapping(value = "/AccountReportByAccount")
     public void AccountReportByAccount(Long accountId, String startDateStr, String endDateStr) {
         QueryWrapper<CtopOauthToken> oauthTokenQueryWrapper = new QueryWrapper<>();

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

@@ -2,10 +2,10 @@ package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.mapper.UserAllocationMapper;
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.StringUtils;
-import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -48,7 +48,7 @@ public class UserAllocationController {
     @Autowired
     private IProjectService projectService;
     @Autowired
-    private MaterialReportMapper materialReportMapper;
+    private ISysRoleService sysRoleService;
     @Autowired
     private ProjectMemberMapper memberMapper;
     @Autowired
@@ -98,7 +98,7 @@ public class UserAllocationController {
                 addMember.setProjectName(project.getProjectName());
                 addMember.setUserId(userAllocations.getUserId());
                 addMember.setUserName(userAllocations.getUserName());
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userAllocations.getUserId());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocations.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }
@@ -153,7 +153,7 @@ public class UserAllocationController {
                 queryWrapper.eq("media_id", project.getMediaId());
             }
 
-            String roleCode = materialReportMapper.getRoleCodeByUserId(userId);
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
             if (!"admin".equals(roleCode) && !"kuaishouOperationManager".equals(roleCode) && !"designTeamLeader".equals(roleCode) && !"touTiaoOperationManager".equals(roleCode)) {
                 queryWrapper.eq("user_id", userId);
             }
@@ -221,7 +221,7 @@ public class UserAllocationController {
         Result<IPage<UserAllocation>> result = new Result<>();
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         QueryWrapper<UserAllocation> queryWrapper = QueryGenerator.initQueryWrapper(userAllocation, req.getParameterMap());
-        String roleCode = materialReportMapper.getRoleCodeByUserId(user.getId());
+        String roleCode = sysRoleService.getRoleCodeByUserId(user.getId());
         if (!"admin".equals(roleCode)) {
             queryWrapper.eq("user_id", user.getId());
             queryWrapper.orderByDesc("id");
@@ -281,7 +281,7 @@ public class UserAllocationController {
                 addMember.setProjectName(userAllocation.getProjectName());
                 addMember.setUserId(userAllocation.getUserId());
                 addMember.setUserName(userAllocation.getUserName());
-                String roleCode = materialReportMapper.getRoleCodeByUserId(userAllocation.getUserId());
+                String roleCode = sysRoleService.getRoleCodeByUserId(userAllocation.getUserId());
                 if (!Check.isNull(roleCode)) {
                     addMember.setRoleCode(roleCode);
                 }

+ 23 - 35
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/job/WatermarkVideoJob.java

@@ -15,7 +15,6 @@ import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import java.io.IOException;
 import java.util.List;
 
 public class WatermarkVideoJob implements Job {
@@ -26,43 +25,32 @@ public class WatermarkVideoJob implements Job {
 
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        Thread thread = new Thread() {
-            @Override
-            public void run() {
-                QueryWrapper<VideoWatermarkTask> queryWrapper = new QueryWrapper<>();
-                queryWrapper.in("status", "Submitted", "Transcoding");
-                List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
-                if (list != null && list.size() > 0) {
-                    for (VideoWatermarkTask videoWatermarkTask : list) {
-                        QueryJobListResponse.Job job = MpsUtils.getJobStatus(videoWatermarkTask.getJobId());
-                        if ("TranscodeSuccess".equals(job.getState())) {
-                            String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
+        QueryWrapper<VideoWatermarkTask> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("status", "Submitted", "Transcoding");
+        List<VideoWatermarkTask> list = videoWaterMarkService.list(queryWrapper);
+        if (list != null && !list.isEmpty()) {
+            for (VideoWatermarkTask videoWatermarkTask : list) {
+                QueryJobListResponse.Job job = MpsUtils.getJobStatus(videoWatermarkTask.getJobId());
+                if ("TranscodeSuccess".equals(job.getState())) {
+                    String url = "https://ctop-media.oss-cn-beijing.aliyuncs.com/" + job.getOutput().getOutputFile().getObject();
+                    String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
+                    LoadFileUtil.delFile(localPath);
+                    QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
+                    materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
+                    MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
+                    if (Check.isNull(materialInfo)) {
+                        videoWaterMarkService.removeById(videoWatermarkTask.getId());
+                        continue;
 
-                            try {
-                                String localPath = LoadFileUtil.downLoadFromUrl(url, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
-                                LoadFileUtil.delFile(localPath);
-                                QueryWrapper<MaterialInfo> materialInfoQueryWrapper = new QueryWrapper<>();
-                                materialInfoQueryWrapper.eq("watermark_code", job.getJobId());
-                                MaterialInfo materialInfo = materialInfoService.getOne(materialInfoQueryWrapper);
-                                if (Check.isNull(materialInfo)) {
-                                    videoWaterMarkService.removeById(videoWatermarkTask.getId());
-                                    continue;
-
-                                }
-                                materialInfo.setWatermarkUrl(url);
-                                materialInfoService.saveOrUpdate(materialInfo);
-                                videoWatermarkTask.setVideoUrl(url);
-                                videoWatermarkTask.setStatus(job.getState());
-                                videoWatermarkTask.setVideoId(materialInfo.getId());
-                                videoWaterMarkService.updateById(videoWatermarkTask);
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
-                        }
                     }
+                    materialInfo.setWatermarkUrl(url);
+                    materialInfoService.saveOrUpdate(materialInfo);
+                    videoWatermarkTask.setVideoUrl(url);
+                    videoWatermarkTask.setStatus(job.getState());
+                    videoWatermarkTask.setVideoId(materialInfo.getId());
+                    videoWaterMarkService.updateById(videoWatermarkTask);
                 }
             }
-        };
-        thread.start();
+        }
     }
 }

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

@@ -1,13 +0,0 @@
-package org.jeecg.modules.ctop.mapper;
-
-import org.apache.ibatis.annotations.Param;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-
-import java.util.List;
-
-public interface CleanMaterialMapper {
-    List<String> getSignatureList();
-
-    KuaiShouCleanMaterialReport calculationMaterialReport(@Param("signature") String signature);
-
-}

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

@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ctop.mapper.CleanMaterialMapper">
-    <select id="getSignatureList" resultType="java.lang.String">
-    SELECT
-      DISTINCT(signature)
-      from ctop_kuaishou_report_daily_creative
-      WHERE signature !=''
-    </select>
-
-    <select id="calculationMaterialReport" resultType="org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport">
-        select
-        signature id,
-        sum(charge) charge,
-        sum(photo_show) photoShow,
-        sum(photo_click) photoClick,
-        sum(aclick) aclick,
-        sum(bclick) bclick,
-        sum(activation) activation,
-        sum(form_count) formCount
-        from ctop_kuaishou_report_daily_creative
-        where
-        signature = #{signature}
-    </select>
-
-
-    <select id="getByteDanceSignatureList" resultType="java.lang.String">
-    SELECT
-      DISTINCT(signature)
-      from ctop_bytedance_report_creative_daily
-      WHERE signature !=''
-    </select>
-
-    <select id="calculationByteDanceMaterialReport" resultType="org.jeecg.modules.ctop.entity.ByteDanceCleanMaterialReport">
-        select
-        signature id,
-        sum(cost) cost,
-        sum(show_num) showNum,
-        sum(click) click,
-        sum(convert_num) convertNum,
-        sum(active) active,
-        sum(register) register,
-        sum(form) form,
-        sum(total_play) totalPlay,
-        sum(valid_play) validPlay
-        from ctop_bytedance_report_creative_daily
-        where
-        signature = #{signature}
-    </select>
-
-</mapper>

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

@@ -1,14 +0,0 @@
-package org.jeecg.modules.ctop.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
-}

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

@@ -1,52 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
-import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-import org.jeecg.modules.ctop.mapper.CleanMaterialMapper;
-import org.jeecg.modules.ctop.service.ICleanMaterialService;
-import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class CleanMaterialServiceImpl implements ICleanMaterialService {
-    @Autowired
-    private CleanMaterialMapper cleanMaterialMapper;
-    @Autowired
-    IKuaishouReportDailyCreativeService kuaishouReportDailyCreativeService;
-    @Autowired
-    private IKuaiShouCleanMaterialReportService cleanMaterialReportService;
-    @Autowired
-    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
-
-
-    /**
-     * 快手 MD5集合
-     *
-     * @return
-     */
-    @Override
-    public List<String> getSignature() {
-        return cleanMaterialMapper.getSignatureList();
-    }
-
-    /**
-     * 计算素材报表
-     *
-     * @param signature
-     */
-    @Override
-    public void calculationReport(String signature) {
-        if (Check.isNull(signature)) {
-            return;
-        }
-        KuaiShouCleanMaterialReport calculationMaterialReport = cleanMaterialMapper.calculationMaterialReport(signature);
-        if (!Check.isNull(calculationMaterialReport)) {
-            cleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
-        }
-    }
-}

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

@@ -1,20 +0,0 @@
-package org.jeecg.modules.ctop.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-import org.jeecg.modules.ctop.mapper.KuaiShouCleanMaterialReportMapper;
-import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 快手素材清洗数据
- *
- * @author jeecg-boot
- * @version V1.0
- * @date 2020-02-24
- */
-@Service
-public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
-
-}

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

@@ -1,7 +1,7 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import cn.com.ctop.common.module.service.ISysRoleService;
 import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.kuaishou.modules.report.mapper.MaterialReportMapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.ctop.entity.Project;
 import org.jeecg.modules.ctop.entity.ProjectMember;
@@ -24,11 +24,10 @@ import java.util.Map;
  */
 @Service
 public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, ProjectMember> implements IProjectMemberService {
-
-    @Autowired
-    private MaterialReportMapper materialReportMapper;
     @Autowired
     private ProjectMemberMapper memberMapper;
+    @Autowired
+    private ISysRoleService sysRoleService;
 
     @Override
     public void addMember(SysUser sysUser, Project project) {
@@ -41,7 +40,7 @@ public class ProjectMemberServiceImpl extends ServiceImpl<ProjectMemberMapper, P
         member.setProjectName(project.getProjectName());
         member.setUserId(sysUser.getId());
         member.setUserName(sysUser.getRealname());
-        String roleCode = materialReportMapper.getRoleCodeByUserId(sysUser.getId());
+        String roleCode = sysRoleService.getRoleCodeByUserId(sysUser.getId());
         if (!Check.isNull(roleCode)) {
             member.setRoleCode(roleCode);
         }

+ 15 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/HttpUtils.java

@@ -35,6 +35,7 @@ import org.apache.http.util.EntityUtils;
 import org.eclipse.jetty.util.UrlEncoded;
 
 import javax.net.ssl.SSLContext;
+import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -43,6 +44,7 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLEncoder;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.security.cert.CertificateException;
 import java.security.cert.X509Certificate;
 import java.util.*;
@@ -53,6 +55,19 @@ import java.util.*;
 @Slf4j
 public class HttpUtils {
 
+    //发送响应流方法
+    public static void setResponseHeader(HttpServletResponse response, String fileName) {
+        try {
+            fileName = new String(fileName.getBytes(), StandardCharsets.UTF_8);
+            response.setContentType("application/octet-stream;charset=ISO8859-1");
+            response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+            response.addHeader("Pargam", "no-cache");
+            response.addHeader("Cache-Control", "no-cache");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
     public static JSONObject bytedanceGetRequest(String accessToken, String url, JSONObject params) {
         // 构造请求
         HttpEntityEnclosingRequestBase httpEntity = new HttpEntityEnclosingRequestBase() {

+ 95 - 33
module-common/src/main/java/cn/com/ctop/common/module/utils/LoadFileUtil.java

@@ -5,6 +5,8 @@ import org.apache.commons.codec.digest.DigestUtils;
 import java.io.*;
 import java.net.HttpURLConnection;
 import java.net.URL;
+import java.net.URLEncoder;
+import java.util.Map;
 
 public class LoadFileUtil {
     /**
@@ -15,41 +17,46 @@ public class LoadFileUtil {
      * @return
      * @throws IOException
      */
-    public static String downLoadFromUrl(String urlStr, String savePath) throws IOException {
-        String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
-        URL url = new URL(urlStr);
-
-        System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
-        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-        //设置超时间为3秒
-        conn.setConnectTimeout(60 * 1000);
-        //防止屏蔽程序抓取而返回403错误
-        conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
-        //得到输入流
-        InputStream inputStream = conn.getInputStream();
-        //获取自己数组
-        byte[] getData = readInputStream(inputStream);
-
-        //文件保存位置
-        File saveDir = new File(savePath);
-        if (!saveDir.exists()) {
+    public static String downLoadFromUrl(String urlStr, String savePath) {
+        try {
+
+            String fileName = AesEncryptUtil.getUrlDecoderString(urlStr.substring(urlStr.lastIndexOf("/") + 1));
+            URL url = new URL(urlStr);
+
+            System.setProperty("https.protocols", "TLSv1,TLSv1.1,TLSv1.2,SSLv3");
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(60 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            //得到输入流
+            InputStream inputStream = conn.getInputStream();
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(savePath);
+            if (!saveDir.exists()) {
 //            saveDir.mkdir();
-            saveDir.mkdirs();
-        }
-        String localPath = saveDir + File.separator + fileName;
-        File file = new File(localPath);
-        if (!file.exists()) {
-            file.getParentFile().mkdirs();
-        }
-        FileOutputStream fos = new FileOutputStream(file);
-        fos.write(getData);
-        if (fos != null) {
-            fos.close();
-        }
-        if (inputStream != null) {
-            inputStream.close();
+                saveDir.mkdirs();
+            }
+            String localPath = saveDir + File.separator + fileName;
+            File file = new File(localPath);
+            if (!file.exists()) {
+                file.getParentFile().mkdirs();
+            }
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            if (fos != null) {
+                fos.close();
+            }
+            if (inputStream != null) {
+                inputStream.close();
+            }
+            return localPath;
+        } catch (Exception e) {
+            return null;
         }
-        return localPath;
 
 
     }
@@ -112,4 +119,59 @@ public class LoadFileUtil {
             file.mkdir();
         }
     }
+
+    public static String downloadByUrl(Map<String, Object> requestMap, String downloadPath, String urlStr, String token, String fileName) {
+
+        try {
+            StringBuilder postBody = null;
+            if (!Check.isNull(requestMap)) {
+                postBody = new StringBuilder();
+                for (Map.Entry<String, Object> entry : requestMap.entrySet()) {
+                    if (entry.getValue() == null) {
+                        continue;
+                    }
+                    postBody.append(entry.getKey()).append("=").append(URLEncoder.encode(entry.getValue().toString(),
+                            "utf-8")).append("&");
+                }
+                if (!requestMap.isEmpty()) {
+                    postBody.deleteCharAt(postBody.length() - 1);
+                }
+            }
+
+            URL url = new URL(urlStr + "?" + postBody);
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+            //设置超时间为3秒
+            conn.setConnectTimeout(120 * 1000);
+            //防止屏蔽程序抓取而返回403错误
+            conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
+            conn.setRequestProperty("Access-Token", token);
+            //得到输入流
+            InputStream inputStream = null;
+
+            inputStream = conn.getInputStream();
+
+            //获取自己数组
+            byte[] getData = readInputStream(inputStream);
+
+            //文件保存位置
+            File saveDir = new File(downloadPath);
+            if (!saveDir.exists()) {
+                saveDir.mkdirs();
+            }
+            String filePath = downloadPath + fileName;
+
+            File file = new File(saveDir + File.separator + fileName);
+            FileOutputStream fos = new FileOutputStream(file);
+            fos.write(getData);
+            fos.close();
+            inputStream.close();
+            return filePath;
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+
+        return null;
+
+    }
 }

+ 0 - 18
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/IMaterialUploadService.java

@@ -1,18 +0,0 @@
-package cn.com.ctop.manage.modules.edu.service;
-
-import com.alibaba.fastjson.JSONArray;
-
-import java.io.IOException;
-
-public interface IMaterialUploadService {
-
-    /**
-     * 同步素材到账号下
-     *
-     * @param mediaId
-     * @param materialArray
-     * @param accountArray
-     */
-    void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) throws IOException;
-
-}

+ 0 - 295
module-ctop/src/main/java/cn/com/ctop/manage/modules/edu/service/impl/MaterialUploadServiceImpl.java

@@ -1,295 +0,0 @@
-package cn.com.ctop.manage.modules.edu.service.impl;
-
-import cn.com.ctop.common.module.entity.CtopOauthToken;
-import cn.com.ctop.common.module.entity.MaterialInfo;
-import cn.com.ctop.common.module.entity.MaterialParameter;
-import cn.com.ctop.common.module.enums.MaterialEnum;
-import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
-import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
-import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
-import cn.com.ctop.common.module.service.IFileInfoService;
-import cn.com.ctop.common.module.service.IMaterialParameterService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.LoadFileUtil;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
-import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.http.ParseException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-@Slf4j
-@Service
-public class MaterialUploadServiceImpl implements IMaterialUploadService {
-    static ExecutorService kuaiShouExecutorService = Executors.newFixedThreadPool(5);
-    static ExecutorService touTiaoExecutorService = Executors.newFixedThreadPool(5);
-    @Value("${oss.replace.replace-value}")
-    private String replaceValue;
-    @Value("${oss.replace.replace-old-value}")
-    private String replaceOldValue;
-    @Value("${oss.replace.download}")
-    private String downloadUrl;
-
-
-    @Autowired
-    private CtopOauthTokenMapper oauthTokenMapper;
-    @Autowired
-    private MaterialInfoMapper materialInfoMapper;
-    @Autowired
-    private IKuaishouInterfaceService kuaishouInterfaceService;
-    @Autowired
-    private IFileInfoService fileInfoService;
-    @Autowired
-    private IKuaiShouImageGetService iKuaiShouImageGetService;
-    @Autowired
-    private IMaterialParameterService materialParameterService;
-    @Autowired
-    private MaterialParameterMapper parameterMapper;
-    @Autowired
-    private IKuaiShouVideoGetService kuaiShouVideoGetService;
-    @Autowired
-    private IMaterialUploadImageService materialUploadImageService;
-
-
-    /**
-     * 同步素材到账号下
-     *
-     * @param mediaId
-     * @param materialArray
-     * @param accountArray
-     */
-
-    @Override
-    public void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) {
-        try {
-            if ("2".equals(mediaId)) {
-                this.kuaiShouUpload(mediaId, materialArray, accountArray);
-            } else if ("1".equals(mediaId)) {
-                this.touTiaoUpload(mediaId, materialArray, accountArray);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-
-
-    }
-
-
-    private void touTiaoUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
-        for (int j = 0; j < materialArray.size(); j++) {
-            String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
-            if (Check.isNull(materialInfo)) {
-                continue;
-            }
-            if (Check.isNull(materialInfo.getUrl())) {
-                continue;
-            }
-
-
-            try {
-                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
-                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-
-                for (int i = 0; i < accountArray.size(); i++) {
-                    Long accountId = accountArray.getLong(i);
-                    if (Check.isNull(accountId)) {
-                        continue;
-                    }
-                    touTiaoExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                                if ("VIDEO".equals(materialInfo.getType())) {
-                                    fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl);
-
-                                } else if ("IMAGE".equals(materialInfo.getType())) {
-                                    fileInfoService.uploadImageToBytedance(String.valueOf(accountId), localUrl);
-                                }
-
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    });
-                }
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-
-
-        }
-
-
-    }
-
-
-    private void kuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
-        for (int j = 0; j < materialArray.size(); j++) {
-            String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
-            if (Check.isNull(materialInfo)) {
-                continue;
-            }
-            if (Check.isNull(materialInfo.getUrl())) {
-                continue;
-            }
-            try {
-                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
-                log.info("replaceUrl:{}", url);
-                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-                FileSystemResource resource = new FileSystemResource(new File(localUrl));
-                Map<String, String> headerMap = new HashMap<>();
-                headerMap.put("Content-Type", "multipart/form-data");
-                JSONObject requestJson = new JSONObject();
-                requestJson.put("file", resource);
-                requestJson.put("signature", materialInfo.getCode());
-
-                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                parameterQueryWrapper.eq("material_id", materialInfo.getCode());
-                parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
-                MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
-                if (!Check.isNull(materialParameter)) {
-                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
-                    if (!Check.isNull(type) && type != 0) {
-                        requestJson.put("type", type);
-                    }
-                }
-                for (int i = 0; i < accountArray.size(); i++) {
-                    Long accountId = accountArray.getLong(i);
-                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
-                    tokenQueryWrapper.eq("account_id", accountId);
-                    tokenQueryWrapper.eq("media_id", mediaId);
-                    tokenQueryWrapper.orderByDesc("create_time");
-                    tokenQueryWrapper.last("limit 1");
-                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
-                    if (Check.isNull(ctopOauthToken)) {
-                        continue;
-                    }
-                    requestJson.put("advertiser_id", accountId);
-                    headerMap.put("Access-Token", ctopOauthToken.getAccessToken());
-                    kuaiShouExecutorService.submit(new Runnable() {
-                        @Override
-                        public void run() {
-                            try {
-                                log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-
-                                String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
-                                JSONObject resultJson = JSONObject.parseObject(result);
-                                if (!Check.isNull(resultJson)) {
-                                    if (resultJson.getInteger("code") == 0) {
-                                        JSONObject dataJson = resultJson.getJSONObject("data");
-                                        if (!Check.isNull(dataJson)) {
-
-
-                                            // kuaishouInterfaceService.videoGet(accountId, ctopOauthToken.getAccessToken(), dataJson.getString("photo_id"), dataJson.getString("signature"));
-                                            String photoId = dataJson.getString("photo_id");
-                                            String signature = dataJson.getString("signature");
-                                            KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
-                                            videoGet.setAccountId(accountId);
-                                            videoGet.setId(accountId + photoId);
-                                            videoGet.setUrl(materialInfo.getUrl());
-                                            QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
-                                            parameterQueryWrapper.eq("material_id", signature);
-                                            parameterQueryWrapper.last("limit 1");
-
-                                            MaterialParameter materialParameter = parameterMapper.selectOne(parameterQueryWrapper);
-                                            if (!Check.isNull(materialParameter)) {
-                                                String width = materialParameter.getWidth();
-                                                String height = materialParameter.getHeight();
-                                                videoGet.setWidth(Integer.valueOf(width));
-                                                videoGet.setHeight(Integer.valueOf(height));
-                                                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
-                                                if (!Check.isNull(type)) {
-                                                    videoGet.setMaterialType(type);
-                                                }
-                                            }
-                                            videoGet.setPhotoId(photoId);
-                                            //    videoGet.setCoverUrl(dataJson.getString("cover_url"));
-                                            videoGet.setSignature(signature);
-                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);
-                                            materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
-
-                                        }
-                                        log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
-                                    } else {
-                                        log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
-                                    }
-                                }
-
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    });
-
-                }
-                /*boolean isTrue = LoadFileUtil.delFile(localUrl);
-                if (isTrue) {
-                    log.info("删除本地缓存素材成功,code:{}", materialInfo.getCode());
-                }*/
-
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-
-
-        }
-
-
-    }
-
-
-    @Autowired
-    private RestTemplate rest;
-
-    private String exceptInfoForRestTemplate(String url, Map<String, Object> paramMap, Map<String, String> headerMap) throws ParseException {
-        try {
-            MultiValueMap<String, Object> param = new LinkedMultiValueMap<>();
-            if (!Check.isNullMap(paramMap)) {
-                for (String key : paramMap.keySet()) {
-                    param.add(key, paramMap.get(key));
-                }
-                HttpHeaders headers = new HttpHeaders();
-                if (!Check.isNullMap(headerMap)) {
-                    for (String key : headerMap.keySet()) {
-                        headers.add(key, headerMap.get(key));
-                    }
-                }
-                HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity<MultiValueMap<String, Object>>(param, headers);
-                ResponseEntity<String> responseEntity = rest.exchange(url, HttpMethod.POST, httpEntity, String.class);
-                return responseEntity.getBody();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-}

+ 121 - 58
module-ctop/src/main/java/cn/com/ctop/manage/modules/material/service/impl/MaterialUploadServiceImpl.java

@@ -1,23 +1,27 @@
-package cn.com.ctop.manage.modules.material.service.impl;
+package cn.com.ctop.manage.modules.edu.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialInfo;
 import cn.com.ctop.common.module.entity.MaterialParameter;
 import cn.com.ctop.common.module.enums.MaterialEnum;
-import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.mapper.CtopOauthTokenMapper;
+import cn.com.ctop.common.module.mapper.MaterialInfoMapper;
+import cn.com.ctop.common.module.mapper.MaterialParameterMapper;
 import cn.com.ctop.common.module.service.IFileInfoService;
-import cn.com.ctop.common.module.service.IMaterialInfoService;
 import cn.com.ctop.common.module.service.IMaterialParameterService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadImageService;
 import cn.com.ctop.manage.modules.material.service.IMaterialUploadService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -40,7 +44,8 @@ import java.util.concurrent.Executors;
 @Slf4j
 @Service
 public class MaterialUploadServiceImpl implements IMaterialUploadService {
-    static ExecutorService executorService = Executors.newFixedThreadPool(4);
+    static ExecutorService kuaiShouExecutorService = Executors.newFixedThreadPool(5);
+    static ExecutorService touTiaoExecutorService = Executors.newFixedThreadPool(5);
     @Value("${oss.replace.replace-value}")
     private String replaceValue;
     @Value("${oss.replace.replace-old-value}")
@@ -50,14 +55,20 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
 
 
     @Autowired
-    private ICtopOauthTokenService oauthTokenService;
+    private CtopOauthTokenMapper oauthTokenMapper;
     @Autowired
-    private IMaterialInfoService materialInfoService;
+    private MaterialInfoMapper materialInfoMapper;
+    @Autowired
+    private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private IFileInfoService fileInfoService;
     @Autowired
+    private IKuaiShouImageGetService iKuaiShouImageGetService;
+    @Autowired
     private IMaterialParameterService materialParameterService;
     @Autowired
+    private MaterialParameterMapper parameterMapper;
+    @Autowired
     private IKuaiShouVideoGetService kuaiShouVideoGetService;
     @Autowired
     private IMaterialUploadImageService materialUploadImageService;
@@ -75,9 +86,9 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     public void uploadAccount(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         try {
             if ("2".equals(mediaId)) {
-                this.kuaiShouUpload(materialArray, accountArray);
+                this.kuaiShouUpload(mediaId, materialArray, accountArray);
             } else if ("1".equals(mediaId)) {
-                this.touTiaoUpload(materialArray, accountArray);
+                this.touTiaoUpload(mediaId, materialArray, accountArray);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -87,37 +98,55 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
     }
 
 
-    private void touTiaoUpload(JSONArray materialArray, JSONArray accountArray) {
+    private void touTiaoUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
             String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoService.getById(materialId);
+            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
             if (Check.isNull(materialInfo) || Check.isNull(materialInfo.getUrl())) {
                 continue;
             }
-            String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
-            String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
-            for (int i = 0; i < accountArray.size(); i++) {
-                Long accountId = accountArray.getLong(i);
-                if (Check.isNull(accountId)) {
-                    continue;
-                }
-                executorService.submit(() -> {
-                    log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                    if ("VIDEO".equals(materialInfo.getType())) {
-                        fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl);
-                    } else if ("IMAGE".equals(materialInfo.getType())) {
-                        fileInfoService.uploadImageToBytedance(String.valueOf(accountId), localUrl);
+            try {
+                String url = materialInfo.getUrl().replace(replaceOldValue, replaceValue);
+                String localUrl = LoadFileUtil.downLoadFromUrl(url, downloadUrl);
+
+                for (int i = 0; i < accountArray.size(); i++) {
+                    Long accountId = accountArray.getLong(i);
+                    if (Check.isNull(accountId)) {
+                        continue;
                     }
-                });
+                    touTiaoExecutorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                log.info("头条文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
+                                if ("VIDEO".equals(materialInfo.getType())) {
+                                    fileInfoService.uploadVideoToBytedance(String.valueOf(accountId), localUrl);
+
+                                } else if ("IMAGE".equals(materialInfo.getType())) {
+                                    fileInfoService.uploadImageToBytedance(String.valueOf(accountId), localUrl);
+                                }
+
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    });
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
             }
+
+
         }
+
+
     }
 
 
-    private void kuaiShouUpload(JSONArray materialArray, JSONArray accountArray) {
+    private void kuaiShouUpload(String mediaId, JSONArray materialArray, JSONArray accountArray) {
         for (int j = 0; j < materialArray.size(); j++) {
             String materialId = materialArray.getString(j);
-            MaterialInfo materialInfo = materialInfoService.getById(materialId);
+            MaterialInfo materialInfo = materialInfoMapper.selectById(materialId);
             if (Check.isNull(materialInfo) || Check.isNull(materialInfo.getUrl())) {
                 continue;
             }
@@ -131,7 +160,11 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 JSONObject requestJson = new JSONObject();
                 requestJson.put("file", resource);
                 requestJson.put("signature", materialInfo.getCode());
-                MaterialParameter materialParameter = materialParameterService.getOneByMaterialId(materialInfo.getId());
+
+                QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                parameterQueryWrapper.eq("material_id", materialInfo.getCode());
+                parameterQueryWrapper.orderByDesc("create_time").last("limit 1");
+                MaterialParameter materialParameter = materialParameterService.getOne(parameterQueryWrapper);
                 if (!Check.isNull(materialParameter)) {
                     Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(materialParameter.getWidth()), Integer.valueOf(materialParameter.getHeight()));
                     if (!Check.isNull(type) && type != 0) {
@@ -140,54 +173,84 @@ public class MaterialUploadServiceImpl implements IMaterialUploadService {
                 }
                 for (int i = 0; i < accountArray.size(); i++) {
                     Long accountId = accountArray.getLong(i);
-                    CtopOauthToken ctopOauthToken = oauthTokenService.getTokenByAccountId(accountId);
+                    QueryWrapper<CtopOauthToken> tokenQueryWrapper = new QueryWrapper<>();
+                    tokenQueryWrapper.eq("account_id", accountId);
+                    tokenQueryWrapper.eq("media_id", mediaId);
+                    tokenQueryWrapper.orderByDesc("create_time");
+                    tokenQueryWrapper.last("limit 1");
+                    CtopOauthToken ctopOauthToken = oauthTokenMapper.selectOne(tokenQueryWrapper);
                     if (Check.isNull(ctopOauthToken)) {
                         continue;
                     }
                     requestJson.put("advertiser_id", accountId);
                     headerMap.put("Access-Token", ctopOauthToken.getAccessToken());
-                    executorService.submit(() -> {
-                        log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
-                        String videoUploadUrl = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
-                        String result = exceptInfoForRestTemplate(videoUploadUrl, requestJson, headerMap);
-                        JSONObject resultJson = JSONObject.parseObject(result);
-                        if (!Check.isNull(resultJson) && resultJson.getInteger("code") == 0) {
-                            JSONObject dataJson = resultJson.getJSONObject("data");
-                            if (!Check.isNull(dataJson)) {
-                                String photoId = dataJson.getString("photo_id");
-                                String signature = dataJson.getString("signature");
-                                KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
-                                videoGet.setAccountId(accountId);
-                                videoGet.setId(accountId + photoId);
-                                videoGet.setUrl(materialInfo.getUrl());
-
-                                if (!Check.isNull(materialParameter)) {
-                                    String width = materialParameter.getWidth();
-                                    String height = materialParameter.getHeight();
-                                    videoGet.setWidth(Integer.valueOf(width));
-                                    videoGet.setHeight(Integer.valueOf(height));
-                                    Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
-                                    if (!Check.isNull(type)) {
-                                        videoGet.setMaterialType(type);
+                    kuaiShouExecutorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                log.info("快手文件多线程上传:{},accountId:{}", Thread.currentThread().getName(), accountId);
+                                String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.VIDEO_UPLOAD;
+
+                                String result = exceptInfoForRestTemplate(url, requestJson, headerMap);
+                                JSONObject resultJson = JSONObject.parseObject(result);
+                                if (!Check.isNull(resultJson)) {
+                                    if (resultJson.getInteger("code") == 0) {
+                                        JSONObject dataJson = resultJson.getJSONObject("data");
+                                        if (!Check.isNull(dataJson)) {
+                                            String photoId = dataJson.getString("photo_id");
+                                            String signature = dataJson.getString("signature");
+                                            KuaiShouVideoGet videoGet = new KuaiShouVideoGet();
+                                            videoGet.setAccountId(accountId);
+                                            videoGet.setId(accountId + photoId);
+                                            videoGet.setUrl(materialInfo.getUrl());
+                                            QueryWrapper<MaterialParameter> parameterQueryWrapper = new QueryWrapper<>();
+                                            parameterQueryWrapper.eq("material_id", signature);
+                                            parameterQueryWrapper.last("limit 1");
+
+                                            MaterialParameter materialParameter = parameterMapper.selectOne(parameterQueryWrapper);
+                                            if (!Check.isNull(materialParameter)) {
+                                                String width = materialParameter.getWidth();
+                                                String height = materialParameter.getHeight();
+                                                videoGet.setWidth(Integer.valueOf(width));
+                                                videoGet.setHeight(Integer.valueOf(height));
+                                                Integer type = MaterialEnum.getTypeBySize(Integer.valueOf(width), Integer.valueOf(height));
+                                                if (!Check.isNull(type)) {
+                                                    videoGet.setMaterialType(type);
+                                                }
+                                            }
+                                            videoGet.setPhotoId(photoId);
+                                            videoGet.setSignature(signature);
+                                            kuaiShouVideoGetService.saveOrUpdate(videoGet);
+                                            materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
+
+                                        }
+                                        log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
+                                    } else {
+                                        log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
                                     }
                                 }
-                                videoGet.setPhotoId(photoId);
-                                videoGet.setSignature(signature);
-                                kuaiShouVideoGetService.saveOrUpdate(videoGet);
-                                materialUploadImageService.uploadImage(videoGet.getId(), accountId, ctopOauthToken.getAccessToken());
+
+                            } catch (Exception e) {
+                                e.printStackTrace();
                             }
-                            log.info("快手素材同步完成,accountId:{},code:{},返回信息:{}", accountId, materialInfo.getCode(), resultJson);
-                        } else {
-                            log.error("快手同步素材失败,返回信息:{},请求参数:{}", resultJson, requestJson);
                         }
                     });
+
                 }
+                /*boolean isTrue = LoadFileUtil.delFile(localUrl);
+                if (isTrue) {
+                    log.info("删除本地缓存素材成功,code:{}", materialInfo.getCode());
+                }*/
+
             } catch (Exception e) {
                 e.printStackTrace();
             }
         }
+
+
     }
 
+
     @Autowired
     private RestTemplate rest;
 

+ 7 - 94
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouActionBarTextController.java

@@ -6,7 +6,6 @@ import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouActionBarText;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaignCreate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouActionBarTextService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignCreateService;
-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;
@@ -15,27 +14,10 @@ import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 快手-行动号召文案
@@ -68,12 +50,12 @@ public class KuaiShouActionBarTextController {
                                                               @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                               @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                               @RequestParam(name = "campaignId") String campaignId) {
-        Result<IPage<KuaiShouActionBarText>> result = new Result<IPage<KuaiShouActionBarText>>();
+        Result<IPage<KuaiShouActionBarText>> result = new Result<>();
         KuaiShouCampaignCreate campaignCreate = campaignCreateService.selectCampaignByCampaignId(campaignId);
         if (!Check.isNull(campaignCreate)) {
             QueryWrapper<KuaiShouActionBarText> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("type", campaignCreate.getType());
-            Page<KuaiShouActionBarText> page = new Page<KuaiShouActionBarText>(pageNo, pageSize);
+            Page<KuaiShouActionBarText> page = new Page<>(pageNo, pageSize);
             IPage<KuaiShouActionBarText> pageList = kuaiShouActionBarTextService.page(page, queryWrapper);
             result.setSuccess(true);
             result.setResult(pageList);
@@ -95,7 +77,7 @@ public class KuaiShouActionBarTextController {
     @ApiOperation(value = "快手-行动号召文案-添加", notes = "快手-行动号召文案-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouActionBarText> add(@RequestBody KuaiShouActionBarText kuaiShouActionBarText) {
-        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        Result<KuaiShouActionBarText> result = new Result<>();
         try {
             kuaiShouActionBarTextService.save(kuaiShouActionBarText);
             result.success("添加成功!");
@@ -116,13 +98,12 @@ public class KuaiShouActionBarTextController {
     @ApiOperation(value = "快手-行动号召文案-编辑", notes = "快手-行动号召文案-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouActionBarText> edit(@RequestBody KuaiShouActionBarText kuaiShouActionBarText) {
-        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        Result<KuaiShouActionBarText> result = new Result<>();
         KuaiShouActionBarText kuaiShouActionBarTextEntity = kuaiShouActionBarTextService.getById(kuaiShouActionBarText.getId());
         if (kuaiShouActionBarTextEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = kuaiShouActionBarTextService.updateById(kuaiShouActionBarText);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -140,7 +121,7 @@ public class KuaiShouActionBarTextController {
     @AutoLog(value = "快手-行动号召文案-通过id删除")
     @ApiOperation(value = "快手-行动号召文案-通过id删除", notes = "快手-行动号召文案-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouActionBarTextService.removeById(id);
         } catch (Exception e) {
@@ -160,7 +141,7 @@ public class KuaiShouActionBarTextController {
     @ApiOperation(value = "快手-行动号召文案-批量删除", notes = "快手-行动号召文案-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouActionBarText> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        Result<KuaiShouActionBarText> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -180,7 +161,7 @@ public class KuaiShouActionBarTextController {
     @ApiOperation(value = "快手-行动号召文案-通过id查询", notes = "快手-行动号召文案-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouActionBarText> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouActionBarText> result = new Result<KuaiShouActionBarText>();
+        Result<KuaiShouActionBarText> result = new Result<>();
         KuaiShouActionBarText kuaiShouActionBarText = kuaiShouActionBarTextService.getById(id);
         if (kuaiShouActionBarText == null) {
             result.error500("未找到对应实体");
@@ -190,72 +171,4 @@ public class KuaiShouActionBarTextController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouActionBarText> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouActionBarText kuaiShouActionBarText = JSON.parseObject(deString, KuaiShouActionBarText.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouActionBarText, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouActionBarText> pageList = kuaiShouActionBarTextService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-行动号召文案列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouActionBarText.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<KuaiShouActionBarText> listKuaiShouActionBarTexts = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouActionBarText.class, params);
-                kuaiShouActionBarTextService.saveBatch(listKuaiShouActionBarTexts);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouActionBarTexts.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("文件导入失败!");
-    }
-
 }

+ 7 - 91
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAdvertiserBaseInfoController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * 快手-广告主基本信息
@@ -65,9 +49,9 @@ public class KuaiShouAdvertiserBaseInfoController {
                                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                    HttpServletRequest req) {
-        Result<IPage<KuaiShouAdvertiserBaseInfo>> result = new Result<IPage<KuaiShouAdvertiserBaseInfo>>();
+        Result<IPage<KuaiShouAdvertiserBaseInfo>> result = new Result<>();
         QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAdvertiserBaseInfo, req.getParameterMap());
-        Page<KuaiShouAdvertiserBaseInfo> page = new Page<KuaiShouAdvertiserBaseInfo>(pageNo, pageSize);
+        Page<KuaiShouAdvertiserBaseInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouAdvertiserBaseInfo> pageList = kuaiShouAdvertiserBaseInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -84,7 +68,7 @@ public class KuaiShouAdvertiserBaseInfoController {
     @ApiOperation(value = "快手-广告主基本信息-添加", notes = "快手-广告主基本信息-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouAdvertiserBaseInfo> add(@RequestBody KuaiShouAdvertiserBaseInfo kuaiShouAdvertiserBaseInfo) {
-        Result<KuaiShouAdvertiserBaseInfo> result = new Result<KuaiShouAdvertiserBaseInfo>();
+        Result<KuaiShouAdvertiserBaseInfo> result = new Result<>();
         try {
             kuaiShouAdvertiserBaseInfoService.save(kuaiShouAdvertiserBaseInfo);
             result.success("添加成功!");
@@ -105,7 +89,7 @@ public class KuaiShouAdvertiserBaseInfoController {
     @ApiOperation(value = "快手-广告主基本信息-编辑", notes = "快手-广告主基本信息-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouAdvertiserBaseInfo> edit(@RequestBody KuaiShouAdvertiserBaseInfo kuaiShouAdvertiserBaseInfo) {
-        Result<KuaiShouAdvertiserBaseInfo> result = new Result<KuaiShouAdvertiserBaseInfo>();
+        Result<KuaiShouAdvertiserBaseInfo> result = new Result<>();
         KuaiShouAdvertiserBaseInfo kuaiShouAdvertiserBaseInfoEntity = kuaiShouAdvertiserBaseInfoService.getById(kuaiShouAdvertiserBaseInfo.getId());
         if (kuaiShouAdvertiserBaseInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -128,7 +112,7 @@ public class KuaiShouAdvertiserBaseInfoController {
     @AutoLog(value = "快手-广告主基本信息-通过id删除")
     @ApiOperation(value = "快手-广告主基本信息-通过id删除", notes = "快手-广告主基本信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouAdvertiserBaseInfoService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +132,7 @@ public class KuaiShouAdvertiserBaseInfoController {
     @ApiOperation(value = "快手-广告主基本信息-批量删除", notes = "快手-广告主基本信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouAdvertiserBaseInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouAdvertiserBaseInfo> result = new Result<KuaiShouAdvertiserBaseInfo>();
+        Result<KuaiShouAdvertiserBaseInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +152,7 @@ public class KuaiShouAdvertiserBaseInfoController {
     @ApiOperation(value = "快手-广告主基本信息-通过id查询", notes = "快手-广告主基本信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouAdvertiserBaseInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouAdvertiserBaseInfo> result = new Result<KuaiShouAdvertiserBaseInfo>();
+        Result<KuaiShouAdvertiserBaseInfo> result = new Result<>();
         KuaiShouAdvertiserBaseInfo kuaiShouAdvertiserBaseInfo = kuaiShouAdvertiserBaseInfoService.getById(id);
         if (kuaiShouAdvertiserBaseInfo == null) {
             result.error500("未找到对应实体");
@@ -178,72 +162,4 @@ public class KuaiShouAdvertiserBaseInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouAdvertiserBaseInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouAdvertiserBaseInfo kuaiShouAdvertiserBaseInfo = JSON.parseObject(deString, KuaiShouAdvertiserBaseInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAdvertiserBaseInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouAdvertiserBaseInfo> pageList = kuaiShouAdvertiserBaseInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-广告主基本信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouAdvertiserBaseInfo.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<KuaiShouAdvertiserBaseInfo> listKuaiShouAdvertiserBaseInfos = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouAdvertiserBaseInfo.class, params);
-                kuaiShouAdvertiserBaseInfoService.saveBatch(listKuaiShouAdvertiserBaseInfos);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouAdvertiserBaseInfos.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("文件导入失败!");
-    }
-
 }

+ 7 - 92
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppCreateController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppCreate;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppCreateService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 创建应用
@@ -64,9 +48,9 @@ public class KuaiShouAppCreateController {
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<KuaiShouAppCreate>> result = new Result<IPage<KuaiShouAppCreate>>();
+        Result<IPage<KuaiShouAppCreate>> result = new Result<>();
         QueryWrapper<KuaiShouAppCreate> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppCreate, req.getParameterMap());
-        Page<KuaiShouAppCreate> page = new Page<KuaiShouAppCreate>(pageNo, pageSize);
+        Page<KuaiShouAppCreate> page = new Page<>(pageNo, pageSize);
         queryWrapper.orderByDesc("id");
         IPage<KuaiShouAppCreate> pageList = kuaiShouAppCreateService.page(page, queryWrapper);
         result.setSuccess(true);
@@ -84,7 +68,7 @@ public class KuaiShouAppCreateController {
     @ApiOperation(value = "创建应用-添加", notes = "创建应用-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouAppCreate> add(@RequestBody KuaiShouAppCreate kuaiShouAppCreate) {
-        Result<KuaiShouAppCreate> result = new Result<KuaiShouAppCreate>();
+        Result<KuaiShouAppCreate> result = new Result<>();
         try {
             kuaiShouAppCreateService.save(kuaiShouAppCreate);
             result.success("添加成功!");
@@ -105,13 +89,12 @@ public class KuaiShouAppCreateController {
     @ApiOperation(value = "创建应用-编辑", notes = "创建应用-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouAppCreate> edit(@RequestBody KuaiShouAppCreate kuaiShouAppCreate) {
-        Result<KuaiShouAppCreate> result = new Result<KuaiShouAppCreate>();
+        Result<KuaiShouAppCreate> result = new Result<>();
         KuaiShouAppCreate kuaiShouAppCreateEntity = kuaiShouAppCreateService.getById(kuaiShouAppCreate.getId());
         if (kuaiShouAppCreateEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = kuaiShouAppCreateService.updateById(kuaiShouAppCreate);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -129,7 +112,7 @@ public class KuaiShouAppCreateController {
     @AutoLog(value = "创建应用-通过id删除")
     @ApiOperation(value = "创建应用-通过id删除", notes = "创建应用-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouAppCreateService.removeById(id);
         } catch (Exception e) {
@@ -149,7 +132,7 @@ public class KuaiShouAppCreateController {
     @ApiOperation(value = "创建应用-批量删除", notes = "创建应用-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouAppCreate> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouAppCreate> result = new Result<KuaiShouAppCreate>();
+        Result<KuaiShouAppCreate> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -169,7 +152,7 @@ public class KuaiShouAppCreateController {
     @ApiOperation(value = "创建应用-通过id查询", notes = "创建应用-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouAppCreate> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouAppCreate> result = new Result<KuaiShouAppCreate>();
+        Result<KuaiShouAppCreate> result = new Result<>();
         KuaiShouAppCreate kuaiShouAppCreate = kuaiShouAppCreateService.getById(id);
         if (kuaiShouAppCreate == null) {
             result.error500("未找到对应实体");
@@ -179,72 +162,4 @@ public class KuaiShouAppCreateController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouAppCreate> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouAppCreate kuaiShouAppCreate = JSON.parseObject(deString, KuaiShouAppCreate.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppCreate, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouAppCreate> pageList = kuaiShouAppCreateService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "创建应用列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouAppCreate.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<KuaiShouAppCreate> listKuaiShouAppCreates = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouAppCreate.class, params);
-                kuaiShouAppCreateService.saveBatch(listKuaiShouAppCreates);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouAppCreates.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("文件导入失败!");
-    }
-
 }

+ 7 - 92
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppInfoController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppInfoService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 广告组-app信息
@@ -64,9 +48,9 @@ public class KuaiShouAppInfoController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<KuaiShouAppInfo>> result = new Result<IPage<KuaiShouAppInfo>>();
+        Result<IPage<KuaiShouAppInfo>> result = new Result<>();
         QueryWrapper<KuaiShouAppInfo> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppInfo, req.getParameterMap());
-        Page<KuaiShouAppInfo> page = new Page<KuaiShouAppInfo>(pageNo, pageSize);
+        Page<KuaiShouAppInfo> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouAppInfo> pageList = kuaiShouAppInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class KuaiShouAppInfoController {
     @ApiOperation(value = "广告组-app信息-添加", notes = "广告组-app信息-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouAppInfo> add(@RequestBody KuaiShouAppInfo kuaiShouAppInfo) {
-        Result<KuaiShouAppInfo> result = new Result<KuaiShouAppInfo>();
+        Result<KuaiShouAppInfo> result = new Result<>();
         try {
             kuaiShouAppInfoService.save(kuaiShouAppInfo);
             result.success("添加成功!");
@@ -104,13 +88,12 @@ public class KuaiShouAppInfoController {
     @ApiOperation(value = "广告组-app信息-编辑", notes = "广告组-app信息-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouAppInfo> edit(@RequestBody KuaiShouAppInfo kuaiShouAppInfo) {
-        Result<KuaiShouAppInfo> result = new Result<KuaiShouAppInfo>();
+        Result<KuaiShouAppInfo> result = new Result<>();
         KuaiShouAppInfo kuaiShouAppInfoEntity = kuaiShouAppInfoService.getById(kuaiShouAppInfo.getId());
         if (kuaiShouAppInfoEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = kuaiShouAppInfoService.updateById(kuaiShouAppInfo);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -128,7 +111,7 @@ public class KuaiShouAppInfoController {
     @AutoLog(value = "广告组-app信息-通过id删除")
     @ApiOperation(value = "广告组-app信息-通过id删除", notes = "广告组-app信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouAppInfoService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +131,7 @@ public class KuaiShouAppInfoController {
     @ApiOperation(value = "广告组-app信息-批量删除", notes = "广告组-app信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouAppInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouAppInfo> result = new Result<KuaiShouAppInfo>();
+        Result<KuaiShouAppInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +151,7 @@ public class KuaiShouAppInfoController {
     @ApiOperation(value = "广告组-app信息-通过id查询", notes = "广告组-app信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouAppInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouAppInfo> result = new Result<KuaiShouAppInfo>();
+        Result<KuaiShouAppInfo> result = new Result<>();
         KuaiShouAppInfo kuaiShouAppInfo = kuaiShouAppInfoService.getById(id);
         if (kuaiShouAppInfo == null) {
             result.error500("未找到对应实体");
@@ -178,72 +161,4 @@ public class KuaiShouAppInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouAppInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouAppInfo kuaiShouAppInfo = JSON.parseObject(deString, KuaiShouAppInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouAppInfo> pageList = kuaiShouAppInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "广告组-app信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouAppInfo.class);
-        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("广告组-app信息列表数据", "导出人: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<KuaiShouAppInfo> listKuaiShouAppInfos = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouAppInfo.class, params);
-                kuaiShouAppInfoService.saveBatch(listKuaiShouAppInfos);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouAppInfos.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("文件导入失败!");
-    }
-
 }

+ 7 - 92
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouAppListController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAppListService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 快手-应用列表
@@ -64,9 +48,9 @@ public class KuaiShouAppListController {
                                                         @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                         @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                         HttpServletRequest req) {
-        Result<IPage<KuaiShouAppList>> result = new Result<IPage<KuaiShouAppList>>();
+        Result<IPage<KuaiShouAppList>> result = new Result<>();
         QueryWrapper<KuaiShouAppList> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppList, req.getParameterMap());
-        Page<KuaiShouAppList> page = new Page<KuaiShouAppList>(pageNo, pageSize);
+        Page<KuaiShouAppList> page = new Page<>(pageNo, pageSize);
         IPage<KuaiShouAppList> pageList = kuaiShouAppListService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class KuaiShouAppListController {
     @ApiOperation(value = "快手-应用列表-添加", notes = "快手-应用列表-添加")
     @PostMapping(value = "/add")
     public Result<KuaiShouAppList> add(@RequestBody KuaiShouAppList kuaiShouAppList) {
-        Result<KuaiShouAppList> result = new Result<KuaiShouAppList>();
+        Result<KuaiShouAppList> result = new Result<>();
         try {
             kuaiShouAppListService.save(kuaiShouAppList);
             result.success("添加成功!");
@@ -104,13 +88,12 @@ public class KuaiShouAppListController {
     @ApiOperation(value = "快手-应用列表-编辑", notes = "快手-应用列表-编辑")
     @PutMapping(value = "/edit")
     public Result<KuaiShouAppList> edit(@RequestBody KuaiShouAppList kuaiShouAppList) {
-        Result<KuaiShouAppList> result = new Result<KuaiShouAppList>();
+        Result<KuaiShouAppList> result = new Result<>();
         KuaiShouAppList kuaiShouAppListEntity = kuaiShouAppListService.getById(kuaiShouAppList.getId());
         if (kuaiShouAppListEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = kuaiShouAppListService.updateById(kuaiShouAppList);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             }
@@ -128,7 +111,7 @@ public class KuaiShouAppListController {
     @AutoLog(value = "快手-应用列表-通过id删除")
     @ApiOperation(value = "快手-应用列表-通过id删除", notes = "快手-应用列表-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             kuaiShouAppListService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +131,7 @@ public class KuaiShouAppListController {
     @ApiOperation(value = "快手-应用列表-批量删除", notes = "快手-应用列表-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaiShouAppList> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<KuaiShouAppList> result = new Result<KuaiShouAppList>();
+        Result<KuaiShouAppList> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +151,7 @@ public class KuaiShouAppListController {
     @ApiOperation(value = "快手-应用列表-通过id查询", notes = "快手-应用列表-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<KuaiShouAppList> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<KuaiShouAppList> result = new Result<KuaiShouAppList>();
+        Result<KuaiShouAppList> result = new Result<>();
         KuaiShouAppList kuaiShouAppList = kuaiShouAppListService.getById(id);
         if (kuaiShouAppList == null) {
             result.error500("未找到对应实体");
@@ -178,72 +161,4 @@ public class KuaiShouAppListController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<KuaiShouAppList> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                KuaiShouAppList kuaiShouAppList = JSON.parseObject(deString, KuaiShouAppList.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouAppList, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<KuaiShouAppList> pageList = kuaiShouAppListService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "快手-应用列表列表");
-        mv.addObject(NormalExcelConstants.CLASS, KuaiShouAppList.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<KuaiShouAppList> listKuaiShouAppLists = ExcelImportUtil.importExcel(file.getInputStream(), KuaiShouAppList.class, params);
-                kuaiShouAppListService.saveBatch(listKuaiShouAppLists);
-                return Result.ok("文件导入成功!数据行数:" + listKuaiShouAppLists.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("文件导入失败!");
-    }
-
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouCampaignController.java

@@ -64,7 +64,7 @@ public class KuaiShouCampaignController {
                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                          HttpServletRequest req) {
-        Result<IPage<KuaiShouCampaign>> result = new Result<IPage<KuaiShouCampaign>>();
+        Result<IPage<KuaiShouCampaign>> result = new Result<>();
         QueryWrapper<KuaiShouCampaign> queryWrapper = QueryGenerator.initQueryWrapper(kuaiShouCampaign, req.getParameterMap());
         Page<KuaiShouCampaign> page = new Page<KuaiShouCampaign>(pageNo, pageSize);
         IPage<KuaiShouCampaign> pageList = kuaiShouCampaignService.page(page, queryWrapper);

+ 0 - 90
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaiShouController.java

@@ -3,12 +3,10 @@ package cn.com.ctop.kuaishou.modules.batch.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -22,87 +20,6 @@ public class KuaiShouController {
 
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
-
-    @RequestMapping("/campaignCreate")
-    public void campaignCreate() {
-        String accessToken = "f60f51a8f7d8938d6147d38357fed70c";
-        Long advertiserId = 23212L;
-        JSONObject requestJson = new JSONObject();
-        requestJson.put("campaign_name", "Test Api");
-        requestJson.put("type", 2);
-        requestJson.put("day_budget", 0L);
-        Map<String, Object> stringObjectMap = kuaishouInterfaceService.campaignCreate(accessToken, advertiserId, requestJson);
-    }
-
-    /**
-     * 创建组
-     */
-    @RequestMapping("/adUnitCreate")
-    public void adUnitCcreate() {
-        String accessToken = "cbe9caeffcc2c5ccd97a05bf909896da";
-        Long advertiserId = 23212L;
-        JSONObject requestJson = new JSONObject();
-        requestJson.put("campaign_id", 4178072L);
-        requestJson.put("unit_name", "测试广告组名称");
-        requestJson.put("bid_type", 2);
-        requestJson.put("bid", 100000);
-        requestJson.put("deep_conversion_type", 3);
-        requestJson.put("page", 2);
-        requestJson.put("begin_time", "2019-07-24");
-        requestJson.put("end_time", "2019-07-25");
-        requestJson.put("day_budget", 10000000);
-        requestJson.put("app_id", 156982);
-        requestJson.put("show_mode", 1);
-        requestJson.put("speed", 1);
-        JSONObject targetJson = new JSONObject();
-        JSONObject ageJson = new JSONObject();
-        ageJson.put("min", 15);
-        ageJson.put("max", 50);
-        targetJson.put("age", ageJson);
-
-        targetJson.put("gender", 0);
-        targetJson.put("platform_os", 0);
-        targetJson.put("android_osv", 3);
-        targetJson.put("network", 0);
-        Map<String, Object> stringObjectMap = kuaishouInterfaceService.adUnitCreate(accessToken, advertiserId, requestJson);
-    }
-
-
-    @RequestMapping("/getDeepConversionInfos")
-    public void getDeepConversionInfos() {
-        String accessToken = "cbe9caeffcc2c5ccd97a05bf909896da";
-        Long advertiserId = 23212L;
-        kuaishouInterfaceService.getDeepConversionInfos(advertiserId, accessToken);
-    }
-
-
-    @RequestMapping("/image/get")
-    public void imageGet() {
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-        String imageToken = "market825e095b83eb4456a31ce95704d03238.jpg";
-        kuaishouInterfaceService.imageGet(advertiserId, accessToken, imageToken);
-    }
-
-
-    @RequestMapping("/area/list")
-    public void areaList() {
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-        String imageToken = "market825e095b83eb4456a31ce95704d03238.jpg";
-        kuaishouInterfaceService.areaList(accessToken);
-    }
-
-
-    @RequestMapping("/getAppList")
-    public void getAppList() throws IOException {
-        String accessToken = "360d43b49553684a011d6607322582b1";
-        Long advertiserId = 23212L;
-        kuaishouInterfaceService.getAppList(advertiserId, accessToken);
-
-    }
-
-
     @Autowired
     private ICtopOauthTokenService tokenService;
 
@@ -139,11 +56,4 @@ public class KuaiShouController {
         }
         return result;
     }
-
-    @RequestMapping("advertiserInfo")
-    public void advertiserInfo() {
-        kuaishouInterfaceService.advertiserInfo(23212L, "10b6ad966b7e958d1510a78a5315ec5c");
-    }
-
-
 }

+ 26 - 123
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouAccountBudgetController.java

@@ -1,41 +1,21 @@
 package cn.com.ctop.kuaishou.modules.batch.controller;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouAccountBudget;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouAccountBudgetService;
-import org.jeecg.common.api.vo.Result;
-import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.common.aspect.annotation.AutoLog;
-import org.jeecg.common.util.oConvertUtils;
-
-import java.util.Date;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-
-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.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.query.QueryGenerator;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
-import org.springframework.web.servlet.ModelAndView;
-import com.alibaba.fastjson.JSON;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
 
  /**
  * 账户日预算
@@ -50,7 +30,7 @@ import io.swagger.annotations.ApiOperation;
 public class KuaishouAccountBudgetController {
 	@Autowired
 	private IKuaishouAccountBudgetService kuaishouAccountBudgetService;
-	
+
 	/**
 	  * 分页列表查询
 	 * @param kuaishouAccountBudget
@@ -66,15 +46,15 @@ public class KuaishouAccountBudgetController {
 															  @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
 															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
 															  HttpServletRequest req) {
-		Result<IPage<KuaishouAccountBudget>> result = new Result<IPage<KuaishouAccountBudget>>();
+        Result<IPage<KuaishouAccountBudget>> result = new Result<>();
 		QueryWrapper<KuaishouAccountBudget> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAccountBudget, req.getParameterMap());
-		Page<KuaishouAccountBudget> page = new Page<KuaishouAccountBudget>(pageNo, pageSize);
+        Page<KuaishouAccountBudget> page = new Page<>(pageNo, pageSize);
 		IPage<KuaishouAccountBudget> pageList = kuaishouAccountBudgetService.page(page, queryWrapper);
 		result.setSuccess(true);
 		result.setResult(pageList);
 		return result;
 	}
-	
+
 	/**
 	  *   添加
 	 * @param kuaishouAccountBudget
@@ -84,7 +64,7 @@ public class KuaishouAccountBudgetController {
 	@ApiOperation(value="账户日预算-添加", notes="账户日预算-添加")
 	@PostMapping(value = "/add")
 	public Result<KuaishouAccountBudget> add(@RequestBody KuaishouAccountBudget kuaishouAccountBudget) {
-		Result<KuaishouAccountBudget> result = new Result<KuaishouAccountBudget>();
+        Result<KuaishouAccountBudget> result = new Result<>();
 		try {
 			kuaishouAccountBudgetService.save(kuaishouAccountBudget);
 			result.success("添加成功!");
@@ -94,7 +74,7 @@ public class KuaishouAccountBudgetController {
 		}
 		return result;
 	}
-	
+
 	/**
 	  *  编辑
 	 * @param kuaishouAccountBudget
@@ -104,7 +84,7 @@ public class KuaishouAccountBudgetController {
 	@ApiOperation(value="账户日预算-编辑", notes="账户日预算-编辑")
 	@PutMapping(value = "/edit")
 	public Result<KuaishouAccountBudget> edit(@RequestBody KuaishouAccountBudget kuaishouAccountBudget) {
-		Result<KuaishouAccountBudget> result = new Result<KuaishouAccountBudget>();
+        Result<KuaishouAccountBudget> result = new Result<>();
 		KuaishouAccountBudget kuaishouAccountBudgetEntity = kuaishouAccountBudgetService.getById(kuaishouAccountBudget.getId());
 		if(kuaishouAccountBudgetEntity==null) {
 			result.error500("未找到对应实体");
@@ -114,11 +94,11 @@ public class KuaishouAccountBudgetController {
 				result.success("修改成功!");
 			}
 		}
-		
-		return result;
+
+        return result;
 	}
-	
-	/**
+
+     /**
 	  *   通过id删除
 	 * @param id
 	 * @return
@@ -126,7 +106,7 @@ public class KuaishouAccountBudgetController {
 	@AutoLog(value = "账户日预算-通过id删除")
 	@ApiOperation(value="账户日预算-通过id删除", notes="账户日预算-通过id删除")
 	@DeleteMapping(value = "/delete")
-	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
 		try {
 			kuaishouAccountBudgetService.removeById(id);
 		} catch (Exception e) {
@@ -135,8 +115,8 @@ public class KuaishouAccountBudgetController {
 		}
 		return Result.ok("删除成功!");
 	}
-	
-	/**
+
+     /**
 	  *  批量删除
 	 * @param ids
 	 * @return
@@ -145,7 +125,7 @@ public class KuaishouAccountBudgetController {
 	@ApiOperation(value="账户日预算-批量删除", notes="账户日预算-批量删除")
 	@DeleteMapping(value = "/deleteBatch")
 	public Result<KuaishouAccountBudget> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		Result<KuaishouAccountBudget> result = new Result<KuaishouAccountBudget>();
+        Result<KuaishouAccountBudget> result = new Result<>();
 		if(ids==null || "".equals(ids.trim())) {
 			result.error500("参数不识别!");
 		}else {
@@ -154,8 +134,8 @@ public class KuaishouAccountBudgetController {
 		}
 		return result;
 	}
-	
-	/**
+
+     /**
 	  * 通过id查询
 	 * @param id
 	 * @return
@@ -164,7 +144,7 @@ public class KuaishouAccountBudgetController {
 	@ApiOperation(value="账户日预算-通过id查询", notes="账户日预算-通过id查询")
 	@GetMapping(value = "/queryById")
 	public Result<KuaishouAccountBudget> queryById(@RequestParam(name="id",required=true) String id) {
-		Result<KuaishouAccountBudget> result = new Result<KuaishouAccountBudget>();
+        Result<KuaishouAccountBudget> result = new Result<>();
 		KuaishouAccountBudget kuaishouAccountBudget = kuaishouAccountBudgetService.getById(id);
 		if(kuaishouAccountBudget==null) {
 			result.error500("未找到对应实体");
@@ -174,81 +154,4 @@ public class KuaishouAccountBudgetController {
 		}
 		return result;
 	}
-
-  /**
-      * 导出excel
-   *
-   * @param request
-   * @param response
-   */
-  @RequestMapping(value = "/exportXls")
-  public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-      // Step.1 组装查询条件
-      QueryWrapper<KuaishouAccountBudget> queryWrapper = null;
-      try {
-          String paramsStr = request.getParameter("paramsStr");
-          if (oConvertUtils.isNotEmpty(paramsStr)) {
-              String deString = URLDecoder.decode(paramsStr, "UTF-8");
-              KuaishouAccountBudget kuaishouAccountBudget = JSON.parseObject(deString, KuaishouAccountBudget.class);
-              queryWrapper = QueryGenerator.initQueryWrapper(kuaishouAccountBudget, request.getParameterMap());
-          }
-      } catch (UnsupportedEncodingException e) {
-          e.printStackTrace();
-      }
-
-      //Step.2 AutoPoi 导出Excel
-      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-      List<KuaishouAccountBudget> pageList = kuaishouAccountBudgetService.list(queryWrapper);
-      //导出文件名称
-      mv.addObject(NormalExcelConstants.FILE_NAME, "账户日预算列表");
-      mv.addObject(NormalExcelConstants.CLASS, KuaishouAccountBudget.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<KuaishouAccountBudget> listKuaishouAccountBudgets = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouAccountBudget.class, params);
-              kuaishouAccountBudgetService.saveBatch(listKuaishouAccountBudgets);
-              return Result.ok("文件导入成功!数据行数:" + listKuaishouAccountBudgets.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("文件导入失败!");
-  }
-
-
-	 @RequestMapping("/getAccountBudget")
-	 public void getAccountBudget() throws IOException {
-		 String accessToken = "f5254e5c3a230d9e690628e1f90763b7";
-		 Long advertiserId = 1022694L;
-		 kuaishouAccountBudgetService.getAccountBudget(advertiserId, accessToken);
-
-	 }
-
 }

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

@@ -1,5 +1,7 @@
-package org.jeecg.modules.ctop.controller;
+package cn.com.ctop.kuaishou.modules.report.controller;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -9,8 +11,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
-import org.jeecg.modules.ctop.service.IKuaiShouCleanMaterialReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/KuaiShouCleanMaterialReport.java

@@ -1,4 +1,4 @@
-package org.jeecg.modules.ctop.entity;
+package cn.com.ctop.kuaishou.modules.report.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;

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

@@ -1,7 +1,7 @@
-package org.jeecg.modules.ctop.mapper;
+package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.jeecg.modules.ctop.entity.KuaiShouCleanMaterialReport;
 
 /**
  * 快手素材清洗数据

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

@@ -1,5 +1,6 @@
 package cn.com.ctop.kuaishou.modules.report.mapper;
 
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -13,4 +14,8 @@ public interface KuaishouReportDailyCreativeMapper extends BaseMapper<KuaishouRe
     void formatCreativeDailyReportData(@Param("accountId") Long accountId, @Param("statDate") String statDate);
 
     List<JSONObject> selectCodeByDate(@Param("startDate") String startDate, @Param("endDate") String endDate);
+
+    List<String> getSignatureList();
+
+    KuaiShouCleanMaterialReport calculationMaterialReport(@Param("signature") String signature);
 }

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

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="org.jeecg.modules.ctop.mapper.KuaiShouCleanMaterialReportMapper">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper">
 
-</mapper>
+</mapper>

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

@@ -108,8 +108,29 @@
    and stat_date &lt;= #{endDate}
    and signature is not null
    group by signature
+    </select>
 
+    <select id="getSignatureList" resultType="java.lang.String">
+    SELECT
+      DISTINCT(signature)
+      from ctop_kuaishou_report_daily_creative
+      WHERE signature !=''
+    </select>
 
+    <select id="calculationMaterialReport"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport">
+        select
+        signature id,
+        sum(charge) charge,
+        sum(photo_show) photoShow,
+        sum(photo_click) photoClick,
+        sum(aclick) aclick,
+        sum(bclick) bclick,
+        sum(activation) activation,
+        sum(form_count) formCount
+        from ctop_kuaishou_report_daily_creative
+        where
+        signature = #{signature}
     </select>
 
 </mapper>

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

@@ -0,0 +1,29 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+public interface IKuaiShouCleanMaterialReportService extends IService<KuaiShouCleanMaterialReport> {
+    /**
+     * 快手 唯一素材MD5标识
+     *
+     * @return
+     */
+    List<String> getSignature();
+
+    /**
+     * 计算快手素材报表
+     *
+     * @param signature
+     */
+    void calculationReport(String signature);
+}

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

@@ -0,0 +1,41 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 快手素材清洗数据
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2020-02-24
+ */
+@Service
+public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
+    @Autowired
+    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;
+
+    @Override
+    public List<String> getSignature() {
+        return kuaishouReportDailyCreativeMapper.getSignatureList();
+    }
+
+    @Override
+    public void calculationReport(String signature) {
+        if (Check.isNull(signature)) {
+            return;
+        }
+        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
+        if (!Check.isNull(calculationMaterialReport)) {
+            this.saveOrUpdate(calculationMaterialReport);
+        }
+    }
+}

+ 6 - 90
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertisePlanController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条广告计划信息
@@ -64,9 +48,9 @@ public class ByteDanceAdvertisePlanController {
                                                                @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
-        Result<IPage<ByteDanceAdvertisePlan>> result = new Result<IPage<ByteDanceAdvertisePlan>>();
+        Result<IPage<ByteDanceAdvertisePlan>> result = new Result<>();
         QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceAdvertisePlan, req.getParameterMap());
-        Page<ByteDanceAdvertisePlan> page = new Page<ByteDanceAdvertisePlan>(pageNo, pageSize);
+        Page<ByteDanceAdvertisePlan> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceAdvertisePlan> pageList = byteDanceAdvertisePlanService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ByteDanceAdvertisePlanController {
     @ApiOperation(value = "今日头条广告计划信息-添加", notes = "今日头条广告计划信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceAdvertisePlan> add(@RequestBody ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
-        Result<ByteDanceAdvertisePlan> result = new Result<ByteDanceAdvertisePlan>();
+        Result<ByteDanceAdvertisePlan> result = new Result<>();
         try {
             byteDanceAdvertisePlanService.save(byteDanceAdvertisePlan);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ByteDanceAdvertisePlanController {
     @ApiOperation(value = "今日头条广告计划信息-编辑", notes = "今日头条广告计划信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceAdvertisePlan> edit(@RequestBody ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
-        Result<ByteDanceAdvertisePlan> result = new Result<ByteDanceAdvertisePlan>();
+        Result<ByteDanceAdvertisePlan> result = new Result<>();
         ByteDanceAdvertisePlan byteDanceAdvertisePlanEntity = byteDanceAdvertisePlanService.getById(byteDanceAdvertisePlan.getId());
         if (byteDanceAdvertisePlanEntity == null) {
             result.error500("未找到对应实体");
@@ -149,7 +133,7 @@ public class ByteDanceAdvertisePlanController {
     @ApiOperation(value = "今日头条广告计划信息-批量删除", notes = "今日头条广告计划信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceAdvertisePlan> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceAdvertisePlan> result = new Result<ByteDanceAdvertisePlan>();
+        Result<ByteDanceAdvertisePlan> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -169,7 +153,7 @@ public class ByteDanceAdvertisePlanController {
     @ApiOperation(value = "今日头条广告计划信息-通过id查询", notes = "今日头条广告计划信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceAdvertisePlan> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceAdvertisePlan> result = new Result<ByteDanceAdvertisePlan>();
+        Result<ByteDanceAdvertisePlan> result = new Result<>();
         ByteDanceAdvertisePlan byteDanceAdvertisePlan = byteDanceAdvertisePlanService.getById(id);
         if (byteDanceAdvertisePlan == null) {
             result.error500("未找到对应实体");
@@ -179,72 +163,4 @@ public class ByteDanceAdvertisePlanController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceAdvertisePlan byteDanceAdvertisePlan = JSON.parseObject(deString, ByteDanceAdvertisePlan.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceAdvertisePlan, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceAdvertisePlan> pageList = byteDanceAdvertisePlanService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条广告计划信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceAdvertisePlan.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<ByteDanceAdvertisePlan> listByteDanceAdvertisePlans = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceAdvertisePlan.class, params);
-                byteDanceAdvertisePlanService.saveBatch(listByteDanceAdvertisePlans);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceAdvertisePlans.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("文件导入失败!");
-    }
-
 }

+ 7 - 92
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertiserController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertiser;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条广告主信息
@@ -64,9 +48,9 @@ public class ByteDanceAdvertiserController {
                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                             @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                             HttpServletRequest req) {
-        Result<IPage<ByteDanceAdvertiser>> result = new Result<IPage<ByteDanceAdvertiser>>();
+        Result<IPage<ByteDanceAdvertiser>> result = new Result<>();
         QueryWrapper<ByteDanceAdvertiser> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceAdvertiser, req.getParameterMap());
-        Page<ByteDanceAdvertiser> page = new Page<ByteDanceAdvertiser>(pageNo, pageSize);
+        Page<ByteDanceAdvertiser> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceAdvertiser> pageList = byteDanceAdvertiserService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ByteDanceAdvertiserController {
     @ApiOperation(value = "今日头条广告主信息-添加", notes = "今日头条广告主信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceAdvertiser> add(@RequestBody ByteDanceAdvertiser byteDanceAdvertiser) {
-        Result<ByteDanceAdvertiser> result = new Result<ByteDanceAdvertiser>();
+        Result<ByteDanceAdvertiser> result = new Result<>();
         try {
             byteDanceAdvertiserService.save(byteDanceAdvertiser);
             result.success("添加成功!");
@@ -104,13 +88,12 @@ public class ByteDanceAdvertiserController {
     @ApiOperation(value = "今日头条广告主信息-编辑", notes = "今日头条广告主信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceAdvertiser> edit(@RequestBody ByteDanceAdvertiser byteDanceAdvertiser) {
-        Result<ByteDanceAdvertiser> result = new Result<ByteDanceAdvertiser>();
+        Result<ByteDanceAdvertiser> result = new Result<>();
         ByteDanceAdvertiser byteDanceAdvertiserEntity = byteDanceAdvertiserService.getById(byteDanceAdvertiser.getId());
         if (byteDanceAdvertiserEntity == null) {
             result.error500("未找到对应实体");
         } else {
             boolean ok = byteDanceAdvertiserService.updateById(byteDanceAdvertiser);
-            //TODO 返回false说明什么?
             if (ok) {
                 result.success("修改成功!");
             } else {
@@ -130,7 +113,7 @@ public class ByteDanceAdvertiserController {
     @AutoLog(value = "今日头条广告主信息-通过id删除")
     @ApiOperation(value = "今日头条广告主信息-通过id删除", notes = "今日头条广告主信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceAdvertiserService.removeById(id);
         } catch (Exception e) {
@@ -150,7 +133,7 @@ public class ByteDanceAdvertiserController {
     @ApiOperation(value = "今日头条广告主信息-批量删除", notes = "今日头条广告主信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceAdvertiser> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceAdvertiser> result = new Result<ByteDanceAdvertiser>();
+        Result<ByteDanceAdvertiser> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -170,7 +153,7 @@ public class ByteDanceAdvertiserController {
     @ApiOperation(value = "今日头条广告主信息-通过id查询", notes = "今日头条广告主信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceAdvertiser> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceAdvertiser> result = new Result<ByteDanceAdvertiser>();
+        Result<ByteDanceAdvertiser> result = new Result<>();
         ByteDanceAdvertiser byteDanceAdvertiser = byteDanceAdvertiserService.getById(id);
         if (byteDanceAdvertiser == null) {
             result.error500("未找到对应实体");
@@ -180,72 +163,4 @@ public class ByteDanceAdvertiserController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceAdvertiser> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceAdvertiser byteDanceAdvertiser = JSON.parseObject(deString, ByteDanceAdvertiser.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceAdvertiser, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceAdvertiser> pageList = byteDanceAdvertiserService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条广告主信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceAdvertiser.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<ByteDanceAdvertiser> listByteDanceAdvertisers = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceAdvertiser.class, params);
-                byteDanceAdvertiserService.saveBatch(listByteDanceAdvertisers);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceAdvertisers.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("文件导入失败!");
-    }
-
 }

+ 7 - 91
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCampaign;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条广告组信息
@@ -64,9 +48,9 @@ public class ByteDanceCampaignController {
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<ByteDanceCampaign>> result = new Result<IPage<ByteDanceCampaign>>();
+        Result<IPage<ByteDanceCampaign>> result = new Result<>();
         QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, req.getParameterMap());
-        Page<ByteDanceCampaign> page = new Page<ByteDanceCampaign>(pageNo, pageSize);
+        Page<ByteDanceCampaign> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCampaign> pageList = byteDanceCampaignService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ByteDanceCampaignController {
     @ApiOperation(value = "今日头条广告组信息-添加", notes = "今日头条广告组信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceCampaign> add(@RequestBody ByteDanceCampaign byteDanceCampaign) {
-        Result<ByteDanceCampaign> result = new Result<ByteDanceCampaign>();
+        Result<ByteDanceCampaign> result = new Result<>();
         try {
             byteDanceCampaignService.save(byteDanceCampaign);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ByteDanceCampaignController {
     @ApiOperation(value = "今日头条广告组信息-编辑", notes = "今日头条广告组信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceCampaign> edit(@RequestBody ByteDanceCampaign byteDanceCampaign) {
-        Result<ByteDanceCampaign> result = new Result<ByteDanceCampaign>();
+        Result<ByteDanceCampaign> result = new Result<>();
         ByteDanceCampaign byteDanceCampaignEntity = byteDanceCampaignService.getById(byteDanceCampaign.getId());
         if (byteDanceCampaignEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +113,7 @@ public class ByteDanceCampaignController {
     @AutoLog(value = "今日头条广告组信息-通过id删除")
     @ApiOperation(value = "今日头条广告组信息-通过id删除", notes = "今日头条广告组信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceCampaignService.removeById(id);
         } catch (Exception e) {
@@ -149,7 +133,7 @@ public class ByteDanceCampaignController {
     @ApiOperation(value = "今日头条广告组信息-批量删除", notes = "今日头条广告组信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceCampaign> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceCampaign> result = new Result<ByteDanceCampaign>();
+        Result<ByteDanceCampaign> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -169,7 +153,7 @@ public class ByteDanceCampaignController {
     @ApiOperation(value = "今日头条广告组信息-通过id查询", notes = "今日头条广告组信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceCampaign> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceCampaign> result = new Result<ByteDanceCampaign>();
+        Result<ByteDanceCampaign> result = new Result<>();
         ByteDanceCampaign byteDanceCampaign = byteDanceCampaignService.getById(id);
         if (byteDanceCampaign == null) {
             result.error500("未找到对应实体");
@@ -179,72 +163,4 @@ public class ByteDanceCampaignController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceCampaign> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceCampaign byteDanceCampaign = JSON.parseObject(deString, ByteDanceCampaign.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCampaign, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceCampaign> pageList = byteDanceCampaignService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条广告组信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceCampaign.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<ByteDanceCampaign> listByteDanceCampaigns = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceCampaign.class, params);
-                byteDanceCampaignService.saveBatch(listByteDanceCampaigns);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceCampaigns.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("文件导入失败!");
-    }
-
 }

+ 7 - 91
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreative;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条创意信息
@@ -64,9 +48,9 @@ public class ByteDanceCreativeController {
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                           HttpServletRequest req) {
-        Result<IPage<ByteDanceCreative>> result = new Result<IPage<ByteDanceCreative>>();
+        Result<IPage<ByteDanceCreative>> result = new Result<>();
         QueryWrapper<ByteDanceCreative> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreative, req.getParameterMap());
-        Page<ByteDanceCreative> page = new Page<ByteDanceCreative>(pageNo, pageSize);
+        Page<ByteDanceCreative> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCreative> pageList = byteDanceCreativeService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ByteDanceCreativeController {
     @ApiOperation(value = "今日头条创意信息-添加", notes = "今日头条创意信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceCreative> add(@RequestBody ByteDanceCreative byteDanceCreative) {
-        Result<ByteDanceCreative> result = new Result<ByteDanceCreative>();
+        Result<ByteDanceCreative> result = new Result<>();
         try {
             byteDanceCreativeService.save(byteDanceCreative);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ByteDanceCreativeController {
     @ApiOperation(value = "今日头条创意信息-编辑", notes = "今日头条创意信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceCreative> edit(@RequestBody ByteDanceCreative byteDanceCreative) {
-        Result<ByteDanceCreative> result = new Result<ByteDanceCreative>();
+        Result<ByteDanceCreative> result = new Result<>();
         ByteDanceCreative byteDanceCreativeEntity = byteDanceCreativeService.getById(byteDanceCreative.getId());
         if (byteDanceCreativeEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +113,7 @@ public class ByteDanceCreativeController {
     @AutoLog(value = "今日头条创意信息-通过id删除")
     @ApiOperation(value = "今日头条创意信息-通过id删除", notes = "今日头条创意信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceCreativeService.removeById(id);
         } catch (Exception e) {
@@ -149,7 +133,7 @@ public class ByteDanceCreativeController {
     @ApiOperation(value = "今日头条创意信息-批量删除", notes = "今日头条创意信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceCreative> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceCreative> result = new Result<ByteDanceCreative>();
+        Result<ByteDanceCreative> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -169,7 +153,7 @@ public class ByteDanceCreativeController {
     @ApiOperation(value = "今日头条创意信息-通过id查询", notes = "今日头条创意信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceCreative> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceCreative> result = new Result<ByteDanceCreative>();
+        Result<ByteDanceCreative> result = new Result<>();
         ByteDanceCreative byteDanceCreative = byteDanceCreativeService.getById(id);
         if (byteDanceCreative == null) {
             result.error500("未找到对应实体");
@@ -179,72 +163,4 @@ public class ByteDanceCreativeController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceCreative> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceCreative byteDanceCreative = JSON.parseObject(deString, ByteDanceCreative.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreative, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceCreative> pageList = byteDanceCreativeService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条创意信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceCreative.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<ByteDanceCreative> listByteDanceCreatives = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceCreative.class, params);
-                byteDanceCreativeService.saveBatch(listByteDanceCreatives);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceCreatives.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("文件导入失败!");
-    }
-
 }

+ 7 - 91
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeMaterialController.java

@@ -3,7 +3,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceCreativeMaterial;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeMaterialService;
-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;
@@ -13,26 +12,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条创意素材信息
@@ -64,9 +48,9 @@ public class ByteDanceCreativeMaterialController {
                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                   HttpServletRequest req) {
-        Result<IPage<ByteDanceCreativeMaterial>> result = new Result<IPage<ByteDanceCreativeMaterial>>();
+        Result<IPage<ByteDanceCreativeMaterial>> result = new Result<>();
         QueryWrapper<ByteDanceCreativeMaterial> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreativeMaterial, req.getParameterMap());
-        Page<ByteDanceCreativeMaterial> page = new Page<ByteDanceCreativeMaterial>(pageNo, pageSize);
+        Page<ByteDanceCreativeMaterial> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCreativeMaterial> pageList = byteDanceCreativeMaterialService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -83,7 +67,7 @@ public class ByteDanceCreativeMaterialController {
     @ApiOperation(value = "今日头条创意素材信息-添加", notes = "今日头条创意素材信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceCreativeMaterial> add(@RequestBody ByteDanceCreativeMaterial byteDanceCreativeMaterial) {
-        Result<ByteDanceCreativeMaterial> result = new Result<ByteDanceCreativeMaterial>();
+        Result<ByteDanceCreativeMaterial> result = new Result<>();
         try {
             byteDanceCreativeMaterialService.save(byteDanceCreativeMaterial);
             result.success("添加成功!");
@@ -104,7 +88,7 @@ public class ByteDanceCreativeMaterialController {
     @ApiOperation(value = "今日头条创意素材信息-编辑", notes = "今日头条创意素材信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceCreativeMaterial> edit(@RequestBody ByteDanceCreativeMaterial byteDanceCreativeMaterial) {
-        Result<ByteDanceCreativeMaterial> result = new Result<ByteDanceCreativeMaterial>();
+        Result<ByteDanceCreativeMaterial> result = new Result<>();
         ByteDanceCreativeMaterial byteDanceCreativeMaterialEntity = byteDanceCreativeMaterialService.getById(byteDanceCreativeMaterial.getId());
         if (byteDanceCreativeMaterialEntity == null) {
             result.error500("未找到对应实体");
@@ -129,7 +113,7 @@ public class ByteDanceCreativeMaterialController {
     @AutoLog(value = "今日头条创意素材信息-通过id删除")
     @ApiOperation(value = "今日头条创意素材信息-通过id删除", notes = "今日头条创意素材信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceCreativeMaterialService.removeById(id);
         } catch (Exception e) {
@@ -149,7 +133,7 @@ public class ByteDanceCreativeMaterialController {
     @ApiOperation(value = "今日头条创意素材信息-批量删除", notes = "今日头条创意素材信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceCreativeMaterial> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceCreativeMaterial> result = new Result<ByteDanceCreativeMaterial>();
+        Result<ByteDanceCreativeMaterial> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -169,7 +153,7 @@ public class ByteDanceCreativeMaterialController {
     @ApiOperation(value = "今日头条创意素材信息-通过id查询", notes = "今日头条创意素材信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceCreativeMaterial> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceCreativeMaterial> result = new Result<ByteDanceCreativeMaterial>();
+        Result<ByteDanceCreativeMaterial> result = new Result<>();
         ByteDanceCreativeMaterial byteDanceCreativeMaterial = byteDanceCreativeMaterialService.getById(id);
         if (byteDanceCreativeMaterial == null) {
             result.error500("未找到对应实体");
@@ -179,72 +163,4 @@ public class ByteDanceCreativeMaterialController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceCreativeMaterial> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceCreativeMaterial byteDanceCreativeMaterial = JSON.parseObject(deString, ByteDanceCreativeMaterial.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceCreativeMaterial, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceCreativeMaterial> pageList = byteDanceCreativeMaterialService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条创意素材信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceCreativeMaterial.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<ByteDanceCreativeMaterial> listByteDanceCreativeMaterials = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceCreativeMaterial.class, params);
-                byteDanceCreativeMaterialService.saveBatch(listByteDanceCreativeMaterials);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceCreativeMaterials.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("文件导入失败!");
-    }
-
 }

+ 7 - 91
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceVideoInfoController.java

@@ -2,7 +2,6 @@ package cn.com.ctop.toutiao.modules.material.controller;
 
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceVideoInfo;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceVideoInfoService;
-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;
@@ -12,26 +11,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.system.query.QueryGenerator;
-import org.jeecg.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.*;
-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;
 
 /**
  * @Description: 今日头条视频素材信息
@@ -63,9 +47,9 @@ public class ByteDanceVideoInfoController {
                                                            @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                            @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                            HttpServletRequest req) {
-        Result<IPage<ByteDanceVideoInfo>> result = new Result<IPage<ByteDanceVideoInfo>>();
+        Result<IPage<ByteDanceVideoInfo>> result = new Result<>();
         QueryWrapper<ByteDanceVideoInfo> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceVideoInfo, req.getParameterMap());
-        Page<ByteDanceVideoInfo> page = new Page<ByteDanceVideoInfo>(pageNo, pageSize);
+        Page<ByteDanceVideoInfo> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceVideoInfo> pageList = byteDanceVideoInfoService.page(page, queryWrapper);
         result.setSuccess(true);
         result.setResult(pageList);
@@ -82,7 +66,7 @@ public class ByteDanceVideoInfoController {
     @ApiOperation(value = "今日头条视频素材信息-添加", notes = "今日头条视频素材信息-添加")
     @PostMapping(value = "/add")
     public Result<ByteDanceVideoInfo> add(@RequestBody ByteDanceVideoInfo byteDanceVideoInfo) {
-        Result<ByteDanceVideoInfo> result = new Result<ByteDanceVideoInfo>();
+        Result<ByteDanceVideoInfo> result = new Result<>();
         try {
             byteDanceVideoInfoService.save(byteDanceVideoInfo);
             result.success("添加成功!");
@@ -103,7 +87,7 @@ public class ByteDanceVideoInfoController {
     @ApiOperation(value = "今日头条视频素材信息-编辑", notes = "今日头条视频素材信息-编辑")
     @PutMapping(value = "/edit")
     public Result<ByteDanceVideoInfo> edit(@RequestBody ByteDanceVideoInfo byteDanceVideoInfo) {
-        Result<ByteDanceVideoInfo> result = new Result<ByteDanceVideoInfo>();
+        Result<ByteDanceVideoInfo> result = new Result<>();
         ByteDanceVideoInfo byteDanceVideoInfoEntity = byteDanceVideoInfoService.getById(byteDanceVideoInfo.getId());
         if (byteDanceVideoInfoEntity == null) {
             result.error500("未找到对应实体");
@@ -128,7 +112,7 @@ public class ByteDanceVideoInfoController {
     @AutoLog(value = "今日头条视频素材信息-通过id删除")
     @ApiOperation(value = "今日头条视频素材信息-通过id删除", notes = "今日头条视频素材信息-通过id删除")
     @DeleteMapping(value = "/delete")
-    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+    public Result<Object> delete(@RequestParam(name = "id", required = true) String id) {
         try {
             byteDanceVideoInfoService.removeById(id);
         } catch (Exception e) {
@@ -148,7 +132,7 @@ public class ByteDanceVideoInfoController {
     @ApiOperation(value = "今日头条视频素材信息-批量删除", notes = "今日头条视频素材信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
     public Result<ByteDanceVideoInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
-        Result<ByteDanceVideoInfo> result = new Result<ByteDanceVideoInfo>();
+        Result<ByteDanceVideoInfo> result = new Result<>();
         if (ids == null || "".equals(ids.trim())) {
             result.error500("参数不识别!");
         } else {
@@ -168,7 +152,7 @@ public class ByteDanceVideoInfoController {
     @ApiOperation(value = "今日头条视频素材信息-通过id查询", notes = "今日头条视频素材信息-通过id查询")
     @GetMapping(value = "/queryById")
     public Result<ByteDanceVideoInfo> queryById(@RequestParam(name = "id", required = true) String id) {
-        Result<ByteDanceVideoInfo> result = new Result<ByteDanceVideoInfo>();
+        Result<ByteDanceVideoInfo> result = new Result<>();
         ByteDanceVideoInfo byteDanceVideoInfo = byteDanceVideoInfoService.getById(id);
         if (byteDanceVideoInfo == null) {
             result.error500("未找到对应实体");
@@ -178,72 +162,4 @@ public class ByteDanceVideoInfoController {
         }
         return result;
     }
-
-    /**
-     * 导出excel
-     *
-     * @param request
-     * @param response
-     */
-    @RequestMapping(value = "/exportXls")
-    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
-        // Step.1 组装查询条件
-        QueryWrapper<ByteDanceVideoInfo> queryWrapper = null;
-        try {
-            String paramsStr = request.getParameter("paramsStr");
-            if (oConvertUtils.isNotEmpty(paramsStr)) {
-                String deString = URLDecoder.decode(paramsStr, "UTF-8");
-                ByteDanceVideoInfo byteDanceVideoInfo = JSON.parseObject(deString, ByteDanceVideoInfo.class);
-                queryWrapper = QueryGenerator.initQueryWrapper(byteDanceVideoInfo, request.getParameterMap());
-            }
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-
-        //Step.2 AutoPoi 导出Excel
-        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
-        List<ByteDanceVideoInfo> pageList = byteDanceVideoInfoService.list(queryWrapper);
-        //导出文件名称
-        mv.addObject(NormalExcelConstants.FILE_NAME, "今日头条视频素材信息列表");
-        mv.addObject(NormalExcelConstants.CLASS, ByteDanceVideoInfo.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<ByteDanceVideoInfo> listByteDanceVideoInfos = ExcelImportUtil.importExcel(file.getInputStream(), ByteDanceVideoInfo.class, params);
-                byteDanceVideoInfoService.saveBatch(listByteDanceVideoInfos);
-                return Result.ok("文件导入成功!数据行数:" + listByteDanceVideoInfos.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("文件导入失败!");
-    }
-
 }

+ 20 - 29
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -113,8 +113,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return;
         }
         JSONArray data = resultObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.size() <= 0) {
-//            log.info("获取广告计划信息完成==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
+        if (null == data || data.isEmpty()) {
             return;
         }
         for (int i = 0; i < data.size(); i++) {
@@ -170,15 +169,12 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             log.info("广告主预算信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             resultMap.put("code", 0);
             resultMap.put("message", "获取广告主预算信息完成");
             return resultMap;
         }
-        for (int i = 0; i < data.size(); i++) {
-            JSONObject dataObject = data.getJSONObject(i);
-        }
         resultMap.put("code", 0);
         resultMap.put("message", "获取广告预算信息完成");
         return resultMap;
@@ -210,8 +206,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONArray("data");
-        if (null == data || data.size() <= 0) {
-//            log.info("广告主创意素材信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
+        if (null == data || data.isEmpty()) {
             resultMap.put("code", 0);
             resultMap.put("message", "获取广告主预算信息完成");
             return resultMap;
@@ -244,7 +239,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return;
         }
         JSONArray data = resultObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             return;
         }
         List<ByteDanceCreative> creatives = new ArrayList<>();
@@ -315,7 +310,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray getCampaignIds = data.getJSONArray("campaign_ids");
-        if (null != getCampaignIds && getCampaignIds.size() > 0) {
+        if (null != getCampaignIds && !getCampaignIds.isEmpty()) {
             for (int i = 0; i < getCampaignIds.size(); i++) {
                 Long id = getCampaignIds.getLong(i);
                 ByteDanceCampaign campaign = campaignService.getById(id);
@@ -393,7 +388,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         Map<String, Object> resultMap = new HashMap<>();
         JSONArray ids = new JSONArray();
         String[] getIds = adIds.split(StringUtils.COMMA);
-        if (null != getIds && getIds.length > 0) {
+        if (getIds.length > 0) {
             for (int i = 0; i < getIds.length; i++) {
                 ids.add(Long.parseLong(getIds[i]));
             }
@@ -426,7 +421,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray getAdIds = data.getJSONArray("ad_ids");
-        if (null != getAdIds && getAdIds.size() > 0) {
+        if (null != getAdIds && !getAdIds.isEmpty()) {
             //获取广告计划信息
             getAdvertiserPlan(token, adIds, null, null);
         }
@@ -441,7 +436,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         JSONArray data = new JSONArray();
         String[] getadIds = adIds.split(StringUtils.COMMA);
         String[] getBids = bids.split(StringUtils.COMMA);
-        if (null != getadIds && getadIds.length > 0) {
+        if (getadIds.length > 0) {
             for (int i = 0; i < getadIds.length; i++) {
                 JSONObject object = new JSONObject();
                 Long adId = Long.parseLong(getadIds[i]);
@@ -478,7 +473,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
-        if (null != getAdIds && getAdIds.size() > 0) {
+        if (null != getAdIds && !getAdIds.isEmpty()) {
             //获取广告计划信息
             getAdvertiserPlan(token, adIds, null, null);
         }
@@ -493,7 +488,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         JSONArray data = new JSONArray();
         String[] getadIds = adIds.split(StringUtils.COMMA);
         String[] getBudgets = budgets.split(StringUtils.COMMA);
-        if (null != getadIds && getadIds.length > 0) {
+        if (getadIds.length > 0) {
             for (int i = 0; i < getadIds.length; i++) {
                 JSONObject object = new JSONObject();
                 Long adId = Long.parseLong(getadIds[i]);
@@ -529,7 +524,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray getAdIds = getData.getJSONArray("ad_ids");
-        if (null != getAdIds && getAdIds.size() > 0) {
+        if (null != getAdIds && !getAdIds.isEmpty()) {
             //获取广告计划信息
             getAdvertiserPlan(token, adIds, null, null);
         }
@@ -571,7 +566,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("custom_audience_list");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             log.info("人群包信息不存在==》accountId:{},message:{}", token.getAdvertiserId(), jsonObject.getString("message"));
             resultMap.put("success", false);
             resultMap.put("message", "人群包信息不存在");
@@ -608,7 +603,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return resultMap;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             log.info("获取广告组信息为空==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             resultMap.put("code", code);
             resultMap.put("message", "获取广告组信息为空");
@@ -638,13 +633,13 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return result;
         }
         JSONArray packageList = jsonObject.getJSONObject("data").getJSONArray("list");
-        if (null != packageList && packageList.size() > 0) {
+        if (null != packageList && !packageList.isEmpty()) {
             JSONArray packageArray = new JSONArray();
             for (int i = 0; i < packageList.size(); i++) {
                 JSONObject packageObject = packageList.getJSONObject(i);
                 packageObject.remove("rit");
                 String status = packageObject.getString("status");
-                if (null != status && "FLOW_PACKAGE_ENABLE".equals(status)) {
+                if ("FLOW_PACKAGE_ENABLE".equals(status)) {
                     packageArray.add(packageObject);
                 }
             }
@@ -656,7 +651,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
 
     @Override
     public void getMaterialList(CtopOauthToken token) {
-//        getAdImageByPage(token, "", 1);
         getVideoByPage(token, "", 1);
     }
 
@@ -670,12 +664,10 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         param.put("page_size", 100);
         if (null != videoIds && !"".equals(videoIds.trim())) {
             String[] getIds = videoIds.split(StringUtils.COMMA);
-            if (null != getIds && getIds.length > 0) {
+            if (getIds.length > 0) {
                 JSONObject filter = new JSONObject();
                 JSONArray idArray = new JSONArray();
-                for (int i = 0; i < getIds.length; i++) {
-                    idArray.add(getIds[i]);
-                }
+                Collections.addAll(idArray, getIds);
                 filter.put("video_ids", idArray);
                 param.put("filtering", filter);
             }
@@ -688,7 +680,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return;
         }
         JSONArray data = resultObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             log.info("获取视频素材完成==》accountId:{},message:{}", token.getAccountId(), resultObject.getString("message"));
             return;
         }
@@ -711,8 +703,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         params.put("advertiser_id", token.getAccountId());
         params.put("page", 1);
         params.put("page_size", 100);
-        JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, params);
-        return resultObject;
+        return HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, params);
     }
 
 
@@ -750,7 +741,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
             return;
         }
         JSONArray data = jsonObject.getJSONObject("data").getJSONArray("list");
-        if (null == data || data.size() <= 0) {
+        if (null == data || data.isEmpty()) {
             log.error("获取广告组信息不存在==》accountId:{},message:{}", accountId, jsonObject.getString("message"));
             return;
         }

+ 1 - 10
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceReportController.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.report.controller;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialRetry;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
@@ -92,9 +93,7 @@ public class BytedanceReportController {
             }
 
             for (CtopOauthToken token : tokens) {
-                //if(1629785592929294L == token.getAccountId()){
                 bytedanceReportService.bytedanceAsyncTaskCreate(startDate, endDate, token, type);
-                //}
             }
             Long endtime = System.currentTimeMillis();
             log.info("头条异步报表数据任务执行结束,执行耗时:{}秒", (endtime - starttime) / 1000);
@@ -180,14 +179,6 @@ public class BytedanceReportController {
         Result result = new Result<>();
         try {
             List<BytedanceReportMaterialRetry> retryList = bytedanceReportService.getRetryList();
-            //for(BytedanceReportMaterialRetry retry:retryList){
-            //    CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(retry.getAccountId()));
-            //    log.info("头条素材报表当前accountId为:" + token.getAccountId());
-            //    bytedanceReportService.bytedanceMaterialReportRetry(token,retry.getStartDate(),retry.getEndDate());
-            //}
-
-            //
-            //多线程
             final ExecutorService executorService = Executors.newFixedThreadPool(3);
             retryList.forEach(retry -> {
                 executorService.submit(new Runnable() {

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

@@ -22,9 +22,6 @@ import java.util.List;
 public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDanceCleanMaterialReportMapper, ByteDanceCleanMaterialReport> implements IByteDanceCleanMaterialReportService {
     @Autowired
     private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
-    @Autowired
-    private
-    IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;
 
     /**
      * 头条MD5 集合
@@ -48,7 +45,7 @@ public class ByteDanceCleanMaterialReportServiceImpl extends ServiceImpl<ByteDan
         }
         ByteDanceCleanMaterialReport calculationMaterialReport = bytedanceCreativeDailyReportMapper.calculationMaterialReport(signature);
         if (!Check.isNull(calculationMaterialReport)) {
-            byteDanceCleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
+            this.saveOrUpdate(calculationMaterialReport);
         }
     }
 }

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

@@ -6,9 +6,9 @@ import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.LoadFileUtil;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
-import cn.com.ctop.kuaishou.modules.utils.DownloadUtils;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceAdvertiserDailyReport;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceDailyReportTask;
 import cn.com.ctop.toutiao.modules.report.entity.BytedanceReportMaterialDaily;
@@ -31,7 +31,6 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -73,7 +72,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
      * @param loginId
      * @return
      */
-    @Override
     public JSONObject getAccountReport(String loginId) {
         JSONObject returnJson = new JSONObject();
         QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
@@ -667,7 +665,8 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
 
     /////////////////////////////////////////////////////////////////////////////////////////////////
     //创建异步任务
-    public void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type) throws ParseException {
+    @Override
+    public void bytedanceAsyncTaskCreate(String startDate, String endDate, CtopOauthToken token, Integer type) {
         int diffMonths = DateUtils.calDiffMonth(DateUtils.parseDate(startDate, "yyyy-MM-dd"), DateUtils.parseDate(endDate, "yyyy-MM-dd"));
         if (diffMonths == 0) {
             bytedanceAsyncTaskCreateByMonth(startDate, endDate, token, type);
@@ -767,6 +766,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
     }
 
     //获取任务列表
+    @Override
     public void bytedanceAsyncTaskGet(){
         QueryWrapper<BytedanceDailyReportTask> taskQueryWrapper = new QueryWrapper<>();
         //查询三种状态的信息--任务已创建、任务执行中、任务处理中
@@ -858,7 +858,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         Map<String, Object> requestMap = new HashMap<>();
         requestMap.put("advertiser_id", task.getAccountId());
         requestMap.put("task_id", task.getTaskId());
-        String localPath = DownloadUtils.downloadByUrl(requestMap, downloadPath, url, token.getAccessToken(), fileName);
+        String localPath = LoadFileUtil.downloadByUrl(requestMap, downloadPath, url, token.getAccessToken(), fileName);
         if(type == 1){
             //素材异步报表
             bytedanceDailyReportTaskMapper.loadBytedanceDailyCreativeFileAsync(localPath);
@@ -878,6 +878,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
 
     /////////////////////////////////////////////////////////\
     //素材报表
+    @Override
     public void bytedanceMaterialReportRetry(CtopOauthToken token, String startDate, String endDate){
         Long accountId = token.getAccountId();
         // log.info("头条素材报表当前accountId为:" + accountId);
@@ -899,6 +900,7 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
         }
     }
 
+    @Override
     public void bytedanceMaterialReport(CtopOauthToken token, String startDate, String endDate){
         Long accountId = token.getAccountId();
         // log.info("头条素材报表当前accountId为:" + accountId);