Commit 842e2815 authored by 宋新宇's avatar 宋新宇

修改

parent 219e6409
...@@ -11,7 +11,9 @@ import com.lwby.marketing.po.CrossCallback; ...@@ -11,7 +11,9 @@ import com.lwby.marketing.po.CrossCallback;
import com.lwby.marketing.util.DateTimUtils; import com.lwby.marketing.util.DateTimUtils;
import com.lwby.marketing.vo.NovelAction; import com.lwby.marketing.vo.NovelAction;
import com.lwby.marketing.vo.CrossPlatformAccount; import com.lwby.marketing.vo.CrossPlatformAccount;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -33,7 +35,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -33,7 +35,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
//获取跨平台帐号配置 //获取跨平台帐号配置
CrossPlatformAccount cpa = getCrossPlatformMedia().get(action.getMediaName()); CrossPlatformAccount cpa = getCrossPlatformMedia().get(action.getMediaName());
//判断是否配置跨平台归因,如果没有则继续执行下一个计划归因处理器 //判断是否配置跨平台归因,如果没有则继续执行下一个计划归因处理器
if(Objects.isNull(cpa) || !cpa.getAccount().contains(action.getAdvertiserId())){ if(Objects.isNull(cpa) || (!cpa.getAccount().contains("0") && !cpa.getAccount().contains(action.getAdvertiserId()))
|| (cpa.getOldAccount().contains("0") || cpa.getOldAccount().contains(action.getAdvertiserId()))){
return false; return false;
} }
action.setCpa(cpa); action.setCpa(cpa);
...@@ -143,7 +146,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> { ...@@ -143,7 +146,8 @@ public class CrossPlatformAttributionFlow extends NodeSwitchFlow<NovelAction> {
@Cached(name="cross_platform_account", cacheType = CacheType.LOCAL) @Cached(name="cross_platform_account", cacheType = CacheType.LOCAL)
@CacheRefresh(refresh = 300) @CacheRefresh(refresh = 300)
public Map<String,CrossPlatformAccount> getCrossPlatformMedia(){ public Map<String,CrossPlatformAccount> getCrossPlatformMedia(){
List<CrossCallback> ls = lwbyJdbcTemplate.queryForList("select id,span_check_max_day,new_account,old_account,media_name from cross_callback", CrossCallback.class); RowMapper<CrossCallback> rowMapper = BeanPropertyRowMapper.newInstance(CrossCallback.class);
List<CrossCallback> ls = lwbyJdbcTemplate.query("select span_check_max_day,new_account,old_account,media_name from cross_callback", rowMapper);
return ls.stream() return ls.stream()
.collect(Collectors.toMap(CrossCallback::getMediaName, CrossPlatformAccount::new)); .collect(Collectors.toMap(CrossCallback::getMediaName, CrossPlatformAccount::new));
......
...@@ -2,18 +2,29 @@ package com.lwby.marketing.controller; ...@@ -2,18 +2,29 @@ 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.alicp.jetcache.anno.CacheRefresh;
import com.alicp.jetcache.anno.CacheType;
import com.alicp.jetcache.anno.Cached;
import com.lwby.marketing.att.bystory.DyStoryFlowExecutor; import com.lwby.marketing.att.bystory.DyStoryFlowExecutor;
import com.lwby.marketing.att.bystory.DyStoryUniversalProcess; import com.lwby.marketing.att.bystory.DyStoryUniversalProcess;
import com.lwby.marketing.po.CrossCallback;
import com.lwby.marketing.vo.CrossPlatformAccount;
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;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.kafka.core.KafkaTemplate; import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* @author songxinyu * @author songxinyu
...@@ -153,4 +164,28 @@ public class AttrController { ...@@ -153,4 +164,28 @@ public class AttrController {
log.error("dystory短篇付费发送消息失败:fail={}", JSON.toJSONString(failure)); log.error("dystory短篇付费发送消息失败:fail={}", JSON.toJSONString(failure));
}); });
} }
@Resource
JdbcTemplate lwbyJdbcTemplate;
@RequestMapping("testcross")
public void testCross() {
CrossPlatformAccount cpa = getCrossPlatformMedia().get("gdt");
//判断是否配置跨平台归因,如果没有则继续执行下一个计划归因处理器
if(Objects.isNull(cpa) || (!cpa.getAccount().contains("0") && !cpa.getAccount().contains("32422617"))
|| (cpa.getOldAccount().contains("0") || cpa.getOldAccount().contains("32422617"))){
System.out.println(111);
}
}
@Cached(name="cross_platform_account", cacheType = CacheType.LOCAL)
@CacheRefresh(refresh = 300)
public Map<String,CrossPlatformAccount> getCrossPlatformMedia(){
RowMapper<CrossCallback> rowMapper = BeanPropertyRowMapper.newInstance(CrossCallback.class);
List<CrossCallback> ls = lwbyJdbcTemplate.query("select span_check_max_day,new_account,old_account,media_name from cross_callback", rowMapper);
return ls.stream()
.collect(Collectors.toMap(CrossCallback::getMediaName, CrossPlatformAccount::new));
}
} }
...@@ -23,6 +23,8 @@ public class CrossPlatformAccount { ...@@ -23,6 +23,8 @@ public class CrossPlatformAccount {
*/ */
private Set<String> account; private Set<String> account;
private Set<String> oldAccount;
public CrossPlatformAccount(CrossCallback ccb){ public CrossPlatformAccount(CrossCallback ccb){
setMediaName(ccb.getMediaName()); setMediaName(ccb.getMediaName());
setSpanCheckMaxDay(ccb.getSpanCheckMaxDay()); setSpanCheckMaxDay(ccb.getSpanCheckMaxDay());
...@@ -30,5 +32,9 @@ public class CrossPlatformAccount { ...@@ -30,5 +32,9 @@ public class CrossPlatformAccount {
.map(String::trim) .map(String::trim)
.filter(_s -> _s.matches("\\d+")) .filter(_s -> _s.matches("\\d+"))
.collect(Collectors.toSet())); .collect(Collectors.toSet()));
setOldAccount(Arrays.stream(ccb.getOldAccount().split(","))
.map(String::trim)
.filter(_s -> _s.matches("\\d+"))
.collect(Collectors.toSet()));
} }
} }
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