From c910067dc3a65ed90e93d3352ef2b76955cc8905 Mon Sep 17 00:00:00 2001 From: Hentua <wangdoubleone@gmail.com> Date: Mon, 24 Apr 2023 01:50:16 +0800 Subject: [PATCH] fix --- src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java | 2 +- src/test/java/cc/mrbird/febs/AgentTest.java | 8 +++++++- src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java | 4 ++++ src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java | 7 ++++++- src/main/resources/mapper/modules/MallMemberMapper.xml | 7 ++++--- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java index 0714d62..343bd91 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AgentServiceImpl.java @@ -84,6 +84,10 @@ matrixTreeNode.setParentNode(parentNode == null ? null : parentNode.getMemberId()); matrixTreeNodeMapper.insert(matrixTreeNode); + if (parentNode == null) { + return; + } + List<DataDictionaryCustom> dicList = dataDictionaryCustomMapper.selectDicByType(AppContants.AGENT_LEVEL); DataDictionaryCustom dic = null; for (DataDictionaryCustom dataDictionaryCustom : dicList) { diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java index f428f1b..c755ee4 100644 --- a/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java +++ b/src/main/java/cc/mrbird/febs/mall/service/impl/MemberProfitServiceImpl.java @@ -58,6 +58,7 @@ * @param orderId */ @Override + @Transactional(rollbackFor = Exception.class) public void directProfit(Long orderId) { log.info("######直推奖励, 订单ID:{}######", orderId); MallOrderInfo orderInfo = mallOrderInfoMapper.selectById(orderId); @@ -121,7 +122,7 @@ isSameLevel = 1; // 非代理推代理/非股东推股东 } else { - profitPer = BigDecimal.valueOf(0.1); + profitPer = BigDecimal.valueOf(10); isSameLevel = 2; } } @@ -143,6 +144,10 @@ // 非代理推代理 if (isSameLevel == 2) { + if (StrUtil.isBlank(parentMember.getReferrerIds())) { + continue; + } + List<MallMember> mallMembers = mallMemberMapper.selectParentMemberList(StrUtil.split(parentMember.getReferrerIds(), ','), parentMember.getReferrerId(), 2); if (CollUtil.isEmpty(mallMembers)) { continue; diff --git a/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java b/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java index dfd775b..8ab7948 100644 --- a/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java +++ b/src/main/java/cc/mrbird/febs/rabbit/consumer/AgentConsumer.java @@ -19,7 +19,7 @@ * @date 2021-09-25 **/ @Slf4j -//@Component +@Component public class AgentConsumer { @Autowired diff --git a/src/main/resources/mapper/modules/MallMemberMapper.xml b/src/main/resources/mapper/modules/MallMemberMapper.xml index 4530945..b12db56 100644 --- a/src/main/resources/mapper/modules/MallMemberMapper.xml +++ b/src/main/resources/mapper/modules/MallMemberMapper.xml @@ -492,14 +492,15 @@ </if> </select> - <select id="selectOwnCntByInviteIdAndAccountLevel" resultType="cc.mrbird.febs.mall.entity.MallMember"> - select IFNULL(count(1),0) from mall_member x where x.referrer_id=#{inviteId} + <select id="selectOwnCntByInviteIdAndAccountLevel" resultType="java.lang.Integer"> + select IFNULL(count(1),0) + from mall_member x where x.referrer_id=#{inviteId} and x.level != 'ZERO_LEVEL' <if test="accountLevel == 2"> and x.account_level = 2 </if> <if test="accountLevel == 3"> - and x.accountLevel in (2, 3) + and x.account_level in (2, 3) </if> </select> </mapper> \ No newline at end of file diff --git a/src/test/java/cc/mrbird/febs/AgentTest.java b/src/test/java/cc/mrbird/febs/AgentTest.java index 0474302..bd66d5a 100644 --- a/src/test/java/cc/mrbird/febs/AgentTest.java +++ b/src/test/java/cc/mrbird/febs/AgentTest.java @@ -44,7 +44,13 @@ @Test public void autoLevelUpTest() { - agentProducer.sendAutoLevelUpMsg(1L); + agentProducer.sendAutoLevelUpMsg(803L); + } + + + @Test + public void returnMoneyTest() { + agentProducer.sendOrderReturn(5L); } // // @Autowired -- Gitblit v1.9.1