Commit c4fb1163 authored by 宋新宇's avatar 宋新宇

Merge branch 'release_20240329_01' into 'main'

Release 20240329 01

See merge request !22
parents d9afdbfd af6ad665
package com.lwby.marketing.att.bystory;
import com.lwby.marketing.att.AttributionStatus;
package com.lwby.marketing.att;
/**
* @author songxinyu
......
......@@ -4,15 +4,19 @@ import com.alibaba.fastjson.JSONObject;
import com.alicp.jetcache.anno.CacheRefresh;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.UniversalProcess;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.vo.AttributeRule;
import com.lwby.marketing.vo.DeliveryDeviceInfo;
import com.lwby.marketing.vo.StoryNovelAction;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.kafka.support.SendResult;
import org.springframework.stereotype.Component;
import org.springframework.util.concurrent.ListenableFuture;
......@@ -65,7 +69,7 @@ public class DyStoryUniversalProcess extends UniversalProcess {
}
public String getFirstCheckerKey(StoryNovelAction action) {
return Objects.equals(action.getType(),CallBackType.active.getType())
return Objects.equals(action.getType(), CallBackType.active.getType())
? String.format("fc_%d_%d_%s_%s", action.getUserId(), action.getPlatformId(),action.getMediaName(),action.getCurrentDateStr())
: String.format("fc_%d_%d_%s", action.getUserId(), action.getPlatformId(),action.getMediaName());
}
......@@ -73,11 +77,13 @@ public class DyStoryUniversalProcess extends UniversalProcess {
/******************************************** JDBC *************************************************************/
@Cached(name="attribute_rule_store_novel", cacheType = CacheType.LOCAL)
@Cached(name="attribute_rule_story_novel", cacheType = CacheType.LOCAL)
@CacheRefresh(refresh = 300)
public String getAttributeRuleByPlatformIdAndChannelId(int platformId,Long channelId) {
public AttributeRule getAttributeRuleByPlatformIdAndChannelId(int platformId, Long channelId) {
try {
return lwbyJdbcTemplate.queryForObject(String.format("select shave_make_call from attribute_rule where channel_id=%d and platform_id=%d",channelId,platformId),String.class);
RowMapper<AttributeRule> rowMapper = BeanPropertyRowMapper.newInstance(AttributeRule.class);
return lwbyJdbcTemplate.queryForObject(String.format("select shave_make_call,callback_type from attribute_rule where channel_id=%d and platform_id=%d",channelId,platformId),rowMapper);
} catch (EmptyResultDataAccessException e) {
return null;
}
......
package com.lwby.marketing.att.bystory.handle;
import com.alibaba.fastjson.JSONObject;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.notify.Media;
......@@ -34,7 +33,7 @@ public class ParameterSetupStoryNovelFlow extends NodeFlow<StoryNovelAction> {
DeliveryDeviceInfo deliveryDeviceInfo = null;
//String s = "{\"creativeId\":\"112331\",\"creativeType\":\"3\",\"adid\":\"12321\","
// + "\"clickId\":\"12312143232\",\"channel\":\"216011231\",\"bookId\":\"4322111\","
// + "\"clickId\":\"12312143232\",\"channel\":\"21221021\",\"bookId\":\"4322111\","
// + "\"media\":\"jrtt\",\"clickTime\":123123123,\"code\":\"12ede3e231\"}";;
//StoryLogin storyLogin = JSONObject.parseObject(s,StoryLogin.class);
//匹配OpenId
......
......@@ -2,9 +2,11 @@ package com.lwby.marketing.att.bystory.handle;
import com.alibaba.fastjson.JSON;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.flow.NodeSwitchFlow;
import com.lwby.marketing.vo.AttributeRule;
import com.lwby.marketing.vo.StoryNovelAction;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -16,6 +18,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;
/**
......@@ -40,8 +43,8 @@ public class PaySpduFlow extends NodeSwitchFlow<StoryNovelAction> {
public void process(StoryNovelAction action) {
int platformId = action.getPlatformId();
Long channelId = action.getChannelId();
String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (StringUtils.isEmpty(shaveMakeCall)) {
AttributeRule attributeRule = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (Objects.isNull(attributeRule) || StringUtils.isEmpty(attributeRule.getShaveMakeCall())) {
//直接回传,走回传流
DYSTORY_SYS_LOG.info("PaySpduFlow process0 attribute is null,platformId={},channelId={}",action.getPlatformId(),action.getChannelId());
return;
......@@ -56,7 +59,9 @@ public class PaySpduFlow extends NodeSwitchFlow<StoryNovelAction> {
* "4" : 100
* }
*/
//在这里设置回传类型
action.setCallbackTypeStory(attributeRule.getCallbackType());
String shaveMakeCall = attributeRule.getShaveMakeCall();
Map<String, Integer> map = JSON.parseObject(shaveMakeCall, Map.class);
Integer sprDedu = 0;
......@@ -75,6 +80,14 @@ public class PaySpduFlow extends NodeSwitchFlow<StoryNovelAction> {
return;
}
if (sprDedu == 0) {
DYSTORY_SYS_LOG.info("PaySpduFlow process0 attribute.sprDeduChannel 0,platformId={},channelId={}",action.getPlatformId(),action.getChannelId());
up.notifyResult(action,Objects.equals(action.getCallbackTypeStory(),3)? CallBackType.behavior.getTopic():CallBackType.pay.getTopic(), AttributionStatus.NORMAL_DEDUCTION_CALLBACK);
up.set(up.getFirstCheckerKey(action),60 * 60 * 24,"1");
action.stop(true);
return;
}
//总数
String channelTotal = up.getTotalCountKey(AttributionType.CHANNEL, action.getPlatformId(), action.getChannelId(),goodId, sprDedu, action.getCurrentDateStr());
//回传
......@@ -92,7 +105,7 @@ public class PaySpduFlow extends NodeSwitchFlow<StoryNovelAction> {
"PaySpduFlow.process0.deduction doing dynamic, platformId = {}, channel = {}, sprDedu = {}, goodId = {}, channelTotalCount = {}, channelCallbackCount = {}, v = {}",
platformId, channelId, sprDedu, goodId, channelTotalCount, channelCallbackCount, 1);
} else {
up.notifyResult(action,"ocpc_pay", AttributionStatus.NORMAL_DEDUCTION_CALLBACK);
up.notifyResult(action,Objects.equals(action.getCallbackTypeStory(),3)? CallBackType.behavior.getTopic():CallBackType.pay.getTopic(), AttributionStatus.NORMAL_DEDUCTION_CALLBACK);
up.set(up.getFirstCheckerKey(action),60 * 60 * 24,"1");
DYSTORY_SYS_LOG.info(
"PaySpduFlow.process0.deduction doing dynamic, platformId = {}, channel = {}, sprDedu = {}, goodId = {}, channelTotalCount = {}, channelCallbackCount = {}, v = {}",
......
package com.lwby.marketing.att.bystory.handle;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.StoryNovelAction;
......
package com.lwby.marketing.att.bystory.handle;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.StoryNovelAction;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Objects;
/**
* @author songxinyu
......@@ -24,7 +25,12 @@ public class UploadCallFlow extends NodeFlow<StoryNovelAction> {
boolean success = action.getMedia().notify(action);
if (success) {
up.notifyResult(action, type.getTopic(),type.getStatus());
if (type.getType().equals(CallBackType.active.getType())) {
up.notifyResult(action, type.getTopic(),type.getStatus());
} else {
up.notifyResult(action, Objects.equals(action.getCallbackTypeStory(),3) ? CallBackType.behavior.getTopic() : CallBackType.pay.getTopic(),
Objects.equals(action.getCallbackTypeStory(),3) ? CallBackType.behavior.getStatus() : CallBackType.pay.getStatus());
}
up.set(up.getFirstCheckerKey(action),60 * 60 * 24,"1");
}
}
......
......@@ -7,7 +7,7 @@ import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.UniversalProcess;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.po.ThirdAccountDy;
import com.lwby.marketing.util.HttpUtil;
......
......@@ -3,7 +3,7 @@ package com.lwby.marketing.att.dyvideo.handle;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.dyvideo.DyVideoUniversalProcess;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.flow.NodeSwitchFlow;
......
package com.lwby.marketing.att.dyvideo.handle;
import com.alibaba.fastjson.JSONObject;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.dyvideo.DyVideoUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.notify.Media;
......
package com.lwby.marketing.att.dyvideo.handle;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.dyvideo.DyVideoUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.StoryNovelAction;
......
package com.lwby.marketing.att.dyvideo.handle;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.dyvideo.DyVideoUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.StoryNovelAction;
......
package com.lwby.marketing.att.videoapp;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alicp.jetcache.anno.CacheRefresh;
......@@ -8,7 +7,7 @@ import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.UniversalProcess;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.vo.*;
import lombok.extern.slf4j.Slf4j;
......
package com.lwby.marketing.att.videoapp.handle;
import cn.hutool.crypto.SecureUtil;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.videoapp.DeviceVideoType;
import com.lwby.marketing.att.videoapp.VideoAppUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
......
package com.lwby.marketing.att.videoapp.handle;
import com.lwby.marketing.att.AttributionStatus;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.videoapp.VideoAppUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.NovelAction;
......
package com.lwby.marketing.att.videoapp.handle;
import com.lwby.marketing.att.bystory.CallBackType;
import com.lwby.marketing.att.CallBackType;
import com.lwby.marketing.att.videoapp.VideoAppUniversalProcess;
import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.NovelAction;
......
......@@ -10,10 +10,7 @@ import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.att.novel.AttributionType;
import com.lwby.marketing.po.CrossCallback;
import com.lwby.marketing.util.DateTimUtils;
import com.lwby.marketing.vo.CrossPlatformAccount;
import com.lwby.marketing.vo.DeliveryDeviceInfo;
import com.lwby.marketing.vo.StoryNovelAction;
import com.lwby.marketing.vo.StoreUserUploadEventBO;
import com.lwby.marketing.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
......@@ -87,8 +84,8 @@ public class AttrController {
System.out.println(sprDedu);
}
System.out.println(sprDedu);
String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (StringUtils.isEmpty(shaveMakeCall)) {
AttributeRule attributeRule = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (Objects.isNull(attributeRule) || StringUtils.isEmpty(attributeRule.getShaveMakeCall())) {
//直接回传,走回传流
return;
}
......@@ -102,7 +99,7 @@ public class AttrController {
* "4" : 100
* }
*/
String shaveMakeCall = attributeRule.getShaveMakeCall();
Map<String, Integer> map = JSON.parseObject(shaveMakeCall, Map.class);
String goodId = "1";
......@@ -152,8 +149,8 @@ public class AttrController {
@RequestMapping("/sendPay")
public void testSendPay() {
String msg = "{\"clientInfo\":{\"channel\":214120503,\"clientIp\":\"183.219.7.180\",\"pkv\":1,\"platformGroupId\":412,"
+ "\"platformId\":412,\"sessionid\":\"undefined\",\"ua\":\"Mozilla/5.0 (Linux; Android 12; OXF-AN00 Build/HUAWEIOXF-AN00;"
String msg = "{\"clientInfo\":{\"channel\":214120503,\"clientIp\":\"183.219.7.180\",\"pkv\":1,\"platformGroupId\":601,"
+ "\"platformId\":601,\"sessionid\":\"undefined\",\"ua\":\"Mozilla/5.0 (Linux; Android 12; OXF-AN00 Build/HUAWEIOXF-AN00;"
+ " wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/117.0.0.0 Mobile Safari/537.36 aweme.lite/28.9.0 "
+ "ToutiaoMicroApp/3.14.0 PluginVersion/28909073\",\"version\":\"2.0.0\",\"xClient\":\"version=2.0.0;platformId=412;"
+ "equipment=android\"},\"createTime\":1709533439693,\"extraData\":{},\"id\":\"93857260-8130-442f-bc92-b549dbf28ef0\","
......
......@@ -3,20 +3,28 @@ package com.lwby.marketing.notify.media.jrtt;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.notify.DYNotify;
import com.lwby.marketing.notify.media.jrtt.dto.JrttAttributeRequest;
import com.lwby.marketing.vo.AttributeRule;
import com.lwby.marketing.vo.DeliveryDeviceInfo;
import com.lwby.marketing.vo.StoryNovelAction;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.Objects;
@Slf4j
public class StoryJRTTNotify extends DYNotify {
public static final String ATTRIBUTE_URL = "https://analytics.oceanengine.com/api/v2/conversion";
private static final Logger DYSTORY_SYS_LOG = LoggerFactory.getLogger("dystory.sys");
@Resource
DyStoryUniversalProcess up;
@Override
public boolean active(StoryNovelAction na) {
return notify(na,"active");
......@@ -24,12 +32,12 @@ public class StoryJRTTNotify extends DYNotify {
@Override
public boolean pay(StoryNovelAction na) {
return notify(na,"active_pay");
return Objects.equals(na.getCallbackTypeStory(),3) ? behavior(na) : notify(na,"active_pay");
}
@Override
public boolean behavior(StoryNovelAction na) {
return false;
return notify(na,"game_addiction");
}
public boolean notify(StoryNovelAction na,String eventType) {
......
......@@ -57,4 +57,6 @@ public class AttributeRule implements Serializable {
private String link;
private Integer callbackType;
}
......@@ -29,6 +29,7 @@ public class StoryNovelAction extends Action {
Media media;
String currentDateStr;
String goodId;
Integer callbackTypeStory;
public StoryNovelAction(ClientInfo clientInfo, Long userId, String openId, Integer type){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment