浏览代码

Merge branch 'master' into activity

syh 4 年之前
父节点
当前提交
aecd5e0043

+ 73 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -14,7 +14,10 @@ import cn.com.ctop.toutiao.modules.report.service.IBytedancePlanHourlyReportServ
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceReportService;
 import cn.com.ctop.toutiao.modules.report.service.IReportService;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.api.R;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.util.DateUtils;
 import org.quartz.JobExecutionException;
@@ -68,6 +71,9 @@ public class TestController {
     private IMaterialImageInfoService iMaterialImageInfoService;
     @Autowired
     private IBytedanceReportService bytedanceReportService;
+    @Autowired
+    private IKuaishouInterfaceService2 kuaishouInterfaceService2;
+
     static ExecutorService executorService = Executors.newFixedThreadPool(15);
     static ExecutorService videoService = Executors.newFixedThreadPool(5);
     static ExecutorService suzhaoService = Executors.newFixedThreadPool(5);
@@ -851,4 +857,71 @@ public class TestController {
 
 
     }
+
+
+
+
+    @GetMapping(value = "/getOperationRecord")
+    public Result getOperationRecord(@Param("accountId")Long accountId, @Param("operationTarget")Integer operationTarget, @Param("startDate")String startDate, @Param("endDate")String endDate){
+        Result result = new Result();
+        try {
+            if(StringUtils.isBlank(startDate) || StringUtils.isBlank(endDate)){
+                result.setSuccess(false);
+                result.setMessage("时间参数不能为空");
+                return result;
+            }
+
+            if(operationTarget == null){
+                result.setSuccess(false);
+                result.setMessage("类型不能为空");
+                return result;
+            }
+
+            if(accountId == null){
+                //1:查询当日数据
+                QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("media_id", 2);
+                queryWrapper.orderByDesc("create_time");
+                List<CtopOauthToken> tokens = tokenService.list(queryWrapper);
+                if (null == tokens || tokens.size() <= 0) {
+                    log.error("定时获取快手操作记录数据异常:未获取到可用的token");
+                    result.setSuccess(false);
+                    result.setMessage("定时获取快手操作记录数据异常:未获取到可用的toke");
+                    return result;
+                }
+
+                executorService = Executors.newFixedThreadPool(3);
+                tokens.forEach(token -> {
+                    executorService.submit(new Runnable() {
+                        @Override
+                        public void run() {
+                            log.info("获取操作记录开始:accountId:{},startDate:{},endDate:{}", token.getAccountId(), startDate, endDate);
+                            kuaishouInterfaceService2.getOperationRecord(token.getAccountId(), token.getAccessToken(), operationTarget, startDate, endDate);
+                            log.info("获取操作记录开始:accountId:{}", token.getAccountId());
+                     }
+                    });
+                });
+            }else{
+                QueryWrapper<CtopOauthToken> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("account_id", accountId);
+                CtopOauthToken token = tokenService.getOauthTokenByAccountId(String.valueOf(accountId));
+                if (null == token) {
+                    log.error("定时获取快手操作记录数据异常:未获取到可用的token");
+                    result.setSuccess(false);
+                    result.setMessage("定时获取快手操作记录数据异常:未获取到可用的toke");
+                    return result;
+                }
+                kuaishouInterfaceService2.getOperationRecord(token.getAccountId(), token.getAccessToken(), operationTarget, startDate, endDate);
+
+            }
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+
+
 }

+ 8 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -178,6 +178,7 @@ public class KuaishouInterfaceConstant {
      */
     public static final String ADVERTISER_INFO = "/rest/openapi/v1/advertiser/info";
 
+
     /**
      * 修改广告创意
      */
@@ -208,6 +209,11 @@ public class KuaishouInterfaceConstant {
      */
     public static final String PAGE_LIST = "/rest/openapi/v2/lp/page/list";
 
+    /**
+     * 获取操作记录
+     */
+    public static final String OPERATION_RECORD = "/rest/openapi/v1/tool/operation_record/list";
+
 
     /**
      * 登录
@@ -231,4 +237,6 @@ public class KuaishouInterfaceConstant {
     public static final String HTTPS_PREFIX = "https:";
 
 
+
+
 }

+ 41 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/KuaishouOperationRecord.java

@@ -0,0 +1,41 @@
+package cn.com.ctop.kuaishou.modules.batch.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 操作记录
+ * @author jeecg-boot
+ * @date   2020-04-26
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_kuaishou_operation_record")
+public class KuaishouOperationRecord {
+
+	private Long id;
+
+	private Long accountId;
+
+	private Date operationTime;
+
+	private Integer operationType;
+
+	private Integer roleType;
+
+	private String objectName;
+
+	private Integer operationTarget;
+
+	private String objectId;
+
+	private String fieldName;
+
+	private String originalData;
+
+	private String updateData;
+
+	private String statDate;
+}

+ 41 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouOperationRecordMapper.java

@@ -0,0 +1,41 @@
+package cn.com.ctop.kuaishou.modules.batch.mapper;
+
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.List;
+
+
+public interface KuaishouOperationRecordMapper extends BaseMapper<KuaishouOperationRecord> {
+
+    void deleteOperationRecordInfoAccount(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoAccount(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoCampaign(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoCampaign(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoUnit(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoUnit(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoCreative(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoCreative(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoVideo(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoVideo(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoApp(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoApp(@Param("records")List<KuaishouOperationRecord> records);
+
+    void deleteOperationRecordInfoPackage(@Param("record")KuaishouOperationRecord record);
+
+    void insertOperationRecordInfoPackage(@Param("records")List<KuaishouOperationRecord> records);
+
+}

+ 420 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouOperationRecordMapper.xml

@@ -0,0 +1,420 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper">
+
+    <delete id="deleteOperationRecordInfoAccount">
+        delete
+        from
+        ctop_kuaishou_operation_record_account
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoAccount">
+        insert into
+        ctop_kuaishou_operation_record_account
+        (
+            account_id,
+            stat_date,
+            operation_time,
+            operation_type,
+            role_type,
+            object_name,
+            operation_target,
+            object_id,
+            field_name,
+            original_data,
+            update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+                #{record.accountId},
+                #{record.statDate},
+                #{record.operationTime},
+                #{record.operationType},
+                #{record.roleType},
+                #{record.objectName},
+                #{record.operationTarget},
+                #{record.objectId},
+                #{record.fieldName},
+                #{record.originalData},
+                #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+
+    <delete id="deleteOperationRecordInfoCampaign">
+        delete
+        from
+        ctop_kuaishou_operation_record_campaign
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+     <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoCampaign">
+        insert into
+        ctop_kuaishou_operation_record_campaign
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+    <delete id="deleteOperationRecordInfoUnit">
+        delete
+        from
+        ctop_kuaishou_operation_record_unit
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+       <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoUnit">
+        insert into
+        ctop_kuaishou_operation_record_unit
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+    <delete id="deleteOperationRecordInfoCreative">
+        delete
+        from
+        ctop_kuaishou_operation_record_creative
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoCreative">
+        insert into
+        ctop_kuaishou_operation_record_creative
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+    <delete id="deleteOperationRecordInfoVideo">
+        delete
+        from
+        ctop_kuaishou_operation_record_video
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoVideo">
+        insert into
+        ctop_kuaishou_operation_record_video
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+
+    <delete id="deleteOperationRecordInfoApp">
+        delete
+        from
+        ctop_kuaishou_operation_record_app
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoApp">
+        insert into
+        ctop_kuaishou_operation_record_app
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+
+    <delete id="deleteOperationRecordInfoPackage">
+        delete
+        from
+        ctop_kuaishou_operation_record_package
+        where
+        account_id = #{record.accountId}
+        and
+        stat_date = #{record.statDate}
+        <!--
+        and
+        object_id = #{record.objectId}
+        and
+        operation_type = #{record.operationType}
+        and
+        operation_target = #{record.operationTarget}
+        and
+        role_type = #{record.roleType}
+        and
+        operation_time = #{record.operationTime}
+        -->
+    </delete>
+
+    <insert id="insertOperationRecordInfoPackage">
+        insert into
+        ctop_kuaishou_operation_record_package
+        (
+        account_id,
+        stat_date,
+        operation_time,
+        operation_type,
+        role_type,
+        object_name,
+        operation_target,
+        object_id,
+        field_name,
+        original_data,
+        update_data
+        )
+        values
+        <foreach item="record" index="index" collection="records"  separator="," >
+            (
+            #{record.accountId},
+            #{record.statDate},
+            #{record.operationTime},
+            #{record.operationType},
+            #{record.roleType},
+            #{record.objectName},
+            #{record.operationTarget},
+            #{record.objectId},
+            #{record.fieldName},
+            #{record.originalData},
+            #{record.updateData}
+            )
+        </foreach>
+
+    </insert>
+
+
+</mapper>

+ 10 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouInterfaceService2.java

@@ -0,0 +1,10 @@
+package cn.com.ctop.kuaishou.modules.batch.service;
+
+
+public interface IKuaishouInterfaceService2 {
+
+    void getOperationRecord(Long advertiserId, String accessToken, Integer operationTarget, String startDate, String endDate);
+}
+
+
+

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

@@ -0,0 +1,171 @@
+package cn.com.ctop.kuaishou.modules.batch.service.impl;
+
+import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.common.module.utils.HttpUtils;
+import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
+import cn.com.ctop.common.module.utils.PropertiesUtils;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouOperationRecord;
+import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouOperationRecordMapper;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService2;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.ArrayStack;
+import org.jeecg.common.util.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+
+@Slf4j
+@Service
+public class KuaishouInterfaceServiceImpl2 implements IKuaishouInterfaceService2 {
+
+    @Autowired
+    private KuaishouOperationRecordMapper kuaishouOperationRecordMapper;
+
+    @Override
+    public void getOperationRecord(Long advertiserId, String accessToken, Integer operationTarget, String startDate, String endDate){
+
+        Long days = DateUtils.getDiscrepantDays(startDate, endDate);
+        String start = null;
+        String end = null;
+        for (int i = 0; i <= days; i++) {
+            start = DateUtils.addDay(startDate, i);
+            end = start;
+            getOperationRecordByPage(advertiserId, accessToken,1, 500, operationTarget, start, end);
+        }
+    }
+
+    private void getOperationRecordByPage(Long advertiserId, String accessToken, Integer page, Integer pageSize, Integer operationTarget, String startDate, String endDate) {
+        String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.OPERATION_RECORD;
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Access-Token", accessToken);
+        headers.put("Content-Type", " application/json");
+        JSONObject json = new JSONObject();
+        json.put("advertiser_id", advertiserId);
+        json.put("operation_target", operationTarget);
+        json.put("page", page);
+        json.put("page_size", pageSize);
+        json.put("start_date", startDate);
+        json.put("end_date", endDate);
+
+        String result = HttpUtils.kuaiShouhttpPostRequest(url, json.toJSONString(), headers);
+        JSONObject resultJson = JSONObject.parseObject(result);
+
+        if(!Check.isNull(resultJson)){
+            Integer code = resultJson.getInteger("code");
+            if (code == 0) {
+                JSONObject data = resultJson.getJSONObject("data");
+                if (!Check.isNull(data)) {
+                    List<KuaishouOperationRecord> recordList =  new ArrayList();
+
+                    Integer totalCount = data.getInteger("total_count");
+                    JSONArray dataArr = data.getJSONArray("details");
+                    for (int i = 0; i < dataArr.size(); i++) {
+                        JSONObject dataJson = JSONObject.parseObject(dataArr.get(i).toString());
+                        if (!Check.isNull(dataJson)) {
+
+                            Date operationTime = dataJson.getDate("operation_time");
+                            Integer operationType = dataJson.getInteger("operation_type");
+                            operationTarget = dataJson.getInteger("operation_target");
+                            Integer roleType = dataJson.getInteger("role_type");
+                            String objectId = dataJson.getString("object_id");
+                            String objectName = dataJson.getString("object_name");
+
+                            if (page == 1 && i==0) { //如果页数为1,删除原来的数据
+                                KuaishouOperationRecord recordDelete = new KuaishouOperationRecord();
+                                recordDelete.setStatDate(startDate);//按天删除记录
+                                recordDelete.setAccountId(advertiserId);
+                                //recordDelete.setOperationTime(operationTime);
+                                //recordDelete.setOperationType(operationType);
+                                //recordDelete.setRoleType(roleType);
+                                //recordDelete.setObjectName(objectName);
+                                //recordDelete.setOperationTarget(operationTarget);
+                                //recordDelete.setObjectId(objectId);
+                                operationRecordDelete(recordDelete,operationTarget);
+                            }
+
+                            JSONArray contentLogArray =  dataJson.getJSONArray("content_log");
+                            int jsize =  contentLogArray.size();
+                            for(int j=0; j<jsize;j++){
+                                JSONObject log = contentLogArray.getJSONObject(j);
+                                KuaishouOperationRecord record = new KuaishouOperationRecord();
+                                record.setAccountId(advertiserId);
+                                record.setStatDate(startDate);
+                                record.setOperationTime(operationTime);
+                                record.setOperationType(operationType);
+                                record.setRoleType(roleType);
+                                record.setObjectName(objectName);
+                                record.setOperationTarget(operationTarget);
+                                record.setObjectId(objectId);
+                                record.setFieldName(log.getString("field_name"));
+                                record.setOriginalData(log.getString("original_data"));
+                                record.setUpdateData(log.getString("update_data"));
+
+                                recordList.add(record);
+                            }
+                        }
+                    }
+                    if(recordList !=null && recordList.size()!=0){
+                        operationRecordInsert(recordList,operationTarget);
+                    }
+
+                    Integer totalPage = (totalCount - 1) / pageSize + 1;
+                    if (page < totalPage) {
+                        getOperationRecordByPage(advertiserId, accessToken, page + 1, pageSize, operationTarget, startDate, endDate);
+                    }
+                }else{
+                    log.error("快手操作记录接口data结果不正确,{} ~ {}, resultJson:{}", startDate, endDate, result);
+                }
+            }else{
+                log.error("快手操作记录接口code返回结果不正确,{} ~ {}, resultJson:{}", startDate, endDate, result);
+            }
+        } else {
+            log.error("快手操作记录接口获取地域列表返回结果为空,{} ~ {}, resultJson:{}", startDate, endDate, result);
+        }
+
+    }
+
+    private void operationRecordDelete(KuaishouOperationRecord recordDelete, Integer operationTarget){
+        if(operationTarget == 1){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoAccount(recordDelete);
+        }else if(operationTarget == 2){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoCampaign(recordDelete);
+        }else if(operationTarget == 3){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoUnit(recordDelete);
+        }else if(operationTarget == 4){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoCreative(recordDelete);
+        }else if(operationTarget == 5){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoVideo(recordDelete);
+        }else if(operationTarget == 6){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoApp(recordDelete);
+        }else if(operationTarget == 7){
+            kuaishouOperationRecordMapper.deleteOperationRecordInfoPackage(recordDelete);
+        }
+    }
+
+    private void operationRecordInsert(List<KuaishouOperationRecord> recordList, Integer operationTarget){
+        if(operationTarget == 1){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoAccount(recordList);
+        }else if(operationTarget == 2){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoCampaign(recordList);
+        }else if(operationTarget == 3){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoUnit(recordList);
+        }else if(operationTarget == 4){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoCreative(recordList);
+        }else if(operationTarget == 5){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoVideo(recordList);
+        }else if(operationTarget == 6){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoApp(recordList);
+        }else if(operationTarget == 7){
+            kuaishouOperationRecordMapper.insertOperationRecordInfoPackage(recordList);
+        }
+    }
+
+
+
+
+
+
+}

+ 4 - 4
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertisePlanController.java

@@ -81,18 +81,18 @@ public class ByteDanceAdvertisePlanController {
         String landingType = byteDanceAdvertisePlan.getLandingType();
         List<ByteDanceAdvertisePlan> byteDanceAdvertisePlanList = new ArrayList<>();
         try {
-            for (String name : names) {
+            names.forEach(name -> {
                 byteDanceAdvertisePlan.setName(name);
                 Map<String, Object> advertiserPlan = byteDanceAdvertisePlanService.createAdvertiserPlan(ctopOauthTokenService.getTokenByAccountId(Long.valueOf(byteDanceAdvertisePlan.getAccountId())), landingType, byteDanceAdvertisePlan);
                 if (advertiserPlan.get("code").equals(0)) {
-                    byteDanceAdvertisePlan.setId(((ByteDanceAdvertisePlan)advertiserPlan.get("data")).getId());
-                    byteDanceAdvertisePlanService.save((ByteDanceAdvertisePlan)advertiserPlan.get("data"));
+                    byteDanceAdvertisePlan.setId(((ByteDanceAdvertisePlan) advertiserPlan.get("data")).getId());
+                    byteDanceAdvertisePlanService.save((ByteDanceAdvertisePlan) advertiserPlan.get("data"));
                     byteDanceAdvertisePlanList.add(byteDanceAdvertisePlanService.getById(((ByteDanceAdvertisePlan) advertiserPlan.get("data")).getId()));
                 } else {
                     result.setCode(-200);
                     result.setMessage(advertiserPlan.get("message").toString());
                 }
-            }
+            });
         } catch (Exception e) {
             log.error(e.getMessage(), e);
             result.error500("操作失败");

+ 4 - 0
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java

@@ -147,6 +147,10 @@ public class ByteDanceAdvertisePlan {
     private Date createTime;
 
     private Date updateTime;
+
+    private BigDecimal lubanRoiGoal;
+
+    private BigDecimal roiGoal;
     /**
      *  受众公共参数
      */

+ 2 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertisePlanServiceImpl.java

@@ -78,8 +78,8 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         params.put("hide_if_converted", byteDanceAdvertisePlan.getHideIfConverted());
         params.put("hide_if_exists", byteDanceAdvertisePlan.getHideIfExists() == null ? 0 : byteDanceAdvertisePlan.getHideIfExists());
         params.put("converted_time_duration", byteDanceAdvertisePlan.getConvertedTimeDuration());
-        //params.put("luban_roi_goal",byteDanceAdvertisePlan.getLubanRoiGoal()==null?0.00:byteDanceAdvertisePlan.getFloat("lubanRoiGoal"));
-        //params.put("roi_goal",byteDanceAdvertisePlan.getFroiGoal")==null?0.00:byteDanceAdvertisePlan.getFloat("roiGoal"));
+        params.put("luban_roi_goal",byteDanceAdvertisePlan.getLubanRoiGoal());
+        params.put("roi_goal",byteDanceAdvertisePlan.getRoiGoal());
         //params.put("unique_fk",byteDanceAdvertisePlan.getUniqueFk")==null?"":byteDanceAdvertisePlan.getString("uniqueFk"));
         //params.put("smart_bid_type",byteDanceAdvertisePlan.getSmartBidType")==null?"":byteDanceAdvertisePlan.getString("smartBidType"));
         params.put("adjust_cpa", 0);