Helius
2022-02-21 f54f8a92c09a2cd76b3bbb796df680215b63ab8a
gc-user/src/main/java/com/xzx/gc/user/service/DistribService.java
@@ -106,6 +106,9 @@
    public void join(String headId, String userId) {
        log.info("#加入团队:{}, {}#", headId, userId);
        AccountInfo headInfo = accountMapper.selectOneByUserId(headId);
        if (headInfo == null) {
            return;
        }
        if (AccountInfo.IS_HEAD_N.equals(headInfo.getIsHead())) {
            throw new RestException(-3, "不是团长");
        }
@@ -188,6 +191,7 @@
        stringBuffer.append(pointReward);
        redPaperRule.setStatus((short) 0);
        redPaperRule.setRuleName("分销规则");
        redPaperRule.setRuleType("9");
        redPaperRule.setSharingProfitType("frist_reward,order_num_frist,regular_point,regular_money_percent,point_reward");
        redPaperRule.setShareRatio(stringBuffer.toString());
        redPaperRuleMapper.insert(redPaperRule);
@@ -483,6 +487,11 @@
        }
        RedPaperRule rule = redPaperRules.get(0);
        if (rule.getStatus() == 0) {
            log.info("规则被禁用, 不执行返利");
            return;
        }
        String shareTimes = getRuleValue(rule, CommonEnum.朋友圈分享限次.getValue());
        String shareScore = getRuleValue(rule, CommonEnum.朋友圈分享奖励.getValue());
@@ -524,7 +533,9 @@
            sysMessage.setFlag("2");
            sysMessageMapper.insert(sysMessage);
            redisUtil.setex(key, times.toString(), 84400);
            Date tomorrow = DateUtil.parse(DateUtil.tomorrow().toString("yyyy-MM-dd") + " 00:00:00", "yyyy-MM-dd HH:mm:ss");
            long time = DateUtil.between(new Date(), tomorrow, DateUnit.SECOND, false);
            redisUtil.setex(key, times.toString(), (int) time);
        }
    }
@@ -543,6 +554,14 @@
            return;
        }
        List<UserShareInfo> hasInvite = userShareInfoMapper.selectByPhone(phone);
        if (CollUtil.isNotEmpty(hasInvite)) {
            if (hasInvite.size() >= 10) {
                log.info("超过10个,邀请无效:{}", phone);
                return;
            }
        }
        BigDecimal returnScore = new BigDecimal(invite);
        BigDecimal collectScore = StrUtil.isNotBlank(accountInfo.getCollectScore()) ? new BigDecimal(accountInfo.getCollectScore()) : BigDecimal.ZERO;
        accountInfo.setCollectScore(collectScore.add(returnScore).setScale(0, RoundingMode.DOWN).toString());