Commit 48c284ed by guanchen

修复回扣bug

parent b8246889
...@@ -18,4 +18,6 @@ public interface AgentRevokeRecordsMapper extends BaseMapper<AgentRevokeRecords> ...@@ -18,4 +18,6 @@ public interface AgentRevokeRecordsMapper extends BaseMapper<AgentRevokeRecords>
int insertOrUpdateSelective(AgentRevokeRecords record); int insertOrUpdateSelective(AgentRevokeRecords record);
int getSuccessExisting(String refId, Integer revokeType); int getSuccessExisting(String refId, Integer revokeType);
int getSuccessExistingBySubOrder(String orderType, String orderSn, String subOrderSn);
} }
\ No newline at end of file
...@@ -296,6 +296,9 @@ public class AgentRewardQueueTask { ...@@ -296,6 +296,9 @@ public class AgentRewardQueueTask {
AgentReward agentReward = new AgentReward(); AgentReward agentReward = new AgentReward();
agentReward.setRewardType(message.getRewardType()); agentReward.setRewardType(message.getRewardType());
agentReward.setRechargeTime(DateUtils.parse(message.getRechargeTime(), DateUtils.FORMAT_LONG)); agentReward.setRechargeTime(DateUtils.parse(message.getRechargeTime(), DateUtils.FORMAT_LONG));
if (rewardType != AGENT_REWARD_TYPE_SELF_ORDER && rewardType != AGENT_REWARD_TYPE_SHARE_ORDER) {
agentReward.setSettleTime(DateUtils.parse(message.getRechargeTime(), DateUtils.FORMAT_LONG));
}
agentReward.setSourceUserId(message.getSourceUserId()); agentReward.setSourceUserId(message.getSourceUserId());
agentReward.setReferenceId(Long.parseLong(message.getReferenceId())); agentReward.setReferenceId(Long.parseLong(message.getReferenceId()));
agentReward.setAgentId(agent.getAgentId()); agentReward.setAgentId(agent.getAgentId());
......
...@@ -80,8 +80,14 @@ public class RevokeAgentRewardTask { ...@@ -80,8 +80,14 @@ public class RevokeAgentRewardTask {
* 如果存在已成功扣除的记录 * 如果存在已成功扣除的记录
* 不再重复处理, 写190 * 不再重复处理, 写190
*/ */
int existingCnt = agentRevokeRecordsService.getSuccessExisting(revokeRecord.getRefId(), revokeRecord.getRevokeType()); int existingCnt = 0;
if (revokeType == AGENT_REVOKE_TYPE_ACTIVATION || revokeType == AGENT_REVOKE_TYPE_SELF_ORDER) {
existingCnt = agentRevokeRecordsService.getSuccessExisting(revokeRecord.getRefId(), revokeRecord.getRevokeType());
} else if (revokeType == AGENT_REVOKE_TYPE_SHARE_ORDER) {
existingCnt = agentRevokeRecordsService.getSuccessExisting(revokeRecord.getOrderType(), revokeRecord.getOrderSn(), revokeRecord.getSubOrderSn());
}
if (existingCnt > 0) { if (existingCnt > 0) {
logger.info("奖励已经扣除过, 无需重复扣除, id: {}", revokeRecord.getId());
revokeRecord.setState(REVOKE_STATE_DO_NOTHING); revokeRecord.setState(REVOKE_STATE_DO_NOTHING);
agentRevokeRecordsService.updateById(revokeRecord); agentRevokeRecordsService.updateById(revokeRecord);
return; return;
......
...@@ -25,4 +25,6 @@ public interface AgentRevokeRecordsService extends IService<AgentRevokeRecords>{ ...@@ -25,4 +25,6 @@ public interface AgentRevokeRecordsService extends IService<AgentRevokeRecords>{
List<AgentRevokeRecords> getAllPending(); List<AgentRevokeRecords> getAllPending();
int getSuccessExisting(String refId, Integer revokeType); int getSuccessExisting(String refId, Integer revokeType);
int getSuccessExisting(String orderType, String orderSn, String subOrderSn);
} }
...@@ -48,4 +48,9 @@ public class AgentRevokeRecordsServiceImpl extends ServiceImpl<AgentRevokeRecord ...@@ -48,4 +48,9 @@ public class AgentRevokeRecordsServiceImpl extends ServiceImpl<AgentRevokeRecord
public int getSuccessExisting(String refId, Integer revokeType) { public int getSuccessExisting(String refId, Integer revokeType) {
return baseMapper.getSuccessExisting(refId, revokeType); return baseMapper.getSuccessExisting(refId, revokeType);
} }
@Override
public int getSuccessExisting(String orderType, String orderSn, String subOrderSn) {
return baseMapper.getSuccessExistingBySubOrder(orderType, orderSn, subOrderSn);
}
} }
...@@ -258,5 +258,12 @@ ...@@ -258,5 +258,12 @@
SELECT count(*) SELECT count(*)
FROM agent_revoke_records FROM agent_revoke_records
WHERE state=120 and ref_id=#{refId} and revoke_type=#{revokeType} WHERE state=120 and ref_id=#{refId} and revoke_type=#{revokeType}
and revoke_type in (100,300)
</select> </select>
<select id="getSuccessExistingBySubOrder" resultType="int">
SELECT count(*)
FROM agent_revoke_records
WHERE state=120 and order_type=#{orderType} and order_sn=#{orderSn} and sub_order_sn=#{subOrderSn}
and revoke_type=400
</select>
</mapper> </mapper>
\ 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