Browse Source

Merge branch 'test' of http://git.tjyourong.com.cn/ctop/adsp-boot into test

# Conflicts:
#	jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
yumeng 4 năm trước cách đây
mục cha
commit
221ce845fd
22 tập tin đã thay đổi với 342 bổ sung189 xóa
  1. 26 0
      jeecg-boot-module-system/pom.xml
  2. 3 6
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java
  3. 0 2
      jeecg-boot-module-system/src/main/resources/application-wps.yml
  4. 1 1
      jeecg-boot-module-system/src/main/resources/application.yml
  5. 9 19
      jeecg-boot-module-system/src/test/java/org/jeecg/SampleTest.java
  6. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccountDTO.java
  7. 37 32
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml
  8. 1 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/ByteDanceBatchController.java
  9. 82 35
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceAdvertisePlanController.java
  10. 0 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java
  11. 3 2
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java
  12. 1 10
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceAdvertisePlan.java
  13. 1 11
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCampaign.java
  14. 7 4
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCreative.java
  15. 107 50
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceAdvertisePlanServiceImpl.java
  16. 0 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCampaignServiceImpl.java
  17. 12 5
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java
  18. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java
  19. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceHomepageReportServiceImpl.java
  20. 1 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/LinkUtils.java
  21. 47 3
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ByteDanceQueryToolController.java
  22. 1 1
      module-toutiao/src/main/resources/bytedance_config.properties

+ 26 - 0
jeecg-boot-module-system/pom.xml

@@ -179,6 +179,32 @@
             <version>7.6.0.Final</version>
         </dependency>
 
+        <!--drools规则引擎-->
+        <dependency>
+            <groupId>org.drools</groupId>
+            <artifactId>drools-core</artifactId>
+            <version>7.6.0.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.drools</groupId>
+            <artifactId>drools-compiler</artifactId>
+            <version>7.6.0.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.drools</groupId>
+            <artifactId>drools-templates</artifactId>
+            <version>7.6.0.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-api</artifactId>
+            <version>7.6.0.Final</version>
+        </dependency>
+        <dependency>
+            <groupId>org.kie</groupId>
+            <artifactId>kie-spring</artifactId>
+            <version>7.6.0.Final</version>
+        </dependency>
     </dependencies>
 
     <dependencyManagement>

+ 3 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/wps/entity/WpsFile.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.wps.entity;
 
+import cn.com.ctop.common.module.annotation.Dict;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -40,8 +41,7 @@ public class WpsFile {
     @ApiModelProperty(value = "size")
 	private Integer size;
 	/**creator*/
-	@Excel(name = "creator", width = 15)
-    @ApiModelProperty(value = "creator")
+	@Dict(dicCode = "id",dictTable="sys_user",dicText="realname")
     private String creator;
 	/**createTime*/
 	@Excel(name = "createTime", width = 15)
@@ -60,13 +60,10 @@ public class WpsFile {
     @ApiModelProperty(value = "downloadUrl")
 	private String downloadUrl;
 	/**deleted*/
-	@Excel(name = "deleted", width = 15)
-    @ApiModelProperty(value = "deleted")
 	private String deleted;
 	/**canDelete*/
-	@Excel(name = "canDelete", width = 15)
-    @ApiModelProperty(value = "canDelete")
 	private String canDelete;
+	@Dict(dicCode = "id",dictTable="ctop_project",dicText="project_name")
 	private Long projectId;
 
 	private String code;

+ 0 - 2
jeecg-boot-module-system/src/main/resources/application-wps.yml

@@ -57,7 +57,6 @@ spring:
     exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
   datasource:
     url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#    url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
     username: hcst
     password: test@20190531
     driver-class-name: com.mysql.jdbc.Driver
@@ -97,7 +96,6 @@ spring:
       datasource:
         master:
           url: jdbc:mysql://139.186.27.96:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-#          url: jdbc:mysql://39.106.184.70:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
           username: hcst
           password: test@20190531
           driver-class-name: com.mysql.jdbc.Driver

+ 1 - 1
jeecg-boot-module-system/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: @activatedProperties@
+    active: test
   application:
     name: system-web
 #分页pageHelper

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

@@ -10,11 +10,10 @@ import cn.com.ctop.crawler.modules.pangolin.entity.PangolinApp;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinAppService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinCrawlerService;
 import cn.com.ctop.crawler.modules.pangolin.service.PangolinLoginService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.kuaishou.modules.graphql.service.IKuaishouWebInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceCampaignService;
-import cn.com.ctop.toutiao.modules.report.service.IReportService;
+import cn.com.ctop.toutiao.modules.material.service.IByteDanceCreativeService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.extern.slf4j.Slf4j;
@@ -47,25 +46,16 @@ public class SampleTest {
     @Autowired
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
-    private IReportService reportService;
-    @Autowired
-    private IKuaishouInterfaceService interfaceService;
+    private IByteDanceCreativeService creativeService;
 
     @Test
-    public void loadBytedanceCampaignData() {
-
-
-        CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(5975714L);
-
-        interfaceService.getCreativeList(oauthToken, null, null);
-               /* try {
-                 //   Thread.sleep(1000L);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                }*/
-
-
-
+    public void loadBytedanceCreativeData() {
+        /**
+         *
+         */
+        CtopOauthToken token = oauthTokenService.getTokenByAccountId(1649600126891015L);
+        creativeService.getAdvertiserCreative(token,null,null);
+//        advertiserDataService.getMaterialList(token);
     }
 
     @Autowired

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/entity/KuaishouReportDailyAccountDTO.java

@@ -50,4 +50,5 @@ public class KuaishouReportDailyAccountDTO implements Serializable {
     private Long photoId;
     private String url;
     private String coverUrl;
+    private Integer materialType;
 }

+ 37 - 32
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouReportDailyAccountMapper.xml

@@ -531,8 +531,8 @@
     </select>
 
     <select id="getKuaishouAccountInfoByProjectId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
-        select * from
-        (
+--         select * from
+--         (
         select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
@@ -608,15 +608,15 @@
         </if>
         group by a.account_id
         order by sum(a.charge) desc
-        )m
-        <if test="yn=1">
-            where
-            m.charge != 0
-        </if>
+<!--        )m-->
+<!--        <if test="yn=1">-->
+<!--            where-->
+<!--            m.charge != 0-->
+<!--        </if>-->
     </select>
 
     <select id="getKuaishouProjectInfo" resultType="cn.com.ctop.kuaishou.modules.report.entity.ProjectAccountDTO">
-        select* from (
+--         select* from (
              select
         #{yn} as 'yn',
             concat(#{startDate}, '~' , #{endDate}) as 'statDate',
@@ -691,17 +691,18 @@
                 #{item}
             </foreach>
             group by b.project_id
-        ) m
-        <if test="yn = 1">
-        where
-            m.charge != 0
-        </if>
+            order by sum(a.charge) desc
+<!--        ) m-->
+<!--        <if test="yn = 1">-->
+<!--        where-->
+<!--            m.charge != 0-->
+<!--        </if>-->
     </select>
 
     <!-- 计划汇总 -->
     <select id="getKuaishouCampaignInfoByAccountId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
-        select * from
-        (select
+--         select * from(
+        select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
         b.project_id as 'projectId',
@@ -776,17 +777,18 @@
         </if>
 
         group by a.campaign_id
-        ) m
+        order by sum(a.charge) desc
+<!--        ) m-->
 
-        <if test="yn = 1">
-            where
-            m.charge != 0
-        </if>
+<!--        <if test="yn = 1">-->
+<!--            where-->
+<!--            m.charge != 0-->
+<!--        </if>-->
     </select>
 
     <!-- 根据计划id获取组信息 -->
     <select id="getKuaishouUnitInfoByCampaignId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
-        select * from (
+--         select * from (
         select
         #{yn} as 'yn',
         concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
@@ -864,11 +866,12 @@
                 </foreach>
             </if>
             group by unit_id
-            ) m
-        <if test="yn = 1">
-            where
-            m.charge != 0
-        </if>
+            order by sum(a.charge) desc
+<!--            ) m-->
+<!--        <if test="yn = 1">-->
+<!--            where-->
+<!--            m.charge != 0-->
+<!--        </if>-->
     </select>
 
     <select id="queryProjectMemberByUserId" resultType="long">
@@ -964,7 +967,7 @@
     </select>
 
     <select id="getKuaishouCreativeInfoByUnitId" resultType="cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccountDTO">
-        select * from (
+--         select * from (
             select
         #{yn} as 'yn',
             concat(#{startDate}, '~' ,#{endDate}) as 'statDate',
@@ -1025,7 +1028,8 @@
             end
             ) as 'eventNextDayStayCost',  -- 次日留存成本
             (select url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as url,
-            (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl
+            (select cover_url from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as coverUrl,
+            (select material_type from ctop_kuaishou_video_get where photo_id = c.photo_id limit 1) as materialType
             from
             ctop_kuaishou_report_daily_creative a
             left join (select * from ctop_user_allocation group by account_id) b on a.account_id = b.account_id
@@ -1047,10 +1051,11 @@
                 </foreach>
             </if>
             group by a.creative_id
-        )m
-        <if test="yn=1">
-            where m.charge != 0
-        </if>
+            order by sum(a.charge) desc
+<!--        )m-->
+<!--        <if test="yn=1">-->
+<!--            where m.charge != 0-->
+<!--        </if>-->
     </select>
 
     <!-- 获取项目成员所在所有项目下的所有账户id -->

+ 1 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/batch/controller/ByteDanceBatchController.java

@@ -75,9 +75,8 @@ public class ByteDanceBatchController {
             if (Check.isNull(accountId)) {
                 throw new Exception("账户id不能为空");
             }
-
             QueryWrapper<ByteDanceVideoInfo> queryWrapper = new QueryWrapper<>();
-            if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
+            if (null!=startDate&&!"".equals(startDate.trim()) && null!=endDate&&!"".equals(endDate.trim())) {
                 queryWrapper.between("create_time", startDate+" 00:00:00", endDate+" 23:59:59");
             }
             if(null!=type&&type!=0){

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

@@ -1,9 +1,11 @@
 package cn.com.ctop.toutiao.modules.material.controller;
 
+import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.StringUtils;
 import cn.com.ctop.toutiao.modules.material.entity.ByteDanceAdvertisePlan;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertisePlanService;
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -43,19 +45,23 @@ public class ByteDanceAdvertisePlanController {
                                                                @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                                                HttpServletRequest req) {
         Result<IPage<ByteDanceAdvertisePlan>> result = new Result<>();
-        if(!accountId.isEmpty()){
+        if (!accountId.isEmpty()) {
             byteDanceAdvertisePlan.setAccountId(accountId);
         }
+        if(byteDanceAdvertisePlan.getToutiaoStatus()!=null){
+            String toutiaoStatus="AD_STATUS"+byteDanceAdvertisePlan.getToutiaoStatus();
+            byteDanceAdvertisePlan.setToutiaoStatus(toutiaoStatus);
+        }
         QueryWrapper<ByteDanceAdvertisePlan> queryWrapper = QueryGenerator.initQueryWrapper(byteDanceAdvertisePlan, req.getParameterMap());
         Page<ByteDanceAdvertisePlan> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceAdvertisePlan> pageList = byteDanceAdvertisePlanService.page(page, queryWrapper);
         //处理计划投放状态
-        if(!pageList.getRecords().isEmpty()){
-            pageList.getRecords().forEach(it->{
-                if(it.getToutiaoStatus().equals("AD_STATUS_DELIVERY_OK")){
-                    it.setStatus(true);
-                }else{
-                    it.setStatus(false);
+        if (!pageList.getRecords().isEmpty()) {
+            pageList.getRecords().forEach(it -> {
+                if (it.getToutiaoStatus().equals("AD_STATUS_DELIVERY_OK")) {
+                    it.setPlanStatus(true);
+                } else {
+                    it.setPlanStatus(false);
                 }
             });
         }
@@ -68,25 +74,25 @@ public class ByteDanceAdvertisePlanController {
      * 添加
      */
     @PostMapping(value = "/add")
-        public Result<List<ByteDanceAdvertisePlan>> add(@RequestBody ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
+    public Result<List<ByteDanceAdvertisePlan>> add(@RequestBody ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
 
         Result<List<ByteDanceAdvertisePlan>> result = new Result<>();
-        List<String> names= (List) byteDanceAdvertisePlan.getNames();
+        List<String> names = (List) byteDanceAdvertisePlan.getNames();
         String landingType = byteDanceAdvertisePlan.getLandingType();
-        List<ByteDanceAdvertisePlan> byteDanceAdvertisePlanList=new ArrayList<>();
+        List<ByteDanceAdvertisePlan> byteDanceAdvertisePlanList = new ArrayList<>();
         try {
-            names.forEach(name->{
+            for (String name : names) {
                 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(Long.valueOf(((Map)advertiserPlan.get("data")).get("ad_id").toString()));
-                    byteDanceAdvertisePlanService.save(byteDanceAdvertisePlan);
-                    byteDanceAdvertisePlanList.add(byteDanceAdvertisePlan);
-                }else {
+                if (advertiserPlan.get("code").equals(0)) {
+                    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("操作失败");
@@ -101,36 +107,77 @@ public class ByteDanceAdvertisePlanController {
     @PostMapping(value = "/edit")
     public Result<ByteDanceAdvertisePlan> edit(@RequestBody ByteDanceAdvertisePlan byteDanceAdvertisePlan) {
         Result<ByteDanceAdvertisePlan> result = new Result<>();
-        ByteDanceAdvertisePlan byteDanceAdvertisePlanEntity = byteDanceAdvertisePlanService.getById(byteDanceAdvertisePlan.getId());
-        if (byteDanceAdvertisePlanEntity == null) {
-            result.error500("未找到数据");
-        } else {
+        String landingType = byteDanceAdvertisePlan.getLandingType();
+        Map<String, Object> map = byteDanceAdvertisePlanService.updateAdvertiserPlan(ctopOauthTokenService.getTokenByAccountId(Long.valueOf(byteDanceAdvertisePlan.getAccountId())), landingType, byteDanceAdvertisePlan);
+        if(!map.get("code").equals(0)){
+            result.error500(map.get("message").toString());
+        }else {
             boolean ok = byteDanceAdvertisePlanService.updateById(byteDanceAdvertisePlan);
             if (ok) {
                 result.success("修改成功!");
-            }else {
+            } else {
                 result.error500("未知错误");
             }
         }
-
         return result;
     }
 
-    @PostMapping(value = "/batchEdit")
-    public Result<List<ByteDanceAdvertisePlan>> edit(@RequestBody List<ByteDanceAdvertisePlan> byteDanceAdvertisePlanList) {
+    @PostMapping(value = "/batchEdit/{operate}")
+    public Result<List<ByteDanceAdvertisePlan>> edit(@RequestBody List<ByteDanceAdvertisePlan> byteDanceAdvertisePlanList,
+                                                     @PathVariable String operate) {
         Result<List<ByteDanceAdvertisePlan>> result = new Result<>();
-        byteDanceAdvertisePlanList.forEach(it->{
-            ByteDanceAdvertisePlan byteDanceAdvertisePlanEntity = byteDanceAdvertisePlanService.getById(it.getId());
-            if (byteDanceAdvertisePlanEntity == null) {
-                result.error500("未找到数据");
-            } else {
-                boolean ok = byteDanceAdvertisePlanService.updateById(it);
-                if (ok) {
-                    result.success("修改成功!");
-                }else {
-                    result.error500("未知错误");
+        if (byteDanceAdvertisePlanList.isEmpty()) {
+            log.error("未选择数据");
+            result.error500("请选择数据");
+        }
+        CtopOauthToken token = ctopOauthTokenService.getTokenByAccountId(Long.valueOf(byteDanceAdvertisePlanList.get(0).getAccountId()));
+        try {
+            if ("status".equals(operate)) {
+                JSONArray adIds = new JSONArray();
+                String optStatus = byteDanceAdvertisePlanList.get(0).getOptStatus();
+                byteDanceAdvertisePlanList.forEach(it -> {
+                    adIds.add(it.getId());
+                });
+                Map<String, Object> map = byteDanceAdvertisePlanService.updateAdvertiserPlanStatus(token, adIds, optStatus);
+                if (!map.get("code").equals(0)) {
+                    result.error500(map.get("message").toString());
+                    return result;
+                }
+            } else if ("bid".equals(operate)) {
+                JSONArray adIds = new JSONArray();
+                JSONArray bids = new JSONArray();
+                byteDanceAdvertisePlanList.forEach(it -> {
+                    adIds.add(it.getId());
+                    bids.add(it.getBid());
+                });
+                Map<String, Object> map = byteDanceAdvertisePlanService.updateAdvertiserPlanBid(token, adIds, bids);
+                if (!map.get("code").equals(0)) {
+                    result.error500(map.get("message").toString());
+                    return result;
+                }
+            } else if ("budget".equals(operate)) {
+                JSONArray adIds = new JSONArray();
+                JSONArray budgets = new JSONArray();
+                byteDanceAdvertisePlanList.forEach(it -> {
+                    adIds.add(it.getId());
+                    budgets.add(it.getBudget());
+                });
+                Map<String, Object> map = byteDanceAdvertisePlanService.updateAdvertiserPlanBudget(token, adIds, budgets);
+                if (!map.get("code").equals(0)) {
+                    result.error500(map.get("message").toString());
+                    return result;
                 }
             }
+        } catch (Exception e) {
+            log.error("头条批量更新接口错误");
+        }
+        byteDanceAdvertisePlanList.forEach(it -> {
+            boolean ok = byteDanceAdvertisePlanService.updateById(it);
+            if (ok) {
+                result.success("修改成功!");
+            } else {
+                result.error500("未知错误");
+            }
         });
         result.setResult(byteDanceAdvertisePlanList);
         return result;

+ 0 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCampaignController.java

@@ -40,8 +40,6 @@ public class ByteDanceCampaignController {
 
     /**
      * 分页列表查询
-     *
-     * @param byteDanceCampaign
      * @param pageNo
      * @param pageSize
      * @param req

+ 3 - 2
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/controller/ByteDanceCreativeController.java

@@ -69,13 +69,14 @@ public class ByteDanceCreativeController {
             queryWrapper.like("title",name);
         }
         if(null!=status&&!status.trim().equals("")){
-            queryWrapper.eq("status","CREATIVE_STATUS_AD_"+status);
+            queryWrapper.eq("opt_status","CREATIVE_STATUS_"+status);
         }
+        queryWrapper.orderByDesc("creative_create_time");
         Page<ByteDanceCreative> page = new Page<>(pageNo, pageSize);
         IPage<ByteDanceCreative> pageList = byteDanceCreativeService.page(page, queryWrapper);
         List<ByteDanceCreative> records = pageList.getRecords();
         if(null!=records&&!records.isEmpty()){
-            List<ByteDanceCreative> creatives = records.stream().map(creative-> creative.setCreateStatus(creative.getStatus().equalsIgnoreCase("CAMPAIGN_STATUS_ENABLE"))).collect(Collectors.toList());
+            List<ByteDanceCreative> creatives = records.stream().map(creative-> creative.setCreateStatus(creative.getOptStatus().equalsIgnoreCase("CREATIVE_STATUS_ENABLE"))).collect(Collectors.toList());
             pageList.setRecords(creatives);
         }
         result.setSuccess(true);

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

@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -29,16 +28,9 @@ import java.util.Date;
 @Accessors(chain = true)
 @ApiModel(value = "ctop_bytedance_advertise_plan对象", description = "今日头条广告计划信息")
 public class ByteDanceAdvertisePlan {
-
-    /**
-     * 头条平台广告计划id
-     */
     @TableId
-    @ApiModelProperty(value = "头条平台广告计划id")
     private Long id;
 
-
-    // 账户Id
     @Dict(dicCode = "account_id",dictTable="ctop_user_allocation",dicText="auth_name")
     private String accountId;
 
@@ -51,7 +43,6 @@ public class ByteDanceAdvertisePlan {
     @TableField(exist=false)
     private String landingType;
 
-    // 广告组id
     @Dict(dicCode = "id",dictTable="ctop_bytedance_campaign",dicText="name")
     private Long campaignId;
 
@@ -81,7 +72,7 @@ public class ByteDanceAdvertisePlan {
     private String toutiaoStatus;
 
     //true:投放中 false:暂停
-    private Boolean status;
+    private Boolean planStatus;
 
     // 广告计划操作状态
     private String optStatus;

+ 1 - 11
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/entity/ByteDanceCampaign.java

@@ -34,20 +34,15 @@ public class ByteDanceCampaign {
      * 今日头条广告组id
      */
     @TableId
-    @ApiModelProperty(value = "今日头条广告组id")
     private Long id;
     private Long accountId;
     /**
      * 广告组名称
      */
-    @Excel(name = "广告组名称", width = 15)
-    @ApiModelProperty(value = "广告组名称")
     private String name;
     /**
      * 广告组预算
      */
-    @Excel(name = "广告组预算", width = 15)
-    @ApiModelProperty(value = "广告组预算")
     private BigDecimal budget;
     /**
      * 广告组预算类型
@@ -56,8 +51,6 @@ public class ByteDanceCampaign {
     private String budgetMode;
     /**
      * 广告组推广目的
-     */
-    /**
      * extendsValue在此处为固定值,切忌胡乱修改
      */
     @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "181afbae847dd3bc7e27795d89538c9c")
@@ -68,19 +61,16 @@ public class ByteDanceCampaign {
     @Excel(name = "广告组时间戳,用于更新时提交,服务端判断是否基于最新信息修改", width = 15)
     @ApiModelProperty(value = "广告组时间戳,用于更新时提交,服务端判断是否基于最新信息修改")
     private String modifyTime;
+
     @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "fbc3e2fc9e6f5cfa5f6aeddd4c3bf818")
     private String status;
     /**
      * 广告组创建时间
      */
-    @Excel(name = "广告组创建时间", width = 15)
-    @ApiModelProperty(value = "广告组创建时间")
     private String campaignCreateTime;
     /**
      * 广告组修改时间
      */
-    @Excel(name = "广告组修改时间", width = 15)
-    @ApiModelProperty(value = "广告组修改时间")
     private String campaignModifyTime;
     /**
      * createTime

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

@@ -61,6 +61,7 @@ public class ByteDanceCreative {
      */
     @Dict(dicCode = "item_value", dictTable = "sys_dict_item", dicText = "item_text",extendsKey = "dict_id",extendsValue = "57b60cec65bbc7cd3d6da4fbda589594")
     private String status;
+    private String optStatus;
     /**
      * 创意素材类型
      */
@@ -76,14 +77,12 @@ public class ByteDanceCreative {
     /**
      * 视频素材封面
      */
-    @Excel(name = "视频素材封面", width = 15)
-    @ApiModelProperty(value = "视频素材封面")
+    @Dict(dicCode = "id",dictTable="ctop_bytedance_image_info",dicText="image_url")
     private String imageId;
     /**
      * 视频id
      */
-    @Excel(name = "视频id", width = 15)
-    @ApiModelProperty(value = "视频id")
+    @Dict(dicCode = "id",dictTable="ctop_bytedance_video_info",dicText="video_url")
     private String videoId;
     /**
      * 创意审核信息
@@ -142,6 +141,10 @@ public class ByteDanceCreative {
         if (null != status && !"".equals(status.trim())) {
             this.status = status;
         }
+        String optStatus = dataObject.getString("opt_status");
+        if(null!=optStatus&&!"".equals(optStatus.trim())){
+            this.optStatus = optStatus;
+        }
         String imageMode = dataObject.getString("image_mode");
         if (null != imageMode && !"".equals(imageMode.trim())) {
             this.imageMode = imageMode;

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

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -55,7 +56,9 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         params.put("start_time", byteDanceAdvertisePlan.getStartTime());
         params.put("end_time", byteDanceAdvertisePlan.getEndTime());
         //广告投放时段
-        //params.put("schedule_time",byteDanceAdvertisePlan.getString("scheduleTime"));
+        if(!byteDanceAdvertisePlan.getScheduleTime().equals("")){
+            params.put("schedule_time",byteDanceAdvertisePlan.getScheduleTime());
+        }
         params.put("pricing", byteDanceAdvertisePlan.getPricing());
         params.put("bid", byteDanceAdvertisePlan.getBid());
         params.put("cpa_bid", byteDanceAdvertisePlan.getCpaBid());
@@ -65,7 +68,9 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
                 //查询必填参数convert_id
                 params.put("convert_id", byteDanceAdvertisePlan.getConvertId());
             }else{
-                params.put("convert_id",getConvertIdByExternalAction(byteDanceAdvertisePlan.getExternalAction()));
+                int convertId=getConvertIdByExternalAction(byteDanceAdvertisePlan.getExternalAction());
+                params.put("convert_id",convertId);
+                byteDanceAdvertisePlan.setConvertId((long) convertId);
             }
         }
         params.put("deep_bid_type", byteDanceAdvertisePlan.getDeepBidType());
@@ -124,7 +129,8 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_create"), params, headers));
         if (jsonObject.getInteger("code") == 0) {
             resultMap.put("code", 0);
-            resultMap.put("data",jsonObject.getJSONObject("data"));
+            byteDanceAdvertisePlan.setId(jsonObject.getJSONObject("data").getLong("ad_id"));
+            resultMap.put("data",byteDanceAdvertisePlan);
         } else {
             log.error("广告计划创建失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
             resultMap.put("code",-200);
@@ -138,53 +144,70 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
 
         Map<String, Object> resultMap = new HashMap<>();
 
-        Map<String, String> headers = new HashMap<>();
-        headers.put("Content-Type", "application/json");
-        headers.put("Access-Token", token.getAccessToken());
-
-        JSONObject params = new JSONObject();
-        params.put("advertiser_id", byteDanceAdvertisePlan.getAccountId());
-        params.put("ad_id", byteDanceAdvertisePlan.getId());
-        params.put("name", byteDanceAdvertisePlan.getName());
-        params.put("modify_time", byteDanceAdvertisePlan.getModifyTime());
-        params.put("budget", byteDanceAdvertisePlan.getBudget());
-        params.put("schedule_type", byteDanceAdvertisePlan.getScheduleType());
-        params.put("start_time", byteDanceAdvertisePlan.getStartTime());
-        params.put("end_time", byteDanceAdvertisePlan.getEndTime());
-        //广告投放时段
-        params.put("schedule_time",byteDanceAdvertisePlan.getScheduleTime());
-        params.put("bid", byteDanceAdvertisePlan.getBid());
-        params.put("cpa_bid", byteDanceAdvertisePlan.getCpaBid());
-        params.put("flow_control_mode", byteDanceAdvertisePlan.getFlowControlMode());
-        if (byteDanceAdvertisePlan.getPricing().equals("OCPM")) {
+        //查询记录,获取修改时间等字段
+        List adId=new ArrayList();
+        adId.add(byteDanceAdvertisePlan.getId());
+        Map<String, Object> map = queryAdByAdId(token, Long.valueOf(byteDanceAdvertisePlan.getAccountId()), adId);
+        if(!map.get("code").equals(0)){
+            log.error("获取修改时间接口错误");
+        }else {
+            Object modifyTime = ((Map) ((JSONObject) map.get("data")).getJSONArray("list").get(0)).get("modify_time");
+            Map<String, String> headers = new HashMap<>();
+            headers.put("Content-Type", "application/json");
+            headers.put("Access-Token", token.getAccessToken());
+
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", byteDanceAdvertisePlan.getAccountId());
+            params.put("ad_id", byteDanceAdvertisePlan.getId());
+            params.put("name", byteDanceAdvertisePlan.getName());
+            params.put("modify_time", modifyTime);
+            params.put("budget", byteDanceAdvertisePlan.getBudget());
+            params.put("schedule_type", byteDanceAdvertisePlan.getScheduleType());
+            params.put("start_time", byteDanceAdvertisePlan.getStartTime());
+            params.put("end_time", byteDanceAdvertisePlan.getEndTime());
+            //广告投放时段
+            if(!byteDanceAdvertisePlan.getScheduleTime().equals("")){
+                params.put("schedule_time",byteDanceAdvertisePlan.getScheduleTime());
+            }
+            params.put("bid", byteDanceAdvertisePlan.getBid());
+            params.put("cpa_bid", byteDanceAdvertisePlan.getCpaBid());
+            params.put("flow_control_mode", byteDanceAdvertisePlan.getFlowControlMode());
             params.put("convert_id", byteDanceAdvertisePlan.getConvertId());
-        }
-        params.put("deep_bid_type", byteDanceAdvertisePlan.getDeepBidType());
-        params.put("deep_cpabid", byteDanceAdvertisePlan.getDeepCpaBid());
-        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("audience_package_id",byteDanceAdvertisePlan.getLong("audiencePackageId"));
-        params.put("open_url", byteDanceAdvertisePlan.getOpenUrl());
-        //判断推广目的
-        if (landingType.equals("Link")) {
+            params.put("deep_bid_type", byteDanceAdvertisePlan.getDeepBidType());
+            params.put("deep_cpabid", byteDanceAdvertisePlan.getDeepCpaBid());
+            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("audience_package_id",byteDanceAdvertisePlan.getLong("audiencePackageId"));
+            params.put("adjust_cpa", 0);
+            //暂时不需要定向包id
+            //params.put("audience_package_id",byteDanceAdvertisePlan.getLong("audiencePackageId"));
+        /*if(byteDanceAdvertisePlan.getUseOpenUrl().equals("YES")){
+            params.put("open_url", byteDanceAdvertisePlan.getOpenUrl());
+        }*/
+            //判断推广目的
+        /*if (landingType.equals("LINK")) {
             params.put("external_url", byteDanceAdvertisePlan.getExternalUrl());
         }
         if (landingType.equals("APP")) {
-            params.put("download_type", byteDanceAdvertisePlan.getExternalUrl());
-
-        }
-        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update"), params, headers));
-        if (jsonObject.getInteger("code") != 0) {
-            log.error("广告计划创建失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
-            resultMap.put("code", -1);
-            resultMap.put("message", jsonObject.getString("message"));
-            return resultMap;
+            params.put("download_type", byteDanceAdvertisePlan.getDownloadType());
+            params.put("download_url", byteDanceAdvertisePlan.getDownloadUrl());
+            params.put("package", byteDanceAdvertisePlan.getToutiaoPackage());
+            params.put("app_type",byteDanceAdvertisePlan.getAppType());
+        }*/
+            JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpPostRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_update"), params, headers));
+            if (jsonObject.getInteger("code") != 0) {
+                log.error("广告计划修改失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+                resultMap.put("code", -1);
+                resultMap.put("message", jsonObject.getString("message"));
+                return resultMap;
+            }
+            resultMap.put("code", 0);
+            resultMap.put("message", "广告组状态修改成功");
         }
-        resultMap.put("code", 0);
-        resultMap.put("message", "广告组状态修改成功");
+
         return resultMap;
     }
 
@@ -194,7 +217,17 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         Map<String, String> headers = new HashMap<>();
         headers.put("Content-Type", "application/json");
         headers.put("Access-Token", token.getAccessToken());
-
+        switch (optStatus) {
+            case "AD_STATUS_DISABLE":
+                optStatus = "disable";
+                break;
+            case "AD_STATUS_ENABLE":
+                optStatus = "enable";
+                break;
+            case "AD_STATUS_DELETE":
+                optStatus = "delete";
+                break;
+        }
         JSONObject params = new JSONObject();
         params.put("advertiser_id", token.getAccountId());
         params.put("ad_ids", adIds.toJSONString());
@@ -220,8 +253,8 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         if (adIds.size() > 0) {
             for (int i = 0; i < adIds.size(); i++) {
                 JSONObject object = new JSONObject();
-                Long adId = (Long)adIds.get(i);
-                Long budget = (Long)budgets.get(i);
+                Long adId = Long.valueOf(adIds.get(i).toString());
+                Long budget = Long.valueOf(budgets.get(i).toString());
                 object.put("ad_id", adId);
                 object.put("budget", budget);
                 data.add(object);
@@ -255,8 +288,8 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         if (adIds.size() > 0) {
             for (int i = 0; i < adIds.size(); i++) {
                 JSONObject object = new JSONObject();
-                Long adId = (Long)adIds.get(i);
-                Long bid = (Long)bids.get(i);
+                Long adId = Long.valueOf(adIds.get(i).toString());
+                Long bid = Long.valueOf(bids.get(i).toString());
                 object.put("ad_id", adId);
                 object.put("bid", bid);
                 data.add(object);
@@ -375,6 +408,30 @@ public class ByteDanceAdvertisePlanServiceImpl extends ServiceImpl<ByteDanceAdve
         return byteDanceAdvertisePlanMapper.selectWarningCpaBid(accountId, maxCapBid);
     }
 
+    private Map<String, Object> queryAdByAdId(CtopOauthToken token, Long accountId, List adId){
+
+        Map<String, String> headers = new HashMap<>();
+        headers.put("Content-Type", "application/json");
+        headers.put("Access-Token", token.getAccessToken());
+
+        JSONObject params = new JSONObject();
+        params.put("advertiser_id", accountId);
+        Map<String, Object> filtering = new HashMap<>();
+        filtering.put("ids",adId);
+        params.put("filtering", filtering);
+        JSONObject jsonObject = JSONObject.parseObject(HttpUtils.httpGetRequest(PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get"), headers, params));
+        Map<String, Object> resultMap = new HashMap<>();
+        if (jsonObject.getInteger("code") == 0) {
+            resultMap.put("code", 0);
+            resultMap.put("data",jsonObject.getJSONObject("data"));
+        } else {
+            log.error("广告计划查询失败==》accountId:{},message:{}", token.getAccountId(), jsonObject.getString("message"));
+            resultMap.put("code",-200);
+            resultMap.put("message", jsonObject.getString("message"));
+        }
+        return resultMap;
+    }
+
     private int getConvertIdByExternalAction(String externalAction){
         int result=0;
         switch (externalAction) {

+ 0 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCampaignServiceImpl.java

@@ -124,7 +124,6 @@ public class ByteDanceCampaignServiceImpl extends ServiceImpl<ByteDanceCampaignM
             return resultMap;
         }
         this.getAdvertiserCampaign(token,campaignId+"",null);
-
         resultMap.put("code", 0);
         resultMap.put("message", "广告组信息修改成功");
         resultMap.put("success",true);

+ 12 - 5
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/ByteDanceCreativeServiceImpl.java

@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
@@ -173,19 +174,18 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
         data.put("ad_id", adId);
         String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2");
         JSONObject result = HttpUtils.bytedancePostRequest(token.getAccessToken(),url,data);
-        System.out.println(result);
         Integer code = result.getInteger("code");
         String message = result.getString("message");
         if (null == code || code != 0) {
             log.info("广告创意创建失败,accountId:{},message:{}", accountId, message);
             resultMap.put("success", false);
             resultMap.put("code", -1);
-            resultMap.put("message", message);
+            resultMap.put("message", "广告计划("+adId+"):"+message);
             return resultMap;
         }
         resultMap.put("success", true);
         resultMap.put("code", 0);
-        resultMap.put("message", "广告创意创建成功");
+        resultMap.put("message", "广告计划("+adId+"):"+"创意创建成功");
         return resultMap;
     }
 
@@ -294,7 +294,9 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
             Map<String,Object> getData = creativeCreate(accountId+"",planIds.getLong(i),params);
             array.add(getData);
         }
+        getAdvertiserCreative(token,null, DateUtils.formatDate());
         result.put("data",array);
+        ResultMapUtils.setResultMap(result,StatusCode.COMMON_SUCCESS);
         return result;
     }
 
@@ -528,8 +530,13 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
                     }
                     JSONArray dpaDictIds = creativeObject.getJSONArray("dpaDictIds");
                     creativeObject.remove("dpaDictIds");
-                    if(null!=creativeWordIds&&!creativeWordIds.isEmpty()){
-                        creativeObject.put("creative_word_ids",creativeWordIds);
+                    if(null!=dpaDictIds&&!dpaDictIds.isEmpty()){
+                        creativeObject.put("dpa_dict_ids",dpaDictIds);
+                    }
+                    String text = creativeObject.getString("text");
+                    creativeObject.remove("text");
+                    if(null!=text&&!"".equals(text.trim())){
+                        creativeObject.put("title",text);
                     }
                     Integer derivePosterCid = creativeObject.getInteger("derivePosterCid");
                     creativeObject.remove("derivePosterCid");

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -4,7 +4,7 @@ import cn.com.ctop.common.module.utils.CtopAdConstant;
 import cn.com.ctop.toutiao.modules.report.DTO.ByteDanceReportAccountDailyDTO;
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceAccountReportMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceAccountReportService;
-import cn.com.ctop.toutiao.modules.utils.LinkUtils;
+import cn.com.ctop.toutiao.modules.report.utils.LinkUtils;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageHelper;

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceHomepageReportServiceImpl.java

@@ -2,7 +2,7 @@ package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.toutiao.modules.report.mapper.BytedanceHomepageMapper;
 import cn.com.ctop.toutiao.modules.report.service.IBytedanceHomepageReportService;
-import cn.com.ctop.toutiao.modules.utils.LinkUtils;
+import cn.com.ctop.toutiao.modules.report.utils.LinkUtils;
 import com.alibaba.fastjson.JSONObject;
 import org.jeecg.common.constant.SystemDateConstant;
 import org.jeecg.common.util.DateUtils;

+ 1 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/utils/LinkUtils.java

@@ -1,4 +1,4 @@
-package cn.com.ctop.toutiao.modules.utils;
+package cn.com.ctop.toutiao.modules.report.utils;
 
 import com.alibaba.fastjson.JSONObject;
 

+ 47 - 3
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/tool/controller/ByteDanceQueryToolController.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.tool.controller;
 
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.toutiao.modules.tool.service.IByteDanceConvertToolService;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -9,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -35,10 +37,52 @@ public class ByteDanceQueryToolController {
                 landingType, appType, downloadType, externalUrl, toutiaoPackage, downloadUrl);
         if(!convertQueryMap.get("code").equals(0)){
             result.error500("查询转化目标结果失败");
-            return result;
+        }else{
+            ((List)((JSONObject)convertQueryMap.get("data")).get("list")).forEach(it->{
+                if(((Map)it).get("convert_type")!=null){
+                    ((Map)it).put("name",getName(((Map)it).get("convert_type").toString()));
+                }
+            });
+            result.setSuccess(true);
+            result.setResult(convertQueryMap);
         }
-        result.setSuccess(true);
-        result.setResult(convertQueryMap);
         return result;
     }
+
+    private String getName(String convertType){
+        String convertName="";
+        switch (convertType) {
+            case "AD_CONVERT_SOURCE_TYPE_INTERNAL":
+                convertName = "线索通";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_JS":
+                convertName = "代码检测转化";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_XPATH":
+                convertName = "应用下载API";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_H5_API":
+                convertName = "落地页API(H5)";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_SDK":
+                convertName = "应用下载SDK";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_OPEN_URL":
+                convertName = "应用直达API(应用直达链接)";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_NORMAL_APP_DOWNLOAD":
+                convertName = "普通应用下载";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_CONFIG":
+                convertName = "无转化跟踪";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_CPS_GAME":
+                convertName = "内部游戏cps应用下载";
+                break;
+            case "AD_CONVERT_SOURCE_TYPE_APP_API_TEMAI":
+                convertName = "落地页API(支持特卖)";
+                break;
+        }
+        return convertName;
+    }
 }

+ 1 - 1
module-toutiao/src/main/resources/bytedance_config.properties

@@ -16,7 +16,7 @@ bytedance_v2_advertiser_info=/2/advertiser/public_info/
 bytedance_v2_ad_get=/2/ad/get/
 bytedance_v2_advertiser_fund_daily_stat=/2/advertiser/fund/daily_stat/
 bytedance_v2_ad_create=/2/ad/create/
-bytedance_v2_ad_update=2/ad/update/
+bytedance_v2_ad_update=/2/ad/update/
 bytedance_v2_ad_update_status=/2/ad/update/status/
 bytedance_v2_ad_update_bid=/2/ad/update/bid/
 bytedance_v2_ad_update_budget=/2/ad/update/budget/