瀏覽代碼

加速搜索初版

zhaoxian 3 年之前
父節點
當前提交
b2a7976797
共有 12 個文件被更改,包括 891 次插入68 次删除
  1. 39 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/ExploreReportJob.java
  2. 3 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/KuaishouAccountBalanceBudgetMapper.java
  3. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/xml/KuaishouAccountBalanceBudgetMapper.xml
  4. 36 23
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java
  5. 275 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyExploreController.java
  6. 141 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyExplore.java
  7. 30 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyExploreMapper.java
  8. 103 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyExploreMapper.xml
  9. 5 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java
  10. 28 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyExploreService.java
  11. 54 40
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java
  12. 171 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyExploreServiceImpl.java

+ 39 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/ExploreReportJob.java

@@ -0,0 +1,39 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyExploreService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+@Slf4j
+public class ExploreReportJob {
+
+    @Autowired
+    private IKuaishouReportDailyExploreService exploreService;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+
+    /**
+     * 快手全量计划物料数据
+     */
+    @XxlJob("groupExploreReportJob")
+    public void execute() {
+        List<KuaishouReportDailyExplore> list = exploreService.getUnitListByStudyStatus();
+        list.forEach(group -> executorService.submit(() ->
+                exploreService.getExploreUnitReports(group.getAccountId(), group.getUnitId())
+        ));
+        XxlJobHelper.log("获取广告组加速探索报表信息");
+    }
+
+}

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

@@ -3,6 +3,7 @@ package cn.com.ctop.kuaishou.modules.app.mapper;
 
 import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 快手-账余额、预算
@@ -16,4 +17,6 @@ public interface KuaishouAccountBalanceBudgetMapper extends BaseMapper<KuaishouA
     void replace(KuaishouAccountBalanceBudget budget);
 
     void updateAllIsInvalidState();
+
+    KuaishouAccountBalanceBudget queryByAccountId(@Param("accountId") Long accountId);
 }

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/app/mapper/xml/KuaishouAccountBalanceBudgetMapper.xml

@@ -33,4 +33,10 @@
         where 1 = 1
     </update>
 
+    <select id="queryByAccountId" resultType="cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget">
+        SELECT *
+        FROM ctop_kuaishou_account_balance_budget
+        WHERE account_id = #{accountId}
+    </select>
+
 </mapper>

+ 36 - 23
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java

@@ -1,3 +1,4 @@
+
 package cn.com.ctop.kuaishou.modules.report.controller;
 
 import cn.com.ctop.common.module.utils.QueryGenerator;
@@ -11,11 +12,19 @@ import io.swagger.annotations.Api;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 
+
 /**
  * 广告组的加速探索报表
  *
@@ -23,14 +32,16 @@ import java.util.Arrays;
  * @version V1.0
  * @date 2021-02-02
  */
+
 @Slf4j
 @Api(tags = "广告组的加速探索报表")
 @RestController
-@RequestMapping("/explore")
+@RequestMapping("/explores")
 public class KuaishouGroupExploreController {
     @Autowired
     private IKuaishouGroupExploreService kuaishouGroupExploreService;
 
+
     /**
      * 分页列表查询
      *
@@ -40,6 +51,7 @@ public class KuaishouGroupExploreController {
      * @param req
      * @return
      */
+
     @GetMapping(value = "/list")
     public Result<IPage<KuaishouGroupExplore>> queryPageList(KuaishouGroupExplore kuaishouGroupExplore,
                                                              @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@@ -54,76 +66,71 @@ public class KuaishouGroupExploreController {
         return result;
     }
 
+
     /**
      * 查询加速探索信息接口
      *
      * @param data
      * @return
      */
+
     @PostMapping(value = "/unitExploreInfoGet")
     public Result<Object> unitExploreInfoGet(@RequestBody JSONObject data) {
         try {
-            return kuaishouGroupExploreService.unitExploreInfoGet(data);
+            return kuaishouGroupExploreService.unitExploreInfoGet(data.getLong("accountId"), data.getLong("unitId"));
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             return Result.error("操作失败");
         }
     }
 
-    /**
-     * 广告组的加速探索预算设置接口
-     *
-     * @param data
-     * @return
-     */
+
     @PostMapping(value = "/unitExploreBudgetUpdate")
     public Result<Object> unitExploreBudgetUpdate(@RequestBody JSONObject data) {
         try {
-            return kuaishouGroupExploreService.unitExploreBudgetUpdate(data);
+            return kuaishouGroupExploreService.unitExploreBudgetUpdate(data.getLong("accountId"), data.getLong("unitId"), data.getLong("exploreBudget"));
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             return Result.error("操作失败");
         }
     }
 
-    /**
-     * 暂停广告组的加速探索预算接口
-     *
-     * @param data
-     * @return
-     */
-    @PostMapping(value = "/unitExploreStatusPause")
-    public Result<Object> unitExploreStatusPause(@RequestBody JSONObject data) {
+    @PostMapping(value = "/querySpeedExploreReport")
+    public Result<Object> querySpeedExploreReport(@RequestBody JSONObject data) {
         try {
-            return kuaishouGroupExploreService.unitExploreStatusPause(data);
+            return kuaishouGroupExploreService.querySpeedExploreReport(data.getLong("accountId"), data.getLong("unitId"), data.getInteger("exploreBudget"), data.getLong("max_explore_budget"));
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             return Result.error("操作失败");
         }
     }
 
+
     /**
-     * 查询广告组的加速探索报表接口
+     * 暂停广告组的加速探索预算接口
      *
      * @param data
      * @return
      */
-    @PostMapping(value = "/querySpeedExploreReport")
-    public Result<Object> querySpeedExploreReport(@RequestBody JSONObject data) {
+
+    @PostMapping(value = "/unitExploreStatusPause")
+    public Result<Object> unitExploreStatusPause(@RequestBody JSONObject data) {
         try {
-            return kuaishouGroupExploreService.querySpeedExploreReport(data);
+            return kuaishouGroupExploreService.unitExploreStatusPause(data);
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             return Result.error("操作失败");
         }
     }
 
+
     /**
      * 辅助探索
      *
      * @param data
      * @return
      */
+
     @PostMapping(value = "/adUnitExploreSupport")
     public Result<Object> adUnitExploreSupport(@RequestBody JSONObject data) {
         try {
@@ -141,6 +148,7 @@ public class KuaishouGroupExploreController {
      * @param kuaishouGroupExplore
      * @return
      */
+
     @PostMapping(value = "/add")
     public Result<KuaishouGroupExplore> add(@RequestBody KuaishouGroupExplore kuaishouGroupExplore) {
         Result<KuaishouGroupExplore> result = new Result<>();
@@ -160,6 +168,7 @@ public class KuaishouGroupExploreController {
      * @param kuaishouGroupExplore
      * @return
      */
+
     @PutMapping(value = "/edit")
     public Result<KuaishouGroupExplore> edit(@RequestBody KuaishouGroupExplore kuaishouGroupExplore) {
         Result<KuaishouGroupExplore> result = new Result<KuaishouGroupExplore>();
@@ -176,12 +185,14 @@ public class KuaishouGroupExploreController {
         return result;
     }
 
+
     /**
      * 通过id删除
      *
      * @param id
      * @return
      */
+
     @DeleteMapping(value = "/delete")
     public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
         try {
@@ -199,6 +210,7 @@ public class KuaishouGroupExploreController {
      * @param ids
      * @return
      */
+
     @DeleteMapping(value = "/deleteBatch")
     public Result<KuaishouGroupExplore> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
         Result<KuaishouGroupExplore> result = new Result<>();
@@ -217,6 +229,7 @@ public class KuaishouGroupExploreController {
      * @param id
      * @return
      */
+
     @GetMapping(value = "/queryById")
     public Result<KuaishouGroupExplore> queryById(@RequestParam(name = "id", required = true) String id) {
         Result<KuaishouGroupExplore> result = new Result<>();

+ 275 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyExploreController.java

@@ -0,0 +1,275 @@
+package cn.com.ctop.kuaishou.modules.report.controller;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.QueryGenerator;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyExploreService;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+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.util.oConvertUtils;
+import org.jeecgframework.poi.excel.ExcelImportUtil;
+import org.jeecgframework.poi.excel.def.NormalExcelConstants;
+import org.jeecgframework.poi.excel.entity.ExportParams;
+import org.jeecgframework.poi.excel.entity.ImportParams;
+import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.MultipartHttpServletRequest;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-08-18
+ */
+@Slf4j
+@Api(tags = "广告组加速探索报表")
+@RestController
+@RequestMapping("/explore")
+public class KuaishouReportDailyExploreController {
+    @Autowired
+    private IKuaishouReportDailyExploreService kuaishouReportDailyExploreService;
+
+    /**
+     * 查询当日广告组数据
+     */
+    @PostMapping(value = "/todaylist")
+    public Result<Object> todaylist(@RequestBody JSONObject request) {
+        try {
+            return kuaishouReportDailyExploreService.todaylist(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 查询加上探索历史
+     */
+    @PostMapping(value = "/historyList")
+    public Result<Object> historyList(@RequestBody JSONObject request) {
+        try {
+            return kuaishouReportDailyExploreService.historyList(request);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+
+    /**
+     * 批量开启
+     */
+    @PostMapping(value = "/openBudgets")
+    public Result<Object> openBudgets(@RequestBody JSONObject request) {
+        try {
+            JSONArray unitIds = request.getJSONArray("unitIds");
+            Long accountId = request.getLong("accountId");
+            Long exploreBudget = request.getLong("exploreBudget");
+            if (Check.isNull(accountId) || Check.isNull(exploreBudget)) {
+                return Result.error("缺少参数");
+            }
+            return kuaishouReportDailyExploreService.openBudgets(accountId, unitIds, exploreBudget);
+        } catch (Exception e) {
+            log.error("查询异常,", e.getMessage());
+            e.printStackTrace();
+        }
+        return Result.error("查询失败");
+    }
+
+    /**
+     * 添加
+     *
+     * @param kuaishouReportDailyExplore
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-添加", notes = "广告组加速探索报表-添加")
+    @PostMapping(value = "/add")
+    public Result<KuaishouReportDailyExplore> add(@RequestBody KuaishouReportDailyExplore kuaishouReportDailyExplore) {
+        Result<KuaishouReportDailyExplore> result = new Result<>();
+        try {
+            kuaishouReportDailyExploreService.save(kuaishouReportDailyExplore);
+            result.success("添加成功!");
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            result.error500("操作失败");
+        }
+        return result;
+    }
+
+    /**
+     * 编辑
+     *
+     * @param kuaishouReportDailyExplore
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-编辑", notes = "广告组加速探索报表-编辑")
+    @PutMapping(value = "/edit")
+    public Result<KuaishouReportDailyExplore> edit(@RequestBody KuaishouReportDailyExplore kuaishouReportDailyExplore) {
+        Result<KuaishouReportDailyExplore> result = new Result<KuaishouReportDailyExplore>();
+        KuaishouReportDailyExplore kuaishouReportDailyExploreEntity = kuaishouReportDailyExploreService.getById(kuaishouReportDailyExplore.getId());
+        if (kuaishouReportDailyExploreEntity == null) {
+            result.error500("未找到对应实体");
+        } else {
+            boolean ok = kuaishouReportDailyExploreService.updateById(kuaishouReportDailyExplore);
+            if (ok) {
+                result.success("修改成功!");
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-通过id删除", notes = "广告组加速探索报表-通过id删除")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id") String id) {
+        try {
+            kuaishouReportDailyExploreService.removeById(id);
+        } catch (Exception e) {
+            log.error("删除失败", e.getMessage());
+            return Result.error("删除失败!");
+        }
+        return Result.ok("删除成功!");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-批量删除", notes = "广告组加速探索报表-批量删除")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<KuaishouReportDailyExplore> deleteBatch(@RequestParam(name = "ids") String ids) {
+        Result<KuaishouReportDailyExplore> result = new Result<>();
+        if (ids == null || "".equals(ids.trim())) {
+            result.error500("参数不识别!");
+        } else {
+            this.kuaishouReportDailyExploreService.removeByIds(Arrays.asList(ids.split(",")));
+            result.success("删除成功!");
+        }
+        return result;
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-通过id查询", notes = "广告组加速探索报表-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<KuaishouReportDailyExplore> queryById(@RequestParam(name = "id", required = true) String id) {
+        Result<KuaishouReportDailyExplore> result = new Result<>();
+        KuaishouReportDailyExplore kuaishouReportDailyExplore = kuaishouReportDailyExploreService.getById(id);
+        if (kuaishouReportDailyExplore == null) {
+            result.error500("未找到对应实体");
+        } else {
+            result.setResult(kuaishouReportDailyExplore);
+            result.setSuccess(true);
+        }
+        return result;
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param response
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) {
+        // Step.1 组装查询条件
+        QueryWrapper<KuaishouReportDailyExplore> queryWrapper = null;
+        try {
+            String paramsStr = request.getParameter("paramsStr");
+            if (oConvertUtils.isNotEmpty(paramsStr)) {
+                String deString = URLDecoder.decode(paramsStr, "UTF-8");
+                KuaishouReportDailyExplore kuaishouReportDailyExplore = JSON.parseObject(deString, KuaishouReportDailyExplore.class);
+                queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyExplore, request.getParameterMap());
+            }
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+
+        //Step.2 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        List<KuaishouReportDailyExplore> pageList = kuaishouReportDailyExploreService.list(queryWrapper);
+        //导出文件名称
+        mv.addObject(NormalExcelConstants.FILE_NAME, "广告组加速探索报表列表");
+        mv.addObject(NormalExcelConstants.CLASS, KuaishouReportDailyExplore.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<KuaishouReportDailyExplore> listKuaishouReportDailyExplores = ExcelImportUtil.importExcel(file.getInputStream(), KuaishouReportDailyExplore.class, params);
+                kuaishouReportDailyExploreService.saveBatch(listKuaishouReportDailyExplores);
+                return Result.ok("文件导入成功!数据行数:" + listKuaishouReportDailyExplores.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("文件导入失败!");
+    }
+
+}

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

@@ -0,0 +1,141 @@
+package cn.com.ctop.kuaishou.modules.report.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-08-18
+ */
+@Data
+@TableName("ctop_kuaishou_report_daily_explore")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "ctop_kuaishou_report_daily_explore对象", description = "广告组加速探索报表")
+public class KuaishouReportDailyExplore {
+
+    /**
+     * id
+     */
+    @TableId(type = IdType.AUTO)
+    @ApiModelProperty(value = "id")
+    private Long id;
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID", width = 15)
+    @ApiModelProperty(value = "账户ID")
+    private Long accountId;
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID", width = 15)
+    @ApiModelProperty(value = "计划ID")
+    private Long campaignId;
+    /**
+     * 组ID
+     */
+    @Excel(name = "组ID", width = 15)
+    @ApiModelProperty(value = "组ID")
+    private Long unitId;
+    /**
+     * 组名称
+     */
+    @Excel(name = "组名称", width = 15)
+    @ApiModelProperty(value = "组名称")
+    private String unitName;
+    /**
+     * 探索预算
+     */
+    @Excel(name = "探索预算", width = 15)
+    @ApiModelProperty(value = "探索预算")
+    private java.math.BigDecimal exploreBudget;
+    /**
+     * 优化目标
+     */
+    @Excel(name = "优化目标", width = 15)
+    @ApiModelProperty(value = "优化目标")
+    private Integer ocpxActionType;
+    /**
+     * 总消耗
+     */
+    @Excel(name = "总消耗", width = 15)
+    @ApiModelProperty(value = "总消耗")
+    private java.math.BigDecimal totalCharge;
+    /**
+     * 封面曝光数
+     */
+    @Excel(name = "封面曝光数", width = 15)
+    @ApiModelProperty(value = "封面曝光数")
+    private Long impression;
+    /**
+     * 封面点击数
+     */
+    @Excel(name = "封面点击数", width = 15)
+    @ApiModelProperty(value = "封面点击数")
+    private Long photoClick;
+    /**
+     * 素材曝光数
+     */
+    @Excel(name = "素材曝光数", width = 15)
+    @ApiModelProperty(value = "素材曝光数")
+    private Long click;
+    /**
+     * 转化数
+     */
+    @Excel(name = "转化数", width = 15)
+    @ApiModelProperty(value = "转化数")
+    private Long unifiedConversion;
+    /**
+     * 转化成本
+     */
+    @Excel(name = "转化成本", width = 15)
+    @ApiModelProperty(value = "转化成本")
+    private java.math.BigDecimal unitfiedConversionCost;
+    /**
+     * 记录日期
+     */
+    @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 statDate;
+    /**
+     * 创建时间
+     */
+    @Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+    /**
+     * 修改时间
+     */
+    @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+    /**
+     * 加速探索状态 0:默认;1:加速探索2:加速探索手动暂停;3:探索金额完成;4:时间到达截止时间,默认开启后只探索 6 小时
+     */
+    private Integer exploreStatus;
+    /**
+     * 可设置的最大加速探索预算,单位:里
+     */
+    private Long maxExploreBudget;
+}

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

@@ -0,0 +1,30 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+public interface KuaishouReportDailyExploreMapper extends BaseMapper<KuaishouReportDailyExplore> {
+
+    List<KuaishouReportDailyExplore> getUnitListByStudyStatus();
+
+    List<JSONObject> getTodaylist(@Param("accountId") Long accountId, @Param("sortCode") String sortCode, @Param("sortType") String sortType);
+
+    Long getTodaylistTotal(@Param("accountId") Long accountId);
+
+    List<JSONObject> getHistoryList(@Param("request") JSONObject request, @Param("sortCode") String sortCode, @Param("sortType") String sortType);
+
+    Long getHistoryListTotal(@Param("request") JSONObject request);
+
+    List<Long> getUnitIds(@Param("accountId") Long accountId);
+}

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

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyExploreMapper">
+
+    <select id="getUnitListByStudyStatus"
+            resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore">
+        SELECT account_id, unit_id
+        FROM ctop_kuaishou_report_daily_explore
+        WHERE explore_status IN (0, 1)
+    </select>
+
+    <select id="getTodaylistTotal" resultType="java.lang.Long">
+        SELECT count(1)
+        FROM ctop_kuaishou_group
+        WHERE account_id = #{accountId}
+          AND put_status = 1
+          AND study_status = 1
+          AND unit_id NOT IN (
+            SELECT unit_id FROM ctop_kuaishou_report_daily_explore WHERE account_id = #{accountId}
+        )
+
+    </select>
+
+    <select id="getTodaylist" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t2.unit_id,
+        t2.unit_name,
+        IFNULL(charge,'-') as 'charge',
+        IFNULL(activation,'-') as 'activation',
+        IFNULL(ROUND(charge/activation,2),'-') as 'activationCost',
+        IFNULL(event_pay,'-') as 'eventPay',
+        IFNULL(ROUND(charge/event_pay,2),'-') as 'eventPayCost',
+        IFNULL(event_register,'-') as 'eventRegister',
+        IFNULL(ROUND(charge/event_register,2),'-') as 'eventRegisterCost',
+        IFNULL(aclick,'-') as 'aclick'
+        FROM ctop_etl_kuaishou_group_daily_report t1
+        Right JOIN (
+        SELECT unit_id,unit_name FROM ctop_kuaishou_group WHERE account_id = #{accountId} AND unit_id NOT IN (
+        SELECT unit_id FROM ctop_kuaishou_report_daily_explore WHERE account_id = #{accountId}
+        )
+        AND put_status = 1
+        AND study_status = 1
+        ) t2 ON t1.unit_id = t2.unit_id
+        AND stat_date = DATE_FORMAT(now(),'%Y-%m-%d')
+        <if test="sortCode != '' and sortCode != null ">
+            ORDER BY ${sortCode} ${sortType}
+        </if>
+    </select>
+
+    <select id="getHistoryListTotal" resultType="java.lang.Long">
+        SELECT count(1)
+        FROM ctop_kuaishou_report_daily_explore
+        WHERE account_id = #{request.accountId}
+          AND stat_date &gt;= CONCAT(#{request.startTime}, ' 00:00:01')
+          AND stat_date &lt;= CONCAT(#{request.endTime}, ' 23:59:59')
+    </select>
+
+    <select id="getHistoryList" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore">
+        SELECT
+        id,
+        account_id,
+        unit_id,
+        unit_name,
+        explore_budget,
+        ocpx_action_type,
+        total_charge,
+        impression,
+        photo_click,
+        click,
+        unified_conversion,
+        unitfied_conversion_cost,
+        stat_date,
+        explore_status
+        FROM ctop_kuaishou_report_daily_explore
+        WHERE account_id = #{request.accountId}
+        AND stat_date &gt;= CONCAT(#{request.startTime},' 00:00:01')
+        AND stat_date &lt;= CONCAT(#{request.endTime},' 23:59:59')
+        <if test="request.unitId != null">
+            AND unit_id = #{request.unitId}
+        </if>
+        <if test="request.unitName != null">
+            AND LOCATE(#{request.unitName},unit_name)
+        </if>
+        <if test="request.exploreStatus != null ">
+            AND explore_status = #{request.exploreStatus}
+        </if>
+        <if test="sortCode != '' and sortCode != null ">
+            ORDER BY ${sortCode} ${sortType}
+        </if>
+    </select>
+
+    <select id="getUnitIds" resultType="java.lang.Long">
+        SELECT unit_id
+        FROM ctop_kuaishou_group
+        WHERE account_id = #{accountId}
+          AND put_status = 1
+          AND study_status = 1
+          AND unit_id NOT IN (
+            SELECT unit_id FROM ctop_kuaishou_report_daily_explore WHERE account_id = #{accountId}
+        )
+    </select>
+
+</mapper>

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouGroupExploreService.java

@@ -11,20 +11,20 @@ import java.math.BigDecimal;
 /**
  * @Description: 广告组的加速探索报表
  * @Author: jeecg-boot
- * @Date:   2021-02-02
+ * @Date: 2021-02-02
  * @Version: V1.0
  */
 public interface IKuaishouGroupExploreService extends IService<KuaishouGroupExplore> {
 
-    Result<Object> unitExploreInfoGet(JSONObject data);
+    Result<Object> unitExploreInfoGet(Long accountId, Long unitId);
 
-    Result<Object> unitExploreBudgetUpdate(JSONObject data);
+    Result<Object> unitExploreBudgetUpdate(Long accountId, Long unitId, Long exploreBudget);
 
     Result<Object> unitExploreStatusPause(JSONObject data);
 
-    Result<Object> querySpeedExploreReport(JSONObject data);
+    Result<Object> querySpeedExploreReport(Long accountId, Long unitId, Integer exploreStatus, Long maxExploreBudget);
 
-    void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId);
+    void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount, Long accountExploreId);
 
     void getReportByAccount(CtopOauthToken token);
 

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

@@ -0,0 +1,28 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.common.api.vo.Result;
+
+import java.util.List;
+
+/**
+ * 广告组加速探索报表
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+public interface IKuaishouReportDailyExploreService extends IService<KuaishouReportDailyExplore> {
+
+    void getExploreUnitReports(Long accountId, Long unitId);
+
+    List<KuaishouReportDailyExplore> getUnitListByStudyStatus();
+
+    Result<Object> todaylist(JSONObject request);
+
+    Result<Object> historyList(JSONObject request);
+
+    Result<Object> openBudgets(Long accountId, JSONArray unitIds,Long exploreBudget);
+}

+ 54 - 40
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
+import cn.com.ctop.common.module.utils.BigDecimalUtil;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
@@ -9,9 +10,13 @@ import cn.com.ctop.common.module.utils.PropertiesUtils;
 import cn.com.ctop.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyExploreService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -22,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -39,25 +45,23 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouGroupSpeedExploreLogService groupSpeedExploreLogService;
+    @Autowired
+    private IKuaishouReportDailyExploreService dailyExploreService;
+
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
 
     /**
-     * 查询加速探索信息
+     * 查询加速探索状态、预算
      *
      * @param
+     * @return
      * @throws
      * @author ZHAOXA
      */
     @Override
-    public Result<Object> unitExploreInfoGet(JSONObject data) {
+    public Result<Object> unitExploreInfoGet(Long accountId, Long unitId) {
         try {
-            Long accountId = data.getLong("accountId");
-            if (Check.isNull(accountId)) {
-                return Result.error("请选择广告主");
-            }
-            Long unitId = data.getLong("unitId");
-            if (Check.isNull(unitId)) {
-                return Result.error("请选择广告组");
-            }
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UNIT_EXPLORE_INFO_GET;
             Map<String, String> header = new HashMap<>();
@@ -84,27 +88,16 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
     }
 
     /**
-     * 广告组加速探索预算设置
+     * 开启广告组加速探索
      *
      * @param
      * @throws
      * @author ZHAOXA
      */
     @Override
-    public Result<Object> unitExploreBudgetUpdate(JSONObject data) {
+    public Result<Object> unitExploreBudgetUpdate(Long accountId, Long unitId, Long exploreBudget) {
+        String msg = null;
         try {
-            Long accountId = data.getLong("accountId");
-            if (Check.isNull(accountId)) {
-                return Result.error("请选择广告主");
-            }
-            Long unitId = data.getLong("unitId");
-            if (Check.isNull(unitId)) {
-                return Result.error("请选择广告组");
-            }
-            Long exploreBudget = data.getLong("exploreBudget");
-            if (Check.isNull(exploreBudget)) {
-                return Result.error("请填写加速探索预算");
-            }
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.UNIT_EXPLORE_BUDGET_UPDATE;
             Map<String, String> header = new HashMap<>();
@@ -119,6 +112,21 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
+                    Result<Object> result1 = this.unitExploreInfoGet(accountId, unitId);
+                    if (result1.getCode() == 200) {
+                        JSONObject resultData = (JSONObject) result1.getResult();
+                        Integer exploreStatus = resultData.getInteger("explore_status");
+                        Long maxExploreBudget = resultData.getLong("max_explore_budget");
+                        KuaiShouGroup kuaiShouGroup = new KuaiShouGroup();
+
+                        KuaishouReportDailyExplore kuaishouGroupExplore = new KuaishouReportDailyExplore();
+                        kuaishouGroupExplore.setAccountId(accountId);
+                        kuaishouGroupExplore.setUnitId(unitId);
+                        kuaishouGroupExplore.setStatDate(new Date());
+                        kuaishouGroupExplore.setMaxExploreBudget(maxExploreBudget);
+                        kuaishouGroupExplore.setExploreStatus(exploreStatus);
+                        dailyExploreService.save(kuaishouGroupExplore);
+                    }
                     return Result.ok(resultJson.getJSONObject("data"));
                 } else {
                     log.info("广告组的加速探索预算设置失败,accountId:{},返回信息:{}", accountId, resultJson);
@@ -126,7 +134,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
                 }
             }
         } catch (Exception e) {
-            log.error("广告组的加速探索预算设置失败", e);
+            log.error("广告组({})启动加速探索失败", unitId, e);
         }
         return Result.error("广告组的加速探索预算设置失败");
     }
@@ -182,16 +190,8 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
      * @author ZHAOXA
      */
     @Override
-    public Result<Object> querySpeedExploreReport(JSONObject data) {
+    public Result<Object> querySpeedExploreReport(Long accountId, Long unitId, Integer exploreStatus, Long maxExploreBudget) {
         try {
-            Long accountId = data.getLong("accountId");
-            if (Check.isNull(accountId)) {
-                return Result.error("请选择广告主");
-            }
-            Long unitId = data.getLong("unitId");
-            if (Check.isNull(unitId)) {
-                return Result.error("请选择广告组");
-            }
             CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.QUERY_SPEED_EXPLORE_REPORT;
             Map<String, String> header = new HashMap<>();
@@ -206,19 +206,32 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
                 Integer code = resultJson.getInteger("code");
                 if (code == 0) {
                     JSONObject exploreJson = resultJson.getJSONObject("data");
-                    KuaishouGroupExplore kuaishouGroupExplore = JSONObject.toJavaObject(exploreJson, KuaishouGroupExplore.class);
+                    KuaishouReportDailyExplore kuaishouGroupExplore = JSONObject.toJavaObject(exploreJson, KuaishouReportDailyExplore.class);
                     if (Check.isNull(kuaishouGroupExplore)) {
                         return Result.error("查询失败,结果为空");
                     }
-                    QueryWrapper<KuaishouGroupExplore> queryWrapper = new QueryWrapper<>();
-                    queryWrapper.eq("unit_id", kuaishouGroupExplore.getUnitId());
-                    KuaishouGroupExplore one = this.getOne(queryWrapper);
+                    QueryWrapper<KuaishouReportDailyExplore> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.eq("unit_id", unitId);
+                    queryWrapper.eq("account_id", accountId);
+                    KuaishouReportDailyExplore one = dailyExploreService.getOne(queryWrapper);
                     if (!Check.isNull(one)) {
                         kuaishouGroupExplore.setId(one.getId());
                     }
+                    KuaiShouGroup kuaiShouGroup = kuaiShouGroupService.selectGroupByUnitId(accountId, unitId);
+                    if(!Check.isNull(kuaiShouGroup)){
+                        kuaishouGroupExplore.setUnitName(kuaiShouGroup.getUnitName());
+                        kuaishouGroupExplore.setCampaignId(kuaiShouGroup.getCampaignId());
+                    }
                     kuaishouGroupExplore.setAccountId(accountId);
-                    this.saveOrUpdate(kuaishouGroupExplore);
-                    return Result.ok("添加成功");
+                    kuaishouGroupExplore.setExploreStatus(exploreStatus);
+                    kuaishouGroupExplore.setMaxExploreBudget(maxExploreBudget);
+                    kuaishouGroupExplore.setStatDate(new Date());
+                    kuaishouGroupExplore.setExploreBudget(BigDecimalUtil.divideBigDecimal(kuaishouGroupExplore.getExploreBudget(), new BigDecimal(1000)));
+                    kuaishouGroupExplore.setTotalCharge(BigDecimalUtil.divideBigDecimal(kuaishouGroupExplore.getTotalCharge(), new BigDecimal(1000)));
+                    boolean b = dailyExploreService.saveOrUpdate(kuaishouGroupExplore);
+                    if (b) {
+                        return Result.ok("添加成功");
+                    }
                 } else {
                     log.info("查询广告组的加速探索报表失败,accountId:{},返回信息:{}", accountId, resultJson);
                     return Result.error("查询广告组的加速探索报表失败," + resultJson.getString("message"));
@@ -311,4 +324,5 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
     }
 
 
+
 }

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

@@ -0,0 +1,171 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.app.entity.KuaishouAccountBalanceBudget;
+import cn.com.ctop.kuaishou.modules.app.mapper.KuaishouAccountBalanceBudgetMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyExploreMapper;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyExploreService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyExploreServiceImpl extends ServiceImpl<KuaishouReportDailyExploreMapper, KuaishouReportDailyExplore> implements IKuaishouReportDailyExploreService {
+
+    @Autowired
+    private KuaishouReportDailyExploreMapper reportDailyExploreMapper;
+
+    @Autowired
+    private KuaishouAccountBalanceBudgetMapper kuaishouAccountBalanceBudgetMapper;
+
+    @Autowired
+    private IKuaishouGroupExploreService kuaishouGroupExploreService;
+
+    @Autowired
+    private IKuaiShouGroupService kuaiShouGroupService;
+
+    @Override
+    public void getExploreUnitReports(Long accountId, Long unitId) {
+        Result<Object> result = kuaishouGroupExploreService.unitExploreInfoGet(accountId, unitId);
+        if (result.getCode() == 200) {
+            JSONObject resultResult = (JSONObject) result.getResult();
+            if (!Check.isNull(resultResult)) {
+                kuaishouGroupExploreService.querySpeedExploreReport(accountId, unitId, resultResult.getInteger("explore_status"),resultResult.getLong("max_explore_budget"));
+            }
+        }
+    }
+
+    @Override
+    public List<KuaishouReportDailyExplore> getUnitListByStudyStatus() {
+        return reportDailyExploreMapper.getUnitListByStudyStatus();
+    }
+
+    @Override
+    public Result<Object> todaylist(JSONObject request) {
+        Integer pageNo = request.getInteger("pageNo");
+        Integer pageSize = request.getInteger("pageSize");
+        if (Check.isNull(pageNo)) {
+            pageNo = 1;
+        }
+        if (Check.isNull(pageSize)) {
+            pageSize = 10;
+        }
+        Long accountId = request.getLong("accountId");
+        if (Check.isNull(accountId)) {
+            return Result.error("未选择账户");
+        }
+        String sortCode = request.getString("sortCode");
+        String sortType = request.getString("sortType");
+        if (Check.isNull(sortCode)) {
+            sortCode = "charge";
+        }
+        if (Check.isNull(sortType)) {
+            sortType = "DESC";
+        }
+        Long total = reportDailyExploreMapper.getTodaylistTotal(accountId);
+        PageHelper.startPage(pageNo, pageSize, false);
+        PageInfo pageInfo = new PageInfo(reportDailyExploreMapper.getTodaylist(accountId, sortCode, sortType));
+        pageInfo.setTotal(total);
+        JSONObject result = new JSONObject();
+        result.put("pageInfo", pageInfo);
+        KuaishouAccountBalanceBudget balanceBudget = kuaishouAccountBalanceBudgetMapper.queryByAccountId(accountId);
+        if (!Check.isNull(balanceBudget)) {
+            result.put("dayBudget", balanceBudget.getDayBudget());
+        }
+        return Result.ok(result);
+    }
+
+    @Override
+    public Result<Object> historyList(JSONObject request) {
+        Integer pageNo = request.getInteger("pageNo");
+        Integer pageSize = request.getInteger("pageSize");
+        if (Check.isNull(pageNo)) {
+            pageNo = 1;
+        }
+        if (Check.isNull(pageSize)) {
+            pageSize = 10;
+        }
+        Long accountId = request.getLong("accountId");
+        if (Check.isNull(accountId)) {
+            return Result.error("未选择账户");
+        }
+        String sortCode = request.getString("sortCode");
+        String sortType = request.getString("sortType");
+        if (Check.isNull(sortCode)) {
+            sortCode = "total_charge";
+        }
+        if (Check.isNull(sortType)) {
+            sortType = "DESC";
+        }
+        if (Check.isNull(request.getString("startTime"))) {
+            request.put("startTime", DateUtils.getNowDate("yyyy-MM-dd"));
+            request.put("endTime", DateUtils.getNowDate("yyyy-MM-dd"));
+        }
+        Long total = reportDailyExploreMapper.getHistoryListTotal(request);
+        PageHelper.startPage(pageNo, pageSize, false);
+        PageInfo pageInfo = new PageInfo(reportDailyExploreMapper.getHistoryList(request, sortCode, sortType));
+        pageInfo.setTotal(total);
+        JSONObject result = new JSONObject();
+        result.put("pageInfo", pageInfo);
+        KuaishouAccountBalanceBudget balanceBudget = kuaishouAccountBalanceBudgetMapper.queryByAccountId(accountId);
+        if (!Check.isNull(balanceBudget)) {
+            result.put("dayBudget", balanceBudget.getDayBudget());
+        }
+        return Result.ok(result);
+    }
+
+    @Override
+    public Result<Object> openBudgets(Long accountId, JSONArray unitIds, Long exploreBudget) {
+        try {
+            StringBuilder errUnitIds = new StringBuilder();
+            if (Check.isNull(unitIds) || unitIds.isEmpty()) {
+                List<Long> unitids = reportDailyExploreMapper.getUnitIds(accountId);
+                for (Long unitid : unitids) {
+                    Result<Object> result = kuaishouGroupExploreService.unitExploreBudgetUpdate(accountId, unitid, exploreBudget);
+                    if (result.getCode() != 200) {
+                        if (errUnitIds.length() > 0) {
+                            errUnitIds.append(",");
+                        }
+                        errUnitIds.append(unitid);
+                    }
+                }
+            } else {
+                for (int i = 0; i < unitIds.size(); i++) {
+                    Long unitId = unitIds.getLong(i);
+                    Result<Object> result = kuaishouGroupExploreService.unitExploreBudgetUpdate(accountId, unitId, exploreBudget);
+                    if (result.getCode() != 200) {
+                        if (errUnitIds.length() > 0) {
+                            errUnitIds.append(",");
+                        }
+                        errUnitIds.append(unitId);
+                    }
+                }
+            }
+            if (errUnitIds.length() > 0) {
+                return Result.ok(errUnitIds.insert(0, "启动完成,其中广告组:").append("启动失败"));
+            }
+            return Result.ok("全部启动完成");
+        } catch (Exception e) {
+            log.error("启动加速探索异常", e);
+            return Result.error("启动加速探索失败");
+        }
+    }
+}