Pārlūkot izejas kodu

加速探索初版,添加实体

zhaoxian 3 gadi atpakaļ
vecāks
revīzija
f94bb4af44

+ 246 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouReportDailyExploreController.java

@@ -0,0 +1,246 @@
+package cn.com.ctop.kuaishou.modules.report.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.report.entity.KuaishouReportDailyExplore;
+import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyExploreService;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+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 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.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;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * @version V1.0
+ * @date 2021-08-18
+ */
+@Slf4j
+@Api(tags = "广告组加速探索报表")
+@RestController
+@RequestMapping("/kuaishouReportDailyExplore")
+public class KuaishouReportDailyExploreController {
+    @Autowired
+    private IKuaishouReportDailyExploreService kuaishouReportDailyExploreService;
+
+    /**
+     * 分页列表查询
+     *
+     * @param kuaishouReportDailyExplore
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @ApiOperation(value = "广告组加速探索报表-分页列表查询", notes = "广告组加速探索报表-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<KuaishouReportDailyExplore>> queryPageList(KuaishouReportDailyExplore kuaishouReportDailyExplore,
+                                                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                                   HttpServletRequest req) {
+        Result<IPage<KuaishouReportDailyExplore>> result = new Result<>();
+        QueryWrapper<KuaishouReportDailyExplore> queryWrapper = QueryGenerator.initQueryWrapper(kuaishouReportDailyExplore, req.getParameterMap());
+        Page<KuaishouReportDailyExplore> page = new Page<KuaishouReportDailyExplore>(pageNo, pageSize);
+        IPage<KuaishouReportDailyExplore> pageList = kuaishouReportDailyExploreService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    /**
+     * 添加
+     *
+     * @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("文件导入失败!");
+    }
+
+}

+ 147 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyExplore.java

@@ -0,0 +1,147 @@
+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.UUID)
+    @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;
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称", width = 15)
+    @ApiModelProperty(value = "计划名称")
+    private String campaignName;
+    /**
+     * 组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;
+}

+ 15 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/KuaishouReportDailyExploreMapper.java

@@ -0,0 +1,15 @@
+package cn.com.ctop.kuaishou.modules.report.mapper;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+public interface KuaishouReportDailyExploreMapper extends BaseMapper<KuaishouReportDailyExplore> {
+
+}

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyExploreMapper.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.report.mapper.KuaishouReportDailyExploreMapper">
+
+</mapper>

+ 14 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IKuaishouReportDailyExploreService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.kuaishou.modules.report.service;
+
+import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyExplore;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 广告组加速探索报表
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+public interface IKuaishouReportDailyExploreService extends IService<KuaishouReportDailyExplore> {
+
+}

+ 19 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouReportDailyExploreServiceImpl.java

@@ -0,0 +1,19 @@
+package cn.com.ctop.kuaishou.modules.report.service.impl;
+
+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.IKuaishouReportDailyExploreService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 广告组加速探索报表
+ *
+ * @author jeecg-boot
+ * 2021-08-18
+ * @version V1.0
+ */
+@Service
+public class KuaishouReportDailyExploreServiceImpl extends ServiceImpl<KuaishouReportDailyExploreMapper, KuaishouReportDailyExplore> implements IKuaishouReportDailyExploreService {
+
+}