Commit 07c1474a by guanchen

v1.4.5上线

parent 42bf0f18
......@@ -18,17 +18,18 @@ public class Constants {
* 代理商奖励类型
*/
public static final int AGENT_REWARD_TYPE_YEAR_VIP = 710;
public static final String AGENT_REWARD_TYPE_YEAR_VIP_REMARK = "城市代理商所得的购买年-VIP";
public static final int AGENT_REWARD_TYPE_HALF_YEAR_VIP = 720;
public static final String AGENT_REWARD_TYPE_HALF_YEAR_VIP_REMARK = "城市代理商所得的购买半年-VIP";
public static final int AGENT_REWARD_TYPE_SVIP = 730;
public static final String AGENT_REWARD_TYPE_SVIP_REMARK = "城市代理商所得的购买超级VIP收益";
public static final String AGENT_REWARD_TYPE_YEAR_VIP_REMARK = "推荐奖励-年VIP";
// public static final int AGENT_REWARD_TYPE_HALF_YEAR_VIP = 720;
// public static final String AGENT_REWARD_TYPE_HALF_YEAR_VIP_REMARK = "城市代理商所得的购买半年-VIP";
// public static final int AGENT_REWARD_TYPE_SVIP = 730;
// public static final String AGENT_REWARD_TYPE_SVIP_REMARK = "城市代理商所得的购买超级VIP收益";
public static final int AGENT_REWARD_TYPE_REDPACK = 740;
public static final String AGENT_REWARD_TYPE_REDPACK_REMARK = "城市代理商的红包收益";
public static final String AGENT_REWARD_TYPE_REDPACK_REMARK = "推荐奖励-普通用户购买红包";
public static final int AGENT_REWARD_TYPE_SELF_ORDER = 750;
public static final String AGENT_REWARD_TYPE_SELF_ORDER_REMARK = "城市代理商的自购省收益";
public static final String AGENT_REWARD_TYPE_SELF_ORDER_REMARK = "推荐奖励-自购省";
public static final int AGENT_REWARD_TYPE_SHARE_ORDER = 760;
public static final String AGENT_REWARD_TYPE_SHARE_ORDER_REMARK = "城市代理商的分享赚收益";
public static final String AGENT_REWARD_TYPE_SHARE_ORDER_REMARK = "推荐奖励-分享赚";
public static final int JD_OFFSET = 1000; //用于查找京东的平推奖励比例
public static Map<Integer, Map<Integer, BigDecimal>> AGENT_RATE_MAP = new HashMap<Integer, Map<Integer, BigDecimal>>();
public static Map<Integer, String> AGENT_REWARD_REMARK = new HashMap<Integer, String>();
public static final int AGENT_LEVEL_1 = 1;
......@@ -38,6 +39,7 @@ public class Constants {
public static final String DISTRIBUTE_REDIS_LOCK_KEY = "huhu:partner:distribute:redis:key";
public static final String PARENT_COLUMN_NAME_CENGJI = "parent_agent_id";
public static final String PARENT_COLUMN_NAME_PINGTUI = "presenter_id";
public static final String ORDER_TYPE_JD = "jd";
/**
* 回扣类型
*/
......@@ -135,37 +137,39 @@ public class Constants {
* 代理商平推奖励比例配置
*/
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_YEAR_VIP, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_HALF_YEAR_VIP, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SVIP, new HashMap<Integer, BigDecimal>());
// AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_HALF_YEAR_VIP, new HashMap<Integer, BigDecimal>());
// AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SVIP, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_REDPACK, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SELF_ORDER, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SHARE_ORDER, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SELF_ORDER + JD_OFFSET, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.put(AGENT_REWARD_TYPE_SHARE_ORDER + JD_OFFSET, new HashMap<Integer, BigDecimal>());
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_YEAR_VIP).put(0, new BigDecimal("0.03333333"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_YEAR_VIP).put(1, new BigDecimal("0.01388889"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_YEAR_VIP).put(2, new BigDecimal("0.00833333"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_YEAR_VIP).put(0, new BigDecimal("0.02512563"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_YEAR_VIP).put(1, new BigDecimal("0.01507538"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(0, new BigDecimal("0.03015075"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(1, new BigDecimal("0.01256281"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(2, new BigDecimal("0.00753769"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(0, new BigDecimal("0.02500000"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(1, new BigDecimal("0.01111111"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(2, new BigDecimal("0.00555556"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(0, new BigDecimal("0.03015075"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(1, new BigDecimal("0.01256281"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_HALF_YEAR_VIP).put(2, new BigDecimal("0.00753769"));
//
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(0, new BigDecimal("0.02500000"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(1, new BigDecimal("0.01111111"));
// AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SVIP).put(2, new BigDecimal("0.00555556"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_REDPACK).put(0, new BigDecimal("0.03"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_REDPACK).put(1, new BigDecimal("0.02"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_REDPACK).put(2, new BigDecimal("0.01"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER).put(0, new BigDecimal("0.03"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER).put(1, new BigDecimal("0.02"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER).put(2, new BigDecimal("0.01"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER).put(0, new BigDecimal("0.03"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER).put(1, new BigDecimal("0.02"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER).put(2, new BigDecimal("0.01"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER).put(0, new BigDecimal("0.009"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER).put(1, new BigDecimal("0.009"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER + JD_OFFSET).put(0, new BigDecimal("0.0087"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SELF_ORDER + JD_OFFSET).put(1, new BigDecimal("0.0087"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER).put(0, new BigDecimal("0.009"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER).put(1, new BigDecimal("0.009"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER + JD_OFFSET).put(0, new BigDecimal("0.0087"));
AGENT_RATE_MAP.get(AGENT_REWARD_TYPE_SHARE_ORDER + JD_OFFSET).put(1, new BigDecimal("0.0087"));
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_YEAR_VIP, AGENT_REWARD_TYPE_YEAR_VIP_REMARK);
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_HALF_YEAR_VIP, AGENT_REWARD_TYPE_HALF_YEAR_VIP_REMARK);
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_SVIP, AGENT_REWARD_TYPE_SVIP_REMARK);
// AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_HALF_YEAR_VIP, AGENT_REWARD_TYPE_HALF_YEAR_VIP_REMARK);
// AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_SVIP, AGENT_REWARD_TYPE_SVIP_REMARK);
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_REDPACK, AGENT_REWARD_TYPE_REDPACK_REMARK);
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_SELF_ORDER, AGENT_REWARD_TYPE_SELF_ORDER_REMARK);
AGENT_REWARD_REMARK.put(AGENT_REWARD_TYPE_SHARE_ORDER, AGENT_REWARD_TYPE_SHARE_ORDER_REMARK);
......
......@@ -36,7 +36,7 @@ public class UserController {
@RequestMapping(value = "/relation/nocache", method = RequestMethod.POST)
public Result<User> getRelationNoCache(@RequestBody @Valid User user, @RequestHeader HttpHeaders headers) {
if (logger.isInfoEnabled()) {
logger.info("getRelation userId:{},header:{},time:{}", user.getUserId(), headers.keySet().toArray(), LocalDateTime.now());
logger.info("getRelationNocache userId:{},header:{},time:{}", user.getUserId(), headers.keySet().toArray(), LocalDateTime.now());
}
return userManager.getRelationNoCache(user.getUserId());
}
......
......@@ -70,7 +70,7 @@ public class AgentManager {
agentRewardMessage.setSourceUserId(2328);
agentRewardMessage.setReferenceId("9999");
agentRewardMessage.setAgentId(33);
agentRewardMessage.setAgentReward(new BigDecimal(5));
// agentRewardMessage.setAgentReward(new BigDecimal(0));
agentRewardMessage.setSourceUserPayment(new BigDecimal(5));
agentRewardMessage.setSettleState(-100);
agentRewardMessage.setOrderType("taobao");
......
......@@ -20,7 +20,7 @@ public class AgentRewardMessage extends BaseModel {
int sourceUserId;
String referenceId;
int agentId;
BigDecimal agentReward;
// BigDecimal agentReward;
int settleState;
String orderType;
String orderSn;
......@@ -30,7 +30,7 @@ public class AgentRewardMessage extends BaseModel {
String orderGoodsId;
String orderTitle;
String rewardTypeChild;
String orderRateArray;
// String orderRateArray;
String sourceOrder;
@Override
......@@ -41,7 +41,7 @@ public class AgentRewardMessage extends BaseModel {
one.sourceUserId = this.sourceUserId;
one.referenceId = this.referenceId;
one.agentId = this.agentId;
one.agentReward = this.agentReward;
// one.agentReward = this.agentReward;
one.settleState = this.settleState;
one.orderType = this.orderType;
one.orderSn = this.orderSn;
......@@ -51,7 +51,7 @@ public class AgentRewardMessage extends BaseModel {
one.orderGoodsId = this.orderGoodsId;
one.orderTitle = this.orderTitle;
one.rewardTypeChild = this.rewardTypeChild;
one.orderRateArray = this.orderRateArray;
// one.orderRateArray = this.orderRateArray;
one.sourceOrder = this.sourceOrder;
return one;
}
......
......@@ -57,12 +57,12 @@ public class UserServiceImpl implements UserService {
@Override
@Cacheable
public User getRelationByUserId(Integer userId) {
logger.info("UserServiceImpl get user relation from database, userId: {}", userId);
return getRelationByUserIdRealtime(userId);
}
@Override
public User getRelationByUserIdRealtime(Integer userId) {
logger.info("UserServiceImpl get user relation from database, userId: {}", userId);
User user = new User();
user.setUserId(userId);
user.setPartnerList((ArrayList<ParentPartner>) getPartnerListByUserId(userId));
......@@ -267,15 +267,17 @@ public class UserServiceImpl implements UserService {
* 1. 层级关系 都包含自己
* 2. 推荐关系 只有当自己是总代时才包含自己
*/
if (null != selfAgent && (parentColumnName.equals(PARENT_COLUMN_NAME_CENGJI) ||
parentColumnName.equals(PARENT_COLUMN_NAME_PINGTUI) && selfAgent.getAgentLevel() == AGENT_LEVEL_1)) {
} else {
selfAgent = null;
}
/**
* 1.4.5更新: 平推奖励都不包含自己了
*/
int loopUserId = userId;
int loopTimes = 0;
UserAgent firstAgent = null;
/**
* 自己不是代理商的话 按C端邀请关系找到第一个代理商
* 自己是代理商的话 按B端找, 如果是找平推, 最后都找完再剔除自己
*/
if (selfAgent == null) {
/**
* 自己不是代理商时 按C端邀请关系查找代理商
......@@ -382,7 +384,16 @@ public class UserServiceImpl implements UserService {
logger.info("已找到总代 不再往下找, 总代id: {}", firstAgent.getAgentId());
}
}
/**
* 如果是平推奖励 过滤掉自己
*/
if (parentColumnName.equals(PARENT_COLUMN_NAME_PINGTUI)
&& selfAgent != null
&& agentList.size() > 0) {
agentList.remove(0);
}
}
if (logger.isInfoEnabled()) {
logger.info("setAgentList for user: {} end", userId);
}
......
......@@ -6,11 +6,11 @@
<property name="MaxFileSize" value="256MB"/><!--单个文件大小-->
<property name="totalSizeCap" value="256MB"/><!--单个文件大小-->
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${pattern}</pattern>
</encoder>
</appender>
<!--<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">-->
<!--<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">-->
<!--<pattern>${pattern}</pattern>-->
<!--</encoder>-->
<!--</appender>-->
<appender name="info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${log_file}-info.log</File>
......@@ -24,7 +24,7 @@
<pattern>${pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level>
<level>DEBUG</level>
</filter>
</appender>
......@@ -47,7 +47,7 @@
</appender>
<root level="info">
<appender-ref ref="stdout"/>
<!--<appender-ref ref="stdout"/>-->
<appender-ref ref="info"/>
<appender-ref ref="error"/>
</root>
......
......@@ -55,4 +55,28 @@ select * from partner_income_summary where user_id=1648 and yeartime=2019 and mo
delete from partner_account_log where user_id=1648 and yeartime=2019 and monthtime=6;
update partner_reward set reward_status=100,settle_state=case when settle_state=300 then 200 else settle_state end where user_id=1648 and recharge_time BETWEEN '2019-06-01 00:00:00' and '2019-06-30 23:59:59' ;
delete from partner_income_summary where user_id=1648 and yeartime=2019 and monthtime=6;
\ No newline at end of file
delete from partner_income_summary where user_id=1648 and yeartime=2019 and monthtime=6;
更新自购省分享赚比例
update income_rate_config
set self_rate=0.522
where type in (20,40) and self_role=10;
update income_rate_config
set self_rate=0.783
where type in (20,40) and self_role=20;
update income_rate_config
set self_rate=0.8352
where type in (20,40) and self_role=30;
update income_rate_config
set self_rate=0.54
where type in (10,30) and self_role=10;
update income_rate_config
set self_rate=0.81
where type in (10,30) and self_role=20;
update income_rate_config
set self_rate=0.864
where type in (10,30) and self_role=30;
ALTER TABLE `huhu`.`partner_reward`
ADD COLUMN `tech_fee_rate` decimal(11, 6) NOT NULL DEFAULT 0 COMMENT '技术服务费扣除比例' AFTER `ratio_all`;
\ No newline at end of file
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