| | |
| | | log.error("| |_ / /\\ | | | |"); |
| | | log.error("|_| /_/--\\ |_| |_|__"); |
| | | log.error(" "); |
| | | log.error("DMD启动失败,{}", e.getMessage()); |
| | | log.error("启动失败,{}", e.getMessage()); |
| | | log.error("Redis连接异常,请检查Redis连接配置并确保Redis服务已启动"); |
| | | // 关闭 FEBS |
| | | context.close(); |
| | |
| | | log.info("/ /` / / \\ | |\\/| | |_) | | | |_ | | | |_ "); |
| | | log.info("\\_\\_, \\_\\_/ |_| | |_| |_|__ |_|__ |_| |_|__ "); |
| | | log.info(" "); |
| | | log.info("DMD 权限系统启动完毕,地址:{}", url); |
| | | log.info(" 权限系统启动完毕,地址:{}", url); |
| | | |
| | | boolean auto = febsProperties.isAutoOpenBrowser(); |
| | | if (auto && StringUtils.equalsIgnoreCase(active, FebsConstant.DEVELOP)) { |
| | |
| | | |
| | | @Getter |
| | | public enum DataDictionaryEnum { |
| | | USDT_BALANCE_TIME("USDT_BALANCE_TIME","USDT_BALANCE_TIME"), |
| | | WITHDRAW_PERCENT("WITHDRAW_PERCENT","WITHDRAW_PERCENT"), |
| | | RELEASE_PERCENT("RELEASE_PERCENT","RELEASE_PERCENT"), |
| | | JILI_CHI("JILI_CHI","JILI_CHI"), |
| | |
| | | import cc.mrbird.febs.dapp.entity.DataDictionaryCustom; |
| | | import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum; |
| | | import cc.mrbird.febs.dapp.mapper.DappFundFlowDao; |
| | | import cc.mrbird.febs.dapp.mapper.DappMemberDao; |
| | | import cc.mrbird.febs.dapp.mapper.DappStorageMapper; |
| | | import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper; |
| | | import cc.mrbird.febs.dapp.service.DappMemberService; |
| | |
| | | private DappMemberService dappMemberService; |
| | | @Resource |
| | | private DappFundFlowDao dappFundFlowDao; |
| | | @Resource |
| | | private DappMemberDao dappMemberDao; |
| | | @Resource |
| | | private DataDictionaryCustomMapper dataDictionaryCustomMapper; |
| | | @Resource |
| | |
| | | // int decimals = ChainService.getInstance(ChainEnum.BSC_TFC.name()).decimals(); |
| | | int decimals = 18; |
| | | BigInteger tokens = e.tokens; |
| | | BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN); |
| | | BigDecimal amount = new BigDecimal(tokens.toString()).divide(BigDecimal.TEN.pow(decimals), decimals, RoundingMode.HALF_DOWN).setScale(2,BigDecimal.ROUND_DOWN); |
| | | log.info("触发用户存储:{},金额:{},流水ID:{}",e.from,amount,flowId); |
| | | // 账户是否已经注册 |
| | | DappMemberEntity fromMember = dappMemberService.findByAddress(e.from, null); |
| | |
| | | fundFlow.setStatus(2); |
| | | dappFundFlowDao.updateById(fundFlow); |
| | | |
| | | log.info("触发用户存储:{},金额:{},流水ID:{}",e.from,amount,flowId); |
| | | log.info("产生用户存储:{},金额:{},流水ID:{}",e.from,amount,flowId); |
| | | |
| | | /** |
| | | * 新增一条记录 |
| | |
| | | BigDecimal releasePercent = new BigDecimal(dataDictionaryCustom.getValue()); |
| | | DappStorage dappStorage = new DappStorage(); |
| | | dappStorage.setState(1); |
| | | dappStorage.setMemberId(fromMember.getId()); |
| | | dappStorage.setAmount(amount); |
| | | dappStorage.setReleasePercent(releasePercent); |
| | | BigDecimal releaseAmount = amount.multiply(releasePercent).setScale(2, BigDecimal.ROUND_DOWN); |
| | | dappStorage.setReleaseAmount(releaseAmount); |
| | | dappStorageMapper.insert(dappStorage); |
| | | |
| | | DataDictionaryCustom usdtBalanceTimeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode( |
| | | DataDictionaryEnum.USDT_BALANCE_TIME.getType(), |
| | | DataDictionaryEnum.USDT_BALANCE_TIME.getCode() |
| | | ); |
| | | BigDecimal usdtBalanceTime = new BigDecimal(usdtBalanceTimeDic.getValue()); |
| | | BigDecimal multiply = usdtBalanceTime.multiply(amount); |
| | | BigDecimal bigDecimal = fromMember.getUsdtBalance().add(multiply).setScale(2, BigDecimal.ROUND_DOWN); |
| | | fromMember.setUsdtBalance(bigDecimal); |
| | | fromMember.setActiveStatus(1); |
| | | dappMemberDao.updateById(fromMember); |
| | | |
| | | Long id = fundFlow.getId(); |
| | | Long memberId = fromMember.getId(); |
| | |
| | | */ |
| | | chainProducer.sendNodePerkMsg(id); |
| | | /** |
| | | * |
| | | * 3. DAO成员团队奖:5%加权分红(people数量) |
| | | * DAO1: 加权分红50% |
| | | * DAO2:加权分红30% |
| | | * DAO3:加权分红20% |
| | | */ |
| | | chainProducer.sendTeamPerk(id); |
| | | /** |
| | | *3. 成员升级 |
| | | * * DAO1:小区业绩30万/币 加权分红50% |
| | | * * DAO2:小区业绩100万/币 加权分红30% |
| | | * * DAO3:小区业绩500万/币加权分红20% |
| | | * * DAO1:小区业绩30万/币 |
| | | * * DAO2:小区业绩100万/币 |
| | | * * DAO3:小区业绩500万/币 |
| | | */ |
| | | chainProducer.sendMemberLevel(memberId); |
| | | |
| | |
| | | if(1 != activeStatus){ |
| | | continue; |
| | | } |
| | | //获取上级全部的直推 |
| | | //获取上级全部的激活直推 |
| | | String inviteId = dappMemberEntityRef.getInviteId(); |
| | | QueryWrapper<DappMemberEntity> memberInviteQuery = new QueryWrapper<>(); |
| | | memberInviteQuery.eq("referer_id",inviteId); |
| | | memberInviteQuery.eq("active_status",1); |
| | | List<DappMemberEntity> memberInviteList = dappMemberDao.selectList(memberInviteQuery); |
| | | |
| | | //如果没有直推,则跳过 |
| | |
| | | perkMemberId, |
| | | MoneyFlowEnum.DYNAMIC_PERK.getValue(), |
| | | StrUtil.format(MoneyFlowEnum.DYNAMIC_PERK.getDescrition(),amount,memberInviteList.size(),perkAmount)); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | BigDecimal daoNodeAmount = daoNodeAmountTotal.divide(new BigDecimal(dappMemberEntities.size()),2,BigDecimal.ROUND_DOWN); |
| | | for(DappMemberEntity nodeMember : dappMemberEntities){ |
| | | this.updateBalanceInsertFlow( |
| | | daoNodeAmount, |
| | | // this.updateBalanceInsertFlow( |
| | | // daoNodeAmount, |
| | | // nodeMember.getId(), |
| | | // MoneyFlowEnum.NODE_PERK.getValue(), |
| | | // StrUtil.format(MoneyFlowEnum.NODE_PERK.getDescrition(),amount,dappMemberEntities.size(),daoNodeAmount)); |
| | | |
| | | |
| | | |
| | | //生成一条流水 |
| | | DappFundFlowEntity rePutInFlow = new DappFundFlowEntity( |
| | | nodeMember.getId(), |
| | | daoNodeAmount, |
| | | MoneyFlowEnum.NODE_PERK.getValue(), |
| | | 2, |
| | | null, |
| | | StrUtil.format(MoneyFlowEnum.NODE_PERK.getDescrition(),amount,dappMemberEntities.size(),daoNodeAmount)); |
| | | dappFundFlowDao.insert(rePutInFlow); |
| | | //更新用户的金额 |
| | | dappWalletService.updateWalletCoinWithLock(daoNodeAmount, nodeMember.getId(), 1); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public void teamPerk(Long id) { |
| | | DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectById(id); |
| | | if(ObjectUtil.isEmpty(dappFundFlowEntity)){ |
| | | return; |
| | | } |
| | | |
| | | if(MoneyFlowEnum.CUN_CHU.getValue() != dappFundFlowEntity.getType()){ |
| | | return; |
| | |
| | | } |
| | | |
| | | QueryWrapper<DappMemberEntity> daoThreeQuery = new QueryWrapper<>(); |
| | | daoThreeQuery.eq("level", MemberLevelEnum.DAO_2.getCode()); |
| | | daoThreeQuery.eq("level", MemberLevelEnum.DAO_3.getCode()); |
| | | List<DappMemberEntity> daoThrees = dappMemberDao.selectList(daoThreeQuery); |
| | | if(CollUtil.isNotEmpty(daoThrees)){ |
| | | BigDecimal bigDecimal = totalAmount.multiply(new BigDecimal("0.2")).setScale(2, BigDecimal.ROUND_DOWN); |
| | |
| | | } |
| | | //获取全部上级 |
| | | ArrayList<DappMemberEntity> activeMembers = new ArrayList<>(); |
| | | List<String> refererIds = Arrays.asList(StrUtil.split(",", dappMemberEntity.getRefererIds())); |
| | | List<String> refererIds = Arrays.asList(StrUtil.split(dappMemberEntity.getRefererIds(),",")); |
| | | for(String inviteId : refererIds){ |
| | | DappMemberEntity memberEntity = dappMemberDao.selectMemberInfoByInviteId(inviteId); |
| | | if(ObjectUtil.isNotEmpty(memberEntity)){ |
| | |
| | | public void sendMemberLevel(Long id) { |
| | | log.info("发送成员升级,会员ID:{}", id); |
| | | CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString()); |
| | | rabbitTemplate.convertAndSend(QueueEnum.FPD_TEAM_PERK.getExchange(), QueueEnum.FPD_TEAM_PERK.getRoute(), id, correlationData); |
| | | rabbitTemplate.convertAndSend(QueueEnum.FPD_MEMBER_LEVEL.getExchange(), QueueEnum.FPD_MEMBER_LEVEL.getRoute(), id, correlationData); |
| | | } |
| | | |
| | | } |
| | |
| | | datasource: |
| | | # 数据源-1,名称为 base |
| | | base: |
| | | username: db_sdm |
| | | password: sdm123!@# |
| | | username: db_fpd_prd |
| | | password: db_fpd_prd123!@# |
| | | # 8.210.56.119 |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://8.210.56.119:3306/db_sdm?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/db_fpd_prd?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | |
| | | redis: |
| | | # Redis数据库索引(默认为 0) |
| | | database: 15 |
| | | database: 1 |
| | | # Redis服务器地址 |
| | | host: 8.210.56.119 |
| | | host: 127.0.0.1 |
| | | # Redis服务器连接端口 |
| | | port: 6379 |
| | | # Redis 密码 |
| | |
| | | # 连接超时时间(毫秒) |
| | | timeout: 5000 |
| | | rabbitmq: |
| | | host: 8.210.56.119 |
| | | host: 127.0.0.1 |
| | | port: 5672 |
| | | username: xc_rabbit |
| | | password: xuncong123 |
| | |
| | | datasource: |
| | | # 数据源-1,名称为 base |
| | | base: |
| | | username: db_sdm |
| | | password: sdm123!@# |
| | | username: db_fpd_prd |
| | | password: db_fpd_prd123!@# |
| | | # 8.210.56.119 |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://127.0.0.1:3306/db_sdm?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://127.0.0.1:3306/db_fpd_prd?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | |
| | | redis: |
| | | # Redis数据库索引(默认为 0) |
| | | database: 15 |
| | | database: 1 |
| | | # Redis服务器地址 |
| | | host: 127.0.0.1 |
| | | # Redis服务器连接端口 |
| | |
| | | datasource: |
| | | dynamic: |
| | | # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗 |
| | | p6spy: true |
| | | p6spy: false |
| | | hikari: |
| | | connection-timeout: 30000 |
| | | max-lifetime: 1800000 |
| | |
| | | datasource: |
| | | # 数据源-1,名称为 base |
| | | base: |
| | | username: ct_test |
| | | password: 123456 |
| | | username: db_fpd_prd |
| | | password: db_fpd_prd123!@# |
| | | # 8.210.56.119 |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://120.27.238.55:3306/db_sdm?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | url: jdbc:mysql://47.238.110.34:3306/db_fpd_prd?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8 |
| | | |
| | | redis: |
| | | # Redis数据库索引(默认为 0) |
| | | database: 10 |
| | | database: 1 |
| | | # Redis服务器地址 |
| | | host: 120.27.238.55 |
| | | host: 47.238.110.34 |
| | | # Redis服务器连接端口 |
| | | port: 6379 |
| | | # Redis 密码 |
| | | password: xcong123 |
| | | password: 1234!@#$!QAZ |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | |
| | | # 连接超时时间(毫秒) |
| | | timeout: 5000 |
| | | rabbitmq: |
| | | host: 120.27.238.55 |
| | | host: 47.238.110.34 |
| | | port: 5672 |
| | | username: ct_rabbit |
| | | password: 123456 |
| | | username: xc_rabbit |
| | | password: xuncong123 |
| | | publisher-confirm-type: correlated |
| | | |
| | | jackson: |
| | | date-format: yyyy-MM-dd HH:mm:ss |
| | | time-zone: GMT+8 |
| | | |
| | | system: |
| | | online-transfer: false |
| | | chain-listener: false |
| | | reset-job: false |
| | | debug: false |
| | | charge-transfer: false |
| | | debug: false |
| | |
| | | |
| | | spring: |
| | | profiles: |
| | | active: dev |
| | | active: test |
| | | |
| | | thymeleaf: |
| | | cache: false |
| | |
| | | <html xmlns:th="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>DMD 权限系统</title> |
| | | <title> 权限系统</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | |
| | | <html xmlns:th="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>DMD 权限系统</title> |
| | | <title> 权限系统</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | |
| | | <html xmlns:th="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>DMD 权限系统</title> |
| | | <title> 权限系统</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | |
| | | <div class="layui-side-scroll"> |
| | | <div class="layui-logo" style="cursor: pointer"> |
| | | <img data-th-src="@{febs/images/logo.png}"> |
| | | <span>DMD 权限系统</span> |
| | | <span> 权限系统</span> |
| | | </div> |
| | | <script |
| | | type="text/html" |
| | |
| | | <html xmlns:th="http://www.thymeleaf.org"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>DMD 权限系统</title> |
| | | <title> 权限系统</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | |
| | | <div class="layui-container"> |
| | | <div class="layui-row"> |
| | | <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4 febs-tc"> |
| | | <div class="layui-logo"><span><b>DMD</b> 权限系统</span></div> |
| | | <div class="layui-logo"><span><b></b> 权限系统</span></div> |
| | | </div> |
| | | <div class="layui-col-xs12 layui-col-lg4 layui-col-lg-offset4" id="login-div"> |
| | | <div class="layui-form" lay-filter="login-form"> |
| | |
| | | xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>DMD 权限系统</title> |
| | | <title> 权限系统</title> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | |
| | | 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); |
| | | } |
| | | } |