| | |
| | | package cc.mrbird.febs; |
| | | |
| | | import cc.mrbird.febs.common.contants.AppContants; |
| | | import cc.mrbird.febs.dapp.entity.DappMemberEntity; |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.dapp.dto.ConnectDto; |
| | | import cc.mrbird.febs.dapp.entity.DappFundFlowEntity; |
| | | import cc.mrbird.febs.dapp.enumerate.MoneyFlowEnum; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | | import cc.mrbird.febs.dapp.service.DappSystemService; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author wzy |
| | |
| | | public class MemberTest { |
| | | |
| | | @Autowired |
| | | private DappMemberDao dappMemberDao; |
| | | |
| | | private DappMemberService dappMemberService; |
| | | @Autowired |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | private DappFundFlowDao dappFundFlowDao; |
| | | |
| | | @Resource |
| | | private DappSystemService dappSystemService; |
| | | |
| | | @Test |
| | | public void refererIdsTest() { |
| | | DappMemberEntity member = dappMemberDao.selectById(24); |
| | | public void register() {//注册 |
| | | ConnectDto connectDto = new ConnectDto(); |
| | | connectDto.setAddress("0x597e5F0EDB294e7d28EB10A95aa2EEcd169a2dd7"); |
| | | connectDto.setInviteId("53609999"); |
| | | dappMemberService.connect(connectDto); |
| | | } |
| | | |
| | | boolean flag = false; |
| | | String parentId = "35087336"; |
| | | String ids = ""; |
| | | String feeProfitIds = ""; |
| | | @Test |
| | | public void registerV2() {//存储 |
| | | Long memberId = 348L; |
| | | BigDecimal bigDecimal = new BigDecimal("500"); |
| | | DappFundFlowEntity fundFlow = new DappFundFlowEntity( |
| | | memberId, |
| | | bigDecimal.abs(), |
| | | MoneyFlowEnum.CUN_CHU.getValue(), |
| | | 1, |
| | | BigDecimal.ZERO, |
| | | StrUtil.format(MoneyFlowEnum.CUN_CHU.getDescrition(),bigDecimal)); |
| | | dappFundFlowDao.insert(fundFlow); |
| | | |
| | | int i = 1; |
| | | List<DataDictionaryCustom> feeProfitDic = dataDictionaryCustomMapper.selectDicByType(AppContants.DIC_TYPE_DISTRIBUTE_PROP); |
| | | while (!flag && StringUtils.isNotBlank(parentId)) { |
| | | if (StrUtil.isBlank(ids)) { |
| | | ids += parentId; |
| | | } else { |
| | | ids += ("," + parentId); |
| | | } |
| | | } |
| | | |
| | | if (i <= 4) { |
| | | if (StrUtil.isBlank(feeProfitIds)) { |
| | | feeProfitIds += parentId; |
| | | } else { |
| | | feeProfitIds += ("," + parentId); |
| | | } |
| | | } |
| | | @Test |
| | | public void registerV3() {//存储 |
| | | dappSystemService.teamPerk(4360L); |
| | | |
| | | i++; |
| | | DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(parentId); |
| | | if (parentMember == null) { |
| | | break; |
| | | } |
| | | parentId = parentMember.getRefererId(); |
| | | if(StringUtils.isBlank(parentId) || "0".equals(parentId)){ |
| | | break; |
| | | } |
| | | if (parentMember.getRefererId().equals(parentMember.getInviteId())) { |
| | | flag = true; |
| | | } |
| | | } |
| | | member.setRefererIds(ids); |
| | | member.setFeeProfitIds(feeProfitIds); |
| | | } |
| | | } |