瀏覽代碼

Merge remote-tracking branch 'origin/master'

zhouzeyu@c-top.com.cn 3 年之前
父節點
當前提交
a1cf0ff2a1

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/config/Elasticsearch/ElasticsearchConfig.java

@@ -18,7 +18,7 @@ import java.util.ArrayList;
  * @author: zzy
  * @date: 2021-07-12
  */
-@Configuration
+// @Configuration
 public class ElasticsearchConfig {
     @Value("${elasticsearch.address}")
     private String address;

+ 37 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialInfoController.java

@@ -1,3 +1,4 @@
+/*
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
@@ -35,13 +36,15 @@ import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+*/
 /**
  * 素材信息
  *
  * @author jeecg-boot
  * @version V1.0
  * @date 2019-10-11
- */
+ *//*
+
 @Slf4j
 @Api(tags = "素材信息")
 @RestController
@@ -423,12 +426,14 @@ public class MaterialInfoController {
     }
 
 
-    /**
+    */
+/**
      * 添加
      *
      * @param materialInfo
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材信息-添加")
     @ApiOperation(value = "素材信息-添加", notes = "素材信息-添加")
     @PostMapping(value = "/add")
@@ -445,12 +450,14 @@ public class MaterialInfoController {
     }
 
 
-    /**
+    */
+/**
      * 批量修改产品
      *
      * @param jsonObject
      * @return
-     */
+     *//*
+
     @PostMapping(value = "/batchEdit")
     public Result<MaterialInfo> batchEdit(@RequestBody JSONObject jsonObject) {
         Result<MaterialInfo> result = new Result<>();
@@ -473,12 +480,14 @@ public class MaterialInfoController {
         return result;
     }
 
-    /**
+    */
+/**
      * 头条素材信息编辑
      *
      * @param materialInfo
      * @return
-     */
+     *//*
+
     @PutMapping(value = "/bytedance/edit")
     public Result<MaterialInfo> bytedanceEdit(@RequestBody MaterialInfo materialInfo) {
         Result<MaterialInfo> result = new Result<>();
@@ -634,12 +643,14 @@ public class MaterialInfoController {
 
     }
 
-    /**
+    */
+/**
      * 头条素材信息编辑 -- 批量通过审核
      *
      * @param materialInfo
      * @return
-     */
+     *//*
+
     @PutMapping(value = "/bytedance/batchedit")
     public Result<MaterialInfo> bytedanceBatchEdit(@RequestBody MaterialInfo materialInfo) {
         Result<MaterialInfo> result = new Result<>();
@@ -659,12 +670,14 @@ public class MaterialInfoController {
 
     }
 
-    /**
+    */
+/**
      * 通过id删除
      *
      * @param id
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材信息-通过id删除")
     @ApiOperation(value = "素材信息-通过id删除", notes = "素材信息-通过id删除")
     @DeleteMapping(value = "/delete")
@@ -689,12 +702,14 @@ public class MaterialInfoController {
         return Result.ok("删除成功!");
     }
 
-    /**
+    */
+/**
      * 批量删除
      *
      * @param ids
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材信息-批量删除")
     @ApiOperation(value = "素材信息-批量删除", notes = "素材信息-批量删除")
     @DeleteMapping(value = "/deleteBatch")
@@ -709,12 +724,14 @@ public class MaterialInfoController {
         return result;
     }
 
-    /**
+    */
+/**
      * 通过id查询
      *
      * @param id
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材信息-通过id查询")
     @ApiOperation(value = "素材信息-通过id查询", notes = "素材信息-通过id查询")
     @GetMapping(value = "/queryById")
@@ -874,9 +891,11 @@ public class MaterialInfoController {
         return result;
     }
 
-    /**
+    */
+/**
      * adlab 新加查询素材库接口
-     */
+     *//*
+
     @PostMapping(value = "/listByAccountIds")
     public Result<IPage<MaterialInfo>> listByAccountIds(@RequestBody JSONObject requestBody) {
 
@@ -898,3 +917,4 @@ public class MaterialInfoController {
     }
 
 }
+*/

+ 29 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialTagController.java

@@ -1,3 +1,4 @@
+/*
 package org.jeecg.modules.ctop.controller;
 
 import cn.com.ctop.common.module.annotation.AutoLog;
@@ -17,13 +18,15 @@ import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import java.util.Arrays;
 
+*/
 /**
  * 素材归属标
  *
  * @author jeecg-boot
  * @version V1.0
  * @date 2019-11-23
- */
+ *//*
+
 @Slf4j
 @Api(tags = "素材归属标")
 @RestController
@@ -32,7 +35,8 @@ public class MaterialTagController {
     @Autowired
     private IMaterialTagService materialTagService;
 
-    /**
+    */
+/**
      * 分页列表查询
      *
      * @param materialTag
@@ -40,7 +44,8 @@ public class MaterialTagController {
      * @param pageSize
      * @param req
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-分页列表查询")
     @ApiOperation(value = "素材归属标-分页列表查询", notes = "素材归属标-分页列表查询")
     @GetMapping(value = "/list")
@@ -57,12 +62,14 @@ public class MaterialTagController {
         return result;
     }
 
-    /**
+    */
+/**
      * 添加
      *
      * @param materialTag
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-添加")
     @ApiOperation(value = "素材归属标-添加", notes = "素材归属标-添加")
     @PostMapping(value = "/add")
@@ -78,12 +85,14 @@ public class MaterialTagController {
         return result;
     }
 
-    /**
+    */
+/**
      * 编辑
      *
      * @param materialTag
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-编辑")
     @ApiOperation(value = "素材归属标-编辑", notes = "素材归属标-编辑")
     @PutMapping(value = "/edit")
@@ -102,12 +111,14 @@ public class MaterialTagController {
         return result;
     }
 
-    /**
+    */
+/**
      * 通过id删除
      *
      * @param id
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-通过id删除")
     @ApiOperation(value = "素材归属标-通过id删除", notes = "素材归属标-通过id删除")
     @DeleteMapping(value = "/delete")
@@ -121,12 +132,14 @@ public class MaterialTagController {
         return Result.ok("删除成功!");
     }
 
-    /**
+    */
+/**
      * 批量删除
      *
      * @param ids
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-批量删除")
     @ApiOperation(value = "素材归属标-批量删除", notes = "素材归属标-批量删除")
     @DeleteMapping(value = "/deleteBatch")
@@ -141,12 +154,14 @@ public class MaterialTagController {
         return result;
     }
 
-    /**
+    */
+/**
      * 通过id查询
      *
      * @param id
      * @return
-     */
+     *//*
+
     @AutoLog(value = "素材归属标-通过id查询")
     @ApiOperation(value = "素材归属标-通过id查询", notes = "素材归属标-通过id查询")
     @GetMapping(value = "/queryById")
@@ -162,3 +177,4 @@ public class MaterialTagController {
         return result;
     }
 }
+*/

File diff suppressed because it is too large
+ 74 - 45
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java


+ 5 - 9
jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java

@@ -21,6 +21,7 @@ import cn.com.ctop.kuaishou.modules.material.service.IEtlKuaishouVideoInfoServic
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouAudienceReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyImageService;
+import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
 import cn.com.ctop.oa.modules.service.IWechatNoListService;
 import cn.com.ctop.toutiao.modules.link.service.IETLReportBytedanceVideoService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
@@ -96,19 +97,14 @@ public class SampleTest {
     private IKuaiShouDimensionStrategyService dimensionStrategyService;
     @Autowired
     private IKuaiShouDimensionVariableService dimensionVariableService;
+    @Autowired
+    IRuleKuaiShouPlanService ruleKuaiShouPlanService;
 
 
     @Test
     public void loadKuaishouCookie() throws ParseException {
-      //  JSONArray dimensionVariableList = kuaiShouDimensionVariableService.getDimensionVariableList(1L);
-        JSONArray array = new JSONArray();
-        array.add(1);
-        array.add(2);
-        array.add(3);
-        // dimensionStrategyService.create(1L, array);
-        JSONArray dimensionVariableList = dimensionVariableService.getDimensionVariableList(8L); // 获取变量排列组合
-
-        System.err.println(dimensionVariableList);
+        CtopOauthToken oauthToken = tokenService.getTokenByAccountId(10571378L);
+        ruleKuaiShouPlanService.cleanRuleDataTarget(10571378L, oauthToken.getAccessToken(), 1);
     }
 
 

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

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
 
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 快手预警指标数据
  */
@@ -61,4 +63,9 @@ public class RuleDataTargetKuaishou {
 	private java.util.Date createTime;
 	private java.util.Date updateTime;
 
+	private BigDecimal cpaBid;
+	private Integer ocpxActionType;
+	private Integer deepConversionType;
+	private BigDecimal deepConversionBid;
+
 }

+ 3 - 11
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java

@@ -72,11 +72,7 @@ public class RuleDateUnitKuaishou {
     /**
      * 深度转化目标出价
      */
-    private BigDecimal deepConversionBid;
-    /**
-     * 深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无
-     */
-    private Integer deepConversionType;
+
     /**
      * 安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;
      */
@@ -85,16 +81,12 @@ public class RuleDateUnitKuaishou {
      * 优化目标
      * 2:行为数;180:激活数;53:表单数;190: 付费;191:首日ROI;324:唤起应用;348:有效线索;383: 授信;384: 完件;394:订单提交;;396:注册
      */
-    private Integer ocpxActionType;
-    /**
-     * 付费单价
-     */
+
+
     private BigDecimal payCost;
     /**
      * 出价
      */
-    private BigDecimal cpaBid;
-
     private Integer status;
 
     private java.util.Date createTime;

+ 10 - 3
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/RuleDataTargetKuaishouMapper.xml

@@ -17,7 +17,6 @@
         is_open,
         schedule_time,
         status,
-
         platform_os,
         app_store,
         population,
@@ -26,7 +25,11 @@
         business_interest,
         network,
         create_time,
-        update_time
+        update_time,
+        deep_conversion_bid,
+        deep_conversion_type,
+        cpa_bid,
+        ocpx_action_type
         )
         values
         <foreach collection="add" item="add" separator=",">
@@ -52,7 +55,11 @@
             #{add.businessInterest},
             #{add.network},
             #{add.createTime},
-            #{add.updateTime}
+            #{add.updateTime},
+            #{add.deepConversionBid},
+            #{add.deepConversionType},
+            #{add.cpaBid},
+            #{add.ocpxActionType}
             )
         </foreach>
 

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

@@ -20,11 +20,7 @@
         form_cost,
         event_pay,
         pay_cost,
-        deep_conversion_bid,
-        deep_conversion_type,
         android_osv,
-        cpa_bid,
-        ocpx_action_type,
         status,
         create_time,
         update_time
@@ -49,11 +45,7 @@
             #{add.formCost},
             #{add.eventPay},
             #{add.payCost},
-            #{add.deepConversionBid},
-            #{add.deepConversionType},
             #{add.androidOsv},
-            #{add.cpaBid},
-            #{add.ocpxActionType},
             #{add.status},
             #{add.createTime},
             #{add.updateTime}

+ 5 - 4
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/RuleKuaiShouDataTargetCleanJob.java

@@ -27,17 +27,18 @@ public class RuleKuaiShouDataTargetCleanJob {
 
     /**
      * 快手规则引擎定向数据
+     *
      * @throws Exception
      */
     @XxlJob("ruleKuaiShouDataTargetCleanJob")
     public void execute() throws Exception {
         XxlJobHelper.log("规则预警定向维度数据开始清洗");
         List<CtopOauthToken> tokens = oauthTokenService.queryKsValidRuleAccountsToken();
-        tokens.forEach(token -> executorService.submit(() ->{
-            Map<String,Object>params = new HashMap<>();
-            params.put("account_id",token.getAccountId());
+        tokens.forEach(token -> executorService.submit(() -> {
+            Map<String, Object> params = new HashMap<>();
+            params.put("account_id", token.getAccountId());
             ruleDataTargetKuaishouService.removeByMap(params);
-            ruleKuaiShouPlanService.cleanRuleDataTarget(token.getAccountId(), 1);
+            ruleKuaiShouPlanService.cleanRuleDataTarget(token.getAccountId(), token.getAccessToken(), 1);
         }));
     }
 

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

@@ -1221,7 +1221,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
             return;
         }
         addGroup(token.getAccountId(), details);
-        ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
+     //   ruleKuaiShouPlanService.insertTarget(token.getAccountId(), details);
         getGroupListByPage(token, startDate, endDate, page + 1);
     }
 

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

@@ -22,7 +22,7 @@ public interface IRuleKuaiShouPlanService extends IService<RuleDatePlanKuaishou>
     /**
      * 定向
      */
-    void cleanRuleDataTarget(Long accountId, int page);
+    void cleanRuleDataTarget(Long accountId,String accessToken, int page);
 
 
     void insertTarget(Long accountId, JSONArray details);

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

@@ -20,6 +20,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.xxl.job.core.context.XxlJobHelper;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -111,17 +112,21 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
     }
 
     @Override
-    public void cleanRuleDataTarget(Long accountId, int page) {
+    public void cleanRuleDataTarget(Long accountId, String accessToken, int page) {
         JSONObject param = new JSONObject();
         param.put("advertiser_id", accountId);
         param.put("page_size", 500);
         param.put("page", page);
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        param.put("start_date", nowDate);
+        param.put("end_date", nowDate);
 
         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/ad_unit/list", param.toJSONString(), headers);
+        System.err.println(result);
         JSONObject resultJson = JSONObject.parseObject(result);
         if (Check.isNull(resultJson)) {
             XxlJobHelper.log("获取定向信息接口异常,advertiserId:{}", accountId);
@@ -138,7 +143,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         }
 
         this.insertTarget(accountId, details);
-        cleanRuleDataTarget(accountId, page + 1);
+        cleanRuleDataTarget(accountId, accessToken, page + 1);
     }
 
     private void insertPlan(Long accountId, JSONArray details) {
@@ -183,10 +188,6 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                     unit.setUnitId(unitDetail.getLong("unit_id"));
                     unit.setUnitName(unitDetail.getString("unit_name"));
                     unit.setCharge(unitDetail.getBigDecimal("charge"));
-                    unit.setDeepConversionBid(new BigDecimal(group.getDeepConversionBid()).divide(new BigDecimal("1000")));
-                    unit.setDeepConversionType(group.getDeepConversionType());
-                    unit.setOcpxActionType(group.getOcpxActionType());
-                    unit.setCpaBid(new BigDecimal(group.getCpaBid()).divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP));
                     //未知优化目标数据存空
                     if (group.getOcpxActionType() != 0) {
                         unit.setConvertNum(handleConvertNum(group.getOcpxActionType(), unitDetail));
@@ -201,7 +202,6 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
 
         });
         if (!batch.isEmpty()) {
-            //  unitKuaishouService.saveOrUpdateBatch(batch);
             unitKuaishouService.replaceBatch(batch);
         }
     }
@@ -261,6 +261,11 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
 
                 Integer isOpen = unitDetail.getJSONObject("target").getJSONObject("intelli_extend").getInteger("is_open");
                 target.setIsOpen(isOpen == null ? 0 : isOpen);
+
+                target.setDeepConversionBid(new BigDecimal(unitDetail.getLong("deep_conversion_bid")).divide(new BigDecimal("1000")));
+                target.setDeepConversionType(unitDetail.getInteger("deep_conversion_bid"));
+                target.setOcpxActionType(unitDetail.getInteger("ocpx_action_type"));
+                target.setCpaBid(new BigDecimal(unitDetail.getLong("cpa_bid")).divide(new BigDecimal("1000"), 2, RoundingMode.HALF_UP));
                 target.setScheduleTime(unitDetail.getString("schedule_time") == null ? "" : unitDetail.getString("schedule_time"));
                 target.setCreateTime(new Date());
                 target.setUpdateTime(new Date());