Commit 966964e8 authored by 宋新宇's avatar 宋新宇

store归因上报

parent 46d6ffd9
...@@ -2,11 +2,15 @@ package com.lwby.marketing.att.novel; ...@@ -2,11 +2,15 @@ package com.lwby.marketing.att.novel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.lwby.marketing.po.AppChannel; import com.lwby.marketing.po.AppChannel;
import com.lwby.marketing.vo.NovelAction; import com.lwby.marketing.vo.NovelAction;
import com.lwby.marketing.vo.DeliveryDeviceInfo; import com.lwby.marketing.vo.DeliveryDeviceInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
...@@ -123,9 +127,14 @@ public class UniversalProcess { ...@@ -123,9 +127,14 @@ public class UniversalProcess {
/******************************************** JDBC *************************************************************/ /******************************************** JDBC *************************************************************/
@Cached(name="appchannel_novel", cacheType = CacheType.LOCAL)
public AppChannel getAppChannel(int platformId, int channelId){ @CacheRefresh(refresh = 300)
return lwbyJdbcTemplate.queryForObject(String.format("select * from app_channel where platform_id=%d and channel_id=%d ORDER BY update_time DESC LIMIT 1",platformId,channelId),AppChannel.class); public Integer getAppChannel(int platformId, int channelId){
try {
return lwbyJdbcTemplate.queryForObject(String.format("select spr_dedu from app_channel where platform_id=%d and channel_id=%s ORDER BY update_time DESC LIMIT 1",platformId,String.valueOf(channelId)),Integer.class);
} catch (EmptyResultDataAccessException e) {
return null;
}
} }
......
...@@ -40,10 +40,10 @@ public class ChannelAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -40,10 +40,10 @@ public class ChannelAttributionFlow extends NodeSwitchFlow<NovelAction> {
boolean isNewUser = DateTimUtils.isCurrentDayTime(action.getRegistrationDate()); boolean isNewUser = DateTimUtils.isCurrentDayTime(action.getRegistrationDate());
//获取满意配置 //获取满意配置
AppChannel appChannel = up.getAppChannel(action.getPlatformId(), action.getChannelId()); Integer sprDedu = up.getAppChannel(action.getPlatformId(), action.getChannelId());
//等于空 或 100直接回传 //等于空 或 100直接回传
if (appChannel == null || appChannel.getSprDedu() == 100) { if (sprDedu == null || sprDedu == 100) {
//TODO;channelTotalCount 和 channelCallbackCount不加吗 //TODO;channelTotalCount 和 channelCallbackCount不加吗
action.getMedia().callback(action); action.getMedia().callback(action);
up.notifyResult(action, AttributionStatus.ACTIVE_CALLBACK); up.notifyResult(action, AttributionStatus.ACTIVE_CALLBACK);
...@@ -51,8 +51,6 @@ public class ChannelAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -51,8 +51,6 @@ public class ChannelAttributionFlow extends NodeSwitchFlow<NovelAction> {
return; return;
} }
//如果是20 就是回传 20
Integer sprDedu = appChannel.getSprDedu();
//总数 //总数
String channelTotal = up.getTotalCountKey(type, action.getPlatformId(), action.getChannelId(), sprDedu, action.getCurrentDateStr()); String channelTotal = up.getTotalCountKey(type, action.getPlatformId(), action.getChannelId(), sprDedu, action.getCurrentDateStr());
//回传 //回传
......
...@@ -43,10 +43,10 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -43,10 +43,10 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
@Override @Override
public void process(NovelAction action) { public void process(NovelAction action) {
AppChannel appChannel = up.getAppChannel(action.getPlatformId(), action.getChannelId()); Integer sprDedu = up.getAppChannel(action.getPlatformId(), action.getChannelId());
//等于空 或 100直接回传 //等于空 或 100直接回传
if (appChannel == null || appChannel.getSprDedu() == 100) { if (sprDedu == null || sprDedu == 100) {
// callbackService.registerCallback(action); // callbackService.registerCallback(action);
action.getMedia().callback(action); action.getMedia().callback(action);
up.notifyResult(action, AttributionStatus.ACTIVE_CALLBACK); up.notifyResult(action, AttributionStatus.ACTIVE_CALLBACK);
...@@ -54,8 +54,6 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -54,8 +54,6 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
return; return;
} }
//如果是20% 就是回传20%
Integer sprDedu = appChannel.getSprDedu();
//总数 //总数
String channelTotal = up.getTotalCountKey(AttributionType.CROSS_PLATFORM, action.getPlatformId(), action.getChannelId(), sprDedu, action.getCurrentDateStr()); String channelTotal = up.getTotalCountKey(AttributionType.CROSS_PLATFORM, action.getPlatformId(), action.getChannelId(), sprDedu, action.getCurrentDateStr());
//回传 //回传
......
...@@ -3,10 +3,12 @@ package com.lwby.marketing.controller; ...@@ -3,10 +3,12 @@ package com.lwby.marketing.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.lwby.marketing.att.NovelAttributionMain; import com.lwby.marketing.att.NovelAttributionMain;
import com.lwby.marketing.att.novel.UniversalProcess;
import com.lwby.marketing.att.storynovel.UniversalStoryProcess; import com.lwby.marketing.att.storynovel.UniversalStoryProcess;
import com.lwby.marketing.att.storynovel.media.IStoryCallback; import com.lwby.marketing.att.storynovel.media.IStoryCallback;
import com.lwby.marketing.att.storynovel.media.jrtt.JRTTActiveCallback; import com.lwby.marketing.att.storynovel.media.jrtt.JRTTActiveCallback;
import com.lwby.marketing.att.storynovel.media.jrtt.JRTTPayCallback; import com.lwby.marketing.att.storynovel.media.jrtt.JRTTPayCallback;
import com.lwby.marketing.po.AppChannel;
import com.lwby.marketing.vo.StoryNovelAction; import com.lwby.marketing.vo.StoryNovelAction;
import com.lwby.marketing.vo.StoreUserUploadEventBO; import com.lwby.marketing.vo.StoreUserUploadEventBO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -60,10 +62,18 @@ public class AttrController { ...@@ -60,10 +62,18 @@ public class AttrController {
@Resource @Resource
UniversalStoryProcess up; UniversalStoryProcess up;
@Resource
UniversalProcess up2;
@RequestMapping("dedu") @RequestMapping("dedu")
public void testDedu() { public void testDedu() {
Integer platformId = 601; Integer platformId = 5;
Integer channelId = 2122123; Integer channelId = 123213;
Integer sprDedu = up2.getAppChannel(platformId, channelId);
if (sprDedu == null || sprDedu == 100) {
System.out.println(sprDedu);
}
System.out.println(sprDedu);
String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId); String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (StringUtils.isEmpty(shaveMakeCall)) { if (StringUtils.isEmpty(shaveMakeCall)) {
//直接回传,走回传流 //直接回传,走回传流
...@@ -82,7 +92,6 @@ public class AttrController { ...@@ -82,7 +92,6 @@ public class AttrController {
Map<String, Integer> map = JSON.parseObject(shaveMakeCall, Map.class); Map<String, Integer> map = JSON.parseObject(shaveMakeCall, Map.class);
Integer sprDedu = 0;
String goodId = "1"; String goodId = "1";
for (Map.Entry<String, Integer> entry : map.entrySet()) { for (Map.Entry<String, Integer> entry : map.entrySet()) {
......
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