Jelajahi Sumber

Merge branch 'test'

yangzian 3 tahun lalu
induk
melakukan
134500d72f

+ 6 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingService.java

@@ -81,4 +81,10 @@ public interface MarketingService {
 
     Result getCreativeComponent(CtopOauthToken token);
 
+    Result getEventAssets(CtopOauthToken token,String landingType);
+
+    Result getConvertOptimized(CtopOauthToken token,String landingType,String marketingPurpose,String assetType,String appType,String packageName);
+
+    Result getOptimizedTrackUrl(CtopOauthToken token,Long assetId,String downloadUrl);
+
 }

+ 127 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/dockapi/MarketingServiceImpl.java

@@ -1279,4 +1279,131 @@ public class MarketingServiceImpl implements MarketingService{
     }
 
 
+    /**
+     *  获取已创建资产列表
+     * @param token
+     * @param landingType
+     * @return
+     */
+    public Result getEventAssets(CtopOauthToken token,String landingType) {
+        JSONObject params = new JSONObject();
+        //params.put("advertiser_id", 1700992275550222L);
+       // params.put("asset_type", landingType);
+        params.put("page", 1);
+        params.put("page_size", 30);
+        //params = Check.jsonRemoveEmpty(params);
+        log.info("params======{}",params);
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_event_assets")+"?advertiser_id="+token.getAccountId()+"&asset_type="+landingType,params);
+        log.info("result======{}",jsonObject);
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+        if (null == code || !code.equals(0)) {
+            log.info("查询资产列表接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONObject dataList = jsonObject.getJSONObject("data");
+        if (null == dataList || dataList.isEmpty()) {
+            log.info("查询资产列表不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("查询资产列表不存在");
+        }
+
+        return Result.successMsg("查询资产列表成功",dataList);
+    }
+
+
+
+
+    /**
+     * Author: zianY
+     * Description: 资产-获取优化目标列表
+     *------------
+     * @param
+     * @param landingType 广告组推广目的,允许值:LINK 销售线索收集、LIVE 直播间推广、SHOP电商店铺推广、APP 应用、QUICK_APP 快应用
+     * @param marketingPurpose 营销目的,允许值:CONVERSION 行动转化、INTENTION 用户意向、ACKNOWLEDGE 品牌认知
+     * @param assetType 资产类型,允许值:THIRD_EXTERNAL 三方落地页、TETRIS_EXTERNAL 建站、APP 应用、QUICK_APP 快应用
+     * @param appType 应用类型,当asset_type为应用APP时必填 可选值:ANDROID 、IOS
+     * @param packageName 应用类型,当asset_type为应用APP时必填 可选值:ANDROID 、IOS
+     *------------
+     * Return org.jeecg.common.api.vo.Result
+     */
+    @Override
+    public Result getConvertOptimized(CtopOauthToken token, String landingType,String marketingPurpose,String assetType,String appType,String packageName) {
+
+        JSONObject params = new JSONObject();
+        //params.put("page", 1);
+        //params.put("page_size", 30);
+        log.info("params======{}",params);
+
+        String str = "?advertiser_id="+token.getAccountId()+
+                    "&landing_type="+landingType+
+                    "&marketing_purpose="+marketingPurpose+
+                    "&asset_type="+assetType+
+                    "&app_type="+appType+
+                    "&package_name="+packageName;
+
+
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                    urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_event_convert_optimized")+str,params);
+        log.info("result======{}",jsonObject);
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+        if (null == code || !code.equals(0)) {
+            log.info("查询资产-优化目标列表接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONObject dataList = jsonObject.getJSONObject("data");
+        if (null == dataList || dataList.isEmpty()) {
+            log.info("查询资产-优化目标不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("查询资产-优化目标不存在");
+        }
+
+        return Result.successMsg("资产-优化目标",dataList);
+
+    }
+
+
+
+    /**
+     * Author: zianY
+     * Description: 查询事件资产下的监测链接
+     *------------
+     * @param token
+     * @param assetId 资产ID
+     *------------
+     * Return org.jeecg.common.api.vo.Result
+     */
+    @Override
+    public Result getOptimizedTrackUrl(CtopOauthToken token, Long assetId,String downloadUrl) {
+
+
+        JSONObject params = new JSONObject();
+        //params.put("page", 1);
+        //params.put("page_size", 30);
+        //log.info("params======{}",params);
+
+        String str = "?advertiser_id="+token.getAccountId()+
+                    "&asset_id="+assetId+
+                    "&download_url="+downloadUrl;
+
+
+        JSONObject jsonObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(),
+                    urlPath+ PropertiesUtils.getValue("bytedance_config", "bytedance_v2_event_track_url")+str,params);
+        log.info("result======{}",jsonObject);
+        Integer code = jsonObject.getInteger("code");
+        String message = jsonObject.getString("message");
+        if (null == code || !code.equals(0)) {
+            log.info("查询事件资产下的监测链接接口异常==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error(message);
+        }
+        JSONObject dataList = jsonObject.getJSONObject("data");
+        if (null == dataList || dataList.isEmpty()) {
+            log.info("查询事件资产下的监测链接不存在==》accountId:{},message:{}", token.getAccountId(), message);
+            return Result.error("查询事件资产下的监测链接不存在");
+        }
+
+        return Result.successMsg("获取事件资产下的监测链接",dataList);
+    }
+
+
 }

+ 26 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/entity/AiBytedanceAdvertiserStrategy.java

@@ -353,4 +353,30 @@ public class AiBytedanceAdvertiserStrategy{
 	/**广告文案数量*/
 	private Integer copywritingNumber;
 
+
+	/**
+	 *资产id
+	 */
+	private Long adAssetIds;
+	/**
+	 * 优化目标
+	 */
+	private String adExternalAction;
+	/**
+	 * 深度优化目标
+	 */
+	private String adDeepExternalAction;
+	/**
+	 * 监测链接类型
+	 */
+	private String adTrackUrlGroupType;
+	/**
+	 * 监测链接组
+	 */
+	private Long adTrackUrlGroupId;
+
+
+
+
+
 }

+ 1 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/IMonitorBytedanceService.java

@@ -23,5 +23,5 @@ public interface IMonitorBytedanceService{
 
     Result selectAccountActionTrackUrlList(String accountId, String warningFlag, Set<String> operatorUserIds, Integer pageNum, Integer pageSize);
 
-    void trackUrlContrast(CtopOauthToken token,String accountId,String converId,String planId);
+    void trackUrlContrast(CtopOauthToken token,String accountId,Long assetId,String downloadUrl,String planId);
 }

+ 37 - 4
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -196,7 +196,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 adDplinkInfo.setImageMode(creativeImageMode);
                 adDplinkInfoService.save(adDplinkInfo);
 
-                monitorBytedanceService.trackUrlContrast(token,String.valueOf(strategy.getAccountId()),String.valueOf(strategy.getAdConvertId()),String.valueOf(adId));
+                monitorBytedanceService.trackUrlContrast(token,String.valueOf(strategy.getAccountId()),strategy.getAdAssetIds(),strategy.getAdDownloadUrl(),String.valueOf(adId));
                 log.info("账户id:{};==========不使用dp链接=======校验第三方监测链接==============>{};message==>{}",strategy.getAccountId());
 
                 BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
@@ -281,7 +281,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 adDplinkInfo.setImageMode(creativeImageMode);
                 adDplinkInfoService.save(adDplinkInfo);
 
-                monitorBytedanceService.trackUrlContrast(token,String.valueOf(strategy.getAccountId()),String.valueOf(strategy.getAdConvertId()),String.valueOf(adId));
+                monitorBytedanceService.trackUrlContrast(token,String.valueOf(strategy.getAccountId()),strategy.getAdAssetIds(),strategy.getAdDownloadUrl(),String.valueOf(adId));
                 log.info("账户id:{};==========使用dp链接=======校验第三方监测链接==============>{};message==>{}",strategy.getAccountId());
 
                 BytedanceAiVideoCreativeLog creativeLog = new BytedanceAiVideoCreativeLog(strategy,adId,campaignId,video);
@@ -770,10 +770,43 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if(!Check.isNull(strategy.getAdDownloadMode())){
             params.put("download_mode",strategy.getAdDownloadMode());
         }
-        if(!Check.isNull(strategy.getAdConvertId())){
-            params.put("convert_id",strategy.getAdConvertId());
+
+
+        // convert_id 对接废弃 改为 '事件管理'
+        //if(!Check.isNull(strategy.getAdConvertId())){
+        //    params.put("convert_id",strategy.getAdConvertId());
+        //}
+
+        if(!Check.isNull(strategy.getAdAssetIds())){
+            params.put("asset_ids",Arrays.asList(strategy.getAdAssetIds()));
+        }
+
+        if(!Check.isNull(strategy.getAdExternalAction())){
+            params.put("external_action",strategy.getAdExternalAction());
         }
 
+        if(!Check.isNull(strategy.getAdDeepExternalAction())){
+            params.put("deep_external_action",strategy.getAdDeepExternalAction());
+        }
+
+//        if(!Check.isNull(strategy.getAdTrackUrlGroupType())){
+//            params.put("track_url_group_type",strategy.getAdTrackUrlGroupType());
+//        }
+
+        params.put("track_url_group_type","TRACK_URL_GROUP_ID");
+
+        if(!Check.isNull(strategy.getAdTrackUrlGroupId())){
+            params.put("track_url_group_id",strategy.getAdTrackUrlGroupId());
+        }
+
+
+
+
+
+
+
+
+
         if(!Check.isNull(strategy.getAdOpenUrl())){
             params.put("open_url",strategy.getAdOpenUrl());
         }

+ 16 - 9
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/MonitorBytedanceServiceImpl.java

@@ -178,7 +178,7 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
             //根据账户 查询头条计划中的 点击监测链接
             List<MonitorBytedanceAdVo> actionTrackUrlList = monitorBytedanceActionTrackUrlMapper.getBytedancPlanActionTrackUrl(Long.valueOf(accountInfo.getAccountId()));
             if(Check.isNull(actionTrackUrlList)){
-                log.info("accountId:=={}====暂无计划信息============",accountInfo.getAccountId());
+                log.info("accountId:=={}====计划暂无监测链接信息============",accountInfo.getAccountId());
                 continue;
                 //return Result.successMsg("accountId:=={"+accountInfo.getAccountId()+"}====暂无计划信息============。",null);
             }
@@ -189,7 +189,7 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
                     //关停计划
                     CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountInfo.getAccountId()));
                     marketingServiceImpl.updPlanStatus(token, Arrays.asList(Long.valueOf(actiontrackUrl.getPlanId())),"disable");
-                    log.info("accountId:=={}==计划id:{}=====第三方点击监测链接不一致,计划已【关停】============",accountInfo.getAccountId(),actiontrackUrl.getPlanId());
+                    log.info("accountId:=={}==计划id:{}=====第三方点击监测链接与配置中的链接不一致,计划已【关停】============",accountInfo.getAccountId(),actiontrackUrl.getPlanId());
                     planList.add(actiontrackUrl.getPlanId());
                 }
             }
@@ -223,35 +223,42 @@ public class MonitorBytedanceServiceImpl implements IMonitorBytedanceService {
      *
      * @param token
      * @param accountId 账户id
-     * @param converId 转化目标id
+     * @param assetId 事件管理id
+     * @param downloadUrl 下载链接
      * @param planId 计划id
      * @return: void
      * @author: zianY
      * @time: 2022/1/13
      */
-    public void trackUrlContrast(CtopOauthToken token,String accountId,String converId,String planId){
+    public void trackUrlContrast(CtopOauthToken token,String accountId,Long assetId,String downloadUrl,String planId){
         //校验 账户自动投放配置中 监测链接
         //查询 链接配置
         List<MonitorBytedanceAdVo> monitorBytedanceAdVos = monitorBytedanceActionTrackUrlMapper.getAccountActionTrackUrl(String.valueOf(accountId),"1",null);
         if (!Check.isNull(monitorBytedanceAdVos)){
             MonitorBytedanceAdVo bytedanceAdVo = monitorBytedanceAdVos.get(0);
             // 账户id  和 转化id 查询 第三方监测链接
-            Result resultConvert = aiBytedanceAdvertiserStrategyService.readToolConvertInfo(accountId,converId);
+            //Result resultConvert = aiBytedanceAdvertiserStrategyService.readToolConvertInfo(accountId,converId);
+
+            Result resultConvert = marketingServiceImpl.getOptimizedTrackUrl(token,assetId,downloadUrl);
+
             if (resultConvert.isSuccess()){
                 JSONObject jsonObject = (JSONObject) JSONObject.toJSON(resultConvert.getResult());
-                String action_track_url = jsonObject.getString("action_track_url");
+                JSONObject actionTrackUrl = (JSONObject) JSONObject.toJSON(jsonObject.getJSONArray("track_url_groups").get(0));
+                String action_track_url = actionTrackUrl.getString("action_track_url");
+
+
                 //自动投放账户配置中的链接 != 监测链接配置
                 if (!StringUtils.equals(action_track_url,bytedanceAdVo.getActionTrackUrl())){
                     //关停计划
                     marketingServiceImpl.updPlanStatus(token, Arrays.asList(Long.valueOf(planId)),"disable");
                     //发送预警消息
                     sendEnterpriseWeiXinMessage(bytedanceAdVo);
-                    log.info("accountId:=={}==目标转化id:{}=====自动投创建====第三方点击监测链接与自动投放配置不一致,已发送企业微信通知============",bytedanceAdVo.getAccountId(),bytedanceAdVo.getConvertId());
+                    log.info("accountId:=={}==事件管理id:{}=====自动投创建====第三方点击监测链接与自动投放配置不一致,已发送企业微信通知============",bytedanceAdVo.getAccountId(),assetId);
                 }
             }
-            log.info("accountId:=={}==目标转化id:{}=====第三方点击监测链接获取失败",accountId,converId);
+            log.info("accountId:=={}=====第三方点击监测链接获取失败",accountId);
         }
-        log.info("accountId:=={}==目标转化id为空。",accountId);
+        log.info("accountId:=={}==没有配置监测链接。",accountId);
     }
 
 

+ 11 - 1
jeecg-boot-bytedance/src/main/resources/bytedance_config.properties

@@ -106,4 +106,14 @@ bytedance_v2_ad_creative_get=/2/report/creative/get/
 
 
 #\u67E5\u8BE2\u7EC4\u4EF6\u5217\u8868
-bytedance_v2_assets_get=/2/assets/creative_component/get/
+bytedance_v2_assets_get=/2/assets/creative_component/get/
+
+#\u83B7\u53D6\u5DF2\u521B\u5EFA\u7684\u8D44\u4EA7\u5217\u8868
+bytedance_v2_event_assets=/2/tools/event/assets/get/
+
+
+#资产-获取优化目标
+bytedance_v2_event_convert_optimized=/2/tools/event_convert/optimized_goal/get/
+
+#获取事件资产下的监测链接
+bytedance_v2_event_track_url=/2/event_manager/track_url/get/

+ 85 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -402,7 +402,6 @@ public class AiBytedanceAdvertiserStrategyController {
 	}
 
 
-//通投智选--master
 	@ApiOperation(value="智能投放测试创建计划", notes="智能投放测试创建计划")
 	@GetMapping("testCreateCreativeLimit")
 	public Map<String, Object> testCreateCreativeLimit(Long accountId, Integer hour) {
@@ -640,6 +639,91 @@ public class AiBytedanceAdvertiserStrategyController {
 
 
 
+	@ApiOperation(value="获取已创建资产列表", notes="获取已创建资产列表")
+	@GetMapping(value = "/getEventAssetsAccount")
+	public Result getEventAssetsAccount(@RequestParam("accountId") String accountId,
+								 @RequestParam("landingType") String landingType) {
+		try {
+			CtopOauthToken token = tokenService.getTokenByAccountId(new Long(accountId));
+			return marketingService.getEventAssets(token,landingType);
+		}catch (Exception e){
+			log.error("获取已创建资产列表异常",e);
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+
+
+
+
+
+	/**
+	 * Author: zianY
+	 * Description: 资产-获取优化目标列表
+	 *------------
+	 * @param
+	 * @param landingType 广告组推广目的,允许值:LINK 销售线索收集、LIVE 直播间推广、SHOP电商店铺推广、APP 应用、QUICK_APP 快应用
+	 * @param marketingPurpose 营销目的,允许值:CONVERSION 行动转化、INTENTION 用户意向、ACKNOWLEDGE 品牌认知
+	 * @param assetType 资产类型,允许值:THIRD_EXTERNAL 三方落地页、TETRIS_EXTERNAL 建站、APP 应用、QUICK_APP 快应用
+	 * @param appType 应用类型,当asset_type为应用APP时必填 可选值:ANDROID 、IOS
+	 * @param packageName 应用类型,当asset_type为应用APP时必填 可选值:ANDROID 、IOS
+	 *------------
+	 * Return org.jeecg.common.api.vo.Result
+	 */
+	@ApiOperation(value="资产-获取优化目标列表", notes="资产-获取优化目标列表")
+	@GetMapping(value = "/getConvertOptimized")
+	public Result getConvertOptimized(@RequestParam("accountId") String accountId,
+								 @RequestParam("landingType") String landingType,
+								 @RequestParam("marketingPurpose") String marketingPurpose,
+								 @RequestParam("assetType") String assetType,
+								 @RequestParam("appType") String appType,
+								 @RequestParam("packageName") String packageName
+
+
+
+	) {
+		try {
+			CtopOauthToken token = tokenService.getTokenByAccountId(new Long(accountId));
+			return marketingService.getConvertOptimized(token,landingType,marketingPurpose,assetType,appType,packageName);
+		}catch (Exception e){
+			log.error("资产-获取优化目标列表异常",e);
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+
+
+	/**
+	 * Author: zianY
+	 * Description: 查询事件资产下的监测链接
+	 *------------
+	 * @param accountId
+	 * @param assetId 资产ID
+	 *------------
+	 * Return org.jeecg.common.api.vo.Result
+	 */
+	@ApiOperation(value="查询事件资产下的监测链接", notes="查询事件资产下的监测链接")
+	@GetMapping(value = "/getOptimizedTrackUrl")
+	public Result getOptimizedTrackUrl(@RequestParam("accountId") String accountId,
+								 @RequestParam("assetId") Long assetId,
+								 @RequestParam("downloadUrl") String downloadUrl
+	) {
+		try {
+			CtopOauthToken token = tokenService.getTokenByAccountId(new Long(accountId));
+			return marketingService.getOptimizedTrackUrl(token,assetId,downloadUrl);
+		}catch (Exception e){
+			log.error("查询事件资产下的监测链接异常",e);
+			return Result.error("请求失败,请联系开发人员!");
+		}
+	}
+
+
+
+
+
+
+
+
 
 
 }

+ 23 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/BytedancePlanJobController.java

@@ -8,6 +8,8 @@ import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.bytedance.advertise.service.IMonitorBytedanceService;
 import org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo;
 import org.jeecg.modules.bytedance.common.constant.BytedanceConstant;
+import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
+import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
 import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
 import org.jeecg.modules.bytedance.common.utils.Check;
 import org.jeecg.modules.system.service.ISysRoleService;
@@ -39,6 +41,9 @@ public class BytedancePlanJobController {
 	@Autowired
 	private ISysRoleService sysRoleService;;
 
+	@Resource
+	private ICtopOauthTokenService tokenService;
+
 	@ApiOperation(value = "监测预警-点击监测链接", notes = "监测预警-点击监测链接")
 	@GetMapping(value = "/monitorBytedanceActionTrackUrl")
 	public Result monitorBytedanceActionTrackUrl(@RequestParam String accountId) {
@@ -84,4 +89,22 @@ public class BytedancePlanJobController {
 
 
 
+
+
+
+	@GetMapping(value = "/testActionTrackUrl")
+	public Result testActionTrackUrl(@RequestParam("accountId") String accountId,
+									 @RequestParam("assetId") Long assetId,
+									 @RequestParam("downloadUrl") String downloadUrl
+									 ) {
+
+		CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountId));
+
+		 monitorBytedanceService.trackUrlContrast(token,accountId,assetId,downloadUrl,"");
+
+		return Result.successMsg("success",null);
+	}
+
+
+
 }