yumeng 3 年之前
父节点
当前提交
53553c47c9
共有 18 个文件被更改,包括 212 次插入43 次删除
  1. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTargetKuaishou.java
  2. 1 0
      module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java
  3. 4 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/RuleDataTargetKuaishouMapper.java
  4. 4 1
      module-common/src/main/java/cn/com/ctop/common/module/mapper/RuleDateUnitKuaishouMapper.java
  5. 56 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/RuleDataTargetKuaishouMapper.xml
  6. 65 0
      module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/RuleDateUnitKuaishouMapper.xml
  7. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IRuleDataTargetKuaishouService.java
  8. 3 0
      module-common/src/main/java/cn/com/ctop/common/module/service/IRuleDataUnitKuaishouService.java
  9. 9 0
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/RuleDataTargetKuaishouServiceImpl.java
  10. 12 1
      module-common/src/main/java/cn/com/ctop/common/module/service/impl/RuleDataUnitKuaishouServiceImpl.java
  11. 10 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupJob.java
  12. 1 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCreativeJob.java
  13. 4 6
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateGroupJob.java
  14. 6 1
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/RuleKuaiShouDataUnitCleanJob.java
  15. 5 15
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java
  16. 4 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java
  17. 11 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IRuleKuaiShouPlanService.java
  18. 13 11
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDataTargetKuaishou.java

@@ -59,5 +59,6 @@ public class RuleDataTargetKuaishou {
 	private Integer network;
 
 	private java.util.Date createTime;
+	private java.util.Date updateTime;
 
 }

+ 1 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java

@@ -98,4 +98,5 @@ public class RuleDateUnitKuaishou {
     private Integer status;
 
     private java.util.Date createTime;
+    private java.util.Date updateTime;
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/RuleDataTargetKuaishouMapper.java

@@ -2,10 +2,14 @@ package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.RuleDataTargetKuaishou;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 快手预警指标数据
  */
 public interface RuleDataTargetKuaishouMapper extends BaseMapper<RuleDataTargetKuaishou> {
 
+    void replaceBatch(@Param("add") List<RuleDataTargetKuaishou> batch);
 }

+ 4 - 1
module-common/src/main/java/cn/com/ctop/common/module/mapper/RuleDateUnitKuaishouMapper.java

@@ -1,12 +1,15 @@
 package cn.com.ctop.common.module.mapper;
 
 import cn.com.ctop.common.module.entity.RuleDateUnitKuaishou;
-
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * 预警快手计划数据清洗
  */
 public interface RuleDateUnitKuaishouMapper extends BaseMapper<RuleDateUnitKuaishou> {
 
+    void replaceBatch(@Param("add") List<RuleDateUnitKuaishou> batch);
 }

+ 56 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/RuleDataTargetKuaishouMapper.xml

@@ -2,4 +2,60 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.common.module.mapper.RuleDataTargetKuaishouMapper">
 
+    <insert id="replaceBatch">
+        replace into ctop_rule_data_target_kuaishou(
+        id,
+        account_id,
+        plan_id,
+        unit_id,
+        scene_id,
+        region,
+        gender,
+        device_brand,
+        device_price,
+        filter_converted_level,
+        is_open,
+        schedule_time,
+        status,
+
+        platform_os,
+        app_store,
+        population,
+        exclude_population,
+        ages_range,
+        business_interest,
+        network,
+        create_time,
+        update_time
+        )
+        values
+        <foreach collection="add" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.accountId},
+            #{add.planId},
+            #{add.unitId},
+            #{add.sceneId},
+            #{add.region},
+            #{add.gender},
+            #{add.deviceBrand},
+            #{add.devicePrice},
+            #{add.filterConvertedLevel},
+            #{add.isOpen},
+            #{add.scheduleTime},
+            #{add.status},
+            #{add.platformOs},
+            #{add.appStore},
+            #{add.population},
+            #{add.excludePopulation},
+            #{add.agesRange},
+            #{add.businessInterest},
+            #{add.network},
+            #{add.createTime},
+            #{add.updateTime}
+            )
+        </foreach>
+
+
+    </insert>
 </mapper>

+ 65 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/RuleDateUnitKuaishouMapper.xml

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.RuleDateUnitKuaishouMapper">
+
+    <insert id="replaceBatch">
+        replace into ctop_rule_data_unit_kuaishou(
+        id,
+        account_id,
+        plan_id,
+        unit_id,
+        unit_name,
+        charge,
+        convert_num,
+        convert_cost,
+        activation,
+        activation_cost,
+        event_register,
+        register_cost,
+        form_count,
+        form_cost,
+        event_pay,
+        pay_cost,
+        deep_conversion_bid,
+        deep_conversion_type,
+        android_osv,
+        cpa_bid,
+        ocpx_action_type,
+        status,
+        create_time,
+        update_time
+
+        )
+        values
+        <foreach collection="add" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.accountId},
+            #{add.planId},
+            #{add.unitId},
+            #{add.unitName},
+            #{add.charge},
+            #{add.convertNum},
+            #{add.convertCost},
+            #{add.activation},
+            #{add.activationCost},
+            #{add.eventRegister},
+            #{add.registerCost},
+            #{add.formCount},
+            #{add.formCost},
+            #{add.eventPay},
+            #{add.payCost},
+            #{add.deepConversionBid},
+            #{add.deepConversionType},
+            #{add.androidOsv},
+            #{add.cpaBid},
+            #{add.ocpxActionType},
+            #{add.status},
+            #{add.createTime},
+            #{add.updateTime}
+            )
+        </foreach>
+
+
+    </insert>
+</mapper>

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IRuleDataTargetKuaishouService.java

@@ -3,9 +3,12 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.RuleDataTargetKuaishou;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * 快手预警指标数据
  */
 public interface IRuleDataTargetKuaishouService extends IService<RuleDataTargetKuaishou> {
 
+    void replaceBatch(List<RuleDataTargetKuaishou> batch);
 }

+ 3 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IRuleDataUnitKuaishouService.java

@@ -3,9 +3,12 @@ package cn.com.ctop.common.module.service;
 import cn.com.ctop.common.module.entity.RuleDateUnitKuaishou;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  *  组维度数据清洗
  */
 public interface IRuleDataUnitKuaishouService extends IService<RuleDateUnitKuaishou> {
 
+    void replaceBatch(List<RuleDateUnitKuaishou> batch);
 }

+ 9 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RuleDataTargetKuaishouServiceImpl.java

@@ -4,12 +4,21 @@ import cn.com.ctop.common.module.entity.RuleDataTargetKuaishou;
 import cn.com.ctop.common.module.mapper.RuleDataTargetKuaishouMapper;
 import cn.com.ctop.common.module.service.IRuleDataTargetKuaishouService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 快手预警指标数据
  */
 @Service
 public class RuleDataTargetKuaishouServiceImpl extends ServiceImpl<RuleDataTargetKuaishouMapper, RuleDataTargetKuaishou> implements IRuleDataTargetKuaishouService {
+    @Autowired
+    private RuleDataTargetKuaishouMapper ruleDataTargetKuaishouMapper;
 
+    @Override
+    public void replaceBatch(List<RuleDataTargetKuaishou> batch) {
+        ruleDataTargetKuaishouMapper.replaceBatch(batch);
+    }
 }

+ 12 - 1
module-common/src/main/java/cn/com/ctop/common/module/service/impl/RuleDataUnitKuaishouServiceImpl.java

@@ -4,15 +4,26 @@ import cn.com.ctop.common.module.entity.RuleDateUnitKuaishou;
 import cn.com.ctop.common.module.mapper.RuleDateUnitKuaishouMapper;
 import cn.com.ctop.common.module.service.IRuleDataUnitKuaishouService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * 组维度数据清洗
+ *
  * @author jeecg-boot
- * @date   2020-12-04
  * @version V1.0
+ * @date 2020-12-04
  */
 @Service
 public class RuleDataUnitKuaishouServiceImpl extends ServiceImpl<RuleDateUnitKuaishouMapper, RuleDateUnitKuaishou> implements IRuleDataUnitKuaishouService {
 
+    @Autowired
+    private RuleDateUnitKuaishouMapper ruleDateUnitKuaishouMapper;
+
+    @Override
+    public void replaceBatch(List<RuleDateUnitKuaishou> batch) {
+        ruleDateUnitKuaishouMapper.replaceBatch(batch);
+    }
 }

+ 10 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouGroupJob.java

@@ -5,9 +5,12 @@ import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -23,12 +26,18 @@ public class KuaishouGroupJob {
 
     /**
      * 快手广告组物料
+     *
      * @throws Exception
      */
     @XxlJob("kuaishouGroup")
     public void execute() throws Exception {
+        Date endDate = new Date();
+        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
+        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = sim.parse(anotherDay);
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, null, null)));
+        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, parse, parse)));
         XxlJobHelper.log("快手物料数据同步完成");
     }
+
 }

+ 1 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateCreativeJob.java

@@ -9,6 +9,7 @@ import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;

+ 4 - 6
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouNowDateGroupJob.java

@@ -22,7 +22,7 @@ public class KuaishouNowDateGroupJob {
     @Autowired
     private IKuaishouInterfaceService kuaishouInterfaceService;
 
-    static ExecutorService executorService = Executors.newFixedThreadPool(5);
+    static ExecutorService executorService = Executors.newFixedThreadPool(8);
 
     /**
      * 快手当日广告组物料数据
@@ -31,12 +31,10 @@ public class KuaishouNowDateGroupJob {
     @XxlJob("kuaishouNowDateGroup")
     public void execute() throws Exception {
         //1:查询当日数据
-        Date endDate = new Date();
-        String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
-        SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
-        Date startDate = sim.parse(anotherDay);
+        Date nowDate = new Date();
+
         List<CtopOauthToken> tokens = tokenService.selectKuaiShouToken();
-        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, startDate, endDate)));
+        tokens.forEach(token -> executorService.submit(() -> kuaishouInterfaceService.getGroupList(token, nowDate, nowDate)));
         XxlJobHelper.log("快手物料数据同步完成");
     }
 

+ 6 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/RuleKuaiShouDataUnitCleanJob.java

@@ -39,8 +39,13 @@ public class RuleKuaiShouDataUnitCleanJob {
             Map<String,Object>params = new HashMap<>();
             params.put("account_id",token.getAccountId());
             ruleDataUnitKuaishouService.removeByMap(params);
-            ruleKuaiShouPlanService.cleanRuleDataUnit(token.getAccountId(), DateUtils.date2Str(), DateUtils.date2Str(), 1);
+            ruleKuaiShouPlanService.cleanRuleDataUnit(token.getAccountId(),token.getAccessToken(), DateUtils.date2Str(), DateUtils.date2Str(), 1);
         }));
     }
 
+    public static void main(String[] args) {
+        System.err.println(DateUtils.date2Str());
+        System.err.println(DateUtils.date2Str());
+    }
+
 }

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

@@ -3,22 +3,12 @@ package cn.com.ctop.kuaishou.modules.ai.service.impl;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.MaterialCutFrame;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.HttpUtils2;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.common.module.utils.*;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaiShouCreateService;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouLandpagePackageService;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTemplateService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouMaterialUploadService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -285,9 +275,9 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                 if (!Check.isNull(creativeJson.getLong("photo_id"))) {
                     createJson.put("photo_id", creativeJson.getLong("photo_id"));  // 视频ID
                 }
-                KuaiShouVideoGet video = videoGetService.getVideoByPhotoId(creativeJson.getLong("photo_id"));
-                if (!Check.isNull(video)) {
-                    createJson.put("creative_material_type", video.getMaterialType());  // 素材类型
+                //        KuaiShouVideoGet video = videoGetService.getVideoByPhotoId(creativeJson.getLong("photo_id"));
+                if (!Check.isNull(creativeJson.getInteger("creative_material_type"))) {
+                    createJson.put("creative_material_type", creativeJson.getInteger("creative_material_type"));  // 素材类型
                 }
                 if (!Check.isNull(creativeJson.getString("action_bar_text"))) {
                     createJson.put("action_bar_text", creativeJson.getString("action_bar_text"));  // 行动号召按钮文案

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

@@ -1188,6 +1188,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     }
 
 
+    @Autowired
+    IRuleKuaiShouPlanService ruleKuaiShouPlanService;
+
     private void getGroupListByPage(CtopOauthToken token, Date startDate, Date endDate, int page) {
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.GROUP_LIST;
         JSONObject param = new JSONObject();
@@ -1218,6 +1221,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             return;
         }
         addGroup(token.getAccountId(), details);
+        ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
         getGroupListByPage(token, startDate, endDate, page + 1);
     }
 

+ 11 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IRuleKuaiShouPlanService.java

@@ -1,26 +1,30 @@
 package cn.com.ctop.kuaishou.modules.report.service;
 
 import cn.com.ctop.common.module.entity.RuleDatePlanKuaishou;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
- *  快手规则引擎数据清洗;计划、组、定向
+ * 快手规则引擎数据清洗;计划、组、定向
  */
 public interface IRuleKuaiShouPlanService extends IService<RuleDatePlanKuaishou> {
 
     /**
-     *  计划
+     * 计划
      */
-    void cleanRuleDataPlan(Long accountId,int page);
+    void cleanRuleDataPlan(Long accountId, int page);
 
     /**
-     *  
+     * 组
      */
-    void cleanRuleDataUnit(Long accountId,String startDate, String endDate,int page);
+    void cleanRuleDataUnit(Long accountId, String accessToken,String startDate, String endDate, int page);
 
     /**
-     *  定向
+     * 定向
      */
-    void cleanRuleDataTarget(Long accountId,int page);
+    void cleanRuleDataTarget(Long accountId, int page);
+
+
+    void insertTarget(Long accountId, JSONArray details);
 
 }

+ 13 - 11
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java

@@ -25,10 +25,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaishouMapper, RuleDatePlanKuaishou> implements IRuleKuaiShouPlanService {
@@ -82,7 +79,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
     }
 
     @Override
-    public void cleanRuleDataUnit(Long accountId, String startDate, String endDate, int page) {
+    public void cleanRuleDataUnit(Long accountId, String accessToken, String startDate, String endDate, int page) {
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
         param.put("page_size", 500);
@@ -91,7 +88,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         param.put("end_date", endDate);
 
         Map<String, String> headers = new HashMap<>();
-        headers.put("Access-Token", oauthTokenService.getTokenByAccountId(accountId).getAccessToken());
+        headers.put("Access-Token", accessToken);
         headers.put("Content-Type", "application/json");
 
         String result = HttpUtils.kuaiShouhttpPostRequest("https://ad.e.kuaishou.com/rest/openapi/v1/report/unit_report", param.toJSONString(), headers);
@@ -110,7 +107,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
             return;
         }
         this.insertUnit(accountId, details);
-        cleanRuleDataUnit(accountId, startDate, endDate, page + 1);
+        cleanRuleDataUnit(accountId, accessToken, startDate, endDate, page + 1);
     }
 
     @Override
@@ -197,17 +194,20 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                             unit.setConvertCost(unitDetail.getBigDecimal("charge").divide(BigDecimal.valueOf(unit.getConvertNum()), 2, RoundingMode.HALF_UP));
                         }
                     }
+                    unit.setCreateTime(new Date());
                     batch.add(unit);
                 }
             }
 
         });
         if (!batch.isEmpty()) {
-            unitKuaishouService.saveOrUpdateBatch(batch);
+            //  unitKuaishouService.saveOrUpdateBatch(batch);
+            unitKuaishouService.replaceBatch(batch);
         }
     }
 
-    private void insertTarget(Long accountId, JSONArray details) {
+    @Override
+    public void insertTarget(Long accountId, JSONArray details) {
         List<RuleDataTargetKuaishou> batch = new ArrayList<>();
         details.forEach(detail -> {
             JSONObject unitDetail = (JSONObject) detail;
@@ -262,12 +262,14 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                 Integer isOpen = unitDetail.getJSONObject("target").getJSONObject("intelli_extend").getInteger("is_open");
                 target.setIsOpen(isOpen == null ? 0 : isOpen);
                 target.setScheduleTime(unitDetail.getString("schedule_time") == null ? "" : unitDetail.getString("schedule_time"));
-
+                target.setCreateTime(new Date());
+                target.setUpdateTime(new Date());
                 batch.add(target);
             }
         });
         if (!batch.isEmpty()) {
-            targetKuaishouService.saveOrUpdateBatch(batch);
+            // targetKuaishouService.saveOrUpdateBatch(batch);
+            targetKuaishouService.replaceBatch(batch);
         }
     }