Browse Source

直播投流,初版1

zhaoxian 3 years ago
parent
commit
448e022839
39 changed files with 1263 additions and 69 deletions
  1. 6 2
      ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchCampaignController.java
  2. 6 2
      ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchCreativeController.java
  3. 20 2
      ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchGroupController.java
  4. 19 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchTargetTemplateController.java
  5. 90 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/AccountToken.java
  6. 6 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCampaign.java
  7. 95 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCampaignRecord.java
  8. 6 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCreative.java
  9. 150 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCreativeRecord.java
  10. 6 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroup.java
  11. 12 1
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroupRecord.java
  12. 5 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroupTarget.java
  13. 12 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchTargetTemplate.java
  14. 17 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/AccountTokenMapper.java
  15. 61 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchCampaignRecordMapper.java
  16. 61 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchCreativeRecordMapper.java
  17. 1 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchGroupMapper.java
  18. 3 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchGroupRecordMapper.java
  19. 7 4
      ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchTargetTemplateMapper.java
  20. 25 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/IAccountTokenService.java
  21. 3 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/IKuaishouLaunchGroupService.java
  22. 5 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/IKuaishouLaunchTargetTemplateService.java
  23. 30 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/AccountTokenServiceImpl.java
  24. 53 22
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCampaignAutoStrategyServiceImpl.java
  25. 27 8
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCampaignServiceImpl.java
  26. 17 3
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCreativeServiceImpl.java
  27. 14 4
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchGroupServiceImpl.java
  28. 23 13
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchGroupTargetServiceImpl.java
  29. 44 0
      ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchTargetTemplateServiceImpl.java
  30. 6 7
      ruixuan-launch/src/main/java/com/ruixuan/launch/unitls/APIUtil.java
  31. 49 0
      ruixuan-launch/src/main/resources/mapper/launch/AccountTokenMapper.xml
  32. 6 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCampaignMapper.xml
  33. 133 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCampaignRecordMapper.xml
  34. 6 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCreativeMapper.xml
  35. 184 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCreativeRecordMapper.xml
  36. 7 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupMapper.xml
  37. 20 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupRecordMapper.xml
  38. 6 0
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupTargetMapper.xml
  39. 22 1
      ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchTargetTemplateMapper.xml

+ 6 - 2
ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchCampaignController.java

@@ -6,7 +6,9 @@ import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.utils.Check;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchCampaign;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchCampaignService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -32,6 +34,8 @@ import java.util.List;
 public class KuaishouLaunchCampaignController extends BaseController {
     @Autowired
     private IKuaishouLaunchCampaignService kuaishouLaunchCampaignService;
+    @Autowired
+    private IAccountTokenService tokenService;
 
     /**
      * 查询广告计划信息列表
@@ -60,8 +64,8 @@ public class KuaishouLaunchCampaignController extends BaseController {
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增广告计划")
     public ResultResponse add(@RequestBody JSONObject requestJson) {
-        String token = "";
-        Long campaignId = kuaishouLaunchCampaignService.insertKuaishouLaunchCampaign(requestJson, token);
+        AccountToken token = tokenService.getAccountToken(requestJson.getLong("accountId"));
+        Long campaignId = kuaishouLaunchCampaignService.insertKuaishouLaunchCampaign(requestJson, token.getAccessToken());
         if (Check.isNotNull(campaignId) && campaignId > 0) {
             return ResultResponse.success(campaignId);
         }

+ 6 - 2
ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchCreativeController.java

@@ -5,7 +5,9 @@ import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchCreative;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchCreativeService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -32,6 +34,8 @@ import java.util.List;
 public class KuaishouLaunchCreativeController extends BaseController {
     @Autowired
     private IKuaishouLaunchCreativeService kuaishouLaunchCreativeService;
+    @Autowired
+    private IAccountTokenService tokenService;
 
     /**
      * 查询广告创意信息列表
@@ -59,8 +63,8 @@ public class KuaishouLaunchCreativeController extends BaseController {
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增广告创意信息")
     public ResultResponse add(@RequestBody JSONObject requestJson) {
-        String token = "";
-        return kuaishouLaunchCreativeService.insertKuaishouLaunchCreative(requestJson,token);
+        AccountToken token = tokenService.getAccountToken(requestJson.getLong("accountId"));
+        return kuaishouLaunchCreativeService.insertKuaishouLaunchCreative(requestJson, token.getAccessToken());
     }
 
     /**

+ 20 - 2
ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchGroupController.java

@@ -5,7 +5,10 @@ import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchGroup;
+import com.ruixuan.launch.entity.KuaishouLaunchGroupRecord;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchGroupService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -33,6 +36,9 @@ public class KuaishouLaunchGroupController extends BaseController {
     @Autowired
     private IKuaishouLaunchGroupService kuaishouLaunchGroupService;
 
+    @Autowired
+    private IAccountTokenService tokenService;
+
     /**
      * 查询广告组信息列表
      */
@@ -44,6 +50,18 @@ public class KuaishouLaunchGroupController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询创建记录
+     */
+    @ApiOperation(value = "查询创建记录")
+    @GetMapping("/queryGroupRecord")
+    public TableDataInfo queryGroupRecord(@ApiParam("账户Id") @RequestParam(value = "accountId", required = true) Long accountId,
+                                          @ApiParam("策略ID") @RequestParam(value = "strategyId", required = true) Long strategyId) {
+        startPage();
+        List<KuaishouLaunchGroupRecord> list = kuaishouLaunchGroupService.queryGroupRecord(accountId, strategyId);
+        return getDataTable(list);
+    }
+
 
     /**
      * 获取广告组信息详细信息
@@ -61,8 +79,8 @@ public class KuaishouLaunchGroupController extends BaseController {
     @ApiOperation(value = "新增广告组")
     public ResultResponse add(@RequestBody JSONObject requestJson) {
         try {
-            String token = "";
-            kuaishouLaunchGroupService.insertKuaishouLaunchGroup(requestJson, token);
+            AccountToken token = tokenService.getAccountToken(requestJson.getLong("accountId"));
+            kuaishouLaunchGroupService.insertKuaishouLaunchGroup(requestJson, token.getAccessToken());
             return ResultResponse.success();
         } catch (Exception e) {
             e.printStackTrace();

+ 19 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/controller/KuaishouLaunchTargetTemplateController.java

@@ -1,5 +1,6 @@
 package com.ruixuan.launch.controller;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
@@ -54,6 +55,15 @@ public class KuaishouLaunchTargetTemplateController extends BaseController {
     }
 
     /**
+     * 获取账户下所属定向信息详细信息
+     */
+    @ApiOperation(value = "批量获取账户下所属定向信息详细信息")
+    @GetMapping("/getByIds")
+    public ResultResponse getInfo(@ApiParam("ids") @RequestParam(value = "ids", required = true) String ids) {
+        return kuaishouLaunchTargetTemplateService.selectKuaishouLaunchTargetTemplateByIds(ids);
+    }
+
+    /**
      * 新增广告组定向信息
      */
     @PostMapping(value = "/add")
@@ -63,6 +73,15 @@ public class KuaishouLaunchTargetTemplateController extends BaseController {
     }
 
     /**
+     * 批量新增广告组定向信息
+     */
+    @PostMapping(value = "/adds")
+    @ApiOperation(value = "批量新增广告组定向信息")
+    public ResultResponse adds(@RequestBody JSONObject request) {
+        return kuaishouLaunchTargetTemplateService.insertMore(request);
+    }
+
+    /**
      * 修改账户下所属定向信息
      */
     @PostMapping(value = "/edit")

+ 90 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/AccountToken.java

@@ -0,0 +1,90 @@
+package com.ruixuan.launch.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruixuan.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 对象 agent_token
+ *
+ * @author ruoyi
+ * @date 2022-07-15
+ */
+@Data
+public class AccountToken {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    private String id;
+
+    /**
+     * 媒体ID(外部广告平台类型,快手/头条/抖音等)
+     */
+    @Excel(name = "媒体ID", readConverterExp = "外=部广告平台类型,快手/头条/抖音等")
+    private String mediaId;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long agentId;
+
+    /**
+     * 访问令牌
+     */
+    @Excel(name = "访问令牌")
+    private String accessToken;
+
+    /**
+     * 访问令牌有效期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "访问令牌有效期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date accessTokenExpiresIn;
+
+    /**
+     * 刷新令牌
+     */
+    @Excel(name = "刷新令牌")
+    private String refreshToken;
+
+    /**
+     * 刷新令牌有效期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "刷新令牌有效期", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date refreshTokenExpiresIn;
+
+    /**
+     * 代理商类型 0:三方代理商 1:本代理商
+     */
+    @Excel(name = "代理商类型 0:三方代理商 1:本代理商")
+    private Integer agentType;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long appId;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String secret;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+}

+ 6 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCampaign.java

@@ -41,6 +41,12 @@ public class KuaishouLaunchCampaign {
     private String campaignName;
 
     /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    /**
      * 计划类型	3:获取电商下单 13:小店商品推广 14:直播推广
      */
     @Excel(name = "计划类型	3:获取电商下单 13:小店商品推广 14:直播推广")

+ 95 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCampaignRecord.java

@@ -0,0 +1,95 @@
+package com.ruixuan.launch.entity;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruixuan.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 广告计划信息对象 kuaishou_launch_campaign_record
+ *
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@Data
+public class KuaishouLaunchCampaignRecord {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     */
+    private String id;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 策略ID
+     */
+    @Excel(name = "策略ID")
+    private Long strategyId;
+
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID")
+    private Long campaignId;
+
+    /**
+     * 计划名称
+     */
+    @Excel(name = "计划名称")
+    private String campaignName;
+
+    /**
+     * 计划类型	3:获取电商下单 13:小店商品推广 14:直播推广
+     */
+    @Excel(name = "计划类型	3:获取电商下单 13:小店商品推广 14:直播推广")
+    private Integer campaignType;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    /**
+     * 推广方式1:极速推广,2:专业推广(当前支持)
+     */
+    @Excel(name = "推广方式1:极速推广,2:专业推广", readConverterExp = "当=前支持")
+    private Integer promotionType;
+
+    /**
+     * 单日预算金额 单位:厘,0表示预算不限,默认0
+     */
+    @Excel(name = "单日预算金额 单位:厘,0表示预算不限,默认0")
+    private Long dayBudget;
+
+    /**
+     * 分日预算
+     */
+    @Excel(name = "分日预算")
+    private String budgetSchedule;
+
+    /**
+     * 结果说明
+     */
+    @Excel(name = "结果说明")
+    private String message;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+}

+ 6 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCreative.java

@@ -38,6 +38,12 @@ public class KuaishouLaunchCreative {
     private Long unitId;
 
     /**
+     * 日期
+     */
+    @Excel(name = "日期")
+
+    private String statDate;
+    /**
      * 广告创意ID
      */
     @Excel(name = "广告创意ID")

+ 150 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchCreativeRecord.java

@@ -0,0 +1,150 @@
+package com.ruixuan.launch.entity;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruixuan.common.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 广告创意信息创建记录对象 kuaishou_launch_creative_record
+ *
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+@Data
+public class KuaishouLaunchCreativeRecord {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private String id;
+
+    /**
+     * 账户ID
+     */
+    @Excel(name = "账户ID")
+    private Long accountId;
+
+    /**
+     * 计划ID
+     */
+    @Excel(name = "计划ID")
+    private Long campaignId;
+
+    /**
+     * 组ID
+     */
+    @Excel(name = "组ID")
+    private Long unitId;
+
+    /**
+     * 广告创意ID
+     */
+    @Excel(name = "广告创意ID")
+    private Long creativeId;
+
+    /**
+     * 策略ID
+     */
+    @Excel(name = "策略ID")
+    private Long strategyId;
+
+    /**
+     * 创意名称
+     */
+    @Excel(name = "创意名称")
+    private String creativeName;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    /**
+     * 封面 直播直投传""
+     */
+    @Excel(name = "封面 直播直投传''")
+    private String coverUrl;
+
+    /**
+     * 封面宽 直播直投传 0
+     */
+    @Excel(name = "封面宽 直播直投传 0")
+    private Long coverWidth;
+
+    /**
+     * 封面高 直播直投传 0
+     */
+    @Excel(name = "封面高 直播直投传 0")
+    private Long coverHeight;
+
+    /**
+     * 视频ID	直播直投传 0
+     */
+    @Excel(name = "视频ID	直播直投传 0")
+    private String photoId;
+
+    /**
+     * 素材类型	1:竖版视频 2:横版视频 ,直播直投传 0
+     */
+    @Excel(name = "素材类型	1:竖版视频 2:横版视频 ,直播直投传 0")
+    private Integer creativeMaterialType;
+
+    /**
+     * 行动号召按钮文案
+     */
+    @Excel(name = "行动号召按钮文案")
+    private String actionBar;
+
+    /**
+     * 商品推荐语
+     */
+    @Excel(name = "商品推荐语")
+    private String recommendation;
+
+    /**
+     * 作品标题
+     */
+    @Excel(name = "作品标题")
+    private String description;
+
+    /**
+     * 推荐理由描述
+     */
+    @Excel(name = "推荐理由描述")
+    private String newExposeText;
+
+    /**
+     * 推荐理由url
+     */
+    @Excel(name = "推荐理由url")
+    private String newExposeUrl;
+
+    /**
+     * 作品类型(小店直播推广类型,计划 type=14	1 - 直投直播;2 - 视频引流直播)
+     */
+    @Excel(name = "作品类型", readConverterExp = "小=店直播推广类型,计划,t=ype=14	1,-=,直=投直播;2,-=,视=频引流直播")
+    private Integer liveCreativeType;
+
+    /**
+     * 结果说明
+     */
+    @Excel(name = "结果说明")
+    private String message;
+    /**
+     * 更新时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date updateTime;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+}

+ 6 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroup.java

@@ -41,6 +41,12 @@ public class KuaishouLaunchGroup {
     private Long unitId;
 
     /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    /**
      * 广告组名称
      */
     @Excel(name = "广告组名称")

+ 12 - 1
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroupRecord.java

@@ -9,7 +9,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 /**
- * 广告组创建记录对象 kuaishou_launch_group_record
+ * 广告组创建记录对象 kuaishou_launch_record_group
  *
  * @author ruoyi
  * @date 2022-07-08
@@ -42,6 +42,17 @@ public class KuaishouLaunchGroupRecord {
     private Long unitId;
 
     /**
+     * 策略ID
+     */
+    private Long strategyId;
+
+    /**
+     * 日期
+     */
+    @Excel(name = "日期")
+    private String statDate;
+
+    /**
      * 广告组名称
      */
     @Excel(name = "广告组名称")

+ 5 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchGroupTarget.java

@@ -38,6 +38,11 @@ public class KuaishouLaunchGroupTarget {
     private String region;
 
     /**
+     * 地域类型 0:不限 1:指定地区 3:城市等级
+     */
+
+    private String regionType;
+    /**
      * 自定义年龄段
      */
     @Excel(name = "自定义年龄段")

+ 12 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/entity/KuaishouLaunchTargetTemplate.java

@@ -33,6 +33,13 @@ public class KuaishouLaunchTargetTemplate {
      */
     @Excel(name = "定向包名")
     private String targetName;
+
+    /**
+     * 1智能优选,2自定义
+     */
+    @Excel(name = " 1智能优选,2自定义")
+    private String targetType;
+
     /**
      * 地域
      */
@@ -40,6 +47,11 @@ public class KuaishouLaunchTargetTemplate {
     private String region;
 
     /**
+     * 地域类型 0:不限 1:指定地区 3:城市等级
+     */
+    private String regionType;
+
+    /**
      * 自定义年龄段
      */
     @Excel(name = "自定义年龄段")

+ 17 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/AccountTokenMapper.java

@@ -0,0 +1,17 @@
+package com.ruixuan.launch.mapper;
+
+
+import com.ruixuan.launch.entity.AccountToken;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-07-15
+ */
+public interface AccountTokenMapper {
+
+    public AccountToken selectAccountTokenById(String id);
+
+    AccountToken getKuaishouToken();
+}

+ 61 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchCampaignRecordMapper.java

@@ -0,0 +1,61 @@
+package com.ruixuan.launch.mapper;
+
+import com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord;
+
+import java.util.List;
+
+/**
+ * 广告计划信息Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface KuaishouLaunchCampaignRecordMapper {
+    /**
+     * 查询广告计划信息
+     *
+     * @param id 广告计划信息主键
+     * @return 广告计划信息
+     */
+    public KuaishouLaunchCampaignRecord selectKuaishouLaunchCampaignRecordById(String id);
+
+    /**
+     * 查询广告计划信息列表
+     *
+     * @param kuaishouLaunchCampaignRecord 广告计划信息
+     * @return 广告计划信息集合
+     */
+    public List<KuaishouLaunchCampaignRecord> selectKuaishouLaunchCampaignRecordList(KuaishouLaunchCampaignRecord kuaishouLaunchCampaignRecord);
+
+    /**
+     * 新增广告计划信息
+     *
+     * @param kuaishouLaunchCampaignRecord 广告计划信息
+     * @return 结果
+     */
+    public int insertKuaishouLaunchCampaignRecord(KuaishouLaunchCampaignRecord kuaishouLaunchCampaignRecord);
+
+    /**
+     * 修改广告计划信息
+     *
+     * @param kuaishouLaunchCampaignRecord 广告计划信息
+     * @return 结果
+     */
+    public int updateKuaishouLaunchCampaignRecord(KuaishouLaunchCampaignRecord kuaishouLaunchCampaignRecord);
+
+    /**
+     * 删除广告计划信息
+     *
+     * @param id 广告计划信息主键
+     * @return 结果
+     */
+    public int deleteKuaishouLaunchCampaignRecordById(String id);
+
+    /**
+     * 批量删除广告计划信息
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLaunchCampaignRecordByIds(String[] ids);
+}

+ 61 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchCreativeRecordMapper.java

@@ -0,0 +1,61 @@
+package com.ruixuan.launch.mapper;
+
+import com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord;
+
+import java.util.List;
+
+/**
+ * 广告创意信息创建记录Mapper接口
+ *
+ * @author ruoyi
+ * @date 2022-07-14
+ */
+public interface KuaishouLaunchCreativeRecordMapper {
+    /**
+     * 查询广告创意信息创建记录
+     *
+     * @param id 广告创意信息创建记录主键
+     * @return 广告创意信息创建记录
+     */
+    public KuaishouLaunchCreativeRecord selectKuaishouLaunchCreativeRecordById(String id);
+
+    /**
+     * 查询广告创意信息创建记录列表
+     *
+     * @param kuaishouLaunchCreativeRecord 广告创意信息创建记录
+     * @return 广告创意信息创建记录集合
+     */
+    public List<KuaishouLaunchCreativeRecord> selectKuaishouLaunchCreativeRecordList(KuaishouLaunchCreativeRecord kuaishouLaunchCreativeRecord);
+
+    /**
+     * 新增广告创意信息创建记录
+     *
+     * @param kuaishouLaunchCreativeRecord 广告创意信息创建记录
+     * @return 结果
+     */
+    public int insertKuaishouLaunchCreativeRecord(KuaishouLaunchCreativeRecord kuaishouLaunchCreativeRecord);
+
+    /**
+     * 修改广告创意信息创建记录
+     *
+     * @param kuaishouLaunchCreativeRecord 广告创意信息创建记录
+     * @return 结果
+     */
+    public int updateKuaishouLaunchCreativeRecord(KuaishouLaunchCreativeRecord kuaishouLaunchCreativeRecord);
+
+    /**
+     * 删除广告创意信息创建记录
+     *
+     * @param id 广告创意信息创建记录主键
+     * @return 结果
+     */
+    public int deleteKuaishouLaunchCreativeRecordById(String id);
+
+    /**
+     * 批量删除广告创意信息创建记录
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLaunchCreativeRecordByIds(String[] ids);
+}

+ 1 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchGroupMapper.java

@@ -59,4 +59,5 @@ public interface KuaishouLaunchGroupMapper {
      * @return 结果
      */
     public int deleteKuaishouLaunchGroupByIds(String[] ids);
+
 }

+ 3 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchGroupRecordMapper.java

@@ -2,6 +2,7 @@ package com.ruixuan.launch.mapper;
 
 
 import com.ruixuan.launch.entity.KuaishouLaunchGroupRecord;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -59,4 +60,6 @@ public interface KuaishouLaunchGroupRecordMapper {
      * @return 结果
      */
     public int deleteKuaishouLaunchGroupRecordByIds(String[] ids);
+
+    List<KuaishouLaunchGroupRecord> queryGroupRecord(@Param("accountId") Long accountId, @Param("strategyId") Long strategyId, @Param("statDate") String statDate);
 }

+ 7 - 4
ruixuan-launch/src/main/java/com/ruixuan/launch/mapper/KuaishouLaunchTargetTemplateMapper.java

@@ -1,7 +1,7 @@
 package com.ruixuan.launch.mapper;
 
-import com.ruixuan.launch.entity.KuaishouLaunchCampaign;
 import com.ruixuan.launch.entity.KuaishouLaunchTargetTemplate;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -11,8 +11,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2022-07-05
  */
-public interface KuaishouLaunchTargetTemplateMapper
-{
+public interface KuaishouLaunchTargetTemplateMapper {
     /**
      * 查询账户下所属定向信息
      *
@@ -35,7 +34,7 @@ public interface KuaishouLaunchTargetTemplateMapper
      * @param kuaishouLaunchTargetTemplate 账户下所属定向信息
      * @return 结果
      */
-    public int insertKuaishouLaunchTargetTemplate(KuaishouLaunchTargetTemplate kuaishouLaunchTargetTemplate);
+    public Long insertKuaishouLaunchTargetTemplate(KuaishouLaunchTargetTemplate kuaishouLaunchTargetTemplate);
 
     /**
      * 修改账户下所属定向信息
@@ -60,4 +59,8 @@ public interface KuaishouLaunchTargetTemplateMapper
      * @return 结果
      */
     public int deleteKuaishouLaunchTargetTemplateByIds(Long[] ids);
+
+    List<KuaishouLaunchTargetTemplate> selectKuaishouLaunchTargetTemplateByIds(@Param("ids") List<Long> ids);
+
+    KuaishouLaunchTargetTemplate getOne(@Param("accountId") Long accountId, String targetName, String targetType);
 }

+ 25 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/service/IAccountTokenService.java

@@ -0,0 +1,25 @@
+package com.ruixuan.launch.service;
+
+
+import com.ruixuan.launch.entity.AccountToken;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author ruoyi
+ * @date 2022-07-15
+ */
+public interface IAccountTokenService {
+    /**
+     * 查询【请填写功能名称】
+     *
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public AccountToken selectAccountTokenById(String id);
+
+
+    AccountToken getAccountToken(Long accountId);
+}

+ 3 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/service/IKuaishouLaunchGroupService.java

@@ -3,6 +3,7 @@ package com.ruixuan.launch.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.launch.entity.KuaishouLaunchGroup;
+import com.ruixuan.launch.entity.KuaishouLaunchGroupRecord;
 
 import java.util.List;
 
@@ -60,4 +61,6 @@ public interface IKuaishouLaunchGroupService {
      * @return 结果
      */
     public int deleteKuaishouLaunchGroupByIds(String[] ids);
+
+    List<KuaishouLaunchGroupRecord> queryGroupRecord(Long accountId,Long strategyId);
 }

+ 5 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/service/IKuaishouLaunchTargetTemplateService.java

@@ -1,6 +1,7 @@
 package com.ruixuan.launch.service;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.launch.entity.KuaishouLaunchTargetTemplate;
@@ -63,4 +64,8 @@ public interface IKuaishouLaunchTargetTemplateService {
     public int deleteKuaishouLaunchTargetTemplateById(Long id);
 
     JSONObject getTargetJson(Long targetId, JSONObject strategyJson);
+
+    ResultResponse selectKuaishouLaunchTargetTemplateByIds(String ids);
+
+    ResultResponse insertMore(JSONObject request);
 }

+ 30 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/AccountTokenServiceImpl.java

@@ -0,0 +1,30 @@
+package com.ruixuan.launch.service.impl;
+
+import com.ruixuan.launch.entity.AccountToken;
+import com.ruixuan.launch.mapper.AccountTokenMapper;
+import com.ruixuan.launch.service.IAccountTokenService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2022-07-15
+ */
+@Service
+public class AccountTokenServiceImpl implements IAccountTokenService {
+    @Autowired
+    private AccountTokenMapper accountTokenMapper;
+
+    @Override
+    public AccountToken selectAccountTokenById(String id) {
+        return accountTokenMapper.selectAccountTokenById(id);
+    }
+
+
+    @Override
+    public AccountToken getAccountToken(Long accountId) {
+        return accountTokenMapper.getKuaishouToken();
+    }
+}

+ 53 - 22
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCampaignAutoStrategyServiceImpl.java

@@ -6,10 +6,12 @@ import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.RedisUtil;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchCampaign;
 import com.ruixuan.launch.entity.KuaishouLaunchCampaignAutoStrategy;
 import com.ruixuan.launch.entity.KuaishouLaunchTargetTemplate;
 import com.ruixuan.launch.mapper.KuaishouLaunchCampaignAutoStrategyMapper;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchCampaignAutoStrategyService;
 import com.ruixuan.launch.service.IKuaishouLaunchCampaignService;
 import com.ruixuan.launch.service.IKuaishouLaunchCreativeService;
@@ -49,6 +51,9 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
     @Autowired
     private RedisUtil redisUtil;
 
+    @Autowired
+    private IAccountTokenService tokenService;
+
     /**
      * 查询投流策略
      */
@@ -64,7 +69,8 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
     public List<JSONObject> selectKuaishouLaunchCampaignAutoStrategyList(String campaignName, String accountName) {
         List<JSONObject> list = kuaishouLaunchCampaignAutoStrategyMapper.selectKuaishouLaunchCampaignAutoStrategyList(campaignName, accountName);
         for (JSONObject obj : list) {
-            obj.put("groupCount", 0);
+            String createCountKey = DateUtils.dateTime() + obj.getLong("accountId") + obj.getLong("id");
+            obj.put("groupCount", (Integer) redisUtil.get(createCountKey));
         }
         return list;
     }
@@ -90,9 +96,10 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
 
     @Override
     public ResultResponse createByStrategy(Long id) {
-        String token = "";
         KuaishouLaunchCampaignAutoStrategy strategy = kuaishouLaunchCampaignAutoStrategyMapper.selectKuaishouLaunchCampaignAutoStrategyById(id);
         String statDate = DateUtils.getDate();
+        AccountToken accountToken = tokenService.getAccountToken(strategy.getAccountId());
+        String token = accountToken.getAccessToken();
         JSONObject strategyJson = (JSONObject) JSONObject.toJSON(strategy);
         //1、创建计划&获取计划ID
         Long campaignId = createCampaign(strategyJson, token);
@@ -125,19 +132,33 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
         JSONArray targetTemplate = strategyJson.getJSONArray("targetTemplate");
         for (int i = 0; i < ocpxActionArr.size(); i++) {
             JSONObject ocpx = ocpxActionArr.getJSONObject(i);
-            for (int j = 0; j < targetTemplate.size(); j++) {
-                Long targetId = targetTemplate.getLong(j);
-                KuaishouLaunchTargetTemplate template = kuaishouLaunchTargetTemplateService.selectKuaishouLaunchTargetTemplateById(targetId);
-                String name = getName(strategyJson, targetId, ocpx.getInteger("type"), ocpx.getBigDecimal("cpaBid"));
-                strategyJson.put("unitName", name);
-                strategyJson = kuaishouLaunchTargetTemplateService.getTargetJson(targetId, strategyJson);
-                Long unitId = kuaishouLaunchGroupService.insertKuaishouLaunchGroup(strategyJson, token);
-                if (unitId > 0) {
-                    strategyJson.put("unitId", unitId);
-                    kuaishouLaunchCreativeService.insertKuaishouLaunchCreative(strategyJson, token);
-                    Thread.sleep(500);
+            Integer type = ocpx.getInteger("type");
+            String cpaBids = ocpx.getString("cpaBid");
+            if (Check.isNotNull(cpaBids)) {
+                String[] cpaBidArr = cpaBids.split("/");
+                for (int j = 0; j < cpaBidArr.length; j++) {
+                    String cpaBid = cpaBidArr[j];
+                    strategyJson.put("cpaBid", cpaBid);
+                    for (int k = 0; k < targetTemplate.size(); k++) {
+                        Long targetId = targetTemplate.getLong(k);
+                        KuaishouLaunchTargetTemplate template = kuaishouLaunchTargetTemplateService.selectKuaishouLaunchTargetTemplateById(targetId);
+                        String name = getName(strategyJson, targetId, type, new BigDecimal(cpaBid));
+                        strategyJson.put("unitName", name);
+                        strategyJson = kuaishouLaunchTargetTemplateService.getTargetJson(targetId, strategyJson);
+                        Long unitId = kuaishouLaunchGroupService.insertKuaishouLaunchGroup(strategyJson, token);
+                        if (unitId > 0) {
+                            String createCountKey = DateUtils.dateTime() + strategyJson.getLong("accountId") + strategyJson.getLong("id");
+                            getTimeRedisNumberValue(createCountKey);
+                            strategyJson.put("unitId", unitId);
+                            kuaishouLaunchCreativeService.insertKuaishouLaunchCreative(strategyJson, token);
+                            Thread.sleep(500);
+
+                        }
+                    }
                 }
             }
+
+
         }
         return 0L;
 
@@ -176,16 +197,8 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
         String date = DateUtils.dateTime();//yyyyMMdd
         unitName = unitName.replace("-{{日期}}-", date);
         //组序号,必填
-        Integer cnt = null;
         String redisKey = strategy.getLong("accountId") + "_" + strategy.getLong("campaignId") + date;
-        Integer redisCnt = (Integer) redisUtil.get(redisKey);
-        if (Check.isNull(redisCnt)) {
-            cnt = 1;
-            redisUtil.set(redisKey, cnt, 100000L);
-        } else {
-            cnt = redisCnt + 1;
-            redisUtil.set(redisKey, cnt, 100000L);
-        }
+        Integer cnt = getTimeRedisNumberValue(redisKey);
         if (unitName.contains("-{{序号}}-")) {
             unitName = unitName.replace("-{{序号}}-", cnt + "");
         } else {
@@ -203,4 +216,22 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
         }
         return unitName;
     }
+
+
+    /**
+     * 获取缓存数据
+     */
+    private Integer getTimeRedisNumberValue(String key) {
+        Integer cnt = null;
+        Integer redisCnt = (Integer) redisUtil.get(key);
+        if (Check.isNull(redisCnt)) {
+            cnt = 1;
+            redisUtil.set(key, cnt, 100000L);
+        } else {
+            cnt = redisCnt + 1;
+            redisUtil.set(key, cnt, 100000L);
+        }
+        return cnt;
+    }
+
 }

+ 27 - 8
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCampaignServiceImpl.java

@@ -6,8 +6,12 @@ import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.KuaishouAPIConstant;
 import com.ruixuan.common.utils.http.HttpUtil;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchCampaign;
+import com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord;
 import com.ruixuan.launch.mapper.KuaishouLaunchCampaignMapper;
+import com.ruixuan.launch.mapper.KuaishouLaunchCampaignRecordMapper;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchCampaignService;
 import com.ruixuan.launch.unitls.APIUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -30,6 +34,11 @@ import java.util.UUID;
 public class KuaishouLaunchCampaignServiceImpl implements IKuaishouLaunchCampaignService {
     @Autowired
     private KuaishouLaunchCampaignMapper kuaishouLaunchCampaignMapper;
+    @Autowired
+    private KuaishouLaunchCampaignRecordMapper kuaishouLaunchCampaignRecordMapper;
+
+    @Autowired
+    private IAccountTokenService tokenService;
 
     /**
      * 查询广告计划信息
@@ -59,9 +68,6 @@ public class KuaishouLaunchCampaignServiceImpl implements IKuaishouLaunchCampaig
     @Override
     public Long insertKuaishouLaunchCampaign(JSONObject requestJson, String token) {
         try {
-            Map<String, String> headers = new HashMap<String, String>();
-            headers.put("Content-Type", "application/json");
-            headers.put("Access-Token", token);
             Map<String, Object> param = new HashMap<String, Object>();
             param.put("advertiser_id", requestJson.getLong("accountId"));
             param.put("name", requestJson.getString("campaignName"));
@@ -71,22 +77,33 @@ public class KuaishouLaunchCampaignServiceImpl implements IKuaishouLaunchCampaig
                 param.put("day_budget", requestJson.getLong("dayBudget"));
             }
             param.put("budget_schedule", requestJson.getJSONArray("budgetSchedule"));
-            JSONObject resultJson = APIUtil.getApiResult(KuaishouAPIConstant.CREATE_CAMPAIGN, "fbe5da761a5a4328cc42ccbb927f3036", param);
+            JSONObject resultJson = APIUtil.getApiResult(KuaishouAPIConstant.CREATE_CAMPAIGN, token, param);
+            Long campaignId = -1L;
+            KuaishouLaunchCampaignRecord record = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchCampaignRecord.class);
+
             if (resultJson.getInteger("code") == 0) {
                 JSONObject entity = resultJson.getJSONObject("data").getJSONArray("detail").getJSONObject(0);
                 KuaishouLaunchCampaign campaign = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchCampaign.class);
-                campaign.setCampaignId(entity.getLong("id"));
+                campaignId = entity.getLong("id");
+                campaign.setCampaignId(campaignId);
                 if (Check.isNull(campaign.getDayBudget())) {
                     campaign.setDayBudget(0L);
                 }
                 campaign.setPutStatus(1);
                 campaign.setId(UUID.randomUUID().toString().replace("-", ""));
+                campaign.setStatDate(DateUtils.getDate());
                 kuaishouLaunchCampaignMapper.insertKuaishouLaunchCampaign(campaign);
-                return entity.getLong("id");
+                record.setMessage("success");
+                record.setCampaignId(campaignId);
             } else {
+                record.setMessage(resultJson.getString("message"));
                 log.error("创建计划失败,账户{},{}", requestJson.getLong("accountId"), resultJson.toJSONString());
-                return -1L;
             }
+            record.setStrategyId(requestJson.getLong("id"));
+            record.setId(UUID.randomUUID().toString().replace("-", ""));
+            record.setStatDate(DateUtils.getDate());
+            kuaishouLaunchCampaignRecordMapper.insertKuaishouLaunchCampaignRecord(record);
+            return campaignId;
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -96,10 +113,12 @@ public class KuaishouLaunchCampaignServiceImpl implements IKuaishouLaunchCampaig
 
     public ResultResponse getCampaignInfo(Long accountId, Long id, String level, String startTime, String endTime) {
         try {
+            AccountToken accountToken = tokenService.getAccountToken(accountId);
+
             String url = "https://ad.e.kuaishou.com" + KuaishouAPIConstant.SEARCH_AD;
             Map<String, String> headers = new HashMap<String, String>();
             headers.put("Content-Type", "application/json");
-            headers.put("Access-Token", "fbe5da761a5a4328cc42ccbb927f3036");
+            headers.put("Access-Token", accountToken.getAccessToken());
             Map<String, Object> param = new HashMap<String, Object>();
             param.put("advertiser_id", accountId);
             JSONObject params = new JSONObject();

+ 17 - 3
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCreativeServiceImpl.java

@@ -3,9 +3,12 @@ package com.ruixuan.launch.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.KuaishouAPIConstant;
 import com.ruixuan.launch.entity.KuaishouLaunchCreative;
+import com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord;
 import com.ruixuan.launch.mapper.KuaishouLaunchCreativeMapper;
+import com.ruixuan.launch.mapper.KuaishouLaunchCreativeRecordMapper;
 import com.ruixuan.launch.service.IKuaishouLaunchCreativeService;
 import com.ruixuan.launch.unitls.APIUtil;
 import lombok.extern.slf4j.Slf4j;
@@ -28,6 +31,8 @@ import java.util.UUID;
 public class KuaishouLaunchCreativeServiceImpl implements IKuaishouLaunchCreativeService {
     @Autowired
     private KuaishouLaunchCreativeMapper kuaishouLaunchCreativeMapper;
+    @Autowired
+    private KuaishouLaunchCreativeRecordMapper kuaishouLaunchCreativeRecordMapper;
 
     /**
      * 查询广告创意信息
@@ -91,19 +96,28 @@ public class KuaishouLaunchCreativeServiceImpl implements IKuaishouLaunchCreativ
             newExposeTag.put("url", requestJson.getString("newExposeUrl"));
             param.put("new_expose_tag", newExposeTag);
         }
-
+        Long creativeId = -1L;
+        KuaishouLaunchCreativeRecord record = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchCreativeRecord.class);
         JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CREATE_CREATIVE, token, param);
         if (result.getInteger("code") == 0) {
             result = result.getJSONObject("data");
             JSONObject detail = result.getJSONArray("detail").getJSONObject(0);
             KuaishouLaunchCreative creative = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchCreative.class);
-            creative.setCreativeId(detail.getLong("id"));
+            creativeId = detail.getLong("id");
+            creative.setCreativeId(creativeId);
             creative.setId(UUID.randomUUID().toString().replace("-", ""));
+            creative.setStatDate(DateUtils.getDate());
             kuaishouLaunchCreativeMapper.insertKuaishouLaunchCreative(creative);
-            return ResultResponse.success();
+            record.setMessage("success");
+            record.setCreativeId(creativeId);
         } else {
+            record.setMessage(result.getString("message"));
             log.error("广告创意创建失败,账户{},{}", requestJson.getLong("accountId"), result.toJSONString());
         }
+        record.setStrategyId(requestJson.getLong("id"));
+        record.setStatDate(DateUtils.getDate());
+        record.setId(UUID.randomUUID().toString().replace("-", ""));
+        kuaishouLaunchCreativeRecordMapper.insertKuaishouLaunchCreativeRecord(record);
         return ResultResponse.error("创建失败," + result.getString("message"));
     }
 

+ 14 - 4
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchGroupServiceImpl.java

@@ -3,6 +3,7 @@ package com.ruixuan.launch.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.utils.Check;
+import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.KuaishouAPIConstant;
 import com.ruixuan.launch.entity.KuaishouLaunchGroup;
 import com.ruixuan.launch.entity.KuaishouLaunchGroupRecord;
@@ -110,29 +111,33 @@ public class KuaishouLaunchGroupServiceImpl implements IKuaishouLaunchGroupServi
             param.put("live_user_id", requestJson.getInteger("liveUserId"));
         }
 
+        Long unitId = -1L;
         KuaishouLaunchGroupRecord record = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchGroupRecord.class);
         JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CREATE_UNIT, token, param);
         if (result.getInteger("code") == 0) {
             result = result.getJSONObject("data");
             JSONObject detail = result.getJSONArray("detail").getJSONObject(0);
             KuaishouLaunchGroup group = JSONObject.parseObject(requestJson.toJSONString(), KuaishouLaunchGroup.class);
-            group.setUnitId(detail.getLong("id"));
+            unitId = detail.getLong("id");
+            group.setUnitId(unitId);
             group.setId(UUID.randomUUID().toString().replace("-", ""));
+            group.setStatDate(DateUtils.getDate());
             kuaishouLaunchGroupMapper.insertKuaishouLaunchGroup(group);
             record.setMessage("success");
-            record.setUnitId(detail.getLong("id"));
+            record.setUnitId(unitId);
             KuaishouLaunchGroupTarget targetEnt = JSONObject.parseObject(target.toJSONString(), KuaishouLaunchGroupTarget.class);
             targetEnt.setAccountId(requestJson.getLong("accountId"));
             targetEnt.setUnitId(detail.getLong("id"));
             kuaishouLaunchGroupTargetMapper.insertKuaishouLaunchGroupTarget(targetEnt);
-            return detail.getLong("id");
         } else {
             record.setMessage(result.getString("message"));
             log.error("广告组创建失败,账户{},{}", record.getAccountId(), result.toJSONString());
         }
+        record.setStrategyId(requestJson.getLong("id"));
         record.setId(UUID.randomUUID().toString().replace("-", ""));
+        record.setStatDate(DateUtils.getDate());
         kuaishouLaunchGroupRecordMapper.insertKuaishouLaunchGroupRecord(record);
-        return -1L;
+        return unitId;
     }
 
 
@@ -213,6 +218,11 @@ public class KuaishouLaunchGroupServiceImpl implements IKuaishouLaunchGroupServi
         return kuaishouLaunchGroupMapper.deleteKuaishouLaunchGroupByIds(ids);
     }
 
+    @Override
+    public List<KuaishouLaunchGroupRecord> queryGroupRecord(Long accountId, Long strategyId) {
+        return kuaishouLaunchGroupRecordMapper.queryGroupRecord(accountId, strategyId, DateUtils.getDate());
+    }
+
     /**
      * 删除广告组信息信息
      *

+ 23 - 13
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchGroupTargetServiceImpl.java

@@ -5,8 +5,10 @@ import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.KuaishouAPIConstant;
+import com.ruixuan.launch.entity.AccountToken;
 import com.ruixuan.launch.entity.KuaishouLaunchGroupTarget;
 import com.ruixuan.launch.mapper.KuaishouLaunchGroupTargetMapper;
+import com.ruixuan.launch.service.IAccountTokenService;
 import com.ruixuan.launch.service.IKuaishouLaunchGroupTargetService;
 import com.ruixuan.launch.unitls.APIUtil;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +30,9 @@ public class KuaishouLaunchGroupTargetServiceImpl implements IKuaishouLaunchGrou
     @Autowired
     private KuaishouLaunchGroupTargetMapper kuaishouLaunchGroupTargetMapper;
 
+    @Autowired
+    private IAccountTokenService tokenService;
+
     /**
      * 查询广告组定向信息列表
      *
@@ -53,31 +58,34 @@ public class KuaishouLaunchGroupTargetServiceImpl implements IKuaishouLaunchGrou
 
     @Override
     public ResultResponse getRegion(Long accountId, Integer categoryType) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
         param.put("category_type", categoryType);
-        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.REGION, "eb2c0339a36d7270e4a98fdbf556e42b", param);
+        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.REGION, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("details"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("details"));
         }
         return null;
     }
 
     @Override
     public ResultResponse getPopulation(Long accountId) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
 //        param.put("status", 1);
         param.put("page_size", 500);
-        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.POPULATION, "eb2c0339a36d7270e4a98fdbf556e42b", param);
+        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.POPULATION, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("details"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("details"));
         }
         return null;
     }
 
     @Override
     public ResultResponse getCelebrityInfo(Long accountId, String keyword, String secondLabel, Long authorId) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
         if (Check.isNotNull(keyword)) {
@@ -89,47 +97,49 @@ public class KuaishouLaunchGroupTargetServiceImpl implements IKuaishouLaunchGrou
         if (Check.isNotNull(authorId)) {
             param.put("author_id", authorId);
         }
-        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CELEBRITY_QUERY, "eb2c0339a36d7270e4a98fdbf556e42b", param);
+        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CELEBRITY_QUERY, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("details"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("details"));
         }
         return null;
     }
 
     @Override
     public ResultResponse getCelebrityType(Long accountId) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("advertiser_id", accountId);
-        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CELEBRITY_TYPE, "eb2c0339a36d7270e4a98fdbf556e42b", param);
+        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.CELEBRITY_TYPE, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("details"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("details"));
         }
         return null;
     }
 
     @Override
     public ResultResponse getPurchaseIntention(Long accountId) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
-        JSONObject result = APIUtil.getApiResultByGet(KuaishouAPIConstant.PURCHASE_INTENTION, "eb2c0339a36d7270e4a98fdbf556e42b", param);
+        JSONObject result = APIUtil.getApiResultByGet(KuaishouAPIConstant.PURCHASE_INTENTION, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("list"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("list"));
         }
         return null;
     }
 
     @Override
     public ResultResponse getVideos(Long accountId) {
+        AccountToken token = tokenService.getAccountToken(accountId);
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
         JSONObject params = new JSONObject();
         params.put("start_time", DateUtils.timeToStamp("2022-07-01 00:00:33"));
         params.put("end_time", new Date().getTime());
         param.put("param", params);
-
-        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.VIDEO_QUERY, "fbe5da761a5a4328cc42ccbb927f3036", param);
+        JSONObject result = APIUtil.getApiResult(KuaishouAPIConstant.VIDEO_QUERY, token.getAccessToken(), param);
         if (Check.isNotNull(result)) {
-            return ResultResponse.success(result.getJSONArray("details"));
+            return ResultResponse.success(result.getJSONObject("data").getJSONArray("details"));
         }
         return null;
     }

+ 44 - 0
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchTargetTemplateServiceImpl.java

@@ -1,8 +1,12 @@
 package com.ruixuan.launch.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.common.utils.Check;
+import com.ruixuan.launch.entity.KuaishouLaunchCampaignAutoStrategy;
 import com.ruixuan.launch.entity.KuaishouLaunchTargetTemplate;
+import com.ruixuan.launch.mapper.KuaishouLaunchCampaignAutoStrategyMapper;
 import com.ruixuan.launch.mapper.KuaishouLaunchTargetTemplateMapper;
 import com.ruixuan.launch.service.IKuaishouLaunchTargetTemplateService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +25,10 @@ public class KuaishouLaunchTargetTemplateServiceImpl implements IKuaishouLaunchT
     @Autowired
     private KuaishouLaunchTargetTemplateMapper kuaishouLaunchTargetTemplateMapper;
 
+    @Autowired
+    private KuaishouLaunchCampaignAutoStrategyMapper autoStrategyMapper;
+
+
     /**
      * 查询账户下所属定向信息
      *
@@ -52,6 +60,7 @@ public class KuaishouLaunchTargetTemplateServiceImpl implements IKuaishouLaunchT
     @Override
     public ResultResponse insertKuaishouLaunchTargetTemplate(JSONObject request) {
         KuaishouLaunchTargetTemplate kuaishouLaunchTargetTemplate = JSONObject.parseObject(request.toJSONString(), KuaishouLaunchTargetTemplate.class);
+        KuaishouLaunchTargetTemplate one = kuaishouLaunchTargetTemplateMapper.getOne(kuaishouLaunchTargetTemplate.getAccountId(), kuaishouLaunchTargetTemplate.getTargetName(), kuaishouLaunchTargetTemplate.getTargetType());
         kuaishouLaunchTargetTemplateMapper.insertKuaishouLaunchTargetTemplate(kuaishouLaunchTargetTemplate);
         return ResultResponse.success();
     }
@@ -93,8 +102,43 @@ public class KuaishouLaunchTargetTemplateServiceImpl implements IKuaishouLaunchT
     public JSONObject getTargetJson(Long targetId, JSONObject strategyJson) {
         KuaishouLaunchTargetTemplate template = kuaishouLaunchTargetTemplateMapper.selectKuaishouLaunchTargetTemplateById(targetId);
         JSONObject targetJson = (JSONObject) JSONObject.toJSON(template);
+        targetJson.remove("id");
         strategyJson.putAll(targetJson);
         return strategyJson;
     }
 
+    @Override
+    public ResultResponse selectKuaishouLaunchTargetTemplateByIds(String ids) {
+        List<Long> idList = JSONArray.parseArray(ids, Long.class);
+        List<KuaishouLaunchTargetTemplate> list = kuaishouLaunchTargetTemplateMapper.selectKuaishouLaunchTargetTemplateByIds(idList);
+        return ResultResponse.success(list);
+    }
+
+    @Override
+    public ResultResponse insertMore(JSONObject request) {
+        JSONArray array = request.getJSONArray("array");
+        JSONArray temIds = new JSONArray();
+        for (int i = 0; i < array.size(); i++) {
+            JSONObject entity = array.getJSONObject(i);
+            KuaishouLaunchTargetTemplate template = JSONObject.parseObject(entity.toJSONString(), KuaishouLaunchTargetTemplate.class);
+            if (Check.isNull(template.getId())) {
+                kuaishouLaunchTargetTemplateMapper.insertKuaishouLaunchTargetTemplate(template);
+                temIds.add(template.getId());
+            } else {
+                temIds.add(template.getId());
+                kuaishouLaunchTargetTemplateMapper.updateKuaishouLaunchTargetTemplate(template);
+            }
+        }
+        if (Check.isNull(temIds)) {
+            request.put("targetTemplate", "[]");
+        } else {
+            request.put("targetTemplate", temIds);
+        }
+        KuaishouLaunchCampaignAutoStrategy strategy = JSONObject.parseObject(request.toJSONString(), KuaishouLaunchCampaignAutoStrategy.class);
+        autoStrategyMapper.updateKuaishouLaunchCampaignAutoStrategy(strategy);
+
+
+        return ResultResponse.success();
+    }
+
 }

+ 6 - 7
ruixuan-launch/src/main/java/com/ruixuan/launch/unitls/APIUtil.java

@@ -1,7 +1,6 @@
 package com.ruixuan.launch.unitls;
 
 import com.alibaba.fastjson.JSONObject;
-import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.http.HttpUtil;
 import lombok.extern.slf4j.Slf4j;
 
@@ -45,16 +44,16 @@ public class APIUtil {
             String result = HttpUtil.httpGetRequest(url, headers, param);
             JSONObject resultJson = JSONObject.parseObject(result);
             System.out.println(JSONObject.toJSON(resultJson)); //TODO
-            if (Check.isNotNull(resultJson) && resultJson.getInteger("code") == 0) {
-                return resultJson.getJSONObject("data");
-            } else {
-                log.error("调取媒体接口失败,账户:{},接口:{},信息:{}", param.get("advertiser_id"), apiPath, resultJson);
-            }
+            return resultJson;
+
         } catch (Exception e) {
             e.printStackTrace();
             log.error("调用媒体接口异常,账户:{},接口:{}", param.get("advertiser_id"), apiPath);
+            JSONObject result = new JSONObject();
+            result.put("code", -1);
+            result.put("message", "调用媒体接口异常");
+            return result;
         }
-        return null;
     }
 
 }

+ 49 - 0
ruixuan-launch/src/main/resources/mapper/launch/AccountTokenMapper.xml

@@ -0,0 +1,49 @@
+<?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="com.ruixuan.launch.mapper.AccountTokenMapper">
+
+    <resultMap type="com.ruixuan.launch.entity.AccountToken" id="AccountTokenResult">
+        <result property="id" column="id"/>
+        <result property="mediaId" column="media_id"/>
+        <result property="agentId" column="agent_id"/>
+        <result property="accessToken" column="access_token"/>
+        <result property="accessTokenExpiresIn" column="access_token_expires_in"/>
+        <result property="refreshToken" column="refresh_token"/>
+        <result property="refreshTokenExpiresIn" column="refresh_token_expires_in"/>
+        <result property="agentType" column="agent_type"/>
+        <result property="appId" column="app_id"/>
+        <result property="secret" column="secret"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectAccountTokenVo">
+        select id,
+               media_id,
+               agent_id,
+               access_token,
+               access_token_expires_in,
+               refresh_token,
+               refresh_token_expires_in,
+               agent_type,
+               app_id,
+               secret,
+               create_time,
+               update_time
+        from agent_token
+    </sql>
+
+    <select id="selectAccountTokenById" parameterType="String" resultMap="AccountTokenResult">
+        <include refid="selectAccountTokenVo"/>
+        where id = #{id}
+    </select>
+
+    <select id="getKuaishouToken" parameterType="Long" resultMap="AccountTokenResult">
+        <include refid="selectAccountTokenVo"/>
+        where media_id = 2
+        limit 1
+    </select>
+
+</mapper>

+ 6 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCampaignMapper.xml

@@ -12,6 +12,7 @@
         <result property="campaignType" column="campaign_type"/>
         <result property="promotionType" column="promotion_type"/>
         <result property="putStatus" column="put_status"/>
+        <result property="statDate" column="stat_date"/>
         <result property="dayBudget" column="day_budget"/>
         <result property="budgetSchedule" column="budget_schedule"/>
         <result property="createTime" column="create_time"/>
@@ -26,6 +27,7 @@
                campaign_type,
                promotion_type,
                put_status,
+               stat_date,
                day_budget,
                budget_schedule,
                create_time,
@@ -45,6 +47,7 @@
             <if test="campaignType != null ">and campaign_type = #{campaignType}</if>
             <if test="promotionType != null ">and promotion_type = #{promotionType}</if>
             <if test="putStatus != null ">and put_status = #{putStatus}</if>
+            <if test="statDate != null ">and stat_date = #{statDate}</if>
             <if test="dayBudget != null ">and day_budget = #{dayBudget}</if>
             <if test="budgetSchedule != null  and budgetSchedule != ''">and budget_schedule = #{budgetSchedule}</if>
         </where>
@@ -71,6 +74,7 @@
             <if test="campaignType != null">campaign_type,</if>
             <if test="promotionType != null">promotion_type,</if>
             <if test="putStatus != null">put_status,</if>
+            <if test="statDate != null">stat_date,</if>
             <if test="dayBudget != null">day_budget,</if>
             <if test="budgetSchedule != null">budget_schedule,</if>
             <if test="createTime != null">create_time,</if>
@@ -84,6 +88,7 @@
             <if test="campaignType != null">#{campaignType},</if>
             <if test="promotionType != null">#{promotionType},</if>
             <if test="putStatus != null">#{putStatus},</if>
+            <if test="statDate != null">#{stat_date},</if>
             <if test="dayBudget != null">#{dayBudget},</if>
             <if test="budgetSchedule != null">#{budgetSchedule},</if>
             <if test="createTime != null">#{createTime},</if>
@@ -100,6 +105,7 @@
             <if test="campaignType != null">campaign_type = #{campaignType},</if>
             <if test="promotionType != null">promotion_type = #{promotionType},</if>
             <if test="putStatus != null">put_status = #{putStatus},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
             <if test="dayBudget != null">day_budget = #{dayBudget},</if>
             <if test="budgetSchedule != null">budget_schedule = #{budgetSchedule},</if>
             <if test="createTime != null">create_time = #{createTime},</if>

+ 133 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCampaignRecordMapper.xml

@@ -0,0 +1,133 @@
+<?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="com.ruixuan.launch.mapper.KuaishouLaunchCampaignRecordMapper">
+
+    <resultMap type="com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord" id="KuaishouLaunchCampaignRecordResult">
+        <result property="id" column="id"/>
+        <result property="accountId" column="account_id"/>
+        <result property="strategyId" column="strategy_id"/>
+        <result property="campaignId" column="campaign_id"/>
+        <result property="campaignName" column="campaign_name"/>
+        <result property="campaignType" column="campaign_type"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="promotionType" column="promotion_type"/>
+        <result property="dayBudget" column="day_budget"/>
+        <result property="budgetSchedule" column="budget_schedule"/>
+        <result property="message" column="message"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLaunchCampaignRecordVo">
+        select id,
+               account_id,
+               strategy_id,
+               campaign_id,
+               campaign_name,
+               campaign_type,
+               stat_date,
+               promotion_type,
+               day_budget,
+               budget_schedule,
+               message,
+               create_time,
+               update_time
+        from kuaishou_launch_campaign_record
+    </sql>
+
+    <select id="selectKuaishouLaunchCampaignRecordList"
+            parameterType="com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord"
+            resultMap="KuaishouLaunchCampaignRecordResult">
+        <include refid="selectKuaishouLaunchCampaignRecordVo"/>
+        <where>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="strategyId != null ">and strategy_id = #{strategyId}</if>
+            <if test="campaignId != null ">and campaign_id = #{campaignId}</if>
+            <if test="campaignName != null  and campaignName != ''">and campaign_name like concat('%', #{campaignName},
+                '%')
+            </if>
+            <if test="campaignType != null ">and campaign_type = #{campaignType}</if>
+            <if test="statDate != null  and statDate != ''">and stat_date = #{statDate}</if>
+            <if test="promotionType != null ">and promotion_type = #{promotionType}</if>
+            <if test="dayBudget != null ">and day_budget = #{dayBudget}</if>
+            <if test="budgetSchedule != null  and budgetSchedule != ''">and budget_schedule = #{budgetSchedule}</if>
+            <if test="message != null  and message != ''">and message = #{message}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLaunchCampaignRecordById" parameterType="String"
+            resultMap="KuaishouLaunchCampaignRecordResult">
+        <include refid="selectKuaishouLaunchCampaignRecordVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertKuaishouLaunchCampaignRecord"
+            parameterType="com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord">
+        insert into kuaishou_launch_campaign_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="strategyId != null">strategy_id,</if>
+            <if test="campaignId != null">campaign_id,</if>
+            <if test="campaignName != null and campaignName != ''">campaign_name,</if>
+            <if test="campaignType != null">campaign_type,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="promotionType != null">promotion_type,</if>
+            <if test="dayBudget != null">day_budget,</if>
+            <if test="budgetSchedule != null">budget_schedule,</if>
+            <if test="message != null">message,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="strategyId != null">#{strategyId},</if>
+            <if test="campaignId != null">#{campaignId},</if>
+            <if test="campaignName != null and campaignName != ''">#{campaignName},</if>
+            <if test="campaignType != null">#{campaignType},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="promotionType != null">#{promotionType},</if>
+            <if test="dayBudget != null">#{dayBudget},</if>
+            <if test="budgetSchedule != null">#{budgetSchedule},</if>
+            <if test="message != null">#{message},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLaunchCampaignRecord"
+            parameterType="com.ruixuan.launch.entity.KuaishouLaunchCampaignRecord">
+        update kuaishou_launch_campaign_record
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="strategyId != null">strategy_id = #{strategyId},</if>
+            <if test="campaignId != null">campaign_id = #{campaignId},</if>
+            <if test="campaignName != null and campaignName != ''">campaign_name = #{campaignName},</if>
+            <if test="campaignType != null">campaign_type = #{campaignType},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="promotionType != null">promotion_type = #{promotionType},</if>
+            <if test="dayBudget != null">day_budget = #{dayBudget},</if>
+            <if test="budgetSchedule != null">budget_schedule = #{budgetSchedule},</if>
+            <if test="message != null">message = #{message},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLaunchCampaignRecordById" parameterType="String">
+        delete
+        from kuaishou_launch_campaign_record
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLaunchCampaignRecordByIds" parameterType="String">
+        delete from kuaishou_launch_campaign_record where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 6 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCreativeMapper.xml

@@ -15,6 +15,7 @@
         <result property="coverWidth" column="cover_width"/>
         <result property="coverHeight" column="cover_height"/>
         <result property="photoId" column="photo_id"/>
+        <result property="statDate" column="stat_date"/>
         <result property="creativeMaterialType" column="creative_material_type"/>
         <result property="actionBar" column="action_bar"/>
         <result property="recommendation" column="recommendation"/>
@@ -37,6 +38,7 @@
                cover_width,
                cover_height,
                photo_id,
+               stat_date,
                creative_material_type,
                action_bar,
                recommendation,
@@ -65,6 +67,7 @@
             <if test="coverWidth != null ">and cover_width = #{coverWidth}</if>
             <if test="coverHeight != null ">and cover_height = #{coverHeight}</if>
             <if test="photoId != null  and photoId != ''">and photo_id = #{photoId}</if>
+            <if test="statDate != null  and statDate != ''">and stat_date = #{statDate}</if>
             <if test="creativeMaterialType != null ">and creative_material_type = #{creativeMaterialType}</if>
             <if test="actionBar != null  and actionBar != ''">and action_bar = #{actionBar}</if>
             <if test="recommendation != null  and recommendation != ''">and recommendation = #{recommendation}</if>
@@ -94,6 +97,7 @@
             <if test="coverWidth != null">cover_width,</if>
             <if test="coverHeight != null">cover_height,</if>
             <if test="photoId != null">photo_id,</if>
+            <if test="statDate != null">stat_date,</if>
             <if test="creativeMaterialType != null">creative_material_type,</if>
             <if test="actionBar != null">action_bar,</if>
             <if test="recommendation != null">recommendation,</if>
@@ -116,6 +120,7 @@
             <if test="coverWidth != null">#{coverWidth},</if>
             <if test="coverHeight != null">#{coverHeight},</if>
             <if test="photoId != null">#{photoId},</if>
+            <if test="statDate != null">#{statDate},</if>
             <if test="creativeMaterialType != null">#{creativeMaterialType},</if>
             <if test="actionBar != null">#{actionBar},</if>
             <if test="recommendation != null">#{recommendation},</if>
@@ -141,6 +146,7 @@
             <if test="coverWidth != null">cover_width = #{coverWidth},</if>
             <if test="coverHeight != null">cover_height = #{coverHeight},</if>
             <if test="photoId != null">photo_id = #{photoId},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
             <if test="creativeMaterialType != null">creative_material_type = #{creativeMaterialType},</if>
             <if test="actionBar != null">action_bar = #{actionBar},</if>
             <if test="recommendation != null">recommendation = #{recommendation},</if>

+ 184 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchCreativeRecordMapper.xml

@@ -0,0 +1,184 @@
+<?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="com.ruixuan.launch.mapper.KuaishouLaunchCreativeRecordMapper">
+
+    <resultMap type="com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord" id="KuaishouLaunchCreativeRecordResult">
+        <result property="id" column="id"/>
+        <result property="accountId" column="account_id"/>
+        <result property="campaignId" column="campaign_id"/>
+        <result property="unitId" column="unit_id"/>
+        <result property="creativeId" column="creative_id"/>
+        <result property="strategyId" column="strategy_id"/>
+        <result property="creativeName" column="creative_name"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="coverUrl" column="cover_url"/>
+        <result property="coverWidth" column="cover_width"/>
+        <result property="coverHeight" column="cover_height"/>
+        <result property="photoId" column="photo_id"/>
+        <result property="creativeMaterialType" column="creative_material_type"/>
+        <result property="actionBar" column="action_bar"/>
+        <result property="recommendation" column="recommendation"/>
+        <result property="description" column="description"/>
+        <result property="newExposeText" column="new_expose_text"/>
+        <result property="newExposeUrl" column="new_expose_url"/>
+        <result property="liveCreativeType" column="live_creative_type"/>
+        <result property="message" column="message"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLaunchCreativeRecordVo">
+        select id,
+               account_id,
+               campaign_id,
+               unit_id,
+               creative_id,
+               strategy_id,
+               creative_name,
+               stat_date,
+               cover_url,
+               cover_width,
+               cover_height,
+               photo_id,
+               creative_material_type,
+               action_bar,
+               recommendation,
+               description,
+               new_expose_text,
+               new_expose_url,
+               live_creative_type,
+               message,
+               create_time,
+               update_time
+        from kuaishou_launch_creative_record
+    </sql>
+
+    <select id="selectKuaishouLaunchCreativeRecordList" parameterType="com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord"
+            resultMap="KuaishouLaunchCreativeRecordResult">
+        <include refid="selectKuaishouLaunchCreativeRecordVo"/>
+        <where>
+            <if test="accountId != null ">and account_id = #{accountId}</if>
+            <if test="campaignId != null ">and campaign_id = #{campaignId}</if>
+            <if test="unitId != null ">and unit_id = #{unitId}</if>
+            <if test="creativeId != null ">and creative_id = #{creativeId}</if>
+            <if test="strategyId != null ">and strategy_id = #{strategyId}</if>
+            <if test="creativeName != null  and creativeName != ''">and creative_name like concat('%', #{creativeName},
+                '%')
+            </if>
+            <if test="statDate != null  and statDate != ''">and stat_date = #{statDate}</if>
+            <if test="coverUrl != null  and coverUrl != ''">and cover_url = #{coverUrl}</if>
+            <if test="coverWidth != null ">and cover_width = #{coverWidth}</if>
+            <if test="coverHeight != null ">and cover_height = #{coverHeight}</if>
+            <if test="photoId != null  and photoId != ''">and photo_id = #{photoId}</if>
+            <if test="creativeMaterialType != null ">and creative_material_type = #{creativeMaterialType}</if>
+            <if test="actionBar != null  and actionBar != ''">and action_bar = #{actionBar}</if>
+            <if test="recommendation != null  and recommendation != ''">and recommendation = #{recommendation}</if>
+            <if test="description != null  and description != ''">and description = #{description}</if>
+            <if test="newExposeText != null  and newExposeText != ''">and new_expose_text = #{newExposeText}</if>
+            <if test="newExposeUrl != null  and newExposeUrl != ''">and new_expose_url = #{newExposeUrl}</if>
+            <if test="liveCreativeType != null ">and live_creative_type = #{liveCreativeType}</if>
+            <if test="message != null  and message != ''">and message = #{message}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLaunchCreativeRecordById" parameterType="String"
+            resultMap="KuaishouLaunchCreativeRecordResult">
+        <include refid="selectKuaishouLaunchCreativeRecordVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertKuaishouLaunchCreativeRecord" parameterType="com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord">
+        insert into kuaishou_launch_creative_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="accountId != null">account_id,</if>
+            <if test="campaignId != null">campaign_id,</if>
+            <if test="unitId != null">unit_id,</if>
+            <if test="creativeId != null">creative_id,</if>
+            <if test="strategyId != null">strategy_id,</if>
+            <if test="creativeName != null">creative_name,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="coverUrl != null">cover_url,</if>
+            <if test="coverWidth != null">cover_width,</if>
+            <if test="coverHeight != null">cover_height,</if>
+            <if test="photoId != null">photo_id,</if>
+            <if test="creativeMaterialType != null">creative_material_type,</if>
+            <if test="actionBar != null">action_bar,</if>
+            <if test="recommendation != null">recommendation,</if>
+            <if test="description != null">description,</if>
+            <if test="newExposeText != null">new_expose_text,</if>
+            <if test="newExposeUrl != null">new_expose_url,</if>
+            <if test="liveCreativeType != null">live_creative_type,</if>
+            <if test="message != null">message,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="accountId != null">#{accountId},</if>
+            <if test="campaignId != null">#{campaignId},</if>
+            <if test="unitId != null">#{unitId},</if>
+            <if test="creativeId != null">#{creativeId},</if>
+            <if test="strategyId != null">#{strategyId},</if>
+            <if test="creativeName != null">#{creativeName},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="coverUrl != null">#{coverUrl},</if>
+            <if test="coverWidth != null">#{coverWidth},</if>
+            <if test="coverHeight != null">#{coverHeight},</if>
+            <if test="photoId != null">#{photoId},</if>
+            <if test="creativeMaterialType != null">#{creativeMaterialType},</if>
+            <if test="actionBar != null">#{actionBar},</if>
+            <if test="recommendation != null">#{recommendation},</if>
+            <if test="description != null">#{description},</if>
+            <if test="newExposeText != null">#{newExposeText},</if>
+            <if test="newExposeUrl != null">#{newExposeUrl},</if>
+            <if test="liveCreativeType != null">#{liveCreativeType},</if>
+            <if test="message != null">#{message},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLaunchCreativeRecord" parameterType="com.ruixuan.launch.entity.KuaishouLaunchCreativeRecord">
+        update kuaishou_launch_creative_record
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="accountId != null">account_id = #{accountId},</if>
+            <if test="campaignId != null">campaign_id = #{campaignId},</if>
+            <if test="unitId != null">unit_id = #{unitId},</if>
+            <if test="creativeId != null">creative_id = #{creativeId},</if>
+            <if test="strategyId != null">strategy_id = #{strategyId},</if>
+            <if test="creativeName != null">creative_name = #{creativeName},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="coverUrl != null">cover_url = #{coverUrl},</if>
+            <if test="coverWidth != null">cover_width = #{coverWidth},</if>
+            <if test="coverHeight != null">cover_height = #{coverHeight},</if>
+            <if test="photoId != null">photo_id = #{photoId},</if>
+            <if test="creativeMaterialType != null">creative_material_type = #{creativeMaterialType},</if>
+            <if test="actionBar != null">action_bar = #{actionBar},</if>
+            <if test="recommendation != null">recommendation = #{recommendation},</if>
+            <if test="description != null">description = #{description},</if>
+            <if test="newExposeText != null">new_expose_text = #{newExposeText},</if>
+            <if test="newExposeUrl != null">new_expose_url = #{newExposeUrl},</if>
+            <if test="liveCreativeType != null">live_creative_type = #{liveCreativeType},</if>
+            <if test="message != null">message = #{message},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLaunchCreativeRecordById" parameterType="String">
+        delete
+        from kuaishou_launch_creative_record
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLaunchCreativeRecordByIds" parameterType="String">
+        delete from kuaishou_launch_creative_record where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 7 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupMapper.xml

@@ -24,6 +24,7 @@
         <result property="supportType" column="support_type"/>
         <result property="showMode" column="show_mode"/>
         <result property="speed" column="speed"/>
+        <result property="statDate" column="stat_date"/>
         <result property="itemId" column="item_id"/>
         <result property="merchantItemPutType" column="merchant_item_put_type"/>
         <result property="shoppingCarProductId" column="shopping_car_product_id"/>
@@ -52,6 +53,7 @@
                support_type,
                show_mode,
                speed,
+               stat_date,
                item_id,
                merchant_item_put_type,
                shopping_car_product_id,
@@ -84,6 +86,7 @@
             <if test="supportType != null ">and support_type = #{supportType}</if>
             <if test="showMode != null ">and show_mode = #{showMode}</if>
             <if test="speed != null ">and speed = #{speed}</if>
+            <if test="statDate != null ">and stat_date = #{statDate}</if>
             <if test="itemId != null ">and item_id = #{itemId}</if>
             <if test="merchantItemPutType != null ">and merchant_item_put_type = #{merchantItemPutType}</if>
             <if test="shoppingCarProductId != null ">and shopping_car_product_id = #{shoppingCarProductId}</if>
@@ -91,6 +94,7 @@
         </where>
     </select>
 
+
     <select id="selectKuaishouLaunchGroupById" parameterType="String" resultMap="KuaishouLaunchGroupResult">
         <include refid="selectKuaishouLaunchGroupVo"/>
         where id = #{id}
@@ -118,6 +122,7 @@
             <if test="supportType != null">support_type,</if>
             <if test="showMode != null">show_mode,</if>
             <if test="speed != null">speed,</if>
+            <if test="statDate != null">stat_date,</if>
             <if test="itemId != null">item_id,</if>
             <if test="merchantItemPutType != null">merchant_item_put_type,</if>
             <if test="shoppingCarProductId != null">shopping_car_product_id,</if>
@@ -145,6 +150,7 @@
             <if test="supportType != null">#{supportType},</if>
             <if test="showMode != null">#{showMode},</if>
             <if test="speed != null">#{speed},</if>
+            <if test="statDate != null">#{statDate},</if>
             <if test="itemId != null">#{itemId},</if>
             <if test="merchantItemPutType != null">#{merchantItemPutType},</if>
             <if test="shoppingCarProductId != null">#{shoppingCarProductId},</if>
@@ -175,6 +181,7 @@
             <if test="supportType != null">support_type = #{supportType},</if>
             <if test="showMode != null">show_mode = #{showMode},</if>
             <if test="speed != null">speed = #{speed},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
             <if test="itemId != null">item_id = #{itemId},</if>
             <if test="merchantItemPutType != null">merchant_item_put_type = #{merchantItemPutType},</if>
             <if test="shoppingCarProductId != null">shopping_car_product_id = #{shoppingCarProductId},</if>

+ 20 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupRecordMapper.xml

@@ -23,6 +23,8 @@
         <result property="supportType" column="support_type"/>
         <result property="showMode" column="show_mode"/>
         <result property="speed" column="speed"/>
+        <result property="statDate" column="stat_date"/>
+        <result property="strategyId" column="strategy_id"/>
         <result property="itemId" column="item_id"/>
         <result property="merchantItemPutType" column="merchant_item_put_type"/>
         <result property="shoppingCarProductId" column="shopping_car_product_id"/>
@@ -53,6 +55,8 @@
                roi_ratio,
                scene_id,
                unit_type,
+               stat_date,
+               strategy_id,
                begin_time_str,
                end_time_str,
                schedule_time,
@@ -100,6 +104,8 @@
             <if test="supportType != null ">and support_type = #{supportType}</if>
             <if test="showMode != null ">and show_mode = #{showMode}</if>
             <if test="speed != null ">and speed = #{speed}</if>
+            <if test="statDate != null ">and stat_date = #{statDate}</if>
+            <if test="strategyId != null ">and strategy_id = #{strategyId}</if>
             <if test="itemId != null ">and item_id = #{itemId}</if>
             <if test="merchantItemPutType != null ">and merchant_item_put_type = #{merchantItemPutType}</if>
             <if test="shoppingCarProductId != null ">and shopping_car_product_id = #{shoppingCarProductId}</if>
@@ -121,6 +127,14 @@
         </where>
     </select>
 
+    <select id="queryGroupRecord" parameterType="com.ruixuan.launch.entity.KuaishouLaunchGroup"
+            resultMap="KuaishouLaunchGroupRecordResult">
+        <include refid="selectKuaishouLaunchGroupRecordVo"/>
+        where account_id = #{accountId}
+        and stat_date = #{statDate}
+        and strategy_id = #{strategyId}
+    </select>
+
     <select id="selectKuaishouLaunchGroupRecordById" parameterType="String" resultMap="KuaishouLaunchGroupRecordResult">
         <include refid="selectKuaishouLaunchGroupRecordVo"/>
         where id = #{id}
@@ -147,6 +161,8 @@
             <if test="supportType != null">support_type,</if>
             <if test="showMode != null">show_mode,</if>
             <if test="speed != null">speed,</if>
+            <if test="statDate != null">stat_date,</if>
+            <if test="strategyId != null">strategy_id,</if>
             <if test="itemId != null">item_id,</if>
             <if test="merchantItemPutType != null">merchant_item_put_type,</if>
             <if test="shoppingCarProductId != null">shopping_car_product_id,</if>
@@ -183,6 +199,8 @@
             <if test="supportType != null">#{supportType},</if>
             <if test="showMode != null">#{showMode},</if>
             <if test="speed != null">#{speed},</if>
+            <if test="statDate != null">#{statDate},</if>
+            <if test="strategyId != null">#{strategyId},</if>
             <if test="itemId != null">#{itemId},</if>
             <if test="merchantItemPutType != null">#{merchantItemPutType},</if>
             <if test="shoppingCarProductId != null">#{shoppingCarProductId},</if>
@@ -222,6 +240,8 @@
             <if test="supportType != null">support_type = #{supportType},</if>
             <if test="showMode != null">show_mode = #{showMode},</if>
             <if test="speed != null">speed = #{speed},</if>
+            <if test="statDate != null">stat_date = #{statDate},</if>
+            <if test="strategyId != null">strategy_id = #{strategyId},</if>
             <if test="itemId != null">item_id = #{itemId},</if>
             <if test="merchantItemPutType != null">merchant_item_put_type = #{merchantItemPutType},</if>
             <if test="shoppingCarProductId != null">shopping_car_product_id = #{shoppingCarProductId},</if>

+ 6 - 0
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchGroupTargetMapper.xml

@@ -9,6 +9,7 @@
         <result property="accountId" column="account_id"/>
         <result property="unitId" column="unit_id"/>
         <result property="region" column="region"/>
+        <result property="regionType" column="region_type"/>
         <result property="age" column="age"/>
         <result property="genderType" column="gender_type"/>
         <result property="population" column="population"/>
@@ -26,6 +27,7 @@
                account_id,
                unit_id,
                region,
+               region_type,
                age,
                gender_type,
                population,
@@ -46,6 +48,7 @@
             <if test="accountId != null ">and account_id = #{accountId}</if>
             <if test="unitId != null ">and unit_id = #{unitId}</if>
             <if test="region != null  and region != ''">and region = #{region}</if>
+            <if test="regionType != null  and regionType != ''">and region_type = #{regionType}</if>
             <if test="age != null  and age != ''">and age = #{age}</if>
             <if test="genderType != null ">and gender_type = #{genderType}</if>
             <if test="population != null  and population != ''">and population = #{population}</if>
@@ -73,6 +76,7 @@
             <if test="accountId != null">account_id,</if>
             <if test="unitId != null">unit_id,</if>
             <if test="region != null">region,</if>
+            <if test="regionType != null">region_type,</if>
             <if test="age != null">age,</if>
             <if test="genderType != null">gender_type,</if>
             <if test="population != null">population,</if>
@@ -88,6 +92,7 @@
             <if test="accountId != null">#{accountId},</if>
             <if test="unitId != null">#{unitId},</if>
             <if test="region != null">#{region},</if>
+            <if test="regionType != null">#{regionType},</if>
             <if test="age != null">#{age},</if>
             <if test="genderType != null">#{genderType},</if>
             <if test="population != null">#{population},</if>
@@ -107,6 +112,7 @@
             <if test="accountId != null">account_id = #{accountId},</if>
             <if test="unitId != null">unit_id = #{unitId},</if>
             <if test="region != null">region = #{region},</if>
+            <if test="regionType != null">region_type = #{regionType},</if>
             <if test="age != null">age = #{age},</if>
             <if test="genderType != null">gender_type = #{genderType},</if>
             <if test="population != null">population = #{population},</if>

+ 22 - 1
ruixuan-launch/src/main/resources/mapper/launch/KuaishouLaunchTargetTemplateMapper.xml

@@ -8,7 +8,9 @@
         <result property="id" column="id"/>
         <result property="accountId" column="account_id"/>
         <result property="targetName" column="target_name"/>
+        <result property="targetType" column="target_type"/>
         <result property="region" column="region"/>
+        <result property="regionType" column="region_type"/>
         <result property="age" column="age"/>
         <result property="genderType" column="gender_type"/>
         <result property="population" column="population"/>
@@ -27,7 +29,9 @@
         select id,
                account_id,
                target_name,
+               target_type,
                region,
+               region_type,
                age,
                gender_type,
                population,
@@ -48,7 +52,9 @@
         <where>
             <if test="accountId != null ">and account_id = #{accountId}</if>
             <if test="targetName != null  and targetName != ''">and target_name = #{targetName}</if>
+            <if test="targetType != null  and targetType != ''">and target_type = #{targetType}</if>
             <if test="region != null  and region != ''">and region = #{region}</if>
+            <if test="regionType != null  and regionType != ''">and region_type = #{regionType}</if>
             <if test="age != null  and age != ''">and age = #{age}</if>
             <if test="genderType != null ">and gender_type = #{genderType}</if>
             <if test="population != null  and population != ''">and population = #{population}</if>
@@ -74,6 +80,15 @@
         where id = #{id}
     </select>
 
+    <select id="selectKuaishouLaunchTargetTemplateByIds" resultMap="KuaishouLaunchTargetTemplateResult">
+        <include refid="selectKuaishouLaunchTargetTemplateVo"/>
+        where id in
+        <foreach collection="ids" item="item" separator=","
+                 open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
     <insert id="insertKuaishouLaunchTargetTemplate"
             parameterType="com.ruixuan.launch.entity.KuaishouLaunchTargetTemplate" useGeneratedKeys="true"
             keyProperty="id">
@@ -81,7 +96,9 @@
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="accountId != null">account_id,</if>
             <if test="targetName != null">target_name,</if>
+            <if test="targetType != null">target_type,</if>
             <if test="region != null">region,</if>
+            <if test="regionType != null">region_type,</if>
             <if test="age != null">age,</if>
             <if test="genderType != null">gender_type,</if>
             <if test="population != null">population,</if>
@@ -97,8 +114,10 @@
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="accountId != null">#{accountId},</if>
-            <if test="targetName != null">#{target_name},</if>
+            <if test="targetName != null">#{targetName},</if>
+            <if test="targetType != null">#{targetType},</if>
             <if test="region != null">#{region},</if>
+            <if test="regionType != null">#{regionType},</if>
             <if test="age != null">#{age},</if>
             <if test="genderType != null">#{genderType},</if>
             <if test="population != null">#{population},</if>
@@ -120,7 +139,9 @@
         <trim prefix="SET" suffixOverrides=",">
             <if test="accountId != null">account_id = #{accountId},</if>
             <if test="targetName != null">target_name = #{targetName},</if>
+            <if test="targetType != null">target_type = #{targetType},</if>
             <if test="region != null">region = #{region},</if>
+            <if test="regionType != null">region_type = #{regionType},</if>
             <if test="age != null">age = #{age},</if>
             <if test="genderType != null">gender_type = #{genderType},</if>
             <if test="population != null">population = #{population},</if>