Ver código fonte

代码逻辑修改

syh 5 anos atrás
pai
commit
22a1eb2651

+ 28 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/ByteDanceTemplateController.java

@@ -9,7 +9,6 @@ import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.modules.ctop.entity.*;
 import org.jeecg.modules.ctop.service.*;
-import org.jeecg.modules.system.entity.SysDictItem;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -33,7 +32,7 @@ public class ByteDanceTemplateController {
 
     /**
      * 广告组模板
-     *
+     * 完成
      * @param template
      * @param req
      * @return
@@ -68,7 +67,7 @@ public class ByteDanceTemplateController {
     }
 
     /**
-     * 用户定向
+     * 广告计划模板
      *
      * @param template
      * @param req
@@ -80,7 +79,7 @@ public class ByteDanceTemplateController {
     }
 
     /**
-     * 预算与出价模板
+     * 用户定向模板列表
      *
      * @param template
      * @param req
@@ -114,6 +113,31 @@ public class ByteDanceTemplateController {
     }
 
     /**
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     * @功能:获取广告组列表信息
+     */
+    @PostMapping(value = "campaign/data/list")
+    public Result<IPage<ByteDanceCampaign>> audiencePageList(ByteDanceCampaign campaign, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest req) {
+        Result<IPage<ByteDanceCampaign>> result = new Result<>();
+        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        campaign.setAdvertiserId(user.getId());
+        QueryWrapper<ByteDanceCampaign> queryWrapper = QueryGenerator.initQueryWrapper(campaign, req.getParameterMap());
+        queryWrapper.eq("advertiser_id", campaign.getAdvertiserId()).orderByAsc("id");
+        Page<ByteDanceCampaign> page = new Page<>(pageNo, pageSize);
+        IPage<ByteDanceCampaign> pageList = campaignService.page(page, queryWrapper);
+        result.setSuccess(true);
+        result.setResult(pageList);
+        return result;
+    }
+
+    @Autowired
+    private IByteDanceCampaignService campaignService;
+
+    /**
      * 投放目标
      *
      * @param template

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/ByteDanceCampaign.java

@@ -177,5 +177,6 @@ public class ByteDanceCampaign {
 		this.budget = new BigDecimal(template.getBudgetDaily());
 		this.landingType = template.getPromotionPurpuse();
 		this.toutiaoId = token.getAccountId();
+		this.templateId = template.getId();
 	}
 }

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/entity/BytedanceAdvertisePlanTemplate.java

@@ -86,6 +86,13 @@ public class BytedanceAdvertisePlanTemplate {
     private Integer status;
 
     /**
+     * 模板名称
+     */
+    @Excel(name = "模板名称", width = 15)
+    @ApiModelProperty(value = "模板名称")
+    private String name;
+
+    /**
      * createTime
      */
     @ApiModelProperty(value = "createTime")

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -709,7 +709,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         if (null == code || !code.equals(0)) {
             logger.info("创建广告组接口异常==》accountId:{},message:{}", token.getAccountId(), result.getString("message"));
             resultMap.put("code", -1);
-            resultMap.put("message", "创建广告组接口异常");
+            resultMap.put("message", result.getString("message"));
             return resultMap;
         }
         JSONObject data = result.getJSONObject("data");

+ 28 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/BytedanceAdvertisePlanTemplateServiceImpl.java

@@ -1,10 +1,13 @@
 package org.jeecg.modules.ctop.service.impl;
 
+import com.alibaba.fastjson.JSONObject;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.ctop.entity.ByteDanceBudgetTemplate;
 import org.jeecg.modules.ctop.entity.BytedanceAdvertisePlanTemplate;
 import org.jeecg.modules.ctop.entity.CTopOauthToken;
 import org.jeecg.modules.ctop.mapper.BytedanceAdvertisePlanTemplateMapper;
+import org.jeecg.modules.ctop.service.IByteDanceAdvertisePlanService;
 import org.jeecg.modules.ctop.service.IBytedanceAdvertisePlanTemplateService;
 import org.jeecg.modules.ctop.service.ICTopOauthTokenService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,14 +34,35 @@ public class BytedanceAdvertisePlanTemplateServiceImpl extends ServiceImpl<Byted
         CTopOauthToken token = tokenService.getOAuthTokenByAccountId(user.getId());
         template.setAccountId(token.getAccountId());
         template.setAdvertiserId(token.getAdvertiserId());
-//        template.setStatus(1);
+        template.setStatus(1);
         templateMapper.insert(template);
-        resultMap.put("success", true);
-        resultMap.put("message", "投放目标模板保存成功");
-        return resultMap;
+        //同步线上广告计划信息
+        String accountId = "e9ca23d68d884d4ebb19d07889727dae";
+        Long campaignId = template.getCampaignTemplateId();
+//        ByteDanceBudgetTemplate budgetTemplate = bu
+        JSONObject data = new JSONObject();
+        data.put("campaign_id", campaignId);
+        data.put("delivery_range", "DEFAULT");
+        data.put("budget_mode", "BUDGET_MODE_DAY");
+        data.put("budget", 2000);//需要大于bid
+        data.put("bid", 100);
+        data.put("start_time", "2019-07-30 01:00");
+        data.put("end_time", "2019-07-31 01:00");
+        data.put("pricing", "PRICING_CPM");
+        data.put("schedule_type", "SCHEDULE_FROM_NOW");
+        data.put("flow_control_mode", "FLOW_CONTROL_MODE_FAST");
+        data.put("name", "测试计划名称");
+        data.put("external_url", "https://lordsmobile.176.com/download.php");
+        data.put("download_url", "https://lordsmobile.176.com/download.php");
+        data.put("download_type", "DOWNLOAD_URL");//坑
+        data.put("package", "com.igg.android.lordsmobile_cn");//坑
+        data.put("app_type", "APP_ANDROID");//坑
+        return advertisePlanService.advertiserPlanCreate(accountId, campaignId, data.toJSONString());
     }
 
     @Autowired
+    private IByteDanceAdvertisePlanService advertisePlanService;
+    @Autowired
     private BytedanceAdvertisePlanTemplateMapper templateMapper;
     @Autowired
     private ICTopOauthTokenService tokenService;

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

@@ -90,9 +90,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.0.23:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
-          username: hcst
-          password: 123456
+          url: jdbc:mysql://localhost:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false
+          username: root
+          password: root
           driver-class-name: com.mysql.jdbc.Driver
           # 多数据源配置
           #multi-datasource1: