Parcourir la source

V1.1.3 自动投放 批量创建应用

yumeng il y a 4 ans
Parent
commit
728d53893b
13 fichiers modifiés avec 640 ajouts et 24 suppressions
  1. 278 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaiShouAppInfoController.java
  2. 7 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java
  3. 120 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaiShouAppInfo.java
  4. 15 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/AiKuaiShouAppInfoMapper.java
  5. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/mapper/xml/AiKuaiShouAppInfoMapper.xml
  6. 17 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaiShouAppInfoService.java
  7. 151 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java
  8. 13 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java
  9. 11 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouTemplateController.java
  10. 3 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  11. 4 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouTemplateServiceImpl.java
  12. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java
  13. 14 14
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaiShouDailyAgentMapper.xml

+ 278 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/AiKuaiShouAppInfoController.java

@@ -0,0 +1,278 @@
+package cn.com.ctop.kuaishou.modules.ai.controller;
+
+import cn.com.ctop.common.module.annotation.AutoLog;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+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.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+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.FileInputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Slf4j
+@Api(tags = "ai批量上传应用")
+@RestController
+@RequestMapping("/ai/aiKuaiShouAppInfo")
+public class AiKuaiShouAppInfoController {
+    @Autowired
+    private IAiKuaiShouAppInfoService aiKuaiShouAppInfoService;
+
+
+    @PostMapping(value = "/importAppExcel")
+    public Result<?> importExcel(@RequestParam("file") MultipartFile file,
+                                 @RequestParam("accountId") Long accountId,
+                                 @RequestParam("imageToken") String imageToken) {
+
+
+        FileInputStream fis = null;
+        try {
+
+            JSONObject json = aiKuaiShouAppInfoService.importExcel(file, accountId, imageToken);
+            //          System.out.println("导入是否成功:" + flag);
+        } catch (Exception e) {
+            e.printStackTrace();
+        } finally {
+            if (fis != null) {
+                try {
+                    fis.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+        return Result.ok("文件导入成功!");
+    }
+
+
+    /**
+     * 分页列表查询
+     *
+     * @param aiKuaiShouAppInfo
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-分页列表查询")
+    @ApiOperation(value = "ai批量上传应用-分页列表查询", notes = "ai批量上传应用-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<AiKuaiShouAppInfo>> queryPageList(AiKuaiShouAppInfo aiKuaiShouAppInfo,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        Result<IPage<AiKuaiShouAppInfo>> result = new Result<>();
+        QueryWrapper<AiKuaiShouAppInfo> queryWrapper = QueryGenerator.initQueryWrapper(aiKuaiShouAppInfo, req.getParameterMap());
+        Page<AiKuaiShouAppInfo> page = new Page<AiKuaiShouAppInfo>(pageNo, pageSize);
+        IPage<AiKuaiShouAppInfo> pageList = aiKuaiShouAppInfoService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @param aiKuaiShouAppInfo
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-添加")
+    @ApiOperation(value = "ai批量上传应用-添加", notes = "ai批量上传应用-添加")
+    @PostMapping(value = "/add")
+    public Result<AiKuaiShouAppInfo> add(@RequestBody AiKuaiShouAppInfo aiKuaiShouAppInfo) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        try {
+            aiKuaiShouAppInfoService.save(aiKuaiShouAppInfo);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param aiKuaiShouAppInfo
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-编辑")
+    @ApiOperation(value = "ai批量上传应用-编辑", notes = "ai批量上传应用-编辑")
+    @PutMapping(value = "/edit")
+    public Result<AiKuaiShouAppInfo> edit(@RequestBody AiKuaiShouAppInfo aiKuaiShouAppInfo) {
+        Result<AiKuaiShouAppInfo> result = new Result<AiKuaiShouAppInfo>();
+        AiKuaiShouAppInfo aiKuaiShouAppInfoEntity = aiKuaiShouAppInfoService.getById(aiKuaiShouAppInfo.getId());
+        if (aiKuaiShouAppInfoEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = aiKuaiShouAppInfoService.updateById(aiKuaiShouAppInfo);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-通过id删除")
+    @ApiOperation(value = "ai批量上传应用-通过id删除", notes = "ai批量上传应用-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        try {
+            aiKuaiShouAppInfoService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-批量删除")
+    @ApiOperation(value = "ai批量上传应用-批量删除", notes = "ai批量上传应用-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<AiKuaiShouAppInfo> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.aiKuaiShouAppInfoService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "ai批量上传应用-通过id查询")
+    @ApiOperation(value = "ai批量上传应用-通过id查询", notes = "ai批量上传应用-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<AiKuaiShouAppInfo> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<AiKuaiShouAppInfo> result = new Result<>();
+        AiKuaiShouAppInfo aiKuaiShouAppInfo = aiKuaiShouAppInfoService.getById(id);
+        if (aiKuaiShouAppInfo == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(aiKuaiShouAppInfo);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<AiKuaiShouAppInfo> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                AiKuaiShouAppInfo aiKuaiShouAppInfo = JSON.parseObject(deString, AiKuaiShouAppInfo.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(aiKuaiShouAppInfo, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<AiKuaiShouAppInfo> pageList = aiKuaiShouAppInfoService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "ai批量上传应用列表");
+        mv.addObject(NormalExcelConstants.CLASS, AiKuaiShouAppInfo.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("ai批量上传应用列表数据", "导出人: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<AiKuaiShouAppInfo> listAiKuaiShouAppInfos = ExcelImportUtil.importExcel(file.getInputStream(), AiKuaiShouAppInfo.class, params);
+                aiKuaiShouAppInfoService.saveBatch(listAiKuaiShouAppInfos);
+                return Result.ok("文件导入成功!数据行数:" + listAiKuaiShouAppInfos.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 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreativeRefusalController.java

@@ -42,7 +42,7 @@ public class KuaiShouCreativeRefusalController {
     private IKuaiShouImageGetService imageGetService;
     @Autowired
     private IKuaiShouMaterialUploadService uploadService;
-    static ExecutorService executorService = Executors.newFixedThreadPool(100);
+    static ExecutorService executorService = Executors.newFixedThreadPool(80);
 
     /**
      * 吃创意拒审重提
@@ -51,7 +51,7 @@ public class KuaiShouCreativeRefusalController {
      * @return
      */
     @PostMapping(value = "again")
-    public JSONObject campaignCreate(@RequestBody JSONObject requestJson) {
+    public JSONObject again(@RequestBody JSONObject requestJson) {
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson)) {
@@ -90,7 +90,6 @@ public class KuaiShouCreativeRefusalController {
                                     String imageToken = getImageToken(signature, accountId, oauthToken.getAccessToken(), url);
                                     if (!Check.isNull(imageToken)) {
                                         updateJson.put("imageToken", imageToken);
-
                                     }
                                 }
                             } else if (updateType == 1) { // 修改广告语
@@ -104,6 +103,11 @@ public class KuaiShouCreativeRefusalController {
                             } else {
                                 log.info("自动投放拒审重提失败,accountId:{},creativeId:{}", accountId, creativeId);
                             }
+                            try {
+                                Thread.sleep(1000L);
+                            } catch (InterruptedException e) {
+                                e.printStackTrace();
+                            }
                         }
                     }
                 });

+ 120 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/entity/AiKuaiShouAppInfo.java

@@ -0,0 +1,120 @@
+package cn.com.ctop.kuaishou.modules.ai.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Data
+@TableName("ctop_ai_kuaishou_app_info")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_ai_kuaishou_app_info对象", description = "ai批量上传应用")
+public class AiKuaiShouAppInfo {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户id
+     */
+    @Excel(name = "账户id", width = 15)
+    @ApiModelProperty(value = "账户id")
+    private Long accountId;
+    /**
+     * 应用标记
+     */
+    @Excel(name = "应用标记", width = 15)
+    @ApiModelProperty(value = "应用标记")
+    private String appVersion;
+    /**
+     * 应用名称
+     */
+    @Excel(name = "应用名称", width = 15)
+    @ApiModelProperty(value = "应用名称")
+    private String appName;
+    /**
+     * 应用包名
+     */
+    @Excel(name = "应用包名	", width = 15)
+    @ApiModelProperty(value = "应用包名	")
+    private String packageName;
+    /**
+     * 应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏
+     */
+    @Excel(name = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏", width = 15)
+    @ApiModelProperty(value = "应用类型 1:Android应用下载,2:Android网页游戏,3:iOS应用下载,4:iOS网页游戏")
+    private Integer platform;
+    /**
+     * 应用下载地址/网页游戏链接地址
+     */
+    @Excel(name = "应用下载地址/网页游戏链接地址	", width = 15)
+    @ApiModelProperty(value = "应用下载地址/网页游戏链接地址	")
+    private String url;
+    /**
+     * 是否接入快手广告监测SDK	 0:未接入,1:已接入
+     */
+    @Excel(name = "是否接入快手广告监测SDK	 0:未接入,1:已接入", width = 15)
+    @ApiModelProperty(value = "是否接入快手广告监测SDK	 0:未接入,1:已接入")
+    private Integer useSdk;
+    /**
+     * app隐私政策链接 安卓类应用必填
+     */
+    @Excel(name = "app隐私政策链接 安卓类应用必填", width = 15)
+    @ApiModelProperty(value = "app隐私政策链接 安卓类应用必填")
+    private String appPrivacyUrl;
+    private String trackUrl;
+    /**
+     * app文件MD5
+     */
+    @Excel(name = "app文件MD5", width = 15)
+    @ApiModelProperty(value = "app文件MD5")
+    private String appMd5;
+    /**
+     * 状态
+     */
+    @Excel(name = "状态", width = 15)
+    @ApiModelProperty(value = "状态")
+    private Integer status;
+    /**
+     * app_id
+     */
+    @Excel(name = "app_id", width = 15)
+    @ApiModelProperty(value = "app_id")
+    private Long appId;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+}

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

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.ai.mapper;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * ai批量上传应用
+ *
+ * @author: jeecg-boot
+ * @date: 2021-02-02
+ * @cersion: V1.0
+ */
+public interface AiKuaiShouAppInfoMapper extends BaseMapper<AiKuaiShouAppInfo> {
+
+}

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

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

+ 17 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaiShouAppInfoService.java

@@ -0,0 +1,17 @@
+package cn.com.ctop.kuaishou.modules.ai.service;
+
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * @Description: ai批量上传应用
+ * @Author: jeecg-boot
+ * @Date: 2021-02-02
+ * @Version: V1.0
+ */
+public interface IAiKuaiShouAppInfoService extends IService<AiKuaiShouAppInfo> {
+
+    JSONObject importExcel(MultipartFile file, Long accountId, String imageToken);
+}

+ 151 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaiShouAppInfoServiceImpl.java

@@ -0,0 +1,151 @@
+package cn.com.ctop.kuaishou.modules.ai.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaiShouAppInfo;
+import cn.com.ctop.kuaishou.modules.ai.mapper.AiKuaiShouAppInfoMapper;
+import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaiShouAppInfoService;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.hssf.usermodel.HSSFCell;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * ai批量上传应用
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-02-02
+ */
+@Service
+public class AiKuaiShouAppInfoServiceImpl extends ServiceImpl<AiKuaiShouAppInfoMapper, AiKuaiShouAppInfo> implements IAiKuaiShouAppInfoService {
+
+    /**
+     * 文件导入
+     *
+     * @param
+     * @param accountId
+     * @param imageToken
+     * @return
+     */
+    @Override
+    public JSONObject importExcel(MultipartFile myFile, Long accountId, String imageToken) {
+        try {
+            Workbook workbook = null;
+            String fileName = myFile.getOriginalFilename();
+            if (fileName.endsWith("XLS")) {
+                //2003
+                workbook = new HSSFWorkbook(myFile.getInputStream());
+            } else if (fileName.endsWith("XLSX")) {
+                //2007
+                workbook = new XSSFWorkbook(myFile.getInputStream());
+            } else {
+                //   throw new Exception("文件不是Excel文件");
+            }
+
+            Sheet sheet = workbook.getSheet("Sheet1");
+            int rows = sheet.getLastRowNum();// 指的行数,一共有多少行+
+            if (rows == 0) {
+                // throw new Exception("请填写数据");
+            }
+            for (int i = 1; i <= rows + 1; i++) {
+                // 读取左上端单元格
+                Row row = sheet.getRow(i);
+                // 行不为空
+                if (row != null) {
+                    // **读取cell**
+                    AiKuaiShouAppInfo appInfo = new AiKuaiShouAppInfo();
+
+                    String appName = getCellValue(row.getCell(0));
+                    appInfo.setAppName(appName);
+
+                    String packageName = getCellValue(row.getCell(1));
+                    appInfo.setPackageName(packageName);
+
+                    String appVersion = getCellValue(row.getCell(2));
+                    appInfo.setAppVersion(appVersion);
+
+                    String useSdk = getCellValue(row.getCell(3));
+                    if (!Check.isNull(useSdk)) {
+                        appInfo.setUseSdk(Integer.valueOf(useSdk));
+                    }
+                    String appPrivacyUrl = getCellValue(row.getCell(4));
+                    if (!Check.isNull(appPrivacyUrl)) {
+                        appInfo.setAppPrivacyUrl(appPrivacyUrl);
+                    }
+
+                    String trackUrl = getCellValue(row.getCell(5));
+                    if (!Check.isNull(trackUrl)) {
+                        appInfo.setTrackUrl(trackUrl);
+                    }
+                    //考试时间
+                  /*  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
+                    String dateString = getCellValue(row.getCell(3));
+                    if (!StringUtils.isEmpty(dateString)) {
+                        Date date = sdf.parse(dateString);
+                        student.setTime(date);
+                    }
+                    studentMapper.insert(student);*/
+                }
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+        return null;
+    }
+
+
+    private String getCellValue(Cell cell) {
+        String value = "";
+        if (cell != null) {
+            // 以下是判断数据的类型
+            switch (cell.getCellType()) {
+                case HSSFCell.CELL_TYPE_NUMERIC: // 数字
+                    value = cell.getNumericCellValue() + "";
+                    if (HSSFDateUtil.isCellDateFormatted(cell)) {
+                        Date date = cell.getDateCellValue();
+                        if (date != null) {
+                            value = new SimpleDateFormat("yyyy-MM-dd").format(date);
+                        } else {
+                            value = "";
+                        }
+                    } else {
+                        value = new DecimalFormat("0").format(cell.getNumericCellValue());
+                    }
+                    break;
+                case HSSFCell.CELL_TYPE_STRING: // 字符串
+                    value = cell.getStringCellValue();
+                    break;
+                case HSSFCell.CELL_TYPE_BOOLEAN: // Boolean
+                    value = cell.getBooleanCellValue() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_FORMULA: // 公式
+                    value = cell.getCellFormula() + "";
+                    break;
+                case HSSFCell.CELL_TYPE_BLANK: // 空值
+                    value = "";
+                    break;
+                case HSSFCell.CELL_TYPE_ERROR: // 故障
+                    value = "非法字符";
+                    break;
+                default:
+                    value = "未知类型";
+                    break;
+            }
+        }
+        return value.trim();
+    }
+}

+ 13 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java

@@ -165,6 +165,16 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                 if (!Check.isNull(groupCreateJson.getLong("fiction_id"))) {
                     createJson.put("fiction_id", groupCreateJson.getLong("fiction_id")); //小说ID
                 }
+
+                if (unit_type == 7) {
+                    if (!Check.isNull(groupCreateJson.getBoolean("smart_cover"))) {
+                        createJson.put("smart_cover", groupCreateJson.getBoolean("smart_cover")); //是否开启智能抽帧
+                    }
+                    if (!Check.isNull(groupCreateJson.getBoolean("asset_mining"))) {
+                        createJson.put("asset_mining", groupCreateJson.getBoolean("asset_mining")); //程序化创意2.0素材挖掘
+                    }
+                }
+
                 if (!Check.isNull(groupCreateJson.getLong("template_id"))) {
                     createJson.put("template_id", groupCreateJson.getLong("template_id")); //定向模板id
                 } else {
@@ -365,6 +375,8 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     }
                 }
                 programJson.put("cover_image_tokens", cover_image_tokens);
+            } else {
+                programJson.put("cover_image_tokens", new JSONArray());
             }
             if (!Check.isNull(programCreativeJson.getLong("site_id"))) {
                 programJson.put("site_id", programCreativeJson.getLong("site_id"));
@@ -399,6 +411,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_CREATE;
             String result = HttpUtils.kuaiShouhttpPostRequest(url, programJson.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
+            log.info("创建程序化创意返回结果:{}", resultJson);
             JSONObject returnJson = new JSONObject();
             returnJson.put("creative_uuid", creative_uuid);
             returnJson.put("unit_id", unit_id);

+ 11 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/KuaishouTemplateController.java

@@ -157,8 +157,17 @@ public class KuaishouTemplateController {
                 throw new Exception("未获取到账户信息");
             }
             JSONObject returnJson = kuaishouTemplateService.updateTemplate(accountId, oauthToken.getAccessToken(), requestJson);
-            result.setSuccess(true);
-            result.setResult(returnJson);
+            Integer code = returnJson.getInteger("code");
+            if (code == 0) {
+                result.setSuccess(true);
+                result.setMessage("修改成功");
+            } else {
+                result.setSuccess(false);
+                result.setMessage(returnJson.getString("message"));
+            }
+
+
+            // result.setResult(returnJson);
         } catch (Exception e) {
             e.printStackTrace();
             result.setSuccess(false);

+ 3 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -1022,9 +1022,10 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     JSONObject dataJson = resultJson.getJSONObject("data");
                     if (!Check.isNull(dataJson)) {
                         Long unitId = dataJson.getLong("unit_id");
-                        Thread.sleep(100);Thread thread = new Thread(){
+                        Thread.sleep(100);
+                        Thread thread = new Thread() {
                             @Override
-                            public void run(){
+                            public void run() {
                                 getKuaiShouGroupService.getGroupByUnitId(accessToken, advertiserId, unitId);
                             }
                         };

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

@@ -342,6 +342,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
      */
     @Override
     public JSONObject updateTemplate(Long accountId, String accessToken, JSONObject requestJson) {
+        System.err.println(requestJson);
         JSONObject returnJson = new JSONObject();
         try {
             if (Check.isNull(requestJson.getString("templateName"))) {
@@ -458,6 +459,7 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
             headers.put("Access-Token", accessToken);
             headers.put("Content-Type", " application/json");
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.TEMPLATE_UPDATE;
+            System.err.println("入参:" + param);
             String result = HttpUtils.kuaiShouhttpPostRequest(url, param.toJSONString(), headers);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
@@ -470,8 +472,9 @@ public class KuaishouTemplateServiceImpl extends ServiceImpl<KuaishouTemplateMap
                         returnJson.put("templateId", data.getLong("template_id"));
                     }
                 } else {
+                    log.error("修改失败:{}", resultJson);
                     returnJson.put("code", -1);
-                    returnJson.put("message", returnJson.getString("message"));
+                    returnJson.put("message", resultJson.getString("message"));
                 }
             } else {
                 returnJson.put("code", -1);

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAgent.java

@@ -41,13 +41,13 @@ public class KuaishouReportDailyAgent {
     @Excel(name = "账户ID", width = 15)
     @ApiModelProperty(value = "账户ID")
     @TableId(type = IdType.INPUT)
-    private java.lang.Integer accountId;
+    private java.lang.Long accountId;
     /**
      * 快手ID
      */
     @Excel(name = "快手ID", width = 15)
     @ApiModelProperty(value = "快手ID")
-    private java.lang.Integer kid;
+    private java.lang.Long kid;
     /**
      * 广告主名称
      */

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

@@ -6,24 +6,24 @@
     <!-- 代理商列表-->
     <select id="companyReport" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAgentSum">
         select
-        date_time as date,  <!-- 日期 -->
-        sum(charged_campaign_count) as costCampaignCount,  <!-- 有消费计划数 -->
-        sum(total_balance_in_yuan) as balance,  <!-- 总余额 -->
-        sum(total_charged_in_yuan) as cost,  <!-- 总消耗 -->
-        sum(real_charged_in_yuan) as xianjinCost,  <!-- 现金消耗 -->
-        sum(total_rebate_real_charged_in_yuan) as fandianCost,  <!-- 后返消耗 -->
-        sum(contract_rebate_real_charged_in_yuan) as kuangfanCost,  <!-- 框返消耗 -->
-        sum(direct_rebate_real_charged_in_yuan) as jiliCost,  <!-- 激励账户消耗 -->
-        sum(credit_real_charged_in_yuan) as xinyongCost,  <!-- 信用账户消耗 -->
-        sum(ad_photo_impression) as fengmianShowCount,  <!-- 封面曝光数 -->
-        sum(ad_photo_click) as fengmianClickCount,  <!-- 封面点击数 -->
-        sum(ad_item_impression) as sucaiShowCount,  <!-- 素材曝光数 -->
-        sum(ad_item_click) as convertCount,  <!-- 行为数 -->
+        date_time as date,
+        sum(charged_campaign_count) as costCampaignCount,
+        sum(total_balance_in_yuan) as balance,
+        sum(total_charged_in_yuan) as cost,
+        sum(real_charged_in_yuan) as xianjinCost,
+        sum(total_rebate_real_charged_in_yuan) as fandianCost,
+        sum(contract_rebate_real_charged_in_yuan) as kuangfanCost,
+        sum(direct_rebate_real_charged_in_yuan) as jiliCost,
+        sum(credit_real_charged_in_yuan) as xinyongCost,
+        sum(ad_photo_impression) as fengmianShowCount,
+        sum(ad_photo_click) as fengmianClickCount,
+        sum(ad_item_impression) as sucaiShowCount,
+        sum(ad_item_click) as convertCount,
         (case when sum(ad_photo_impression) != 0
         then sum(ad_photo_click) / sum(ad_photo_impression)
         else 0
         end
-        ) as fengmianClickRate,  <!-- 封面点击率 -->
+        ) as fengmianClickRate,
         (
         case when sum(ad_photo_click) != 0
         THEN sum(ad_item_click) / sum(ad_photo_click)