| | |
| | | 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, "不是团长"); |
| | | } |
| | |
| | | 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); |
| | |
| | | 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()); |