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

store归因上报

parent 735774ed
...@@ -39,7 +39,7 @@ public class StoreNovelPayConsumer implements MessageListener<String, String> { ...@@ -39,7 +39,7 @@ public class StoreNovelPayConsumer implements MessageListener<String, String> {
log.info("media.active.topic={}, bookStoreEvent={}", data.topic(), JSON.toJSONString(event)); log.info("media.active.topic={}, bookStoreEvent={}", data.topic(), JSON.toJSONString(event));
} }
StoreNovelAction action = new StoreNovelAction(event.getClientInfo(),null,event.getUserId(),event.getOpenId(),event.getUserUploadEvent(),event.getProductId()); StoreNovelAction action = new StoreNovelAction(event.getClientInfo(),event.getUserId(),event.getOpenId(),event.getUserUploadEvent(),event.getProductId());
novelAttributionMain.executorStoreNovelPay.execute(action); novelAttributionMain.executorStoreNovelPay.execute(action);
} catch (Throwable e) { } catch (Throwable e) {
......
...@@ -57,7 +57,6 @@ public class UniversalStoreProcess { ...@@ -57,7 +57,6 @@ public class UniversalStoreProcess {
ddi.setDj_channel(channelStr); ddi.setDj_channel(channelStr);
} }
ddi.setOs(action.getClientInfo().getOs());
ddi.setIs_call(status.id); ddi.setIs_call(status.id);
ddi.setUserId(action.getUserId()); ddi.setUserId(action.getUserId());
ddi.setActive_time(System.currentTimeMillis()); ddi.setActive_time(System.currentTimeMillis());
...@@ -120,8 +119,8 @@ public class UniversalStoreProcess { ...@@ -120,8 +119,8 @@ public class UniversalStoreProcess {
@Cached(name="attribute_rule_store_novel", cacheType = CacheType.LOCAL) @Cached(name="attribute_rule_store_novel", cacheType = CacheType.LOCAL)
@CacheRefresh(refresh = 300) @CacheRefresh(refresh = 300)
public AttributeRule getAttributeRuleByPlatformIdAndChannelId(int platformId,int channelId) { public String getAttributeRuleByPlatformIdAndChannelId(int platformId,int channelId) {
return lwbyJdbcTemplate.queryForObject(String.format("select * from attribute_rule where channel_id=%d and platform_id=%d",channelId,platformId),AttributeRule.class); return lwbyJdbcTemplate.queryForObject(String.format("select shave_make_call from attribute_rule where channel_id=%d and platform_id=%d",channelId,platformId),String.class);
} }
......
...@@ -8,6 +8,7 @@ import com.lwby.marketing.flow.NodeFlow; ...@@ -8,6 +8,7 @@ import com.lwby.marketing.flow.NodeFlow;
import com.lwby.marketing.vo.AttributeRule; import com.lwby.marketing.vo.AttributeRule;
import com.lwby.marketing.vo.StoreNovelAction; import com.lwby.marketing.vo.StoreNovelAction;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -36,13 +37,12 @@ public class PaySpduFlow extends NodeFlow<StoreNovelAction> { ...@@ -36,13 +37,12 @@ public class PaySpduFlow extends NodeFlow<StoreNovelAction> {
int platformId = action.getPlatformId(); int platformId = action.getPlatformId();
int channelId = action.getChannelId(); int channelId = action.getChannelId();
AttributeRule attributeRule = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId); String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (attributeRule == null) { if (StringUtils.isEmpty(shaveMakeCall)) {
//直接回传,走回传流 //直接回传,走回传流
log.info("PaySpduFlow process0 attribute is null,platformId={},channelId={}",action.getPlatformId(),action.getChannelId()); log.info("PaySpduFlow process0 attribute is null,platformId={},channelId={}",action.getPlatformId(),action.getChannelId());
return; return;
} }
String shaveMakeCall = attributeRule.getShaveMakeCall();
/** /**
* 金额扣量规则 * 金额扣量规则
* 商品id : 回传 * 商品id : 回传
......
package com.lwby.marketing.controller; package com.lwby.marketing.controller;
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.storenovel.UniversalStoreProcess;
import com.lwby.marketing.vo.AttributeRule;
import com.lwby.marketing.vo.StoreNovelAction; import com.lwby.marketing.vo.StoreNovelAction;
import com.lwby.marketing.vo.StoreUserUploadEventBO; import com.lwby.marketing.vo.StoreUserUploadEventBO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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 java.util.Map;
/** /**
* @author songxinyu * @author songxinyu
* @version AttrController.java, v 0.1 2024年03月05日 17:30 songxinyu Exp $ * @version AttrController.java, v 0.1 2024年03月05日 17:30 songxinyu Exp $
...@@ -39,4 +46,43 @@ public class AttrController { ...@@ -39,4 +46,43 @@ public class AttrController {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
@Resource
UniversalStoreProcess up;
@RequestMapping("dedu")
public void testDedu() {
Integer platformId = 601;
Integer channelId = 2122123;
String shaveMakeCall = up.getAttributeRuleByPlatformIdAndChannelId(platformId,channelId);
if (StringUtils.isEmpty(shaveMakeCall)) {
//直接回传,走回传流
return;
}
/**
* 金额扣量规则
* 商品id : 回传
* {
* "1" : 85,
* "2" : 90,
* "3" : 40,
* "4" : 100
* }
*/
Map<String, Integer> map = JSON.parseObject(shaveMakeCall, Map.class);
Integer sprDedu = 0;
String goodId = "1";
for (Map.Entry<String, Integer> entry : map.entrySet()) {
String key = entry.getKey();
if (key.equals(goodId)) {
sprDedu = entry.getValue();
break;
}
}
System.out.println(sprDedu);
}
} }
...@@ -32,6 +32,10 @@ public class StoreNovelAction extends Action { ...@@ -32,6 +32,10 @@ public class StoreNovelAction extends Action {
this(clientInfo,null,userId,openId,type); this(clientInfo,null,userId,openId,type);
} }
public StoreNovelAction(ClientInfo clientInfo,Long userId,String openId,Integer type,String goodId){
this(clientInfo,null,userId,openId,type,goodId);
}
public StoreNovelAction(ClientInfo clientInfo, DeliveryDeviceInfo deliveryDeviceInfo,Long userId,String openId,Integer type){ public StoreNovelAction(ClientInfo clientInfo, DeliveryDeviceInfo deliveryDeviceInfo,Long userId,String openId,Integer type){
this(clientInfo,null,userId,openId,type,null); this(clientInfo,null,userId,openId,type,null);
} }
......
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