xiaoyong931011
2023-05-26 57c12d09f1478036f659a718c81a18f7875aeccb
twoCoin项目修改
38 files modified
22 files added
3959 ■■■■■ changed files
src/main/java/cc/mrbird/febs/FebsShiroApplication.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java 1 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/contants/AppContants.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/common/entity/BaseEntity.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java 18 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/controller/ApiDappMemberController.java 45 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/dto/AKLineDto.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/dto/MineToCoinDto.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/dto/TransferADto.java 45 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/dto/TransferAusdDto.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/dto/WithdrawDto.java 6 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappAKlineEntity.java 30 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappChargeUsdtEntity.java 61 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappMemberNodeEntity.java 2 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DappUsdtPerkEntity.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/DataDictionaryCustom.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/entity/NodePerk.java 54 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/enumerate/FundFlowEnum.java 78 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/enumerate/MemberLevelEnum.java 100 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/enumerate/PoolEnum.java 139 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappAKlineMapper.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappChargeUsdtMapper.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberNodeMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappUsdtPerkEntityMapper.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappWalletCoinDao.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappWalletMineDao.java 4 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/DappMemberService.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/DappSystemService.java 61 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java 204 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 1325 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 509 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/AKLineLimitVo.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/AKLineVo.java 35 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/DappFundFlowVo.java 22 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/DappMemberInfoVo.java 30 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/MyInviteChildInfoVo.java 23 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/MyInviteInfoVo.java 26 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/vo/TeamListVo.java 13 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/job/BnbTransferJob.java 161 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/rabbit/QueueConstants.java 54 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/rabbit/QueueEnum.java 40 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/rabbit/RabbitConfiguration.java 144 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java 80 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/rabbit/producer/ChainProducer.java 80 ●●●●● patch | view | raw | blame | history
src/main/resources/application-dev.yml 10 ●●●● patch | view | raw | blame | history
src/main/resources/application-test.yml 25 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappAKlineMapper.xml 64 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappChargeUsdtMapper.xml 11 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappFundFlowDao.xml 18 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberDao.xml 57 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappMemberNodeMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappUsdtPerkEntityMapper.xml 13 ●●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappWalletCoinDao.xml 6 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappWalletMineDao.xml 7 ●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/dapp/money-change-flow.html 8 ●●●● patch | view | raw | blame | history
src/test/java/cc/mrbird/febs/MemberTest.java 57 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/FebsShiroApplication.java
@@ -5,6 +5,7 @@
import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cn.hutool.core.util.StrUtil;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,6 +31,8 @@
    @Autowired
    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
    @Autowired
    private DappSystemService dappSystemService;
    @Autowired
    private SystemConstants systemConstants;
@@ -42,7 +45,9 @@
    @PostConstruct
    public void systemConstantsInit() {
        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.FEE_ADDRESS_KEY.getType(), DataDictionaryEnum.FEE_ADDRESS_KEY.getCode());
        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                DataDictionaryEnum.FEE_ADDRESS_KEY.getType(),
                DataDictionaryEnum.FEE_ADDRESS_KEY.getCode());
        String key = dataDictionaryCustom.getCode();
        key = StrUtil.toCamelCase(key);
        String value = dataDictionaryCustom.getValue();
@@ -57,4 +62,10 @@
        }
    }
//    @PostConstruct
//    public void systemDicInit() {
//        dappSystemService.selectAndInsertDics();
//    }
}
src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -28,6 +28,7 @@
        registration.excludePathPatterns("/dapi/common/**");
        registration.excludePathPatterns("/dapi/member/runListInfo");
        registration.excludePathPatterns("/dapi/member/nodeInfo");
        registration.excludePathPatterns("/dapi/member/aKLine");
    }
    /**
src/main/java/cc/mrbird/febs/common/contants/AppContants.java
@@ -7,10 +7,11 @@
public class AppContants {
    public static final String MAXACHIEVE = "MAXACHIEVE";
    public static final String MINACHIEVE = "MINACHIEVE";
    /**
     * 系统用户
     */
    public static final String SYSTEM_USER = "system";
    public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCzIfAF0gZs9zn9ENRtz6ocHa8MGljmMmCsjLsRvTIAilBMypMJz/VNooAOhd8GTdsWm8FNGVhRauv7RfxorFJ4Um2UbweUQBIZP2pzZMnclHxhUmYZsn/6IaPzijiUNfEjygtE7ezvso/67ecZJwqfrtlbEjqUbRgo17Qj23suwQIDAQAB";
@@ -191,5 +192,31 @@
     */
    public static final String ADDRESS_PEOJECT = "0xbE3ACc3ae4f12f9b4795E4ed62a082cbCe6250Da";
    /**
     * A入金,90%进入A底池--A底池钱包
     */
    public static final String ADDRESS_A_POOL_PEOJECT = "0xA60AaC0da34C76F3f60207ee09e9F75043319ab4";
    /**
     * A入金,10%进入B底池--B底池钱包
     */
    public static final String ADDRESS_B_POOL_PEOJECT = "0xA60AaC0da34C76F3f60207ee09e9F75043319ab4";
    public static final BigDecimal NODE_PERK_PERCENT = new BigDecimal(0.2);
    public static final Map FEE_ADDRESS_KEY = new HashMap<String,String>();
    /**
     * AK线返回的条数
     */
    public static final int K_LINE_LIMIT = 100;
    /**
     * AK线返回的条数
     */
    public static final String K_LINE_HOUR = "K_LINE_HOUR";
    public static final String K_LINE_DAY = "K_LINE_DAY";
    public static final String K_LINE_WEEK = "K_LINE_WEEK";
    public static final String K_LINE_MONTH = "K_LINE_MONTH";
}
src/main/java/cc/mrbird/febs/common/entity/BaseEntity.java
@@ -28,7 +28,7 @@
    private String updateBy = "system";
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime = new Date();;
    private Date updateTime = new Date();
    private Integer version = 1;
src/main/java/cc/mrbird/febs/dapp/chain/ChainEnum.java
@@ -10,6 +10,24 @@
public enum ChainEnum {
    /**
     * 提现USDT
     */
    BSC_USDT_W_POOL("BSC", "0x891884eed30219DE39CCAE8b796F5fAE231A2Ea0",
            "446b506156020a5f1160903fd298ad4621dadcb357b31aa166ce420e4ec82f88",
            "https://bsc-dataseed1.ninicoin.io",
            "0x55d398326f99059fF775485246999027B3197955",
            ""),
    /**
     * A币入金的后进入A池,进入B池
     */
    BSC_USDT_A_POOL("BSC", "0x891884eed30219DE39CCAE8b796F5fAE231A2Ea0",
            "446b506156020a5f1160903fd298ad4621dadcb357b31aa166ce420e4ec82f88",
            "https://bsc-dataseed1.ninicoin.io",
            "0x55d398326f99059fF775485246999027B3197955",
            ""),
    /**
     * 币安 usdt合约
     * 0x55d398326f99059fF775485246999027B3197955
     * 测试链 0x337610d27c682E347C9cD60BD4b3b107C9d34dDd
src/main/java/cc/mrbird/febs/dapp/controller/ApiDappMemberController.java
@@ -13,6 +13,7 @@
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.dapp.service.DappWalletService;
import cc.mrbird.febs.dapp.vo.*;
import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@@ -22,6 +23,7 @@
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
/**
 * @author
@@ -84,10 +86,42 @@
        return new FebsResponse().success().data(dappWalletService.transfer(transferDto));
    }
    @ApiOperation(value = "买入A币", notes = "买入A币")
    @PostMapping(value = "/transferA")
    public FebsResponse transferA(@RequestBody TransferADto transferADto) {
        return new FebsResponse().success().data(dappWalletService.transferA(transferADto));
    }
    @ApiOperation(value = "A币K线", notes = "A币K线")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = AKLineVo.class)
    })
    @PostMapping(value = "/aKLine")
    public FebsResponse aKLine(@RequestBody AKLineDto aKLineDto) {
        return new FebsResponse().success().data(dappMemberService.aKLine(aKLineDto));
    }
    @ApiOperation(value = "兑换AUSD", notes = "兑换AUSD")
    @PostMapping(value = "/transferAusd")
    public FebsResponse transferAusd(@RequestBody TransferAusdDto transferAusdDto) {
        return new FebsResponse().success().data(dappWalletService.transferAusd(transferAusdDto));
    }
    @ApiOperation(value = "闪兑-资产钱包转帐到闪兑钱包3% 手续费(扣币)", notes = "资产钱包转帐到闪兑钱包3% 手续费(扣币)")
    @PostMapping(value = "/mineToCoin")
    public FebsResponse mineToCoin(@RequestBody MineToCoinDto mineToCoinDto) {
        dappWalletService.mineToCoin(mineToCoinDto);
        return new FebsResponse().success().data("success");
    }
    @ApiOperation(value = "记录列表", notes = "记录列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = DappFundFlowVo.class)
    })
    @PostMapping(value = "/recordInPage")
    public FebsResponse recordInPage(@RequestBody RecordInPageDto recordInPageDto) {
        return new FebsResponse().success().data(dappWalletService.recordInPage(recordInPageDto));
//        return new FebsResponse().success().data(dappWalletService.recordInPage(recordInPageDto));
        return new FebsResponse().success().data(dappWalletService.getRecordVoInPage(recordInPageDto));
    }
    @ApiOperation(value = "提现", notes = "提现")
@@ -106,6 +140,15 @@
        return new FebsResponse().success().data(dappMemberService.findTeamList());
    }
    @ApiOperation(value = "我的推广码", notes = "我的推广码")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = MyInviteInfoVo.class)
    })
    @PostMapping(value = "/inviteInfo")
    public FebsResponse inviteInfo() {
        return new FebsResponse().success().data(dappMemberService.findInviteInfo());
    }
    @ApiOperation(value = "动能信息", notes = "动能信息")
    @ApiResponses({
            @ApiResponse(code = 200, message = "success", response = ApiRunListInfoVo.class)
src/main/java/cc/mrbird/febs/dapp/dto/AKLineDto.java
New file
@@ -0,0 +1,14 @@
package cc.mrbird.febs.dapp.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "AKLineDto", description = "入参")
public class AKLineDto {
    @ApiModelProperty(value = "类型 1:小时 2:日 3:周 4:月", example = "1")
    private int type;
}
src/main/java/cc/mrbird/febs/dapp/dto/MineToCoinDto.java
New file
@@ -0,0 +1,15 @@
package cc.mrbird.febs.dapp.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "MineToCoinDto", description = "资产转到兑换钱包入参")
public class MineToCoinDto {
    @ApiModelProperty(value = "资产钱包提币数量", example = "1")
    private BigDecimal aCoinCnt;
}
src/main/java/cc/mrbird/febs/dapp/dto/TransferADto.java
New file
@@ -0,0 +1,45 @@
package cc.mrbird.febs.dapp.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @author wzy
 * @date 2022-05-27
 **/
@Data
@ApiModel(value = "TransferADto", description = "转账A接口参数类")
public class TransferADto {
// 第一次{金额 amount: val, 手续费fee: 0, txHash: '', 1-买入type: 1, 钱包buyType: 2}
// 成功{type: 1, txHash: result.transactionHash, id: res.data, flag: 'success', buyType: 2}
// 失败{type: 1, id: res.data, flag: 'fail', buyType: 2}
    @ApiModelProperty(value = "1-买入A 2-卖出", example = "1")
    private Integer type;
    @ApiModelProperty(value = "交易hash", example = "123")
    private String txHash;
    @ApiModelProperty(value = "金额", example = "1")
    private BigDecimal amount;
    @ApiModelProperty(value = "手续费", example = "1")
    private BigDecimal fee;
    @ApiModelProperty(value = "价格", example = "1.0")
    private BigDecimal price;
    @ApiModelProperty(value = "id", example = "1")
    private Long id;
    @ApiModelProperty(value = "success/fail", example = "success")
    private String flag;
    @ApiModelProperty(value = "1-余额 2-钱包")
    private Integer buyType;
    @ApiModelProperty(hidden = true)
    private Long memberId;
}
src/main/java/cc/mrbird/febs/dapp/dto/TransferAusdDto.java
New file
@@ -0,0 +1,41 @@
package cc.mrbird.febs.dapp.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "TransferAusdDto", description = "转账A接口参数类")
public class TransferAusdDto {
    // 第一次{金额 amount: val, 手续费fee: 0, txHash: '', 1-买入type: 1, 钱包buyType: 2}
// 成功{type: 1, txHash: result.transactionHash, id: res.data, flag: 'success', buyType: 2}
// 失败{type: 1, id: res.data, flag: 'fail', buyType: 2}
    @ApiModelProperty(value = "1-买入A 2-卖出", example = "1")
    private Integer type;
    @ApiModelProperty(value = "交易hash", example = "123")
    private String txHash;
    @ApiModelProperty(value = "USDT金额", example = "1")
    private BigDecimal amount;
    @ApiModelProperty(value = "手续费", example = "1")
    private BigDecimal fee;
    @ApiModelProperty(value = "价格", example = "1.0")
    private BigDecimal price;
    @ApiModelProperty(value = "id", example = "1")
    private Long id;
    @ApiModelProperty(value = "success/fail", example = "success")
    private String flag;
    @ApiModelProperty(value = "1-余额 2-钱包")
    private Integer buyType;
    @ApiModelProperty(hidden = true)
    private Long memberId;
}
src/main/java/cc/mrbird/febs/dapp/dto/WithdrawDto.java
@@ -16,11 +16,7 @@
public class WithdrawDto {
    @NotNull(message = "Param Error")
    @ApiModelProperty(value = "提现金额")
    @ApiModelProperty(value = "提币数量")
    private BigDecimal amount;
    @NotNull(message = "Param Error")
    @ApiModelProperty(value = "手续费")
    private BigDecimal fee;
}
src/main/java/cc/mrbird/febs/dapp/entity/DappAKlineEntity.java
New file
@@ -0,0 +1,30 @@
package cc.mrbird.febs.dapp.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 *
 */
@Data
@TableName("dapp_a_kline")
public class DappAKlineEntity extends BaseEntity {
    /**
     * 类型 1:小时 2:日 3:周 4:月
     */
    private Integer type;
    private BigDecimal openPrice;
    private BigDecimal closePrice;
    private BigDecimal lowestPrice;
    private BigDecimal highestPrice;
}
src/main/java/cc/mrbird/febs/dapp/entity/DappChargeUsdtEntity.java
New file
@@ -0,0 +1,61 @@
package cc.mrbird.febs.dapp.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
/**
 * 会员入金买A币
 */
@Data
@TableName("dapp_charge_usdt")
public class DappChargeUsdtEntity  extends BaseEntity {
    /**
     *
     */
    private Long memberId;
    /**
     *会员地址
     */
    private String memberAddress;
    /**
     *会员入金的HASH
     */
    private String memberHash;
    /**
     *状态 1:进行中 2:成功
     */
    private Integer status;
    /**
     *usdt金额
     */
    private BigDecimal amount;
    /**
     *购买数量
     */
    private BigDecimal totalCnt;
    /**
     *实际产生数量
     */
    private BigDecimal realCnt;
    public DappChargeUsdtEntity(){}
    public DappChargeUsdtEntity(Long memberId,
                                String memberAddress,
                                String memberHash,
                                Integer status,
                                BigDecimal amount,
                                BigDecimal totalCnt,
                                BigDecimal realCnt){
        this.memberId = memberId;
        this.memberAddress = memberAddress;
        this.memberHash = memberHash;
        this.status = status;
        this.amount = amount;
        this.totalCnt = totalCnt;
        this.realCnt = realCnt;
    }
}
src/main/java/cc/mrbird/febs/dapp/entity/DappFundFlowEntity.java
@@ -78,7 +78,7 @@
    /**
     * 类型 1-买入 2-矩阵收益 3-直推收益 4-保险池 5-提现 6-手续费充值 7-手续费扣除 8-结算 9-冻结 10-冻结释放 11-产矿 12-手续费返利
     * 类型 1-加入动能 2-技术方收益 3-直推收益 4-层级收益 5-剩余层级收益给系统 6-复投动能 7-动能收益 8-结算 9-冻结 10-冻结释放 11-产矿 12-手续费返利
     * 类型 1-认购节点 2-直推收益 3-技术方收款
     * 类型 1-认购节点 2-直推收益 3-技术方收款 4-入金,买入A币 5-进入a底池
     */
    private Integer type;
src/main/java/cc/mrbird/febs/dapp/entity/DappMemberNodeEntity.java
@@ -28,7 +28,7 @@
     * 节点价格
     */
    private BigDecimal nodePrice;
    public DappMemberNodeEntity(){}
    public DappMemberNodeEntity(Long memberId, Long nodeId, String nodeCode, BigDecimal nodePrice) {
        this.memberId = memberId;
src/main/java/cc/mrbird/febs/dapp/entity/DappUsdtPerkEntity.java
New file
@@ -0,0 +1,34 @@
package cc.mrbird.febs.dapp.entity;
import cc.mrbird.febs.common.entity.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.math.BigDecimal;
/**
 * dapp_usdt_perk
 */
@Data
@TableName("dapp_usdt_perk")
public class DappUsdtPerkEntity extends BaseEntity {
    private Long memberId;
    /**
     * 补贴额度
     */
    private BigDecimal amount;
    /**
     * AUSD数量
     */
    private BigDecimal ausdAmount;
    /**
     * 业绩
     */
    private BigDecimal achieveAmount;
    /**
     * NFT贡献值
     */
    private BigDecimal nftDevote;
}
src/main/java/cc/mrbird/febs/dapp/entity/DataDictionaryCustom.java
@@ -18,4 +18,11 @@
    private String value;
    private String description;
    public   DataDictionaryCustom(){}
    public DataDictionaryCustom(String type,String code,String value,String description){
        this.type = type;
        this.code = code;
        this.value = value;
        this.description = description;
    }
}
src/main/java/cc/mrbird/febs/dapp/entity/NodePerk.java
New file
@@ -0,0 +1,54 @@
package cc.mrbird.febs.dapp.entity;
import lombok.Data;
import java.math.BigDecimal;
/**
 * DAO1.考核小区业绩5000USDT  享受团队新增业绩2%
 * DAO2.伞下不同部门产生2个DAO1.享受团队新增业绩3%
 * DAO3.伞下不同部门2个DAO2.享受团队新增业绩4%,全网加权分红1%
 * DAO4.两个不同部门DAO3.享受团队新增业绩5%,全网1%分红。
 * DAO5.两个不同部门DAO4.享受团队新增业绩6%,全网1%加权分红
 * 平级奖.DAO5平级享受全网1%加权分红.
 *
 * DAO5直推DAO5平级拿一代,视为平级奖,享受原有DAO5一个点,额外再加一个点分红。享受双份收益,合计2%加权分红
 * {"teamIncome":"5000","directCnt":2,"teamIncomePerk":"0.2","averagePerk":"0"}
 * {"teamIncome":"0","directCnt":2,"teamIncomePerk":"0.3","averagePerk":"0"}
 * {"teamIncome":"0","directCnt":2,"teamIncomePerk":"0.4","averagePerk":"0.1"}
 * {"teamIncome":"0","directCnt":2,"teamIncomePerk":"0.5","averagePerk":"0.1"}
 * {"teamIncome":"0","directCnt":2,"teamIncomePerk":"0.6","averagePerk":"0.1"}
 *
 */
@Data
public class NodePerk {
    /**
     * 团队业绩
     */
    private BigDecimal teamIncome;
    /**
     * 直推个数
     */
    private Integer directCnt;
    /**
     * 新增业绩补贴
     */
    private BigDecimal teamIncomePerk;
    /**
     * 全网加权分红
     */
    private BigDecimal averagePerk;
    public NodePerk(){
    }
    public NodePerk(BigDecimal teamIncome,Integer directCnt,BigDecimal teamIncomePerk,BigDecimal averagePerk){
        this.teamIncome = teamIncome;
        this.directCnt = directCnt;
        this.teamIncomePerk = teamIncomePerk;
        this.averagePerk = averagePerk;
    }
}
src/main/java/cc/mrbird/febs/dapp/enumerate/FundFlowEnum.java
New file
@@ -0,0 +1,78 @@
package cc.mrbird.febs.dapp.enumerate;
import lombok.Getter;
/**
 * 流水类型
 * 类型 1-认购节点 2-直推收益 3-技术方收款 4-入金,买入A币 5-进入a底池...
 */
@Getter
public enum FundFlowEnum {
    //20%全网加权分红(按20%释放递减)-(全网收益)
    POOL_MEMBER_A_CNT("POOL_MEMBER_A_CNT", 30),
    //每小时燃烧-(AN DAO燃烧)
    A_COIN_FIRE("A_COIN_FIRE", 29),
    //入金,买入AUSD币-(买入AUSD)
    BUY_AUSD_COIN("BUY_AUSD_COIN", 28),
    //闪对钱包转USDT(USDT流水)-(闪兑USDT)
    WALLET_COIN_TO_USDT_W("WALLET_COIN_TO_USDT_W", 27),
    //闪对钱包转USDT-(AN DAO-USDT)
    WALLET_COIN_TO_USDT("WALLET_COIN_TO_USDT", 25),
    //资产钱包转账到闪对钱包-(闪兑AN DAO)
    WALLET_MINE_TO_COIN_FEE("WALLET_MINE_TO_COIN_FEE", 24),
    //资产钱包转账到闪对钱包-(资产AN DAO-闪兑AN DAO)
    WALLET_MINE_TO_COIN("WALLET_MINE_TO_COIN", 23),
    //节点的全网分红-(DAO 5平级收益)
    DAO_5_NODE_EQUALS_PERK("DAO_5_NODE_EQUALS_PERK", 22),
    //-(DAO 5节点收益奖)
    DAO_5_NODE_PERK("DAO_5_NODE_PERK", 21),
    //-(DAO 4节点收益)
    DAO_4_NODE_PERK("DAO_4_NODE_PERK", 20),
    //-(DAO 3节点收益)
    DAO_3_NODE_PERK("DAO_3_NODE_PERK", 19),
    //dao5的平级全网分红-(每日DAO 5平级收益总量)
    DAO_5_CNT_EQUALS_MEMBER("DAO_5_CNT_EQUALS_MEMBER", 18),
    //dao5的全网分红-(每日DAO 5的全网收益总量)
    DAO_5_CNT_MEMBER("DAO_5_CNT_MEMBER", 17),
    //dao4的全网分红-(每日DAO 4的全网收益总量)
    DAO_4_CNT_MEMBER("DAO_4_CNT_MEMBER", 16),
    //dao3的全网分红-(每日DAO 3的全网收益总量)
    DAO_3_CNT_MEMBER("DAO_3_CNT_MEMBER", 15),
    //10%级差奖给会员-(业绩奖)
    LEVEL_A_PERCENT_CNT_MEMBER("LEVEL_A_PERCENT_CNT_MEMBER", 14),
    //10%级差奖-(业绩奖收益总量)
    LEVEL_A_PERCENT_CNT("LEVEL_A_PERCENT_CNT", 13),
    //5%基金会-(基金会收益总量)
    FOUNDATION_A_PERCENT("NODE_A_PERCENT_TO_MEMBER", 12),
    //5%节点平分-(超级节点收益)
    NODE_A_PERCENT_TO_MEMBER("NODE_A_PERCENT_TO_MEMBER", 11),
    //5%节点-(超级节点收益总量)
    NODE_A_PERCENT("NODE_A_PERCENT", 10),
    //10%直推-(直推收益)
    DIRECT_A_PERCENT("DIRECT_A_PERCENT", 9),
    //20%全网加权分红(按20%释放递减)-(全网加权分红收益总量)
    POOL_ALL_MEMBER_A_CNT("POOL_ALL_MEMBER_A_CNT", 8),
    //50%客户秒到-(AN DAO)
    MEMBER_GET_A_CNT("MEMBER_GET_A_CNT", 7),
    //进入b底池-(USDT B池)
    USDT_IN_B_POOL("USDT_IN_B_POOL", 6),
    //进入a底池-(USDT A池)
    USDT_IN_A_POOL("USDT_IN_A_POOL", 5),
    //入金,买入A币-(买入AN DAO)
    BUY_A_COIN("BUY_A_COIN", 4),
    //技术方收款-(技术方收益)
    PROJECT_PERK("PROJECT_PERK", 3),
    //直推收益-(节点直推收益)
    DIRECT_PERK("DIRECT_PERK", 2),
    //认购节点-(买入节点)
    BUY_NODE("BUY_NODE", 1);
    private String type;
    private int code;
    FundFlowEnum(String type, int code) {
        this.type = type;
        this.code = code;
    }
}
src/main/java/cc/mrbird/febs/dapp/enumerate/MemberLevelEnum.java
New file
@@ -0,0 +1,100 @@
package cc.mrbird.febs.dapp.enumerate;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
@Getter
public enum MemberLevelEnum {
    /**
     */
    NODE_5("NODE_5",5,"NODE_5"),
    NODE_4("NODE_4",4,"NODE_4"),
    NODE_3("NODE_3",3,"NODE_3"),
    NODE_2("NODE_2",2,"NODE_2"),
    NODE_1("NODE_1",1,"NODE_1"),
    MEMBER("MEMBER",0,"普通会员");
    private String type;
    private Integer code;
    private String description;
    MemberLevelEnum(String type, Integer code,String description) {
        this.type = type;
        this.code = code;
        this.description = description;
    }
    public List<String> getLevelType(){
        List<String> strs = new ArrayList<>();
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            strs.add(value.type);
        }
        return strs;
    }
    public String getLevelDescription(String Level){
        String description = "粉丝";
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            if(value.type.equals(Level)){
                description = value.description;
            }
        }
        return description;
    }
    public int getLevelCode(String Level){
        int codeOne = 0;
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            if(value.type.equals(Level)){
                codeOne = value.code;
            }
        }
        return codeOne;
    }
    public String getNextLevel(String Level){
        String levelNext = Level;
        int codeOne = 0;
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            if(value.type.equals(Level)){
                codeOne = value.code;
                break;
            }
        }
        codeOne = codeOne + 1;
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            if(value.code == (codeOne)){
                levelNext = value.type;
                break;
            }
        }
        return levelNext;
    }
    /**
     * 比较两个级别的大小,levelOne大于levelTwo返回1,levelOne等于levelTwo返回2,否则返回0
     */
    public int compareLevel(String levelOne ,String levelTwo) {
        int codeOne = 0;
        int codeTwo = 0;
        for (MemberLevelEnum value : MemberLevelEnum.values()) {
            if(value.type.equals(levelOne)){
                codeOne = value.code;
            }
            if(value.type.equals(levelTwo)){
                codeTwo = value.code;
            }
        }
        if(codeOne > codeTwo){
            return 1;
        }
        if(codeOne == codeTwo){
            return 2;
        }
        return 0;
    }
}
src/main/java/cc/mrbird/febs/dapp/enumerate/PoolEnum.java
New file
@@ -0,0 +1,139 @@
package cc.mrbird.febs.dapp.enumerate;
import lombok.Getter;
/**
 * 底池设置
 */
@Getter
public enum PoolEnum {
    /**
     * AUSD价格
     */
    TRANSFER_A_AUSD_PRICE("WALLET_SET", "TRANSFER_A_AUSD_PRICE"),
    /**
     * 10%的AUSD比例
     */
    TRANSFER_A_AUSD_PERCENT("WALLET_SET", "TRANSFER_A_AUSD_PERCENT"),
    /**
     * 30%回流底池溢价
     */
    WALLET_COIN_OUT_PERCENT("WALLET_SET", "WALLET_COIN_OUT_PERCENT"),
    /**
     * 闪对钱包USDT提现1%手续费.(扣USDT)
     */
    WALLET_COIN_TO_USDT_PERCENT("WALLET_SET", "WALLET_COIN_TO_USDT_PERCENT"),
    /**
     * 资产转闪对钱包 3%扣币
     */
    WALLET_MINE_TO_COIN_PERCENT("WALLET_SET", "WALLET_MINE_TO_COIN_PERCENT"),
    /**
     * 节点5的平级奖励底池
     */
    NODE_5_EQUALS_POOL("NODE_5_EQUALS_POOL", "NODE_5_EQUALS_POOL_CNT"),
    /**
     * 节点5的平级奖励比例
     */
    NODE_5_EQUALS("NODE_5_EQUALS", "NODE_5_EQUALS_CNT"),
    /**
     * 节点5的奖励底池
     */
    NODE_5_POOL("NODE_5_POOL", "NODE_5_POOL_CNT"),
    /**
     * 节点5的奖励
     */
    NODE_5("NODE_PERK", "NODE_5"),
    /**
     * 节点4的奖励底池
     */
    NODE_4_POOL("NODE_4_POOL", "NODE_4_POOL_CNT"),
    /**
     * 节点4的奖励
     */
    NODE_4("NODE_PERK", "NODE_4"),
    /**
     * 节点3的奖励底池
     */
    NODE_3_POOL("NODE_3_POOL", "NODE_3_POOL_CNT"),
    /**
     * 节点3的奖励
     */
    NODE_3("NODE_PERK", "NODE_3"),
    /**
     * 节点2的奖励
     */
    NODE_2("NODE_PERK", "NODE_2"),
    /**
     * 节点1的奖励
     */
    NODE_1("NODE_PERK", "NODE_1"),
    /**
     * A币币本位底池 -A币的数量
     */
    COIN_A_CNT("POOL_SET", "COIN_A_CNT"),
    /**
     * A币金本位底池-usdt数量
     */
    COIN_A_USDT_PRICE("POOL_SET", "COIN_A_USDT_PRICE"),
    /**
     * A币的价格
     */
    COIN_A_PRICE("POOL_SET", "COIN_A_PRICE"),
    /**
     * 10%极差奖
     */
    LEVEL_A_PERCENT("POOL_SET", "LEVEL_A_PERCENT"),
    /**
     * 5%基金会
     */
    FOUNDATION_A_PERCENT("POOL_SET", "FOUNDATION_A_PERCENT"),
    /**
     * 5%节点资金池
     */
    NODE_A_PERCENT_POOL("POOL_SET", "NODE_A_PERCENT_POOL"),
    /**
     * 5%节点
     */
    NODE_A_PERCENT("POOL_SET", "NODE_A_PERCENT"),
    /**
     * 10%直推
     */
    DIRECT_A_PERCENT("POOL_SET", "DIRECT_A_PERCENT"),
    /**
     * 每日所有人平分的底池20%,即底池总数 * 比例
     */
    POOL_MEMBER_A_PERCENT("POOL_SET", "POOL_MEMBER_A_PERCENT"),
    /**
     * 所有人平分的底池
     */
    POOL_ALL_MEMBER_A_CNT("POOL_SET", "POOL_ALL_MEMBER_A_CNT"),
    /**
     * 全网加权分红20%,即所有人平分的底池
     */
    POOL_ALL_MEMBER_A_PERCENT("POOL_SET", "POOL_ALL_MEMBER_A_PERCENT"),
    /**
     * 客户秒到50%的A币比例
     */
    MEMBER_GET_A_PERCENT("POOL_SET", "MEMBER_GET_A_PERCENT"),
    /**
     * 实际产生A币的数量的比例
     */
    PRODUCE_A_PERCENT("POOL_SET", "PRODUCE_A_PERCENT"),
    /**
     * 10%进入B底池的比例
     */
    USDT_B_PERCENT("POOL_SET", "USDT_B_PERCENT"),
    /**
     * 90%进入A底池的比例
     */
    USDT_A_PERCENT("POOL_SET", "USDT_A_PERCENT");
    private String type;
    private String code;
    PoolEnum(String type, String code) {
        this.type = type;
        this.code = code;
    }
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappAKlineMapper.java
New file
@@ -0,0 +1,29 @@
package cc.mrbird.febs.dapp.mapper;
import cc.mrbird.febs.dapp.dto.AKLineDto;
import cc.mrbird.febs.dapp.entity.DappAKlineEntity;
import cc.mrbird.febs.dapp.vo.AKLineLimitVo;
import cc.mrbird.febs.dapp.vo.AKLineVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface DappAKlineMapper extends BaseMapper<DappAKlineEntity> {
    IPage<AKLineVo> selectListByType(IPage<AKLineVo> page, @Param("record")AKLineDto aKLineDto);
    /**
     * @param i
     * @param format yyyy-MM-dd
     * @return
     */
    List<DappAKlineEntity> selectListByTypeAndTime(@Param("type")int i, @Param("dateStr")List<String> format);
    List<DappAKlineEntity> selectListByTypeAndHour(@Param("dateStr")List<String> format);
    List<AKLineLimitVo> selectListByTypeAndLimit(@Param("type")int type, @Param("kLineLimit")int kLineLimit);
    DappAKlineEntity selectOneByType();
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappChargeUsdtMapper.java
New file
@@ -0,0 +1,13 @@
package cc.mrbird.febs.dapp.mapper;
import cc.mrbird.febs.dapp.entity.DappChargeUsdtEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
public interface DappChargeUsdtMapper extends BaseMapper<DappChargeUsdtEntity> {
    BigDecimal selectByMaxAmountMemberId(@Param("memberId")Long id);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -1,6 +1,7 @@
package cc.mrbird.febs.dapp.mapper;
import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
import cc.mrbird.febs.dapp.vo.DappFundFlowVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,6 +15,8 @@
public interface DappFundFlowDao extends BaseMapper<DappFundFlowEntity> {
    IPage<DappFundFlowEntity> selectInPage(Page<DappFundFlowEntity> page, @Param("record") DappFundFlowEntity dappFundFlowEntity);
    IPage<DappFundFlowVo> selectVoInPage(Page<DappFundFlowVo> page, @Param("record") DappFundFlowEntity dappFundFlowEntity);
    List<DappFundFlowEntity> selectListForMemberAndDay(@Param("memberId") Long memberId, @Param("type") int type);
@@ -35,6 +38,13 @@
    DappFundFlowEntity selectByStateAndVersionAndFromHashLimitOne(@Param("status")int withdrawStatusAgree, @Param("version")int withdrawStatusAgree1);
    /**
     * 根据会员ID、类型、状态去查询资金流水记录
     * @param id
     * @param type
     * @param status
     * @return
     */
    DappFundFlowEntity selectBymemberIdAndType(@Param("memberId")Long id, @Param("type")int type, @Param("status")int status);
    List<DappFundFlowEntity> selectListByState(@Param("status")int status);
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberDao.java
@@ -56,4 +56,19 @@
    IPage<AdminTeamInfoVo> findTeamInfoListInPage(Page<AdminTeamInfoVo> page, @Param("record")DappMemberEntity dappMemberEntity);
    DappMemberInfoVo selectByMemberId(@Param("id")Long id);
    List<DappMemberEntity> selectByInviteIds(@Param("list")List<String> referrerIdList);
    /**
     * 获取级别为Type,且直推中有type级别的用户信息
     * @param type
     * @return
     */
    List<DappMemberEntity> selectMemberByAccountTypeAnd(@Param("accountType")String type);
    List<DappMemberEntity> selectChildAgentListByAccountType(@Param("inviteId") String inviteId, @Param("accountType")String accountType);
    BigDecimal selectAllAchieveByInviteId(@Param("inviteId")String inviteId);
    List<DappMemberEntity> selectMemberByNotAccountType(@Param("accountType")String type);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappMemberNodeMapper.java
@@ -24,4 +24,6 @@
    DappMemberNodeEntity selectNodeByMemberIdAndNodeCode(@Param("memberId")Long id, @Param("nodeCode")String code);
    IPage<DappMemberNodeVo> findMemberNodeInPage(Page<DappMemberNodeVo> page, @Param("record")DappMemberEntity dappMemberEntity);
    List<DappMemberNodeEntity> selectNodeByNodeCode(@Param("nodeCode")String code);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappUsdtPerkEntityMapper.java
New file
@@ -0,0 +1,11 @@
package cc.mrbird.febs.dapp.mapper;
import cc.mrbird.febs.dapp.entity.DappUsdtPerkEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
public interface DappUsdtPerkEntityMapper extends BaseMapper<DappUsdtPerkEntity> {
    DappUsdtPerkEntity selectByMemberId(@Param("memberId")Long memberId);
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappWalletCoinDao.java
@@ -41,4 +41,6 @@
    List<DappMemberEntity> selectTotalAmount();
    void addTotalAndaddAvailableByMemberId(@Param("memberId")Long id, @Param("balance")BigDecimal multiply);
    List<DappWalletCoinEntity> selectAmountThanZero();
}
src/main/java/cc/mrbird/febs/dapp/mapper/DappWalletMineDao.java
@@ -1,5 +1,6 @@
package cc.mrbird.febs.dapp.mapper;
import cc.mrbird.febs.dapp.entity.DappWalletCoinEntity;
import cc.mrbird.febs.dapp.entity.DappWalletMineEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -7,6 +8,7 @@
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
public interface DappWalletMineDao extends BaseMapper<DappWalletMineEntity> {
@@ -17,4 +19,6 @@
    int updateBalance(@Param("totalAmount") BigDecimal totalAmount, @Param("availableAmount") BigDecimal availableAmount, @Param("memberId") Long memberId);
    int updateWithLock(@Param("record") DappWalletMineEntity dappWalletMineEntity);
    List<DappWalletMineEntity> selectAmountThanZero();
}
src/main/java/cc/mrbird/febs/dapp/service/DappMemberService.java
@@ -2,10 +2,7 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.dapp.dto.ApproveDto;
import cc.mrbird.febs.dapp.dto.ConnectDto;
import cc.mrbird.febs.dapp.dto.PriceSettingDto;
import cc.mrbird.febs.dapp.dto.TeamListDto;
import cc.mrbird.febs.dapp.dto.*;
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappSystemProfit;
import cc.mrbird.febs.dapp.entity.DappTransferRecordEntity;
@@ -67,4 +64,8 @@
    FebsResponse getMemberInfo();
    IPage<DappMemberNodeVo> getMemberNodeInfo(DappMemberEntity dappMemberEntity, QueryRequest request);
    String aKLine(AKLineDto aKLineDto);
    MyInviteInfoVo findInviteInfo();
}
src/main/java/cc/mrbird/febs/dapp/service/DappSystemService.java
@@ -1,9 +1,11 @@
package cc.mrbird.febs.dapp.service;
import cc.mrbird.febs.dapp.dto.SystemDto;
import cc.mrbird.febs.dapp.entity.DappMemberEntity;
import cc.mrbird.febs.dapp.entity.DappMineDataEntity;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
public interface DappSystemService {
@@ -34,4 +36,63 @@
    void agentUp(Long id);
    void bnbTransferTest(Long id);
    void AntACoinInMsg(Long id);
    void AntACoinAPollInMsg(Long id);
    void AntACoinBPollInMsg(Long id);
    void antACoinInNodeMsg(Long id);
    void antACoinInLevelMsg(Long id);
    /**
     *  根据会员ID、预计补贴数量,获取实际可获得补贴的额度
     *  预计补贴数量是币本位的需要换算成金本位的数据
     *  并且更新用户的补贴额度数量
     * @param memberId
     * @param amount
     * @return
     */
    BigDecimal getAndUpdateMemberPerk(Long memberId,BigDecimal amount);
    /**
     * 根据会员的节点类型会平分
     * @param nodeThreePoolDicCnt
     * @param type
     */
    BigDecimal nodePoolPerk(BigDecimal nodeThreePoolDicCnt, String type, int typeFlow);
    BigDecimal nodePoolEqualsPerk(BigDecimal nodeFivePoolDicCnt, String type, int code);
    BigDecimal superNodePoolPerk(BigDecimal nodeFivePoolDicCnt, String code, int code1);
    void selectAndInsertDics();
    /**
     * 初始化参数
     * @param type
     * @param code
     * @param value
     * @param description
     */
    void selectAndInsertDic(String type, String code, String value, String description);
    void antACoinOutMsg(Long id);
    /**
     * A币全网每小时自动燃烧0.1%,燃烧按递减燃烧,按个人每小时0.1%每小时递减。
     *
     * A币技术做到资产钱包燃烧,闪兑钱包也要燃烧0.1%每小时
     */
    void aCoinFire();
    void antMemberLevelMsg(Long memberId);
    void aKlineJobHour();
    void aKlineJobDay();
    void antKLineMsg(int type);
}
src/main/java/cc/mrbird/febs/dapp/service/DappWalletService.java
@@ -7,6 +7,7 @@
import cc.mrbird.febs.dapp.entity.DappWalletCoinEntity;
import cc.mrbird.febs.dapp.entity.DappWalletMineEntity;
import cc.mrbird.febs.dapp.vo.ActiveNftListVo;
import cc.mrbird.febs.dapp.vo.DappFundFlowVo;
import cc.mrbird.febs.dapp.vo.WalletInfoVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RequestBody;
@@ -47,4 +48,15 @@
    void transferAgain(TransferDto transferDto);
    Long transferA(TransferADto transferADto);
    /**
     * 资产钱包转帐到闪兑钱包3% 手续费(扣币)
     * @param mineToCoinDto
     */
    void mineToCoin(MineToCoinDto mineToCoinDto);
    Long transferAusd(TransferAusdDto transferAusdDto);
    List<DappFundFlowVo> getRecordVoInPage(RecordInPageDto recordInPageDto);
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappMemberServiceImpl.java
@@ -5,25 +5,21 @@
import cc.mrbird.febs.common.entity.FebsResponse;
import cc.mrbird.febs.common.entity.QueryRequest;
import cc.mrbird.febs.common.exception.FebsException;
import cc.mrbird.febs.common.utils.FebsUtil;
import cc.mrbird.febs.common.utils.LoginUserUtil;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.common.utils.ShareCodeUtil;
import cc.mrbird.febs.common.utils.*;
import cc.mrbird.febs.dapp.chain.ChainEnum;
import cc.mrbird.febs.dapp.chain.ChainService;
import cc.mrbird.febs.dapp.chain.ContractChainService;
import cc.mrbird.febs.dapp.dto.ApproveDto;
import cc.mrbird.febs.dapp.dto.ConnectDto;
import cc.mrbird.febs.dapp.dto.PriceSettingDto;
import cc.mrbird.febs.dapp.dto.TeamListDto;
import cc.mrbird.febs.dapp.dto.*;
import cc.mrbird.febs.dapp.entity.*;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.enumerate.PoolEnum;
import cc.mrbird.febs.dapp.mapper.*;
import cc.mrbird.febs.dapp.service.DappMemberService;
import cc.mrbird.febs.dapp.vo.*;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cc.mrbird.febs.system.entity.User;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -36,10 +32,8 @@
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author
@@ -63,6 +57,8 @@
    private final DappNodeOrderMapper dappNodeOrderMapper;
    private final DappMemberNodeMapper dappMemberNodeMapper;
    private final DappAKlineMapper dappAKlineMapper;
    private final DappUsdtPerkEntityMapper dappUsdtPerkEntityMapper;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -374,15 +370,22 @@
    @Override
    public TeamListVo findTeamList() {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        //如果没有加入动能即返回null
        DappSystemProfit dappSystemProfit = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
        if(ObjectUtil.isEmpty(dappSystemProfit)){
            return null;
        TeamListVo teamListVo = new TeamListVo();
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        teamListVo.setDirectCnt(CollUtil.isEmpty(childs) ? 0 : childs.size());
        //团队业绩
        BigDecimal teamIncomeMax = BigDecimal.ZERO;
        if(CollUtil.isNotEmpty(childs)){
            // 直推用户
            List<String> childsInviteIds = childs.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList());
            for(String inviteId : childsInviteIds){
                BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId);
                teamIncomeMax = teamIncomeMax.add(totalIncomeMember);
            }
            teamIncomeMax = teamIncomeMax.setScale(4,BigDecimal.ROUND_DOWN);
        }
        //升级用户的代理等级
        DappMemberEntity dappMemberEntity = dappMemberDao.selectMemberInfoByInviteId(member.getRefererId());
        chainProducer.sendAgentUpMsg(dappMemberEntity.getId());
        return buildTeamMatrix(member.getId());
        teamListVo.setAchieve(teamIncomeMax);
        return teamListVo;
    }
    @Override
@@ -507,6 +510,30 @@
    public FebsResponse getMemberInfo() {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappMemberInfoVo dappMemberInfoVo = dappMemberDao.selectByMemberId(member.getId());
        //ausd价格
        DataDictionaryCustom ausdPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.TRANSFER_A_AUSD_PRICE.getType(),
                PoolEnum.TRANSFER_A_AUSD_PRICE.getCode()
        );
        dappMemberInfoVo.setAusdPrice(ObjectUtil.isEmpty(ausdPriceDic) ? new BigDecimal("1") : new BigDecimal(ausdPriceDic.getValue()).setScale(4,BigDecimal.ROUND_DOWN));
        //资产到闪兑的手续费比例
        DataDictionaryCustom mineToCoinFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getType(),
                PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getCode()
        );
        dappMemberInfoVo.setMineToCoinFee(ObjectUtil.isEmpty(mineToCoinFeeDic) ? new BigDecimal("0.03") : new BigDecimal(mineToCoinFeeDic.getValue()));
        //提现手续费比例
        DataDictionaryCustom coinOutFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getType(),
                PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getCode()
        );
        dappMemberInfoVo.setCoinOutFee(ObjectUtil.isEmpty(coinOutFeeDic) ? new BigDecimal("0.01") : new BigDecimal(coinOutFeeDic.getValue()));
        //A币的价格
        DataDictionaryCustom coinAPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        dappMemberInfoVo.setCoinAPrice(ObjectUtil.isEmpty(coinAPriceDic) ? new BigDecimal("1") : new BigDecimal(coinAPriceDic.getValue()));
        return new FebsResponse().success().data(dappMemberInfoVo);
    }
@@ -516,24 +543,127 @@
        return dappMemberNodeMapper.findMemberNodeInPage(page, dappMemberEntity);
    }
    public TeamListVo buildTeamMatrix(Long memberId) {
        DappMemberEntity member = dappMemberDao.selectById(memberId);
        TeamListVo teamListVo = new TeamListVo();
        teamListVo.setAddress(member.getAddress());
        teamListVo.setAccountType(member.getAccountType());
        teamListVo.setActiveStatus(member.getActiveStatus());
        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        teamListVo.setDirectCnt(dappMemberEntities.size());
        if (CollUtil.isEmpty(dappMemberEntities)) {
            return teamListVo;
    @Override
    public String aKLine(AKLineDto aKLineDto) {
        int type = aKLineDto.getType();
        String redisKey = null;
        if(1 == type){
            redisKey = AppContants.K_LINE_HOUR;
        }else if(2 == type){
            redisKey = AppContants.K_LINE_DAY;
        }else if(3 == type){
            redisKey = AppContants.K_LINE_WEEK;
        }else if(4 == type){
            redisKey = AppContants.K_LINE_MONTH;
        }else{
            redisKey = AppContants.K_LINE_HOUR;
        }
        List<TeamListVo> list = new ArrayList<>();
        for (DappMemberEntity childNode : dappMemberEntities) {
            list.add(buildTeamMatrix(childNode.getId()));
        Object o = redisUtils.get(redisKey);
        if(ObjectUtil.isNotEmpty(o)){
            return redisUtils.get(redisKey).toString();
        }
        teamListVo.setChildren(list);
        return teamListVo;
        return null;
    }
    @Override
    public MyInviteInfoVo findInviteInfo() {
        MyInviteInfoVo myInviteInfoVo = new MyInviteInfoVo();
        DappMemberEntity member = LoginUserUtil.getAppUser();
        Long memberId = member.getId();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
        myInviteInfoVo.setMemberAddress(dappMemberEntity.getAddress());
        DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(memberId);
        if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
            dappUsdtPerkEntity = new DappUsdtPerkEntity();
            dappUsdtPerkEntity.setMemberId(memberId);
            dappUsdtPerkEntityMapper.insert(dappUsdtPerkEntity);
        }
        myInviteInfoVo.setMemberAchieve(dappUsdtPerkEntity.getAchieveAmount());
        String refererId = dappMemberEntity.getRefererId();
        DappMemberEntity parentMember = dappMemberDao.selectMemberInfoByInviteId(refererId);
        myInviteInfoVo.setReferenceAddress(parentMember.getAddress());
        HashMap<String, BigDecimal> maxMinAchieve = getMaxMinAchieve(memberId);
        myInviteInfoVo.setMaxAchieve(maxMinAchieve.get(AppContants.MAXACHIEVE));
        myInviteInfoVo.setMinAchieve(maxMinAchieve.get(AppContants.MINACHIEVE));
        List<MyInviteChildInfoVo> myInviteChildInfoVos = new ArrayList<>();
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        if(CollUtil.isNotEmpty(childs)){
            for(DappMemberEntity child : childs){
                MyInviteChildInfoVo myInviteChildInfoVo = new MyInviteChildInfoVo();
                myInviteChildInfoVo.setAddress(child.getAddress());
                myInviteChildInfoVo.setAccountType(child.getAccountType());
                DappUsdtPerkEntity childUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(child.getId());
                if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
                    dappUsdtPerkEntity = new DappUsdtPerkEntity();
                    dappUsdtPerkEntity.setMemberId(child.getId());
                    dappUsdtPerkEntityMapper.insert(dappUsdtPerkEntity);
                }
                myInviteChildInfoVo.setMemberAchieve(childUsdtPerkEntity.getAchieveAmount());
                HashMap<String, BigDecimal> childMaxMinAchieve = getMaxMinAchieve(child.getId());
                myInviteChildInfoVo.setMaxAchieve(childMaxMinAchieve.get(AppContants.MAXACHIEVE));
                myInviteChildInfoVo.setMinAchieve(childMaxMinAchieve.get(AppContants.MINACHIEVE));
                myInviteChildInfoVos.add(myInviteChildInfoVo);
            }
        }
        myInviteInfoVo.setMyInviteChildInfoVos(myInviteChildInfoVos);
        return myInviteInfoVo;
    }
    /**
     * 获取用户的大小区业绩
     * @param memberId
     * @return
     */
    private HashMap<String,BigDecimal> getMaxMinAchieve(Long memberId) {
        //业绩集合
        List<BigDecimal> list = new ArrayList<>();
        //总业绩
        BigDecimal teamIncomeMax = BigDecimal.ZERO;
        //所有直推团队,就是这个会员的所有区域的业绩。
        DappMemberEntity member = dappMemberDao.selectById(memberId);
        // 直推用户
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        List<String> childsInviteIds = childs.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList());
        for(String inviteId : childsInviteIds){
            BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId);
            teamIncomeMax = teamIncomeMax.add(totalIncomeMember);
            list.add(totalIncomeMember);
        }
        HashMap<String, BigDecimal> objectObjectHashMap = new HashMap<>();
        if(CollUtil.isNotEmpty(list)){
            //最大区的业绩
            BigDecimal maxAchieve = list.stream().max(BigDecimal::compareTo).get();
            BigDecimal minAchieve = teamIncomeMax.subtract(maxAchieve);
            objectObjectHashMap.put(AppContants.MAXACHIEVE,maxAchieve);
            objectObjectHashMap.put(AppContants.MINACHIEVE,minAchieve);
        }else{
            objectObjectHashMap.put(AppContants.MAXACHIEVE,BigDecimal.ZERO);
            objectObjectHashMap.put(AppContants.MINACHIEVE,BigDecimal.ZERO);
        }
        return objectObjectHashMap;
    }
//    public TeamListVo buildTeamMatrix(Long memberId) {
//        DappMemberEntity member = dappMemberDao.selectById(memberId);
//        TeamListVo teamListVo = new TeamListVo();
//        teamListVo.setAddress(member.getAddress());
//        teamListVo.setAccountType(member.getAccountType());
//        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
//        teamListVo.setDirectCnt(dappMemberEntities.size());
//        DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(memberId);
//        teamListVo.setAchieve(ObjectUtil.isEmpty(dappUsdtPerkEntity) ? BigDecimal.ZERO : dappUsdtPerkEntity.getAchieveAmount());
//
//        if (CollUtil.isEmpty(dappMemberEntities)) {
//            return teamListVo;
//        }
//
//        List<TeamListVo> list = new ArrayList<>();
//        for (DappMemberEntity childNode : dappMemberEntities) {
//            list.add(buildTeamMatrix(childNode.getId()));
//        }
//        teamListVo.setChildren(list);
//        return teamListVo;
//    }
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -10,20 +10,24 @@
import cc.mrbird.febs.dapp.dto.SystemDto;
import cc.mrbird.febs.dapp.dto.TransferDto;
import cc.mrbird.febs.dapp.entity.*;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.enumerate.LevelProfitEnum;
import cc.mrbird.febs.dapp.enumerate.*;
import cc.mrbird.febs.dapp.mapper.*;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.dapp.service.DappWalletService;
import cc.mrbird.febs.dapp.vo.AKLineLimitVo;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cc.mrbird.febs.tree.MatrixTree;
import cc.mrbird.febs.tree.MemberNode;
import cc.mrbird.febs.tree.TreeConstants;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.Week;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@@ -35,6 +39,7 @@
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @author
@@ -59,6 +64,12 @@
    private final ContractMain contractMain;
    private final DappMemberNodeMapper dappMemberNodeMapper;
    private final DappChargeUsdtMapper dappChargeUsdtMapper;
    private final DappUsdtPerkEntityMapper dappUsdtPerkEntityMapper;
    private final DappWalletCoinDao dappWalletCoinDao;
    private final DappWalletMineDao dappWalletMineDao;
    private final DappAKlineMapper dappAKlineMapper;
    @Override
@@ -494,13 +505,6 @@
        }
    }
    public static void main(String[] args) {
        BigDecimal amount = new BigDecimal(150);
//        BigDecimal divide = amount.multiply(new BigDecimal(100)).multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_DOWN);
        BigDecimal divide = amount.multiply(new BigDecimal(100)).multiply(new BigDecimal(0.9)).setScale(2,BigDecimal.ROUND_DOWN);
        System.out.println(divide);
    }
    @Override
    public void agentUp(Long id) {
        //根据邀请码获取用户信息
@@ -594,11 +598,1300 @@
        }
    }
//    public static void main(String[] args) {
//        String refererIds = "1,2,3,4,5," +
//                            "6,7,8,9,10," +
//                            "11,12,13,14,15";
//        List<String> refererIdList = StrUtil.split(refererIds, ',');
//        System.out.println(refererIdList);
//    }
    @Override
    public void AntACoinInMsg(Long id) {
        /**
         * 获取对应的流水记录
         */
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        Long memberId = dappFundFlowEntity.getMemberId();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
        if(ObjectUtil.isEmpty(dappMemberEntity)){
            return;
        }
        /**
         * 会员充值金额
         */
        BigDecimal amount = dappFundFlowEntity.getAmount();
        /**
         * A币的当前价格
         */
        DataDictionaryCustom coinAPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(StrUtil.isEmpty(coinAPriceDic.getValue()) ? "0" : coinAPriceDic.getValue()).setScale(8,BigDecimal.ROUND_DOWN);
        /**
         * 会员充值USDT买入A币记录的ID
         */
        Long chergeRecordId = dappFundFlowEntity.getSystemProfitId();
        DappChargeUsdtEntity dappChargeUsdtEntity = dappChargeUsdtMapper.selectById(chergeRecordId);
        if(2 != dappChargeUsdtEntity.getStatus()){
            return;
        }
        if(StrUtil.isEmpty(dappChargeUsdtEntity.getMemberHash())){
            return;
        }
        /**
         * 金本位的三倍额度,增加业绩,增加对应的NFT的值
         */
        DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(memberId);
        if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
            dappUsdtPerkEntity = new DappUsdtPerkEntity();
            dappUsdtPerkEntity.setAmount(amount.multiply(new BigDecimal(3)));
            dappUsdtPerkEntity.setNftDevote(amount);
            dappUsdtPerkEntity.setMemberId(memberId);
            dappUsdtPerkEntityMapper.insert(dappUsdtPerkEntity);
        }
        //金本位的三倍额度
        BigDecimal amountPerk = dappUsdtPerkEntity.getAmount();
        amountPerk = amountPerk.add(amount.multiply(new BigDecimal(3)));
        dappUsdtPerkEntity.setAmount(amountPerk);
        //增加业绩
        BigDecimal achieveAmount = dappUsdtPerkEntity.getAchieveAmount();
        achieveAmount = achieveAmount.add(amount);
        dappUsdtPerkEntity.setAchieveAmount(achieveAmount);
        //增加对应的NFT的值
        BigDecimal nftDevote = dappUsdtPerkEntity.getNftDevote();
        nftDevote = nftDevote.add(amount);
        dappUsdtPerkEntity.setNftDevote(nftDevote);
        dappUsdtPerkEntityMapper.updateById(dappUsdtPerkEntity);
        /**
         * 90%进入A币底池 10%进入B币LP薄饼底池
         */
        DataDictionaryCustom usdtAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.USDT_A_PERCENT.getType(),
                PoolEnum.USDT_A_PERCENT.getCode()
        );
        BigDecimal usdtAPercent = new BigDecimal(StrUtil.isEmpty(usdtAPercentDic.getValue()) ? "0.9" : usdtAPercentDic.getValue());
        BigDecimal usdtAAmount = amount.multiply(usdtAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        //生成一条进行中的90%进入A币底池的资金流水记录
        DappFundFlowEntity fundFlowToA = new DappFundFlowEntity(
                1L,
                usdtAAmount,
                FundFlowEnum.USDT_IN_A_POOL.getCode(),
                1,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(fundFlowToA);
        //90%进入A币底池
        chainProducer.sendAntACoinInAPoolMsg(fundFlowToA.getId());
        DataDictionaryCustom usdtBPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.USDT_B_PERCENT.getType(),
                PoolEnum.USDT_B_PERCENT.getCode()
        );
        BigDecimal usdtBPercent = new BigDecimal(StrUtil.isEmpty(usdtBPercentDic.getValue()) ? "0.1" : usdtBPercentDic.getValue());
        BigDecimal usdtBAmount = amount.multiply(usdtBPercent).setScale(4, BigDecimal.ROUND_DOWN);
        //生成一条进行中的10%进入B币底池的资金流水记录
        DappFundFlowEntity fundFlowToB = new DappFundFlowEntity(
                1L,
                usdtBAmount,
                FundFlowEnum.USDT_IN_B_POOL.getCode(),
                1,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(fundFlowToB);
        //10%进入B币LP薄饼底池
        chainProducer.sendAntACoinInBPoolMsg(fundFlowToB.getId());
        /**
         * 1.90%底池的USDT做成100%溢价,铸造出70%金本位价值的A币。
         */
        DataDictionaryCustom produceAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.PRODUCE_A_PERCENT.getType(),
                PoolEnum.PRODUCE_A_PERCENT.getCode()
        );
        BigDecimal produceAPercent = new BigDecimal(StrUtil.isEmpty(produceAPercentDic.getValue()) ? "0.7" : produceAPercentDic.getValue());
        //购买数量
        BigDecimal totalCnt = amount.divide(coinAPrice, 4, BigDecimal.ROUND_DOWN);
        /**
         * 铸造出70%金本位价值的A币。实际产生数量
         */
        BigDecimal realCnt = totalCnt.multiply(produceAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        dappChargeUsdtEntity.setTotalCnt(totalCnt);
        dappChargeUsdtEntity.setRealCnt(realCnt);
        dappChargeUsdtMapper.updateById(dappChargeUsdtEntity);
        /**
         * 重新计算A币的价格
         */
        DataDictionaryCustom coinACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_CNT.getType(),
                PoolEnum.COIN_A_CNT.getCode()
        );
        //A币币本位底池-A币的数量
        BigDecimal coinACntDicCnt = new BigDecimal(coinACntDic.getValue());
        coinACntDicCnt = coinACntDicCnt.add(realCnt);
        coinACntDic.setValue(coinACntDicCnt.toString());
        dataDictionaryCustomMapper.updateById(coinACntDic);
        DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_USDT_PRICE.getType(),
                PoolEnum.COIN_A_USDT_PRICE.getCode()
        );
        //A币金本位底池-usdt数量
        BigDecimal coinAUsdtPriceDicCnt = new BigDecimal(coinAUsdtPriceDic.getValue());
        coinAUsdtPriceDicCnt = coinAUsdtPriceDicCnt.add(amount);
        coinAUsdtPriceDic.setValue(coinAUsdtPriceDicCnt.toString());
        dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic);
        BigDecimal divide = coinAUsdtPriceDicCnt.divide(coinACntDicCnt, 8, BigDecimal.ROUND_DOWN);
        coinAPriceDic.setValue(divide.toString());
        dataDictionaryCustomMapper.updateById(coinAPriceDic);
        chainProducer.sendAntKLineMsg(0);
        /**
         * A币的分配 walletMine
         * 【70%换算100%分配】
         * 50%客户秒到
         * 20%全网加权分红(按20%释放递减)
         * 10%直推
         * 5%节点
         * 5%基金会
         * 10%级差奖
         */
        /**
         * 50%客户秒到
         */
        DataDictionaryCustom memberGetAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.MEMBER_GET_A_PERCENT.getType(),
                PoolEnum.MEMBER_GET_A_PERCENT.getCode()
        );
        BigDecimal memberGetAPercent = new BigDecimal(StrUtil.isEmpty(memberGetAPercentDic.getValue()) ? "0.5" : memberGetAPercentDic.getValue());
        BigDecimal memberGetACnt = realCnt.multiply(memberGetAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        BigDecimal fundFlowToMemberFlag = this.getAndUpdateMemberPerk(dappFundFlowEntity.getMemberId(), memberGetACnt);
        if(fundFlowToMemberFlag.compareTo(BigDecimal.ZERO) > 0){
            //生成一条50%客户秒到的资金流水记录
            DappFundFlowEntity fundFlowToMember = new DappFundFlowEntity(
                    dappFundFlowEntity.getMemberId(),
                    fundFlowToMemberFlag,
                    FundFlowEnum.MEMBER_GET_A_CNT.getCode(),
                    2,
                    BigDecimal.ZERO,
                    null,
                    chergeRecordId);
            dappFundFlowDao.insert(fundFlowToMember);
            //用户的A币账户增加memberGetACnt数量
            dappWalletService.updateWalletMineWithLock(fundFlowToMemberFlag,dappFundFlowEntity.getMemberId(),1);
        }
        /**
         * 20%全网加权分红(按20%释放递减)进入加权分红底池
         */
        DataDictionaryCustom poolAllMemberAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.POOL_ALL_MEMBER_A_PERCENT.getType(),
                PoolEnum.POOL_ALL_MEMBER_A_PERCENT.getCode()
        );
        BigDecimal poolAllMemberAPercent = new BigDecimal(StrUtil.isEmpty(poolAllMemberAPercentDic.getValue()) ? "0.2" : poolAllMemberAPercentDic.getValue());
        BigDecimal poolAllMemberAPercentCnt = realCnt.multiply(poolAllMemberAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        DataDictionaryCustom poolAllMemberACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.POOL_ALL_MEMBER_A_CNT.getType(),
                PoolEnum.POOL_ALL_MEMBER_A_CNT.getCode()
        );
        BigDecimal poolAllMemberACnt = new BigDecimal(StrUtil.isEmpty(poolAllMemberACntDic.getValue()) ? "0" : poolAllMemberACntDic.getValue());
        poolAllMemberACnt = poolAllMemberACnt.add(poolAllMemberAPercentCnt);
        poolAllMemberACntDic.setValue(poolAllMemberACnt.toString());
        dataDictionaryCustomMapper.updateById(poolAllMemberACntDic);
        //生成一条20%全网加权分红(按20%释放递减)进入加权分红底池的资金流水记录
        DappFundFlowEntity poolAllMemberAFundFlow = new DappFundFlowEntity(
                1L,
                poolAllMemberAPercentCnt,
                FundFlowEnum.POOL_ALL_MEMBER_A_CNT.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(poolAllMemberAFundFlow);
        nodePoolPerk(poolAllMemberAPercentCnt, MemberLevelEnum.MEMBER.getType(), FundFlowEnum.POOL_MEMBER_A_CNT.getCode());
        /**
         * 10%直推
         */
        DataDictionaryCustom directAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.DIRECT_A_PERCENT.getType(),
                PoolEnum.DIRECT_A_PERCENT.getCode()
        );
        BigDecimal directAPercent = new BigDecimal(StrUtil.isEmpty(directAPercentDic.getValue()) ? "0.1" : directAPercentDic.getValue());
        BigDecimal directAPercentCnt = realCnt.multiply(directAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        String refererId = dappMemberEntity.getRefererId();
        DappMemberEntity directMemberEntity = dappMemberDao.selectMemberInfoByInviteId(refererId);
        if(ObjectUtil.isNotEmpty(directMemberEntity)){
            /**
             *推荐用户入单可享有贡献值.例.推荐100获得100贡献值
             */
            DappUsdtPerkEntity directDappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(directMemberEntity.getId());
            if(ObjectUtil.isEmpty(directDappUsdtPerkEntity)){
                directDappUsdtPerkEntity = new DappUsdtPerkEntity();
                directDappUsdtPerkEntity.setNftDevote(amount);
                directDappUsdtPerkEntity.setMemberId(directMemberEntity.getId());
                dappUsdtPerkEntityMapper.insert(directDappUsdtPerkEntity);
            }
            BigDecimal directNftDevote = directDappUsdtPerkEntity.getNftDevote();
            directNftDevote = directNftDevote.add(amount);
            directDappUsdtPerkEntity.setNftDevote(directNftDevote);
            dappUsdtPerkEntityMapper.updateById(directDappUsdtPerkEntity);
            BigDecimal directAPercentFundFlowToMemberFlag = this.getAndUpdateMemberPerk(directMemberEntity.getId(), directAPercentCnt);
            if(directAPercentFundFlowToMemberFlag.compareTo(BigDecimal.ZERO) > 0){
                //生成一条10%直推的资金流水记录
                DappFundFlowEntity directAPercentFundFlowToMember = new DappFundFlowEntity(
                        directMemberEntity.getId(),
                        directAPercentFundFlowToMemberFlag,
                        FundFlowEnum.DIRECT_A_PERCENT.getCode(),
                        2,
                        BigDecimal.ZERO,
                        null,
                        chergeRecordId);
                dappFundFlowDao.insert(directAPercentFundFlowToMember);
                //用户的A币账户增加directAPercentCnt数量
                dappWalletService.updateWalletMineWithLock(directAPercentFundFlowToMemberFlag,directMemberEntity.getId(),1);
            }
        }
        /**
         * 5%节点
         */
        DataDictionaryCustom nodeAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_A_PERCENT.getType(),
                PoolEnum.NODE_A_PERCENT.getCode()
        );
        BigDecimal nodeAPercent = new BigDecimal(StrUtil.isEmpty(nodeAPercentDic.getValue()) ? "0.05" : nodeAPercentDic.getValue());
        BigDecimal nodeAPercentCnt = realCnt.multiply(nodeAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        //生成一条5%节点的资金流水记录
        DappFundFlowEntity nodeAPercentFundFlow = new DappFundFlowEntity(
                1L,
                nodeAPercentCnt,
                FundFlowEnum.NODE_A_PERCENT.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(nodeAPercentFundFlow);
//        chainProducer.sendAntACoinInNodeMsg(nodeAPercentFundFlow.getId());
        DataDictionaryCustom nodeAPercentPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_A_PERCENT_POOL.getType(),
                PoolEnum.NODE_A_PERCENT_POOL.getCode()
        );
        BigDecimal nodeAPercentPoolDicCnt = new BigDecimal(StrUtil.isEmpty(nodeAPercentPoolDic.getValue()) ? "0" : nodeAPercentPoolDic.getValue());
        nodeAPercentPoolDicCnt = nodeAPercentPoolDicCnt.add(nodeAPercentCnt);
        nodeAPercentPoolDic.setValue(nodeAPercentPoolDicCnt.toString());
        dataDictionaryCustomMapper.updateById(nodeAPercentPoolDic);
        superNodePoolPerk(nodeAPercentCnt, NodeCodeEnum.SUPER_NODE.getCode(), FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode());
        /**
         * 5%基金会
         */
        DataDictionaryCustom foundationAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.FOUNDATION_A_PERCENT.getType(),
                PoolEnum.FOUNDATION_A_PERCENT.getCode()
        );
        BigDecimal foundationAPercent = new BigDecimal(StrUtil.isEmpty(foundationAPercentDic.getValue()) ? "0.05" : foundationAPercentDic.getValue());
        BigDecimal foundationAPercentCnt = realCnt.multiply(foundationAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        //生成一条5%基金会的资金流水记录
        DappFundFlowEntity foundationAPercentFundFlow = new DappFundFlowEntity(
                1L,
                foundationAPercentCnt,
                FundFlowEnum.FOUNDATION_A_PERCENT.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(foundationAPercentFundFlow);
        //用户的A币账户增加memberGetACnt数量
        dappWalletService.updateWalletMineWithLock(foundationAPercentCnt,1L,1);
        /**
         * 10%级差奖
         */
        DataDictionaryCustom levelAPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.LEVEL_A_PERCENT.getType(),
                PoolEnum.LEVEL_A_PERCENT.getCode()
        );
        BigDecimal levelAPercent = new BigDecimal(StrUtil.isEmpty(levelAPercentDic.getValue()) ? "0.1" : levelAPercentDic.getValue());
        BigDecimal levelAPercentCnt = realCnt.multiply(levelAPercent).setScale(4, BigDecimal.ROUND_DOWN);
        //生成一条10%级差奖进入10%级差奖底池的资金流水记录
        DappFundFlowEntity levelAPercentCntFundFlow = new DappFundFlowEntity(
                1L,
                levelAPercentCnt,
                FundFlowEnum.LEVEL_A_PERCENT_CNT.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                chergeRecordId);
        dappFundFlowDao.insert(levelAPercentCntFundFlow);
        chainProducer.sendAntACoinInLevelMsg(levelAPercentCntFundFlow.getId());
    }
    @Override
    public void AntACoinAPollInMsg(Long id) {
        log.info("{}",id);
        //获取对应的流水记录
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        //金额
        BigDecimal amount = dappFundFlowEntity.getAmount();
        //目标地址
        String address = AppContants.ADDRESS_A_POOL_PEOJECT;
        /**
         * 发起USDT转账
         */
        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(address, amount);
        if(StrUtil.isEmpty(hash)){
            return;
        }
        log.info("{},{}",id,hash);
        dappFundFlowEntity.setFromHash(hash);
        dappFundFlowEntity.setStatus(2);
        dappFundFlowDao.updateById(dappFundFlowEntity);
    }
    @Override
    public void AntACoinBPollInMsg(Long id) {
        log.info("{}",id);
        //获取对应的流水记录
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        //金额
        BigDecimal amount = dappFundFlowEntity.getAmount();
        //目标地址
        String address = AppContants.ADDRESS_B_POOL_PEOJECT;
        /**
         * 发起USDT转账
         */
        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_A_POOL.name()).transfer(address, amount);
        if(StrUtil.isEmpty(hash)){
            return;
        }
        log.info("{},{}",id,hash);
        dappFundFlowEntity.setFromHash(hash);
        dappFundFlowEntity.setStatus(2);
        dappFundFlowDao.updateById(dappFundFlowEntity);
    }
    @Override
    public void antACoinInNodeMsg(Long id) {
        /**
         * 全网节点99名.享受全网5%分红
         */
        log.info("{}",id);
        //获取对应的流水记录
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        //金额
        BigDecimal amount = dappFundFlowEntity.getAmount();
        /**
         * 获取全网的超级节点个数
         */
        List<DappMemberNodeEntity> dappMemberNodeEntities = dappMemberNodeMapper.selectNodeByNodeCode(NodeCodeEnum.SUPER_NODE.getCode());
        if(CollUtil.isNotEmpty(dappMemberNodeEntities)){
            BigDecimal divide = amount.divide(new BigDecimal(dappMemberNodeEntities.size()), 4, BigDecimal.ROUND_DOWN);
            for(DappMemberNodeEntity dappMemberNodeEntity : dappMemberNodeEntities){
                Long memberId = dappMemberNodeEntity.getMemberId();
                DappFundFlowEntity nodeAPercentFundFlow = new DappFundFlowEntity(
                        memberId,
                        divide,
                        FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode(),
                        2,
                        BigDecimal.ZERO,
                        null,
                        dappFundFlowEntity.getSystemProfitId());
                dappFundFlowDao.insert(nodeAPercentFundFlow);
                //用户的A币账户增加divide数量
                dappWalletService.updateWalletMineWithLock(divide,memberId,1);
            }
            dappFundFlowEntity.setFromHash("已分成"+dappMemberNodeEntities.size()+"人");
        }else{
            dappFundFlowEntity.setFromHash("已分成0人");
            dappWalletService.updateWalletMineWithLock(amount,1L,1);
        }
        dappFundFlowEntity.setStatus(2);
        dappFundFlowDao.updateById(dappFundFlowEntity);
    }
    @Override
    public void antACoinInLevelMsg(Long id) {
        /**
         * DAO1.考核小区业绩5000USDT  享受团队新增业绩2%
         * DAO2.伞下不同部门产生2个DAO1.享受团队新增业绩3%
         * DAO3.伞下不同部门2个DAO2.享受团队新增业绩4%,全网加权分红1%
         * DAO4.两个不同部门DAO3.享受团队新增业绩5%,全网1%分红。
         * DAO5.两个不同部门DAO4.享受团队新增业绩6%,全网1%加权分红
         * 平级奖.DAO5平级享受全网1%加权分红.
         *
         * DAO5直推DAO5平级拿一代,视为平级奖,享受原有DAO5一个点,额外再加一个点分红。享受双份收益,合计2%加权分红
         */
        log.info("{}",id);
        //获取对应的流水记录
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        /**
         * 极差总金额
         */
        BigDecimal amountTC = dappFundFlowEntity.getAmount();
        Long systemProfitId = dappFundFlowEntity.getSystemProfitId();
        DappChargeUsdtEntity dappChargeUsdtEntity = dappChargeUsdtMapper.selectById(systemProfitId);
        Long memberId = dappChargeUsdtEntity.getMemberId();
        DappMemberEntity mallMember = dappMemberDao.selectById(memberId);
        /**
         * 团队下不同代理级别获取不用的比例新增业绩补贴
         */
        if(StrUtil.isNotEmpty(mallMember.getRefererIds())){
            String referrerIds = mallMember.getRefererIds();
            List<String> referrerIdList = StrUtil.splitTrim(referrerIds, ",");
            if(CollUtil.isNotEmpty(referrerIdList)){
                List<DappMemberEntity> mallMemberTeamPerk = dappMemberDao.selectByInviteIds(referrerIdList);
                if(CollUtil.isNotEmpty(mallMemberTeamPerk)){
                    //初始级别
                    String levelNormal = MemberLevelEnum.NODE_1.getType();
                    //初始团队新增业绩补贴
                    BigDecimal teamIncomePerkNormal = BigDecimal.ZERO;
                    //补贴总数
                    BigDecimal teamIncomePerkTotal = BigDecimal.ZERO;
                    for(DappMemberEntity teamPerkMember : mallMemberTeamPerk){
                        String level = teamPerkMember.getAccountType();
                        //比较两个级别的大小,level大于levelNormal返回1
                        int compareMin = MemberLevelEnum.NODE_1.compareLevel(level, levelNormal);
                        int compareMax = MemberLevelEnum.NODE_1.compareLevel(MemberLevelEnum.NODE_5.getType(), level);
                        if(compareMin >= 1 && compareMax >= 1){
                            Long teamPerkMemberId = teamPerkMember.getId();
                            DataDictionaryCustom teamPerkMemberDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                                    "NODE_PERK", level);
                            NodePerk nodePerk = JSONObject.parseObject(teamPerkMemberDic.getValue(), NodePerk.class);
                            BigDecimal teamIncomePerk = nodePerk.getTeamIncomePerk();
                            //极差
                            teamIncomePerk = teamIncomePerk.subtract(teamIncomePerkNormal);
                            BigDecimal teamIncomePerkAmount = amountTC.multiply(teamIncomePerk).setScale(4, BigDecimal.ROUND_DOWN);
                            BigDecimal nodeAPercentFundFlowFlag = this.getAndUpdateMemberPerk(teamPerkMemberId, teamIncomePerkAmount);
                            if(nodeAPercentFundFlowFlag.compareTo(BigDecimal.ZERO) > 0){
                                DappFundFlowEntity nodeAPercentFundFlow = new DappFundFlowEntity(
                                        teamPerkMemberId,
                                        nodeAPercentFundFlowFlag,
                                        FundFlowEnum.LEVEL_A_PERCENT_CNT_MEMBER.getCode(),
                                        2,
                                        BigDecimal.ZERO,
                                        null,
                                        dappFundFlowEntity.getSystemProfitId());
                                dappFundFlowDao.insert(nodeAPercentFundFlow);
                                //用户的A币账户增加divide数量
                                dappWalletService.updateWalletMineWithLock(nodeAPercentFundFlowFlag,teamPerkMemberId,1);
                                //累加补贴总数
                                teamIncomePerkTotal = teamIncomePerkTotal.add(nodeAPercentFundFlowFlag);
                            }
                            //初始级别变成当前遍历的会员的级别
                            levelNormal = level;
                            //初始新增业绩补贴比例变成当前会员级别的补贴比例
                            teamIncomePerkNormal = nodePerk.getTeamIncomePerk();
                        }
                    }
                    //更新总数据
                    dappFundFlowEntity.setFromHash("已分成"+teamIncomePerkTotal.setScale(4,BigDecimal.ROUND_DOWN));
                    dappFundFlowEntity.setStatus(2);
                    dappFundFlowDao.updateById(dappFundFlowEntity);
                    BigDecimal subtract = amountTC.subtract(teamIncomePerkTotal);
                    //用户的A币账户增加divide数量
                    dappWalletService.updateWalletMineWithLock(subtract,1L,1);
                }
            }
        }
        /**
         * 极差的dao3、dao4、dao5级别全网分红入自己的底池,每天按20%平分
         */
        //获取新增数量
        DataDictionaryCustom nodeThreeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_3.getType(),
                PoolEnum.NODE_3.getCode());
        NodePerk nodePerk = JSONObject.parseObject(nodeThreeDic.getValue(), NodePerk.class);
        BigDecimal averagePerk = nodePerk.getAveragePerk();
        BigDecimal averagePerkCnt = amountTC.multiply(averagePerk).setScale(4, BigDecimal.ROUND_DOWN);
        nodePoolPerk(averagePerkCnt, MemberLevelEnum.NODE_3.getType(), FundFlowEnum.DAO_3_NODE_PERK.getCode());
        //生成流水记录
        DappFundFlowEntity nodeThreeFundFlow = new DappFundFlowEntity(
                1L,
                averagePerkCnt,
                FundFlowEnum.DAO_3_CNT_MEMBER.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                dappChargeUsdtEntity.getId());
        dappFundFlowDao.insert(nodeThreeFundFlow);
        //更新底池
        DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_3_POOL.getType(),
                PoolEnum.NODE_3_POOL.getCode());
        BigDecimal nodeThreePool = new BigDecimal(nodeThreePoolDic.getValue());
        nodeThreePool = nodeThreePool.add(averagePerkCnt).setScale(4,BigDecimal.ROUND_DOWN);
        nodeThreePoolDic.setValue(nodeThreePool.toString());
        dataDictionaryCustomMapper.updateById(nodeThreePoolDic);
        DataDictionaryCustom nodeFourDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_4.getType(),
                PoolEnum.NODE_4.getCode());
        NodePerk nodeFourDicPerk = JSONObject.parseObject(nodeFourDic.getValue(), NodePerk.class);
        BigDecimal averagePerkFour = nodeFourDicPerk.getAveragePerk();
        BigDecimal averagePerkFourCnt = amountTC.multiply(averagePerkFour).setScale(4, BigDecimal.ROUND_DOWN);
        nodePoolPerk(averagePerkFourCnt, MemberLevelEnum.NODE_4.getType(), FundFlowEnum.DAO_4_NODE_PERK.getCode());
        DappFundFlowEntity nodeFourFundFlow = new DappFundFlowEntity(
                1L,
                averagePerkFourCnt,
                FundFlowEnum.DAO_4_CNT_MEMBER.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                dappChargeUsdtEntity.getId());
        dappFundFlowDao.insert(nodeFourFundFlow);
        DataDictionaryCustom nodeFourPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_4_POOL.getType(),
                PoolEnum.NODE_4_POOL.getCode());
        BigDecimal nodeFourPool = new BigDecimal(nodeFourPoolDic.getValue());
        nodeFourPool = nodeFourPool.add(averagePerkFourCnt).setScale(4,BigDecimal.ROUND_DOWN);
        nodeFourPoolDic.setValue(nodeFourPool.toString());
        dataDictionaryCustomMapper.updateById(nodeFourPoolDic);
        DataDictionaryCustom nodeFiveDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_5.getType(),
                PoolEnum.NODE_5.getCode());
        NodePerk nodeFiveDicPerk = JSONObject.parseObject(nodeFiveDic.getValue(), NodePerk.class);
        BigDecimal averagePerkFive = nodeFiveDicPerk.getAveragePerk();
        BigDecimal averagePerkFiveCnt = amountTC.multiply(averagePerkFive).setScale(4, BigDecimal.ROUND_DOWN);
        nodePoolPerk(averagePerkFiveCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_PERK.getCode());
        DappFundFlowEntity nodeFiveFundFlow = new DappFundFlowEntity(
                1L,
                averagePerkFiveCnt,
                FundFlowEnum.DAO_5_CNT_MEMBER.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                dappChargeUsdtEntity.getId());
        dappFundFlowDao.insert(nodeFiveFundFlow);
        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_5_POOL.getType(),
                PoolEnum.NODE_5_POOL.getCode());
        BigDecimal nodeFivePool = new BigDecimal(nodeFivePoolDic.getValue());
        nodeFivePool = nodeFivePool.add(averagePerkFiveCnt).setScale(4,BigDecimal.ROUND_DOWN);
        nodeFivePoolDic.setValue(nodeFivePool.toString());
        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
        /**
         * DAO5直推DAO5平级拿一代,视为平级奖,享受原有DAO5一个点,额外再加一个点分红。享受双份收益,合计2%加权分红
         */
        DataDictionaryCustom nodeFiveEqualsDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_5_EQUALS.getType(),
                PoolEnum.NODE_5_EQUALS.getCode());
        BigDecimal nodeFiveEquals = new BigDecimal(nodeFiveEqualsDic.getValue());
        BigDecimal nodeFiveEqualsCnt = amountTC.multiply(nodeFiveEquals).setScale(4, BigDecimal.ROUND_DOWN);
        nodePoolEqualsPerk(nodeFiveEqualsCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_EQUALS_PERK.getCode());
        DappFundFlowEntity nodeFiveEqualsFundFlow = new DappFundFlowEntity(
                1L,
                nodeFiveEqualsCnt,
                FundFlowEnum.DAO_5_CNT_EQUALS_MEMBER.getCode(),
                2,
                BigDecimal.ZERO,
                null,
                dappChargeUsdtEntity.getId());
        dappFundFlowDao.insert(nodeFiveEqualsFundFlow);
        DataDictionaryCustom nodeFiveEqualsPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.NODE_5_EQUALS_POOL.getType(),
                PoolEnum.NODE_5_EQUALS_POOL.getCode());
        BigDecimal nodeFiveEqualsPool = new BigDecimal(nodeFiveEqualsPoolDic.getValue());
        nodeFiveEqualsPool = nodeFiveEqualsPool.add(nodeFiveEqualsCnt).setScale(4,BigDecimal.ROUND_DOWN);
        nodeFiveEqualsPoolDic.setValue(nodeFiveEqualsPool.toString());
        dataDictionaryCustomMapper.updateById(nodeFiveEqualsPoolDic);
    }
    @Override
    public BigDecimal getAndUpdateMemberPerk(Long memberId, BigDecimal amount) {
        /**
         * 把币本位换算成金本位
         */
        DataDictionaryCustom coinAPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(coinAPriceDic.getValue());
        //实际补贴的USDT数量 = 币的数量 * 当前A币的价格
        BigDecimal realUsdtAmount = amount.multiply(coinAPrice);
        //实际补贴额度USDT
        BigDecimal perkAmount = BigDecimal.ZERO;
        DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(memberId);
        if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
            return BigDecimal.ZERO;
        }
        //用户剩余补贴额度
        BigDecimal amountSurplus = dappUsdtPerkEntity.getAmount();
        if(BigDecimal.ZERO.compareTo(amountSurplus) >= 0){
            return BigDecimal.ZERO;
        }
        if(realUsdtAmount.compareTo(amountSurplus) >= 0){
            perkAmount = amountSurplus;
        }else{
            perkAmount = realUsdtAmount;
        }
        if(BigDecimal.ZERO.compareTo(perkAmount) < 0){
            amountSurplus = amountSurplus.subtract(perkAmount);
            dappUsdtPerkEntity.setAmount(amountSurplus);
            dappUsdtPerkEntityMapper.updateById(dappUsdtPerkEntity);
        }else{
            return BigDecimal.ZERO;
        }
        /**
         * 把金本位换算成币本位
         */
        perkAmount = perkAmount.divide(coinAPrice,4,BigDecimal.ROUND_DOWN);
        return perkAmount;
    }
    @Override
    public BigDecimal nodePoolPerk(BigDecimal nodeThreePoolDicCnt, String type, int typeFlow) {
        BigDecimal realPerkAmount = BigDecimal.ZERO;
        List<DappMemberEntity> dappMemberEntities = new ArrayList<>();
        //获取type级别的会员
        if(MemberLevelEnum.MEMBER.getType().equals(type)){
            dappMemberEntities = dappMemberDao.selectMemberByNotAccountType(type);
        }else{
            dappMemberEntities = dappMemberDao.selectMemberByAccountType(type);
        }
        //每日补贴总数
        BigDecimal nodePerk = nodeThreePoolDicCnt;
//        BigDecimal nodePerk = nodeThreePoolDicCnt.multiply(AppContants.NODE_PERK_PERCENT);
        if(CollUtil.isNotEmpty(dappMemberEntities)){
            //每人的补贴
            BigDecimal averagePerk = nodePerk.divide(new BigDecimal(dappMemberEntities.size()), 4, BigDecimal.ROUND_DOWN);
            for(DappMemberEntity dappMemberEntity : dappMemberEntities){
                BigDecimal fundFlowToMemberFlag = this.getAndUpdateMemberPerk(dappMemberEntity.getId(), averagePerk);
                if(fundFlowToMemberFlag.compareTo(BigDecimal.ZERO) > 0){
                    //生成一条50%客户秒到的资金流水记录
                    DappFundFlowEntity fundFlowToMember = new DappFundFlowEntity(
                            dappMemberEntity.getId(),
                            fundFlowToMemberFlag,
                            typeFlow,
                            2,
                            BigDecimal.ZERO);
                    dappFundFlowDao.insert(fundFlowToMember);
                    //用户的A币账户增加memberGetACnt数量
                    dappWalletService.updateWalletMineWithLock(fundFlowToMemberFlag,dappMemberEntity.getId(),1);
                    realPerkAmount = realPerkAmount.add(fundFlowToMemberFlag);
                }
            }
        }
        return realPerkAmount;
    }
    @Override
    public BigDecimal nodePoolEqualsPerk(BigDecimal nodeFivePoolDicCnt, String type, int code) {
        BigDecimal realPerkAmount = BigDecimal.ZERO;
        //获取type级别的会员
        List<DappMemberEntity> dappMemberEntities = dappMemberDao.selectMemberByAccountTypeAnd(type);
        //每日补贴总数
        BigDecimal nodePerk = nodeFivePoolDicCnt.multiply(AppContants.NODE_PERK_PERCENT);
        if(CollUtil.isNotEmpty(dappMemberEntities)){
            //每人的补贴
            BigDecimal averagePerk = nodePerk.divide(new BigDecimal(dappMemberEntities.size()), 4, BigDecimal.ROUND_DOWN);
            for(DappMemberEntity dappMemberEntity : dappMemberEntities){
                BigDecimal fundFlowToMemberFlag = this.getAndUpdateMemberPerk(dappMemberEntity.getId(), averagePerk);
                if(fundFlowToMemberFlag.compareTo(BigDecimal.ZERO) > 0){
                    DappFundFlowEntity fundFlowToMember = new DappFundFlowEntity(
                            dappMemberEntity.getId(),
                            fundFlowToMemberFlag,
                            code,
                            2,
                            BigDecimal.ZERO);
                    dappFundFlowDao.insert(fundFlowToMember);
                    //用户的A币账户增加memberGetACnt数量
                    dappWalletService.updateWalletMineWithLock(fundFlowToMemberFlag,dappMemberEntity.getId(),1);
                    realPerkAmount = realPerkAmount.add(fundFlowToMemberFlag);
                }
            }
        }
        return realPerkAmount;
    }
    @Override
    public BigDecimal superNodePoolPerk(BigDecimal nodeFivePoolDicCnt, String code, int code1) {
        BigDecimal realPerkAmount = BigDecimal.ZERO;
        //获取type级别的会员
        List<DappMemberNodeEntity> dappMemberNodeEntities = dappMemberNodeMapper.selectNodeByNodeCode(NodeCodeEnum.SUPER_NODE.getCode());
        //每日补贴总数
//        BigDecimal nodePerk = nodeFivePoolDicCnt.multiply(AppContants.NODE_PERK_PERCENT);
        BigDecimal nodePerk = nodeFivePoolDicCnt;
        if(CollUtil.isNotEmpty(dappMemberNodeEntities)){
            //每人的补贴
            BigDecimal averagePerk = nodePerk.divide(new BigDecimal(dappMemberNodeEntities.size()), 4, BigDecimal.ROUND_DOWN);
            for(DappMemberNodeEntity dappMemberNodeEntity : dappMemberNodeEntities){
                DappFundFlowEntity fundFlowToMember = new DappFundFlowEntity(
                        dappMemberNodeEntity.getMemberId(),
                        averagePerk,
                        code1,
                        2,
                        BigDecimal.ZERO);
                dappFundFlowDao.insert(fundFlowToMember);
                //用户的A币账户增加memberGetACnt数量
                dappWalletService.updateWalletMineWithLock(averagePerk,dappMemberNodeEntity.getMemberId(),1);
                realPerkAmount = realPerkAmount.add(averagePerk);
            }
        }
        return realPerkAmount;
    }
    @Override
    public void selectAndInsertDics() {
        selectAndInsertDic(PoolEnum.TRANSFER_A_AUSD_PRICE.getType(),PoolEnum.TRANSFER_A_AUSD_PRICE.getCode(),"0.01","AUSD价格");
        selectAndInsertDic(PoolEnum.TRANSFER_A_AUSD_PERCENT.getType(),PoolEnum.TRANSFER_A_AUSD_PERCENT.getCode(),"0.1","买入A,10%的AUSD比例");
        selectAndInsertDic(PoolEnum.WALLET_COIN_OUT_PERCENT.getType(),PoolEnum.WALLET_COIN_OUT_PERCENT.getCode(),"0.3","30%回流底池溢价");
        selectAndInsertDic(PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getType(),PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getCode(),"0.01","闪对钱包USDT提现1%手续费.(扣USDT)");
        selectAndInsertDic(PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getType(),PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getCode(),"0.03","资产转闪对钱包 3%扣币");
        selectAndInsertDic(PoolEnum.NODE_5_EQUALS_POOL.getType(),PoolEnum.NODE_5_EQUALS_POOL.getCode(),"0","节点5的平级奖励底池");
        selectAndInsertDic(PoolEnum.NODE_5_EQUALS.getType(),PoolEnum.NODE_5_EQUALS.getCode(),"0.1","节点5的平级奖励比例");
        selectAndInsertDic(
                PoolEnum.NODE_5.getType(),
                PoolEnum.NODE_5.getCode(),
                JSONObject.toJSONString(new NodePerk(BigDecimal.ZERO,2,new BigDecimal("0.6"),new BigDecimal("0.1"))),
                "节点5的奖励");
        selectAndInsertDic(
                PoolEnum.NODE_4.getType(),
                PoolEnum.NODE_4.getCode(),
                JSONObject.toJSONString(new NodePerk(BigDecimal.ZERO,2,new BigDecimal("0.5"),new BigDecimal("0.1"))),
                "节点4的奖励");
        selectAndInsertDic(
                PoolEnum.NODE_3.getType(),
                PoolEnum.NODE_3.getCode(),
                JSONObject.toJSONString(new NodePerk(BigDecimal.ZERO,2,new BigDecimal("0.4"),new BigDecimal("0.1"))),
                "节点3的奖励");
        selectAndInsertDic(
                PoolEnum.NODE_2.getType(),
                PoolEnum.NODE_2.getCode(),
                JSONObject.toJSONString(new NodePerk(BigDecimal.ZERO,2,new BigDecimal("0.3"),new BigDecimal("0.1"))),
                "节点2的奖励");
        selectAndInsertDic(
                PoolEnum.NODE_1.getType(),
                PoolEnum.NODE_1.getCode(),
                JSONObject.toJSONString(new NodePerk(new BigDecimal(5000),3,new BigDecimal("0.2"),new BigDecimal("0.1"))),
                "节点1的奖励");
        selectAndInsertDic(PoolEnum.NODE_5_POOL.getType(),PoolEnum.NODE_5_POOL.getCode(),"0","节点5的奖励底池");
        selectAndInsertDic(PoolEnum.NODE_4_POOL.getType(),PoolEnum.NODE_4_POOL.getCode(),"0","节点4的奖励底池");
        selectAndInsertDic(PoolEnum.NODE_3_POOL.getType(),PoolEnum.NODE_3_POOL.getCode(),"0","节点3的奖励底池");
        selectAndInsertDic(PoolEnum.COIN_A_CNT.getType(),PoolEnum.COIN_A_CNT.getCode(),"0","A币币本位底池 -A币的数量");
        selectAndInsertDic(PoolEnum.COIN_A_USDT_PRICE.getType(),PoolEnum.COIN_A_USDT_PRICE.getCode(),"0","A币金本位底池-usdt数量");
        selectAndInsertDic(PoolEnum.COIN_A_PRICE.getType(),PoolEnum.COIN_A_PRICE.getCode(),"0","A币的价格");
        selectAndInsertDic(PoolEnum.LEVEL_A_PERCENT.getType(),PoolEnum.LEVEL_A_PERCENT.getCode(),"0.1","10%极差奖");
        selectAndInsertDic(PoolEnum.FOUNDATION_A_PERCENT.getType(),PoolEnum.FOUNDATION_A_PERCENT.getCode(),"0.05","5%基金会");
        selectAndInsertDic(PoolEnum.NODE_A_PERCENT_POOL.getType(),PoolEnum.NODE_A_PERCENT_POOL.getCode(),"0","5%节点资金池");
        selectAndInsertDic(PoolEnum.NODE_A_PERCENT.getType(),PoolEnum.NODE_A_PERCENT.getCode(),"0.05","5%节点");
        selectAndInsertDic(PoolEnum.DIRECT_A_PERCENT.getType(),PoolEnum.DIRECT_A_PERCENT.getCode(),"0.1","10%直推");
        selectAndInsertDic(PoolEnum.POOL_MEMBER_A_PERCENT.getType(),PoolEnum.POOL_MEMBER_A_PERCENT.getCode(),"0.2","每日所有人平分的底池20%,即底池总数 * 比例");
        selectAndInsertDic(PoolEnum.POOL_ALL_MEMBER_A_CNT.getType(),PoolEnum.POOL_ALL_MEMBER_A_CNT.getCode(),"0","所有人平分的底池");
        selectAndInsertDic(PoolEnum.POOL_ALL_MEMBER_A_PERCENT.getType(),PoolEnum.POOL_ALL_MEMBER_A_PERCENT.getCode(),"0","全网加权分红20%,即所有人平分的底池");
        selectAndInsertDic(PoolEnum.MEMBER_GET_A_PERCENT.getType(),PoolEnum.MEMBER_GET_A_PERCENT.getCode(),"0.5","客户秒到50%的A币比例");
        selectAndInsertDic(PoolEnum.PRODUCE_A_PERCENT.getType(),PoolEnum.PRODUCE_A_PERCENT.getCode(),"0.7","实际产生A币的数量的比例");
        selectAndInsertDic(PoolEnum.USDT_B_PERCENT.getType(),PoolEnum.USDT_B_PERCENT.getCode(),"0.1","10%进入B底池的比例");
        selectAndInsertDic(PoolEnum.USDT_A_PERCENT.getType(),PoolEnum.USDT_A_PERCENT.getCode(),"0.9","90%进入A底池的比例");
    }
    @Override
    public void selectAndInsertDic(String type, String code, String value, String description) {
        DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(type, code);
        if(ObjectUtil.isEmpty(dic)){
            dic = new DataDictionaryCustom(type,code,value,description);
            dataDictionaryCustomMapper.insert(dic);
        }
    }
    @Override
    public void antACoinOutMsg(Long id) {
        log.info("{}",id);
        //获取对应的流水记录
        DappFundFlowEntity dappFundFlowEntity = dappFundFlowDao.selectInfoById(id);
        if(ObjectUtil.isEmpty(dappFundFlowEntity)){
            return;
        }
        //金额
        BigDecimal amount = dappFundFlowEntity.getAmount();
        Long memberId = dappFundFlowEntity.getMemberId();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(memberId);
        //目标地址
        String address = dappMemberEntity.getAddress();
        /**
         * 发起USDT转账
         */
        log.info("amount:{},address:{}",amount,address);
//        String hash = ChainService.getInstance(ChainEnum.BSC_USDT_W_POOL.name()).transfer(address, amount);
//        if(StrUtil.isEmpty(hash)){
//            return;
//        }
//        log.info("{},{}",id,hash);
//        dappFundFlowEntity.setFromHash(hash);
//        dappFundFlowEntity.setStatus(2);
//        dappFundFlowDao.updateById(dappFundFlowEntity);
    }
    @Override
    public void aCoinFire() {
        /**
         * A币技术做到资产钱包燃烧,闪兑钱包也要燃烧0.1%每小时
         */
        BigDecimal totalCnt = BigDecimal.ZERO;
        //闪兑钱包
        List<DappWalletCoinEntity> walletCoinEntities = dappWalletCoinDao.selectAmountThanZero();
        if(CollUtil.isNotEmpty(walletCoinEntities)){
            for(DappWalletCoinEntity dappWalletCoinEntity : walletCoinEntities){
                BigDecimal availableAmount = dappWalletCoinEntity.getAvailableAmount();
                BigDecimal fireCnt = availableAmount.multiply(new BigDecimal("0.001")).setScale(4,BigDecimal.ROUND_DOWN);
                dappWalletService.updateWalletCoinWithLock(fireCnt,dappWalletCoinEntity.getMemberId(),2);
                totalCnt = totalCnt.add(fireCnt);
            }
        }
        //资产钱包
        List<DappWalletMineEntity> walletMineEntities = dappWalletMineDao.selectAmountThanZero();
        if(CollUtil.isNotEmpty(walletMineEntities)){
            for(DappWalletMineEntity dappWalletMineEntity : walletMineEntities){
                BigDecimal availableAmount = dappWalletMineEntity.getAvailableAmount();
                BigDecimal fireCnt = availableAmount.multiply(new BigDecimal("0.001")).setScale(4,BigDecimal.ROUND_DOWN);
                dappWalletService.updateWalletMineWithLock(fireCnt,dappWalletMineEntity.getMemberId(),2);
                totalCnt = totalCnt.add(fireCnt);
            }
        }
        if(BigDecimal.ZERO.compareTo(totalCnt) >= 0){
            return;
        }
        totalCnt = totalCnt.setScale(4,BigDecimal.ROUND_DOWN);
        /**
         * 插入每小时燃烧的资金流水
         */
        DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity(1L, totalCnt, FundFlowEnum.A_COIN_FIRE.getCode(), 2, BigDecimal.ZERO);
        dappFundFlowDao.insert(dappFundFlowEntity);
        /**
         * 更新A币的价格
         */
        DataDictionaryCustom coinACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_CNT.getType(),
                PoolEnum.COIN_A_CNT.getCode());
        BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue());
        coinACnt = coinACnt.subtract(totalCnt);
        coinACntDic.setValue(coinACnt.toString());
        dataDictionaryCustomMapper.updateById(coinACntDic);
        DataDictionaryCustom coinAUsdtDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_USDT_PRICE.getType(),
                PoolEnum.COIN_A_USDT_PRICE.getCode());
        BigDecimal coinAUsdt = new BigDecimal(coinAUsdtDic.getValue());
        DataDictionaryCustom coinAPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode());
        BigDecimal coinAPrice = coinAUsdt.divide(coinACnt,8,BigDecimal.ROUND_DOWN);
        coinAPriceDic.setValue(coinAPrice.toString());
        dataDictionaryCustomMapper.updateById(coinAPriceDic);
        chainProducer.sendAntKLineMsg(0);
    }
    @Override
    public void antMemberLevelMsg(Long memberId) {
        DappMemberEntity member = dappMemberDao.selectById(memberId);
        if(StrUtil.isBlank(member.getRefererIds())) {
            return;
        }
        List<String> ids = StrUtil.split(member.getRefererIds(), ',');
        List<DappMemberEntity> parentMembers = dappMemberDao.selectByInviteIds(ids);
        for (DappMemberEntity parent : parentMembers) {
            //DAO5不能再升级了
            if(parent.getAccountType().equals(MemberLevelEnum.NODE_5.getType())){
                continue;
            }
            /**
             * 升级到董事就无法升级了
             */
            String nextLevelName = MemberLevelEnum.MEMBER.getNextLevel(parent.getAccountType());
            int levelCode = MemberLevelEnum.MEMBER.getLevelCode(nextLevelName);
            DataDictionaryCustom newLevelDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode("NODE_PERK", nextLevelName);
            if(ObjectUtil.isEmpty(newLevelDic)){
                continue;
            }
            NodePerk nodeFiveDicPerk = JSONObject.parseObject(newLevelDic.getValue(), NodePerk.class);
            //需要判断小区业绩
            if( MemberLevelEnum.NODE_1.getType().equals(nextLevelName)){
                if (!directMemberCnt(parent, nodeFiveDicPerk)) {
                    continue;
                }
                if (!teamIncome(parent, nodeFiveDicPerk)) {
                    continue;
                }
            }else{
                if (!agentCntFinish(parent, nodeFiveDicPerk)) {
                    continue;
                }
            }
            parent.setAccountType(nextLevelName);
            dappMemberDao.updateById(parent);
        }
    }
    @Override
    public void aKlineJobHour() {
        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(dataDictionaryCustom.getValue());
        DateTime dateTime = DateUtil.offsetHour(DateUtil.date(), -1);
        String format = DateUtil.format(dateTime, "yyyy-MM-dd HH");
        List<String> dataDayStrList = new ArrayList<>();
        dataDayStrList.add(format);
        List<DappAKlineEntity> dappAKlineEntities = dappAKlineMapper.selectListByTypeAndHour(dataDayStrList);
        DappAKlineEntity dappAKlineEntity = new DappAKlineEntity();
        dappAKlineEntity.setType(1);
        if(CollUtil.isNotEmpty(dappAKlineEntities)){
            List<BigDecimal> openPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getOpenPrice).collect(Collectors.toList());
            BigDecimal openPrice = openPriceList.stream().min(BigDecimal::compareTo).get();
            dappAKlineEntity.setOpenPrice(openPrice);
            //获取最高价
            List<BigDecimal> highestPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getHighestPrice).collect(Collectors.toList());
            BigDecimal highestPrice = highestPriceList.stream().max(BigDecimal::compareTo).get();
            dappAKlineEntity.setHighestPrice(highestPrice);
            List<BigDecimal> lowestPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getLowestPrice).collect(Collectors.toList());
            BigDecimal lowestPrice = lowestPriceList.stream().min(BigDecimal::compareTo).get();
            dappAKlineEntity.setLowestPrice(lowestPrice);
        }else{
            dappAKlineEntity.setOpenPrice(coinAPrice);
            dappAKlineEntity.setHighestPrice(coinAPrice);
            dappAKlineEntity.setLowestPrice(coinAPrice);
        }
        DappAKlineEntity oldOne = dappAKlineMapper.selectOneByType();
        if(ObjectUtil.isNotEmpty(oldOne)){
            dappAKlineEntity.setClosePrice(oldOne.getClosePrice());
        }else{
            dappAKlineEntity.setClosePrice(coinAPrice);
        }
        dappAKlineMapper.insert(dappAKlineEntity);
        chainProducer.sendAntKLineMsg(1);
    }
    @Override
    public void aKlineJobDay() {
        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(dataDictionaryCustom.getValue());
        /**
         * 当前时间往前推12小时,得到前一天的所有时间的yyyy-MM-dd格式的所有小时的记录
         */
        DappAKlineEntity dappAKlineEntity = new DappAKlineEntity();
        dappAKlineEntity.setType(2);
        DateTime dateTime = DateUtil.offsetHour(DateUtil.date(), -12);
        String format = DateUtil.format(dateTime, "yyyy-MM-dd");
        List<String> dataDayStrList = new ArrayList<>();
        dataDayStrList.add(format);
        List<DappAKlineEntity> dappAKlineEntities = dappAKlineMapper.selectListByTypeAndTime(1,dataDayStrList);
        if(CollUtil.isNotEmpty(dappAKlineEntities)){
            List<BigDecimal> openPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getOpenPrice).collect(Collectors.toList());
            BigDecimal openPrice = openPriceList.stream().min(BigDecimal::compareTo).get();
            dappAKlineEntity.setOpenPrice(openPrice);
            //获取最高价
            List<BigDecimal> highestPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getHighestPrice).collect(Collectors.toList());
            BigDecimal highestPrice = highestPriceList.stream().max(BigDecimal::compareTo).get();
            dappAKlineEntity.setHighestPrice(highestPrice);
            List<BigDecimal> lowestPriceList = dappAKlineEntities.stream().map(DappAKlineEntity::getLowestPrice).collect(Collectors.toList());
            BigDecimal lowestPrice = lowestPriceList.stream().min(BigDecimal::compareTo).get();
            dappAKlineEntity.setLowestPrice(lowestPrice);
        }else{
            dappAKlineEntity.setOpenPrice(coinAPrice);
            dappAKlineEntity.setHighestPrice(coinAPrice);
            dappAKlineEntity.setLowestPrice(coinAPrice);
        }
        dappAKlineEntity.setClosePrice(coinAPrice);
        dappAKlineMapper.insert(dappAKlineEntity);
        chainProducer.sendAntKLineMsg(2);
        //周
        String week = DateUtil.dayOfWeekEnum(DateUtil.date()).toChinese();
        if("星期日".equals(week)){
            /**
             * 当前时间往前推6天,得到前一周的所有时间的yyyy-MM-dd格式的所有type为日的记录
             */
            DappAKlineEntity dappAKlineEntityDay = new DappAKlineEntity();
            dappAKlineEntityDay.setType(3);
            List<String> dataWeekStrList = new ArrayList<>();
            String one = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -6), "yyyy-MM-dd");
            String two = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -5), "yyyy-MM-dd");
            String three = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -4), "yyyy-MM-dd");
            String four = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -3), "yyyy-MM-dd");
            String five = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -2), "yyyy-MM-dd");
            String six = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -1), "yyyy-MM-dd");
            dataWeekStrList.add(one);
            dataWeekStrList.add(two);
            dataWeekStrList.add(three);
            dataWeekStrList.add(four);
            dataWeekStrList.add(five);
            dataWeekStrList.add(six);
            List<DappAKlineEntity> dappAKlineEntitieDays = dappAKlineMapper.selectListByTypeAndTime(2,dataWeekStrList);
            if(CollUtil.isNotEmpty(dappAKlineEntitieDays)){
                List<BigDecimal> openPriceList = dappAKlineEntitieDays.stream().map(DappAKlineEntity::getOpenPrice).collect(Collectors.toList());
                BigDecimal openPrice = openPriceList.stream().min(BigDecimal::compareTo).get();
                dappAKlineEntityDay.setOpenPrice(openPrice);
                //获取最高价
                List<BigDecimal> highestPriceList = dappAKlineEntitieDays.stream().map(DappAKlineEntity::getHighestPrice).collect(Collectors.toList());
                BigDecimal highestPrice = highestPriceList.stream().max(BigDecimal::compareTo).get();
                dappAKlineEntityDay.setHighestPrice(highestPrice);
                List<BigDecimal> lowestPriceList = dappAKlineEntitieDays.stream().map(DappAKlineEntity::getLowestPrice).collect(Collectors.toList());
                BigDecimal lowestPrice = lowestPriceList.stream().min(BigDecimal::compareTo).get();
                dappAKlineEntityDay.setLowestPrice(lowestPrice);
            }else{
                dappAKlineEntityDay.setOpenPrice(coinAPrice);
                dappAKlineEntityDay.setHighestPrice(coinAPrice);
                dappAKlineEntityDay.setLowestPrice(coinAPrice);
            }
            dappAKlineEntityDay.setClosePrice(coinAPrice);
            dappAKlineMapper.insert(dappAKlineEntityDay);
            chainProducer.sendAntKLineMsg(3);
        }
        //月
        int month = DateUtil.dayOfMonth(DateUtil.date());
        if(1 == month){
            /**
             * 当前时间往前推10天,得到前一月的所有时间的yyyy-MM-dd格式的所有type为周的记录
             */
            DappAKlineEntity dappAKlineEntityWeek = new DappAKlineEntity();
            dappAKlineEntityWeek.setType(4);
            List<String> dataMonthStrList = new ArrayList<>();
            String one = DateUtil.format(DateUtil.offsetDay(DateUtil.date(), -10), "yyyy-MM-dd");
            dataMonthStrList.add(one);
            List<DappAKlineEntity> dappAKlineEntitieWeeks = dappAKlineMapper.selectListByTypeAndTime(3,dataMonthStrList);
            if(CollUtil.isNotEmpty(dappAKlineEntitieWeeks)){
                List<BigDecimal> openPriceList = dappAKlineEntitieWeeks.stream().map(DappAKlineEntity::getOpenPrice).collect(Collectors.toList());
                BigDecimal openPrice = openPriceList.stream().min(BigDecimal::compareTo).get();
                dappAKlineEntityWeek.setOpenPrice(openPrice);
                //获取最高价
                List<BigDecimal> highestPriceList = dappAKlineEntitieWeeks.stream().map(DappAKlineEntity::getHighestPrice).collect(Collectors.toList());
                BigDecimal highestPrice = highestPriceList.stream().max(BigDecimal::compareTo).get();
                dappAKlineEntityWeek.setHighestPrice(highestPrice);
                List<BigDecimal> lowestPriceList = dappAKlineEntitieWeeks.stream().map(DappAKlineEntity::getLowestPrice).collect(Collectors.toList());
                BigDecimal lowestPrice = lowestPriceList.stream().min(BigDecimal::compareTo).get();
                dappAKlineEntityWeek.setLowestPrice(lowestPrice);
            }else{
                dappAKlineEntityWeek.setOpenPrice(coinAPrice);
                dappAKlineEntityWeek.setHighestPrice(coinAPrice);
                dappAKlineEntityWeek.setLowestPrice(coinAPrice);
            }
            dappAKlineEntityWeek.setClosePrice(coinAPrice);
            dappAKlineMapper.insert(dappAKlineEntityWeek);
            chainProducer.sendAntKLineMsg(4);
        }
    }
    @Override
    public void antKLineMsg(int type) {
        /**
         * 根据类型去更新redis的K线数据
         */
        String redisKey = null;
        if(1 == type){
            redisKey = AppContants.K_LINE_HOUR;
        }else if(2 == type){
            redisKey = AppContants.K_LINE_DAY;
        }else if(3 == type){
            redisKey = AppContants.K_LINE_WEEK;
        }else if(4 == type){
            redisKey = AppContants.K_LINE_MONTH;
        }else if(0 == type){
            createKDate();
            return;
        }else{
            return;
        }
        List<cn.hutool.json.JSONObject> objects = new ArrayList<>();
        List<AKLineLimitVo> akLineLimitVos = dappAKlineMapper.selectListByTypeAndLimit(type, AppContants.K_LINE_LIMIT);
        if(CollUtil.isNotEmpty(akLineLimitVos)){
            Collections.reverse(akLineLimitVos);
            for(AKLineLimitVo akLineLimitVo : akLineLimitVos){
                cn.hutool.json.JSONObject parseObj = JSONUtil.parseObj(akLineLimitVo);
                objects.add(parseObj);
            }
            redisUtils.del(redisKey);
            redisUtils.set(redisKey, objects.toString());
        }
    }
    /**
     * 生成当前分钟的k线数据,type为0
     */
    public void createKDate(){
        DappAKlineEntity dappAKlineEntity = new DappAKlineEntity();
        dappAKlineEntity.setType(0);
        DataDictionaryCustom dataDictionaryCustom = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(dataDictionaryCustom.getValue());
        /**
         * 获取最新一条小时或者分钟的数据
         */
        DappAKlineEntity oldOne = dappAKlineMapper.selectOneByType();
        if(ObjectUtil.isNotEmpty(oldOne)){
            dappAKlineEntity.setOpenPrice(oldOne.getClosePrice());
        }
        dappAKlineEntity.setOpenPrice(coinAPrice);
        dappAKlineEntity.setLowestPrice(coinAPrice);
        dappAKlineEntity.setHighestPrice(coinAPrice);
        dappAKlineEntity.setClosePrice(coinAPrice);
        dappAKlineMapper.insert(dappAKlineEntity);
    }
    public static void main(String[] args) {
        int month = DateUtil.dayOfMonth(DateUtil.date());
        String s = DateUtil.dayOfWeekEnum(DateUtil.date()).toChinese();
        System.out.println(s);
        System.out.println(month);
    }
    /**
     * 判断直推人数是否达标
     *
     * @param member
     * @return
     */
    private boolean directMemberCnt(DappMemberEntity member, NodePerk agentInfo) {
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        if (CollUtil.isEmpty(childs)) {
            return false;
        }
        if (childs.size() >= agentInfo.getDirectCnt()) {
            return true;
        }
        log.info("用户:{}直推数量未达标, 当前等级:{}, 当前数量:{}, 目标数量:{}", member.getAddress(), member.getAccountType(), childs.size(), agentInfo.getDirectCnt());
        return false;
    }
    /**
     * 判断下级代理数量是否达标
     *
     * @return
     */
    private boolean agentCntFinish(DappMemberEntity member, NodePerk agentInfo) {
        if (agentInfo.getDirectCnt() == null || agentInfo.getDirectCnt() == 0) {
            return true;
        }
        // 直推用户
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        if (CollUtil.isEmpty(childs)) {
            return false;
        }
        // 用户团队达到指定代理数量,且都不在同一条线
        int i = 0;
        for (DappMemberEntity child : childs) {
            List<DappMemberEntity> mallMembers = dappMemberDao.selectChildAgentListByAccountType(child.getInviteId(), member.getAccountType());
            if (CollUtil.isNotEmpty(mallMembers)) {
                i++;
            }
        }
        if (i >= agentInfo.getDirectCnt()) {
            return true;
        }
        log.info("用户:{}代理数量未达标, 当前等级:{}, 当前数量:{}, 目标数量:{}", member.getAddress(), member.getAccountType(), i, agentInfo.getDirectCnt());
        return false;
    }
    /**
     * 团队业绩是否达标
     *  除去直属的最大的一个业绩团队,剩余的所有业绩之和
     *
     * @param
     * @param agentInfo
     * @return
     */
    private boolean teamIncome(DappMemberEntity member, NodePerk agentInfo) {
        BigDecimal teamIncome = agentInfo.getTeamIncome();
        //业绩集合
        List<BigDecimal> list = new ArrayList<>();
        //总业绩
        BigDecimal teamIncomeMax = BigDecimal.ZERO;
        //所有直推团队,就是这个会员的所有区域的业绩。
        // 直推用户
        List<DappMemberEntity> childs = dappMemberDao.selectMemberInfoByRefererId(member.getInviteId());
        List<String> childsInviteIds = childs.stream().map(DappMemberEntity::getInviteId).collect(Collectors.toList());
        for(String inviteId : childsInviteIds){
            BigDecimal totalIncomeMember = dappMemberDao.selectAllAchieveByInviteId(inviteId);
            teamIncomeMax = teamIncomeMax.add(totalIncomeMember);
            list.add(totalIncomeMember);
        }
        //去掉一个最大区的业绩
        BigDecimal bigMax = list.stream().max(BigDecimal::compareTo).get();
        teamIncomeMax = teamIncomeMax.subtract(bigMax);
        if (teamIncomeMax.compareTo(teamIncome) >= 0) {
            return true;
        }
        log.info("用户:{}团队业绩未达标, 当前等级:{}, 当前业绩:{}, 目标业绩:{}", member.getAddress(), member.getAccountType(), teamIncomeMax, teamIncome);
        return false;
    }
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -13,11 +13,14 @@
import cc.mrbird.febs.dapp.dto.*;
import cc.mrbird.febs.dapp.entity.*;
import cc.mrbird.febs.dapp.enumerate.DataDictionaryEnum;
import cc.mrbird.febs.dapp.enumerate.FundFlowEnum;
import cc.mrbird.febs.dapp.enumerate.NodeCodeEnum;
import cc.mrbird.febs.dapp.enumerate.PoolEnum;
import cc.mrbird.febs.dapp.mapper.*;
import cc.mrbird.febs.dapp.service.DappWalletService;
import cc.mrbird.febs.dapp.utils.BoxUtil;
import cc.mrbird.febs.dapp.vo.ActiveNftListVo;
import cc.mrbird.febs.dapp.vo.DappFundFlowVo;
import cc.mrbird.febs.dapp.vo.DappMemberNodeVo;
import cc.mrbird.febs.dapp.vo.WalletInfoVo;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
@@ -67,6 +70,8 @@
    private final DappNodeOrderMapper dappNodeOrderMapper;
    private final DappMemberNodeMapper dappMemberNodeMapper;
    private final DappChargeUsdtMapper dappChargeUsdtMapper;
    private final DappUsdtPerkEntityMapper dappUsdtPerkEntityMapper;
    @Override
    public WalletInfoVo walletInfo() {
@@ -163,12 +168,12 @@
            throw new FebsException("功能升级中");
        }
        if (transferDto.getType() != 2) {
            member = dappMemberDao.selectById(member.getId());
            if (member.getActiveStatus() == 1) {
                throw new FebsException("Do not repeat purchase");
            }
        }
//        if (transferDto.getType() != 2) {
//            member = dappMemberDao.selectById(member.getId());
//            if (member.getActiveStatus() == 1) {
//                throw new FebsException("Do not repeat purchase");
//            }
//        }
        /**
         * buyType=1,余额购买
         */
@@ -188,7 +193,7 @@
            /**
             * buyType=2,钱包购买
             */
            int type = 1;
            int type = FundFlowEnum.BUY_NODE.getCode();
            // 1-认购 2-充值tfc
            if (transferDto.getType() == 2) {
                type = 6;
@@ -296,7 +301,7 @@
                DappFundFlowEntity fundFlow = new DappFundFlowEntity(
                        refererMember.getId(),
                        directProfit,
                        3,
                        2,
                        1,
                        BigDecimal.ZERO,
                        null,
@@ -315,7 +320,7 @@
                DappFundFlowEntity fundFlowEntityProject = new DappFundFlowEntity(
                        4L,
                        subtract,
                        4,
                        3,
                        1,
                        BigDecimal.ZERO,
                        null,
@@ -352,48 +357,108 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void withdraw(WithdrawDto withdrawDto) {
        /**
         * USDT提现1%手续费.(扣USDT)
         * 提币需要*当前a币价格,转换成USDT
         * A币卖币规则,卖出100%销毁,30%回流底池溢价
         */
        DappMemberEntity member = LoginUserUtil.getAppUser();
        //提币数量
        BigDecimal amount = withdrawDto.getAmount();
        if(BigDecimal.ZERO.compareTo(amount) >= 0){
            throw new FebsException("输入正确的数量");
        }
        DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
        if (walletCoin.getAvailableAmount().compareTo(withdrawDto.getAmount()) < 0) {
            throw new FebsException("Balance Not Enough");
            throw new FebsException("可提现的数量不足");
        }
        DataDictionaryCustom aCoinPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_PRICE.getType(),
                PoolEnum.COIN_A_PRICE.getCode()
        );
        BigDecimal coinAPrice = new BigDecimal(aCoinPriceDic.getValue());
        //预计提现的USDT数量 = 币的数量 * 当前A币的价格
        BigDecimal coinUsdtAmount = amount.multiply(coinAPrice);
        /**
         * 卖币可享有贡献值,鼓励卖币,例.卖出价值100U获得100贡献值
         */
        DappUsdtPerkEntity directDappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(member.getId());
        if(ObjectUtil.isEmpty(directDappUsdtPerkEntity)){
            directDappUsdtPerkEntity = new DappUsdtPerkEntity();
            directDappUsdtPerkEntity.setNftDevote(coinUsdtAmount);
            directDappUsdtPerkEntity.setMemberId(member.getId());
            dappUsdtPerkEntityMapper.insert(directDappUsdtPerkEntity);
        }
        DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(member.getId());
        if (walletMine.getAvailableAmount().compareTo(withdrawDto.getFee()) < 0) {
            throw new FebsException("DMD Not Enough");
        }
        BigDecimal directNftDevote = directDappUsdtPerkEntity.getNftDevote();
        directNftDevote = directNftDevote.add(coinUsdtAmount);
        directDappUsdtPerkEntity.setNftDevote(directNftDevote);
        dappUsdtPerkEntityMapper.updateById(directDappUsdtPerkEntity);
        updateWalletCoinWithLock(withdrawDto.getAmount(), member.getId(), 2);
        updateWalletMineWithLock(withdrawDto.getFee(), member.getId(), 2);
        DataDictionaryCustom toUsdtPercentFeeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getType(),
                PoolEnum.WALLET_COIN_TO_USDT_PERCENT.getCode()
        );
        BigDecimal feePercent = new BigDecimal(toUsdtPercentFeeDic.getValue());
        //手续费扣除USDT
        BigDecimal feeUsdtAmount = coinUsdtAmount.multiply(feePercent).setScale(4,BigDecimal.ROUND_DOWN);
        //实际提现USDT数量
        BigDecimal realUsdtAmount = coinUsdtAmount.subtract(feeUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN);
        DappFundFlowEntity feeFlow = new DappFundFlowEntity(member.getId(), withdrawDto.getFee().negate(), 7, 2, null, null);
        dappFundFlowDao.insert(feeFlow);
        DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), withdrawDto.getAmount().negate(), 5, 2, withdrawDto.getFee(), null);
        dappFundFlowDao.insert(fundFlow);
        //减少闪对钱包的币的数量
        this.updateWalletCoinWithLock(amount, member.getId(), 2);
        //增加流水
        DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity(member.getId(), amount.negate(), FundFlowEnum.WALLET_COIN_TO_USDT.getCode(), 2, BigDecimal.ZERO);
        dappFundFlowDao.insert(dappFundFlowEntity);
        //增加流水
        DappFundFlowEntity realUsdtAmountFlow = new DappFundFlowEntity(member.getId(), realUsdtAmount.negate(), FundFlowEnum.WALLET_COIN_TO_USDT_W.getCode(), 1, feeUsdtAmount);
        dappFundFlowDao.insert(realUsdtAmountFlow);
        //增加提现的记录
        MemberCoinWithdrawEntity memberCoinWithdraw = new MemberCoinWithdrawEntity();
        memberCoinWithdraw.setMemberId(member.getId());
        memberCoinWithdraw.setAddress(member.getAddress());
        memberCoinWithdraw.setAmount(withdrawDto.getAmount());
        memberCoinWithdraw.setFeeAmount(withdrawDto.getFee());
        memberCoinWithdraw.setAmount(realUsdtAmount);
        memberCoinWithdraw.setFeeAmount(feeUsdtAmount);
        memberCoinWithdraw.setStatus(MemberCoinWithdrawEntity.STATUS_YES);
        memberCoinWithdraw.setSymbol("USDT");
        memberCoinWithdraw.setFlowId(fundFlow.getId());
        memberCoinWithdraw.setFlowId(realUsdtAmountFlow.getId());
        memberCoinWithdrawDao.insert(memberCoinWithdraw);
        //发送提现消息
        chainProducer.sendAntACoinOutMsg(realUsdtAmountFlow.getId());
        String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(member.getAddress(), withdrawDto.getAmount());
        fundFlow.setToHash(hash);
        dappFundFlowDao.updateById(fundFlow);
        /**
         * A币卖币规则,卖出100%销毁,30%回流底池溢价
         */
        DataDictionaryCustom outPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.WALLET_COIN_OUT_PERCENT.getType(),
                PoolEnum.WALLET_COIN_OUT_PERCENT.getCode()
        );
        BigDecimal outPercent = new BigDecimal(outPercentDic.getValue());
        coinUsdtAmount = coinUsdtAmount.multiply(outPercent).setScale(4,BigDecimal.ROUND_DOWN);
        //金本位底池数量
        DataDictionaryCustom coinAUsdtPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_USDT_PRICE.getType(),
                PoolEnum.COIN_A_USDT_PRICE.getCode()
        );
        BigDecimal coinAUsdtCnt = new BigDecimal(coinAUsdtPriceDic.getValue());
        coinAUsdtCnt = coinAUsdtCnt.add(coinUsdtAmount).setScale(4,BigDecimal.ROUND_DOWN);
        coinAUsdtPriceDic.setValue(coinAUsdtCnt.toString());
        dataDictionaryCustomMapper.updateById(coinAUsdtPriceDic);
        //币本位底池数量
        DataDictionaryCustom coinACntDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.COIN_A_CNT.getType(),
                PoolEnum.COIN_A_CNT.getCode()
        );
        BigDecimal coinACnt = new BigDecimal(coinACntDic.getValue());
        coinACnt = coinACnt.subtract(amount).setScale(4,BigDecimal.ROUND_DOWN);
        coinACntDic.setValue(coinACnt.toString());
        dataDictionaryCustomMapper.updateById(coinACntDic);
        chainProducer.sendFeeDistributeMsg(fundFlow.getId());
//        Map<String, Object> map = new HashMap<>();
//        map.put("fee", withdrawDto.getFee());
//        map.put("address", ChainEnum.BSC_TFC_FEE.getAddress());
//        map.put("flow", feeFlow.getId());
//        chainProducer.sendTfcFee(JSONObject.toJSONString(map));
        coinAPrice = coinAUsdtCnt.divide(coinACnt,8,BigDecimal.ROUND_DOWN);
        aCoinPriceDic.setValue(coinAPrice.toString());
        dataDictionaryCustomMapper.updateById(aCoinPriceDic);
        chainProducer.sendAntKLineMsg(0);
    }
    @Override
@@ -401,7 +466,9 @@
        boolean isSuccess = false;
        while(!isSuccess) {
            DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(memberId);
            if(ObjectUtil.isEmpty(walletCoin)){
                return;
            }
            // 加
            if (type == 1) {
                walletCoin.setTotalAmount(walletCoin.getTotalAmount().add(amount));
@@ -427,13 +494,15 @@
        boolean isSuccess = false;
        while(!isSuccess) {
            DappWalletMineEntity walletMine = dappWalletMineDao.selectByMemberId(memberId);
            if(ObjectUtil.isEmpty(walletMine)){
                return;
            }
            if (type == 1) {
                walletMine.setTotalAmount(walletMine.getTotalAmount().add(amount));
                walletMine.setAvailableAmount(walletMine.getAvailableAmount().add(amount));
            } else {
                if (amount.compareTo(walletMine.getAvailableAmount()) > 0) {
                    throw new FebsException("DMD Not Enough");
                    throw new FebsException("Not Enough");
                }
                walletMine.setTotalAmount(walletMine.getTotalAmount().subtract(amount));
                walletMine.setAvailableAmount(walletMine.getAvailableAmount().subtract(amount));
@@ -547,4 +616,366 @@
        }
    }
    @Override
    public Long transferA(TransferADto transferADto) {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId());
        String upgrade = redisUtils.getString("APP_UPGRADE");
        if ("upgrade".equals(upgrade)) {
            throw new FebsException("功能升级中");
        }
//        if (transferADto.getType() != 2) {
//            member = dappMemberDao.selectById(member.getId());
//            if (member.getActiveStatus() == 1) {
//                throw new FebsException("Do not repeat purchase");
//            }
//        }
        /**
         * buyType=1,余额购买
         */
        if (transferADto.getBuyType() == 1) {
            DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
            if (transferADto.getAmount().compareTo(walletCoin.getAvailableAmount()) > 0) {
                throw new FebsException("Balance Not Enough");
            }
            updateWalletCoinWithLock(transferADto.getAmount(), member.getId(), 2);
            DappFundFlowEntity fundFlow = new DappFundFlowEntity(
                    member.getId(),
                    transferADto.getAmount().negate(),
                    FundFlowEnum.BUY_A_COIN.getCode(),
                    2,
                    transferADto.getFee(),
                    transferADto.getTxHash());
            dappFundFlowDao.insert(fundFlow);
        } else {
            /**
             * buyType=2,钱包购买
             * 4:入金,买入A币
             */
            int type = FundFlowEnum.BUY_A_COIN.getCode();
            // 1-认购 2-充值tfc
            if (transferADto.getType() == 2) {
                type = 6;
            }
            /**
             * 第一次请求,生成一条资金流水ID,并且返回。
             */
            if (transferADto.getId() == null) {
                /**
                 * 查询会员是否已经有正在进行中的入金记录
                 */
                DappFundFlowEntity fundFlowOld = dappFundFlowDao.selectBymemberIdAndType(member.getId(),type,DappFundFlowEntity.WITHDRAW_STATUS_ING);
                if(ObjectUtil.isNotEmpty(fundFlowOld)){
                    //网络问题导致第二次提交前,未成功就关闭了页面
                    if (fundFlowOld.getStatus() == 1 && StrUtil.isEmpty(fundFlowOld.getFromHash())) {
                        dappFundFlowDao.deleteById(fundFlowOld.getId());
                        throw new FebsException("Refresh and try again");
                    }
                }
                /**
                 * 验证账户是否有入金金额的10%的AUSD
                 */
                DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(member.getId());
                if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
                    dappUsdtPerkEntity = new DappUsdtPerkEntity();
                    dappUsdtPerkEntity.setMemberId(member.getId());
                    dappUsdtPerkEntityMapper.insert(dappUsdtPerkEntity);
                }
                BigDecimal ausdAmount = dappUsdtPerkEntity.getAusdAmount();
                DataDictionaryCustom ausdPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                        PoolEnum.TRANSFER_A_AUSD_PERCENT.getType(),
                        PoolEnum.TRANSFER_A_AUSD_PERCENT.getCode()
                );
                BigDecimal ausdPercent = new BigDecimal(ausdPercentDic.getValue());
                BigDecimal ausdPercentUsdt = transferADto.getAmount().multiply(ausdPercent);
                DataDictionaryCustom ausdPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                        PoolEnum.TRANSFER_A_AUSD_PRICE.getType(),
                        PoolEnum.TRANSFER_A_AUSD_PRICE.getCode()
                );
                BigDecimal ausdPrice = new BigDecimal(ausdPriceDic.getValue());
                BigDecimal ausdAmountNeed = ausdPercentUsdt.divide(ausdPrice);
                if(BigDecimal.ZERO.compareTo(ausdAmount) >= 0){
                    throw new FebsException("AUSD数量不足");
                }
                if(ausdAmountNeed.compareTo(ausdAmount) > 0){
                    throw new FebsException("AUSD数量不足");
                }
                /**
                 * 出局复投要求等于戓大于自己上次投资金额
                 */
                BigDecimal maxAmount = dappChargeUsdtMapper.selectByMaxAmountMemberId(member.getId());
                if(maxAmount.compareTo(transferADto.getAmount()) > 0){
                    throw new FebsException("投资金额不能小于"+maxAmount.setScale(4,BigDecimal.ROUND_DOWN));
                }
                //生成一条进行中的入金资金流水记录
                DappFundFlowEntity fundFlow = new DappFundFlowEntity(
                        member.getId(),
                        transferADto.getAmount(),
                        type,
                        1,
                        ausdAmountNeed,
                        transferADto.getTxHash());
                dappFundFlowDao.insert(fundFlow);
                return fundFlow.getId();
            }
            if ("success".equals(transferADto.getFlag())) {
                DappFundFlowEntity flow = dappFundFlowDao.selectById(transferADto.getId());
                if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
                    throw new FebsException("请勿重复提交");
                }
                /**
                 * 生成会员入金买A币的记录
                 */
                DappChargeUsdtEntity dappChargeUsdtEntity = new DappChargeUsdtEntity(
                        member.getId(),
                        dappMemberEntity.getAddress(),
                        transferADto.getTxHash(),
                        2,
                        transferADto.getAmount(),
                        BigDecimal.ZERO,
                        BigDecimal.ZERO);
                dappChargeUsdtMapper.insert(dappChargeUsdtEntity);
                /**
                 * 减少用户的AUSD数量
                 */
                DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(member.getId());
                BigDecimal ausdAmount = dappUsdtPerkEntity.getAusdAmount();
                ausdAmount = ausdAmount.subtract(flow.getFee()).setScale(4,BigDecimal.ROUND_DOWN);
                dappUsdtPerkEntity.setAusdAmount(ausdAmount);
                dappUsdtPerkEntityMapper.updateById(dappUsdtPerkEntity);
                /**
                 * 流水关联用户购买记录
                 */
                flow.setSystemProfitId(dappChargeUsdtEntity.getId());
                /**
                 * 链上转账的hash值
                 */
                flow.setFromHash(transferADto.getTxHash());
                flow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
                dappFundFlowDao.updateById(flow);
                dappMemberDao.updateMemberActiveStatus(1,member.getId());
                /**
                 * 发送消息处理返利逻辑
                 */
                chainProducer.sendAntACoinInMsg(flow.getId());
                /**
                 * 发送消息处理代理升级
                 */
                chainProducer.sendAntMemberLevelMsg(member.getId());
            } else {
                DappFundFlowEntity flow = dappFundFlowDao.selectById(transferADto.getId());
                if (flow.getStatus() == 1) {
                    dappFundFlowDao.deleteById(transferADto.getId());
                }
            }
        }
        return null;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void mineToCoin(MineToCoinDto mineToCoinDto) {
        /**
         * 资产钱包转帐到闪兑钱包3% 手续费(扣币)
         * 4、增加闪对钱包
         * 5、增加流水
         */
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId());
        BigDecimal aCoinCnt = mineToCoinDto.getACoinCnt();
        if(BigDecimal.ZERO.compareTo(aCoinCnt) >= 0){
            throw new FebsException("输入正确的数量");
        }
        DappWalletMineEntity dappWalletMineEntity = dappWalletMineDao.selectByMemberId(dappMemberEntity.getId());
        BigDecimal availableAmount = dappWalletMineEntity.getAvailableAmount();
        if(availableAmount.compareTo(aCoinCnt) < 0){
            throw new FebsException("数量不足");
        }
        //减少资产钱包
        this.updateWalletMineWithLock(aCoinCnt,dappMemberEntity.getId(),2);
        //插入资产闪对的流水
        DappFundFlowEntity aCoinCntFlow = new DappFundFlowEntity(
                dappMemberEntity.getId(),
                aCoinCnt.negate(),
                FundFlowEnum.WALLET_MINE_TO_COIN.getCode(),
                2,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(aCoinCntFlow);
        //闪对钱包3% 手续费(扣币)
        DataDictionaryCustom dic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getType(),
                PoolEnum.WALLET_MINE_TO_COIN_PERCENT.getCode());
        BigDecimal feePercent = new BigDecimal(StrUtil.isEmpty(dic.getValue()) ? "0.03" : dic.getValue());
        //手续费
        BigDecimal feeCnt = aCoinCnt.multiply(feePercent).setScale(4,BigDecimal.ROUND_DOWN);
        //闪对钱包获取的
        BigDecimal aCoinCntReal = aCoinCnt.subtract(feeCnt).setScale(4, BigDecimal.ROUND_DOWN);
        //增加闪对钱包
        this.updateWalletCoinWithLock(aCoinCntReal,dappMemberEntity.getId(),1);
        //插入资产闪对的流水
        DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity(
                dappMemberEntity.getId(),
                aCoinCntReal,
                FundFlowEnum.WALLET_MINE_TO_COIN.getCode(),
                2,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(dappFundFlowEntity);
        //插入资产闪对手续费的流水
        DappFundFlowEntity memberFeeflow = new DappFundFlowEntity(
                dappMemberEntity.getId(),
                feeCnt.negate(),
                FundFlowEnum.WALLET_MINE_TO_COIN_FEE.getCode(),
                2,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(memberFeeflow);
        //插入资产闪对手续费的流水
        DappFundFlowEntity dappFundFlowEntityFee = new DappFundFlowEntity(
                1L,
                feeCnt,
                FundFlowEnum.WALLET_MINE_TO_COIN_FEE.getCode(),
                2,
                BigDecimal.ZERO);
        dappFundFlowDao.insert(dappFundFlowEntityFee);
        this.updateWalletMineWithLock(feeCnt,1L,1);
    }
    @Override
    public Long transferAusd(TransferAusdDto transferAusdDto) {
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappMemberEntity dappMemberEntity = dappMemberDao.selectById(member.getId());
        String upgrade = redisUtils.getString("APP_UPGRADE");
        if ("upgrade".equals(upgrade)) {
            throw new FebsException("功能升级中");
        }
//        if (transferAusdDto.getType() != 2) {
//            member = dappMemberDao.selectById(member.getId());
//            if (member.getActiveStatus() == 1) {
//                throw new FebsException("Do not repeat purchase");
//            }
//        }
        /**
         * buyType=1,余额购买
         */
        if (transferAusdDto.getBuyType() == 1) {
            DappWalletCoinEntity walletCoin = dappWalletCoinDao.selectByMemberId(member.getId());
            if (transferAusdDto.getAmount().compareTo(walletCoin.getAvailableAmount()) > 0) {
                throw new FebsException("Balance Not Enough");
            }
            updateWalletCoinWithLock(transferAusdDto.getAmount(), member.getId(), 2);
            DappFundFlowEntity fundFlow = new DappFundFlowEntity(
                    member.getId(),
                    transferAusdDto.getAmount().negate(),
                    FundFlowEnum.BUY_AUSD_COIN.getCode(),
                    2,
                    transferAusdDto.getFee(),
                    transferAusdDto.getTxHash());
            dappFundFlowDao.insert(fundFlow);
        } else {
            /**
             * buyType=2,钱包购买
             * 4:入金,买入A币
             */
            int type = FundFlowEnum.BUY_AUSD_COIN.getCode();
            // 1-认购 2-充值tfc
            if (transferAusdDto.getType() == 2) {
                type = 6;
            }
            /**
             * 第一次请求,生成一条资金流水ID,并且返回。
             */
            if (transferAusdDto.getId() == null) {
                /**
                 * 查询会员是否已经有正在进行中的入金记录
                 */
                DappFundFlowEntity fundFlowOld = dappFundFlowDao.selectBymemberIdAndType(member.getId(),type,DappFundFlowEntity.WITHDRAW_STATUS_ING);
                if(ObjectUtil.isNotEmpty(fundFlowOld)){
                    //网络问题导致第二次提交前,未成功就关闭了页面
                    if (fundFlowOld.getStatus() == 1 && StrUtil.isEmpty(fundFlowOld.getFromHash())) {
                        dappFundFlowDao.deleteById(fundFlowOld.getId());
                        throw new FebsException("Refresh and try again");
                    }
                }
                //生成一条进行中的入金资金流水记录
                DappFundFlowEntity fundFlow = new DappFundFlowEntity(
                        member.getId(),
                        transferAusdDto.getAmount(),
                        type,
                        1,
                        transferAusdDto.getFee(),
                        transferAusdDto.getTxHash());
                dappFundFlowDao.insert(fundFlow);
                return fundFlow.getId();
            }
            if ("success".equals(transferAusdDto.getFlag())) {
                DappFundFlowEntity flow = dappFundFlowDao.selectById(transferAusdDto.getId());
                if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
                    throw new FebsException("请勿重复提交");
                }
                /**
                 * 增加用户的AUSD数量
                 */
                BigDecimal amount = transferAusdDto.getAmount();
                DataDictionaryCustom ausdPriceDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
                        PoolEnum.TRANSFER_A_AUSD_PRICE.getType(),
                        PoolEnum.TRANSFER_A_AUSD_PRICE.getCode()
                );
                BigDecimal ausdPrice = new BigDecimal(ausdPriceDic.getValue());
                BigDecimal ausdCnt = amount.divide(ausdPrice, 4, BigDecimal.ROUND_DOWN);
                DappUsdtPerkEntity dappUsdtPerkEntity = dappUsdtPerkEntityMapper.selectByMemberId(member.getId());
                if(ObjectUtil.isEmpty(dappUsdtPerkEntity)){
                    dappUsdtPerkEntity = new DappUsdtPerkEntity();
                    dappUsdtPerkEntity.setMemberId(member.getId());
                    dappUsdtPerkEntity.setAmount(BigDecimal.ZERO);
                    dappUsdtPerkEntity.setAusdAmount(BigDecimal.ZERO);
                    dappUsdtPerkEntityMapper.insert(dappUsdtPerkEntity);
                }
                BigDecimal ausdAmount = dappUsdtPerkEntity.getAusdAmount();
                ausdAmount = ausdAmount.add(ausdCnt).setScale(4,BigDecimal.ROUND_DOWN);
                dappUsdtPerkEntity.setAusdAmount(ausdAmount);
                dappUsdtPerkEntityMapper.updateById(dappUsdtPerkEntity);
                /**
                 * 链上转账的hash值
                 */
                flow.setFromHash(transferAusdDto.getTxHash());
                flow.setStatus(DappFundFlowEntity.WITHDRAW_STATUS_AGREE);
                dappFundFlowDao.updateById(flow);
            } else {
                DappFundFlowEntity flow = dappFundFlowDao.selectById(transferAusdDto.getId());
                if (flow.getStatus() == 1) {
                    dappFundFlowDao.deleteById(transferAusdDto.getId());
                }
            }
        }
        return null;
    }
    @Override
    public List<DappFundFlowVo> getRecordVoInPage(RecordInPageDto recordInPageDto) {
        Page<DappFundFlowVo> page = new Page<>(recordInPageDto.getPageNum(), recordInPageDto.getPageSize());
        DappMemberEntity member = LoginUserUtil.getAppUser();
        DappFundFlowEntity dappFundFlowEntity = new DappFundFlowEntity();
        if (recordInPageDto.getType() != null && recordInPageDto.getType() != 0) {
            dappFundFlowEntity.setType(recordInPageDto.getType());
        }
        dappFundFlowEntity.setMemberId(member.getId());
        IPage<DappFundFlowVo> records = dappFundFlowDao.selectVoInPage(page, dappFundFlowEntity);
        return records.getRecords();
    }
}
src/main/java/cc/mrbird/febs/dapp/vo/AKLineLimitVo.java
New file
@@ -0,0 +1,26 @@
package cc.mrbird.febs.dapp.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "AKLineLimitVo", description = "K线数据")
public class AKLineLimitVo {
    private BigDecimal openPrice;
    private BigDecimal closePrice;
    private BigDecimal lowestPrice;
    private BigDecimal highestPrice;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
src/main/java/cc/mrbird/febs/dapp/vo/AKLineVo.java
New file
@@ -0,0 +1,35 @@
package cc.mrbird.febs.dapp.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "AKLineVo", description = "K线数据")
public class AKLineVo {
    @ApiModelProperty(value = "openPrice")
    private BigDecimal openPrice;
    @ApiModelProperty(value = "closePrice")
    private BigDecimal closePrice;
    @ApiModelProperty(value = "lowestPrice")
    private BigDecimal lowestPrice;
    @ApiModelProperty(value = "highestPrice")
    private BigDecimal highestPrice;
    @ApiModelProperty(value = "时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;
}
src/main/java/cc/mrbird/febs/dapp/vo/DappFundFlowVo.java
New file
@@ -0,0 +1,22 @@
package cc.mrbird.febs.dapp.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@ApiModel(value = "DappFundFlowVo", description = "流水信息")
public class DappFundFlowVo {
    @ApiModelProperty(value = "金额")
    private BigDecimal amount;
    @ApiModelProperty(value = "类型")
    private Integer type;
    @ApiModelProperty(value = "时间")
    private String createTime;
}
src/main/java/cc/mrbird/febs/dapp/vo/DappMemberInfoVo.java
@@ -4,6 +4,8 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "DappMemberInfoVo", description = "会员信息")
public class DappMemberInfoVo {
@@ -13,4 +15,32 @@
    @ApiModelProperty(value = "代理身份")
    private String accountType;
    @ApiModelProperty(value = "资产余额")
    private BigDecimal propertyAmount;
    @ApiModelProperty(value = "闪兑余额")
    private BigDecimal exchangeAmount;
    @ApiModelProperty(value = "ASUD余额")
    private BigDecimal ausdAmount;
    @ApiModelProperty(value = "补贴额度")
    private BigDecimal amount;
    @ApiModelProperty(value = "AUSD的价格")
    private BigDecimal ausdPrice;
    @ApiModelProperty(value = "A币的价格")
    private BigDecimal coinAPrice;
    @ApiModelProperty(value = "资产到闪兑的手续费比例")
    private BigDecimal mineToCoinFee;
    @ApiModelProperty(value = "提现手续费比例")
    private BigDecimal coinOutFee;
    @ApiModelProperty(value = "我的贡献值")
    private BigDecimal nftDevote;
}
src/main/java/cc/mrbird/febs/dapp/vo/MyInviteChildInfoVo.java
New file
@@ -0,0 +1,23 @@
package cc.mrbird.febs.dapp.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
@ApiModel(value = "MyInviteChildInfoVo", description = "我的推荐-只显示直推数据")
public class MyInviteChildInfoVo {
    @ApiModelProperty(value = "我的地址")
    private String address;
    @ApiModelProperty(value = "账户类型")
    private String accountType;
    @ApiModelProperty(value = "个人算力")
    private BigDecimal memberAchieve;
    @ApiModelProperty(value = "大区算力")
    private BigDecimal maxAchieve;
    @ApiModelProperty(value = "小区算力")
    private BigDecimal minAchieve;
}
src/main/java/cc/mrbird/febs/dapp/vo/MyInviteInfoVo.java
New file
@@ -0,0 +1,26 @@
package cc.mrbird.febs.dapp.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel(value = "MyInviteInfoVo", description = "我的推广码")
public class MyInviteInfoVo {
    @ApiModelProperty(value = "我的地址")
    private String memberAddress;
    @ApiModelProperty(value = "我的推荐人个人算力")
    private BigDecimal memberAchieve;
    @ApiModelProperty(value = "我的推荐人地址")
    private String referenceAddress;
    @ApiModelProperty(value = "我的算力大区算力")
    private BigDecimal maxAchieve;
    @ApiModelProperty(value = "我的算力小区算力")
    private BigDecimal minAchieve;
    @ApiModelProperty(value = "我的推荐-只显示直推数据")
    private List<MyInviteChildInfoVo> myInviteChildInfoVos;
}
src/main/java/cc/mrbird/febs/dapp/vo/TeamListVo.java
@@ -17,19 +17,10 @@
@ApiModel(value = "TeamLIstVo", description = "团队列表接口返回参数类")
public class TeamListVo {
    @ApiModelProperty(value = "地址")
    private String address;
    @ApiModelProperty(value = "等级")
    private String accountType;
    @ApiModelProperty(value = "是否加入动能")
    private Integer activeStatus;
    @ApiModelProperty(value = "直推人数")
    private int directCnt;
    @ApiModelProperty(value = "子节点")
    private List<TeamListVo> children = new ArrayList<>();
    @ApiModelProperty(value = "团队业绩,不包含本人的")
    private BigDecimal achieve;
}
src/main/java/cc/mrbird/febs/job/BnbTransferJob.java
@@ -1,7 +1,14 @@
package cc.mrbird.febs.job;
import cc.mrbird.febs.dapp.entity.DappFundFlowEntity;
import cc.mrbird.febs.dapp.entity.DataDictionaryCustom;
import cc.mrbird.febs.dapp.enumerate.FundFlowEnum;
import cc.mrbird.febs.dapp.enumerate.MemberLevelEnum;
import cc.mrbird.febs.dapp.enumerate.NodeCodeEnum;
import cc.mrbird.febs.dapp.enumerate.PoolEnum;
import cc.mrbird.febs.dapp.mapper.DappFundFlowDao;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
@@ -9,6 +16,9 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
@Slf4j
@Component
@ConditionalOnProperty(prefix = "system", name = "online-transfer", havingValue = "true")
@@ -20,6 +30,10 @@
    private DappFundFlowDao dappFundFlowDao;
    @Autowired
    private ChainProducer chainProducer;
    @Autowired
    private DataDictionaryCustomMapper dataDictionaryCustomMapper;
    @Autowired
    private DappSystemService dappSystemService;
    @Scheduled(cron = "0/30 * * * * ? ")
    public void BnbTransferAgain() {
@@ -32,4 +46,151 @@
        }
    }
    /**
     * 20%所有人平分的底池
     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void memberPool() {
//        DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.POOL_ALL_MEMBER_A_CNT.getType(),
//                PoolEnum.POOL_ALL_MEMBER_A_CNT.getCode()
//        );
//        BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){
//            return;
//        }
//        BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.MEMBER.getType(), FundFlowEnum.POOL_MEMBER_A_CNT.getCode());
//        BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal);
//        nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeThreePoolDic);
//    }
    /**
     * NODE_5_POOL
     * NODE_4_POOL
     * NODE_3_POOL
     * 节点底池的每日分配
     */
//    @Scheduled(cron = "0 0 1 * * ?")
//    public void NodeThreePool() {
//        DataDictionaryCustom nodeThreePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.NODE_3_POOL.getType(),
//                PoolEnum.NODE_3_POOL.getCode()
//        );
//        BigDecimal nodeThreePoolDicCnt = new BigDecimal(nodeThreePoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeThreePoolDicCnt) >= 0){
//            return;
//        }
//        BigDecimal nodeThreePoolDicCntReal = dappSystemService.nodePoolPerk(nodeThreePoolDicCnt, MemberLevelEnum.NODE_3.getType(), FundFlowEnum.DAO_3_NODE_PERK.getCode());
//        BigDecimal nodeThreePoolDicCntAva = nodeThreePoolDicCnt.subtract(nodeThreePoolDicCntReal);
//        nodeThreePoolDic.setValue(nodeThreePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeThreePoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeThreePoolDic);
//    }
    /**
     * 节点四的每日分配
     */
    @Scheduled(cron = "0 0 1 * * ?")
//    public void NodeFourFivePool() {
//        DataDictionaryCustom nodeFourPoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.NODE_4_POOL.getType(),
//                PoolEnum.NODE_4_POOL.getCode()
//        );
//        BigDecimal nodeFourPoolDicCnt = new BigDecimal(nodeFourPoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeFourPoolDicCnt) >= 0){
//            return;
//        }
//        BigDecimal nodeFourPoolDicCntReal = dappSystemService.nodePoolPerk(nodeFourPoolDicCnt, MemberLevelEnum.NODE_4.getType(), FundFlowEnum.DAO_4_NODE_PERK.getCode());
//        BigDecimal nodeFourPoolDicCntAva = nodeFourPoolDicCnt.subtract(nodeFourPoolDicCntReal);
//        nodeFourPoolDic.setValue(nodeFourPoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFourPoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeFourPoolDic);
//    }
    /**
     * 节点五的每日分配
     */
    @Scheduled(cron = "0 0 1 * * ?")
//    public void NodeFivePool() {
//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.NODE_5_POOL.getType(),
//                PoolEnum.NODE_5_POOL.getCode()
//        );
//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
//            return;
//        }
//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_PERK.getCode());
//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
//    }
    /**
     * 节点五的平级奖励每日分配
     */
    @Scheduled(cron = "0 0 1 * * ?")
//    public void NodeFiveEqualsPool() {
//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.NODE_5_EQUALS_POOL.getType(),
//                PoolEnum.NODE_5_EQUALS_POOL.getCode()
//        );
//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
//            return;
//        }
//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.nodePoolEqualsPerk(nodeFivePoolDicCnt, MemberLevelEnum.NODE_5.getType(), FundFlowEnum.DAO_5_NODE_EQUALS_PERK.getCode());
//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
//    }
    /**
     * 超级节点奖励每日分配
     */
    @Scheduled(cron = "0 0 1 * * ?")
//    public void NodeAPercentPool() {
//        DataDictionaryCustom nodeFivePoolDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(
//                PoolEnum.NODE_A_PERCENT_POOL.getType(),
//                PoolEnum.NODE_A_PERCENT_POOL.getCode()
//        );
//        BigDecimal nodeFivePoolDicCnt = new BigDecimal(nodeFivePoolDic.getValue());
//        if(BigDecimal.ZERO.compareTo(nodeFivePoolDicCnt) >= 0){
//            return;
//        }
//        /**
//         * todo 超级节点的分红
//         */
//        BigDecimal nodeFivePoolDicCntReal = dappSystemService.superNodePoolPerk(nodeFivePoolDicCnt, NodeCodeEnum.SUPER_NODE.getCode(), FundFlowEnum.NODE_A_PERCENT_TO_MEMBER.getCode());
//        BigDecimal nodeFivePoolDicCntAva = nodeFivePoolDicCnt.subtract(nodeFivePoolDicCntReal);
//        nodeFivePoolDic.setValue(nodeFivePoolDicCntAva.compareTo(BigDecimal.ZERO) > 0 ? nodeFivePoolDicCntAva.toString() : "0");
//        dataDictionaryCustomMapper.updateById(nodeFivePoolDic);
//    }
    /**
     * A币全网每小时自动燃烧0.1%,燃烧按递减燃烧,按个人每小时0.1%每小时递减。
     *
     * A币技术做到资产钱包燃烧,闪兑钱包也要燃烧0.1%每小时
     */
    @Scheduled(cron = "0 0 * * * ?")
    public void aCoinFire() {
        dappSystemService.aCoinFire();
    }
    /**
     * A币内网要做K线图,K线效果做到与交易所效果接近。
     * 小时
     */
    @Scheduled(cron = "0 0 * * * ?")
    public void aKlineJobHour() {
        dappSystemService.aKlineJobHour();
    }
    /**
     * A币内网要做K线图,K线效果做到与交易所效果接近。
     * 日
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void aKlineJobDay() {
        dappSystemService.aKlineJobDay();
    }
}
src/main/java/cc/mrbird/febs/rabbit/QueueConstants.java
@@ -6,16 +6,48 @@
 **/
public class QueueConstants {
    public static final String QUEUE_BNB_TRANSFER_TEST = "queue_bnb_agent_up_test";
    public static final String QUEUE_BNB_AGENT_UP = "queue_bnb_agent_up";
    public static final String QUEUE_BNB_TRANSFER = "queue_ant_transfer";
    public static final String QUEUE_MEMBER_OUT = "queue_bnb_member_out";
    public static final String QUEUE_LEVEL_PROFIT = "queue_bnb_level_profit_transfer";
    public static final String QUEUE_BNB_TRANSFER_TEST = "queue_bnb_agent_up_test_test";
    public static final String QUEUE_BNB_AGENT_UP = "queue_bnb_agent_up_test";
    public static final String QUEUE_BNB_TRANSFER = "queue_ant_transfer_test";
    public static final String QUEUE_MEMBER_OUT = "queue_bnb_member_out_test";
    public static final String QUEUE_LEVEL_PROFIT = "queue_bnb_level_profit_transfer_test";
    public static final String ONLINE_TRANSFER = "queue_sdm_online_transfer";
    public static final String DISTRIB_PROFIT = "queue_sdm_distrib_profit";
    public static final String USER_BUY_REWARD = "queue_sdm_user_buy_reward";
    public static final String NFT_BOX = "queue_sdm_nft_box";
    public static final String ACHIEVE_TREE = "queue_sdm_achieve_tree";
    public static final String TFC_NEW_PRICE = "queue_tfc_new_price";
    public static final String ONLINE_TRANSFER = "queue_sdm_online_transfer_test";
    public static final String DISTRIB_PROFIT = "queue_sdm_distrib_profit_test";
    public static final String USER_BUY_REWARD = "queue_sdm_user_buy_reward_test";
    public static final String NFT_BOX = "queue_sdm_nft_box_test";
    public static final String ACHIEVE_TREE = "queue_sdm_achieve_tree_test";
    public static final String TFC_NEW_PRICE = "queue_tfc_new_price_test";
    /**
     * A 入金的消息 队列
     */
    public static final String QUEUE_ANT_A_CION_IN = "queue_ant_a_coin_in_test";
    /**
     * A 入金,转入A底池 队列
     */
    public static final String QUEUE_ANT_A_CION_IN_A_POOL = "queue_ant_a_coin_in_a_pool_test";
    /**
     * A 入金,转入B底池 队列
     */
    public static final String QUEUE_ANT_A_CION_IN_B_POOL = "queue_ant_a_coin_in_b_pool_test";
    /**
     * A 入金,5%节点 队列
     */
    public static final String QUEUE_ANT_A_CION_IN_NODE = "queue_ant_a_coin_in_node_test";
    /**
     * A 入金,极差奖 队列
     */
    public static final String QUEUE_ANT_A_CION_IN_LEVEL = "queue_ant_a_coin_in_level_test";
    /**
     * A 提现
     */
    public static final String QUEUE_ANT_A_CION_OUT = "queue_ant_a_coin_out_test";
    /**
     * A 会员升级
     */
    public static final String QUEUE_ANT_MEMBER_LEVEL = "queue_ant_member_level_test";
    /**
     * A k线数据
     */
    public static final String QUEUE_ANT_K_LINE = "queue_ant_k_line_test";
}
src/main/java/cc/mrbird/febs/rabbit/QueueEnum.java
@@ -5,24 +5,40 @@
@Getter
public enum QueueEnum {
    //A k线数据
    ANT_K_LINE("exchange_ant_k_line_test", "route_key_ant_k_line_test", QueueConstants.QUEUE_ANT_K_LINE),
    //A 会员升级
    ANT_MEMBER_LEVEL("exchange_ant_member_level_test", "route_key_ant_member_level_test", QueueConstants.QUEUE_ANT_MEMBER_LEVEL),
    //A 入金的消息
    ANT_A_CION_OUT("exchange_ant_a_coin_out_test", "route_key_ant_a_coin_out_test", QueueConstants.QUEUE_ANT_A_CION_OUT),
    //A 入金的消息
    ANT_A_CION_IN_LEVEL("exchange_ant_a_coin_in_level_test", "route_key_ant_a_coin_in_level_test", QueueConstants.QUEUE_ANT_A_CION_IN_LEVEL),
    //A 入金的消息
    ANT_A_CION_IN_NODE("exchange_ant_a_coin_in_node_test", "route_key_ant_a_coin_in_node_test", QueueConstants.QUEUE_ANT_A_CION_IN_NODE),
    //A 入金的消息
    ANT_A_CION_IN_B_POOL("exchange_ant_a_coin_in_b_pool_test", "route_key_ant_a_coin_in_b_pool_test", QueueConstants.QUEUE_ANT_A_CION_IN_B_POOL),
    //A 入金的消息
    ANT_A_CION_IN_A_POOL("exchange_ant_a_coin_in_a_pool_test", "route_key_ant_a_coin_in_a_pool_test", QueueConstants.QUEUE_ANT_A_CION_IN_A_POOL),
    //A 入金的消息
    ANT_A_CION_IN("exchange_ant_a_coin_in_test", "route_key_ant_a_coin_in_test", QueueConstants.QUEUE_ANT_A_CION_IN),
    //代理升级
    BNB_TRANSFER_TEST("exchange_bnb_agent_up_test", "route_key_bnb_agent_up_test", "queue_bnb_agent_up_test"),
    BNB_TRANSFER_TEST("exchange_bnb_agent_up_test_test", "route_key_bnb_agent_up_test_test", "queue_bnb_agent_up_test_test"),
    //代理升级
    BNB_AGENT_UP("exchange_bnb_agent_up", "route_key_bnb_agent_up", "queue_bnb_agent_up"),
    BNB_AGENT_UP("exchange_bnb_agent_up_test", "route_key_bnb_agent_up_test", "queue_bnb_agent_up_test"),
    //转账拨币
    BNB_TRANSFER("exchange_ant_transfer", "route_key_ant_transfer", "queue_ant_transfer"),
    BNB_TRANSFER("exchange_ant_transfer_test", "route_key_ant_transfer_test", "queue_ant_transfer_test"),
    //计算是否有人出局
    MEMBER_OUT("exchange_bnb_member_out", "route_key_bnb_member_out", "queue_bnb_member_out"),
    MEMBER_OUT("exchange_bnb_member_out_test", "route_key_bnb_member_out_test", "queue_bnb_member_out_test"),
    //层级奖励
    LEVEL_PROFIT("exchange_bnb_level_profit_transfer", "route_key_bnb_level_profit_transfer", "queue_bnb_level_profit_transfer"),
    LEVEL_PROFIT("exchange_bnb_level_profit_transfer_test", "route_key_bnb_level_profit_transfer_test", "queue_bnb_level_profit_transfer_test"),
    ONLINE_TRANSFER("exchange_sdm_online_transfer", "route_key_sdm_online_transfer", "queue_sdm_online_transfer"),
    DISTRIB_PROFIT("exchange_sdm_distrib_profit", "route_key_sdm_distrib_profit", "queue_sdm_distrib_profit"),
    USER_BUY_REWARD("exchange_sdm_user_buy_reward", "route_key_sdm_user_buy_reward", "queue_sdm_user_buy_reward"),
    NFT_BOX("exchange_sdm_nft_box", "route_key_sdm_nft_box", "queue_sdm_nft_box"),
    ACHIEVE_TREE("exchange_sdm_achieve_tree", "route_key_sdm_achieve_tree", "queue_sdm_achieve_tree"),
    WITHDRAW_FEE("exchange_withdraw_fee", "route_key_withdraw_fee", "queue_withdraw_fee"),
    TFC_NEW_PRICE("exchange_tfc_new_price", "route_key_tfc_new_price", "queue_tfc_new_price");
    ONLINE_TRANSFER("exchange_sdm_online_transfer_test", "route_key_sdm_online_transfer_test", "queue_sdm_online_transfer_test"),
    DISTRIB_PROFIT("exchange_sdm_distrib_profit_test", "route_key_sdm_distrib_profit_test", "queue_sdm_distrib_profit_test"),
    USER_BUY_REWARD("exchange_sdm_user_buy_reward_test", "route_key_sdm_user_buy_reward_test", "queue_sdm_user_buy_reward_test"),
    NFT_BOX("exchange_sdm_nft_box_test", "route_key_sdm_nft_box_test", "queue_sdm_nft_box_test"),
    ACHIEVE_TREE("exchange_sdm_achieve_tree_test", "route_key_sdm_achieve_tree_test", "queue_sdm_achieve_tree_test"),
    WITHDRAW_FEE("exchange_withdraw_fee_test", "route_key_withdraw_fee_test", "queue_withdraw_fee_test"),
    TFC_NEW_PRICE("exchange_tfc_new_price_test", "route_key_tfc_new_price_test", "queue_tfc_new_price_test");
    private String exchange;
src/main/java/cc/mrbird/febs/rabbit/RabbitConfiguration.java
@@ -196,4 +196,148 @@
        return BindingBuilder.bind(bnbTransferTestQueue()).to(bnbTransferTestExchange()).with(QueueEnum.BNB_TRANSFER_TEST.getRoute());
    }
    // === 消息测试 end ===
    // === A 入金的消息 start ===
    @Bean
    public DirectExchange antACoinInExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_IN.getExchange());
    }
    @Bean
    public Queue antACoinInQueue() {
        return new Queue(QueueEnum.ANT_A_CION_IN.getQueue());
    }
    @Bean
    public Binding antACoinInBind() {
        return BindingBuilder.bind(antACoinInQueue()).to(antACoinInExchange()).with(QueueEnum.ANT_A_CION_IN.getRoute());
    }
    // === A 入金的消息 end ===
    // === A 入金,转入A底池 start ===
    @Bean
    public DirectExchange antACoinInAPoolExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_IN_A_POOL.getExchange());
    }
    @Bean
    public Queue antACoinInAPoolQueue() {
        return new Queue(QueueEnum.ANT_A_CION_IN_A_POOL.getQueue());
    }
    @Bean
    public Binding antACoinInAPoolBind() {
        return BindingBuilder.bind(antACoinInAPoolQueue()).to(antACoinInAPoolExchange()).with(QueueEnum.ANT_A_CION_IN_A_POOL.getRoute());
    }
    // === A 入金,转入A底池 end ===
    // === A 入金,转入B底池 start ===
    @Bean
    public DirectExchange antACoinInBPoolExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_IN_B_POOL.getExchange());
    }
    @Bean
    public Queue antACoinInBPoolQueue() {
        return new Queue(QueueEnum.ANT_A_CION_IN_B_POOL.getQueue());
    }
    @Bean
    public Binding antACoinInBPoolBind() {
        return BindingBuilder.bind(antACoinInBPoolQueue()).to(antACoinInBPoolExchange()).with(QueueEnum.ANT_A_CION_IN_B_POOL.getRoute());
    }
    // === A 入金,转入B底池 end ===
    // === A 入金,5%节点 start ===
    @Bean
    public DirectExchange antACoinInNodeExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_IN_NODE.getExchange());
    }
    @Bean
    public Queue antACoinInNodeQueue() {
        return new Queue(QueueEnum.ANT_A_CION_IN_NODE.getQueue());
    }
    @Bean
    public Binding antACoinInNodeBind() {
        return BindingBuilder.bind(antACoinInNodeQueue()).to(antACoinInNodeExchange()).with(QueueEnum.ANT_A_CION_IN_NODE.getRoute());
    }
    // === A 入金,5%节点 end ===
    // === A 入金,极差奖  start ===
    @Bean
    public DirectExchange antACoinInLevelExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_IN_LEVEL.getExchange());
    }
    @Bean
    public Queue antACoinInLevelQueue() {
        return new Queue(QueueEnum.ANT_A_CION_IN_LEVEL.getQueue());
    }
    @Bean
    public Binding antACoinInLevelBind() {
        return BindingBuilder.bind(antACoinInLevelQueue()).to(antACoinInLevelExchange()).with(QueueEnum.ANT_A_CION_IN_LEVEL.getRoute());
    }
    // === A 入金,极差奖  end ===
    // === A 提现  start ===
    @Bean
    public DirectExchange antACoinOutExchange() {
        return new DirectExchange(QueueEnum.ANT_A_CION_OUT.getExchange());
    }
    @Bean
    public Queue antACoinOutQueue() {
        return new Queue(QueueEnum.ANT_A_CION_OUT.getQueue());
    }
    @Bean
    public Binding antACoinOutBind() {
        return BindingBuilder.bind(antACoinOutQueue()).to(antACoinOutExchange()).with(QueueEnum.ANT_A_CION_OUT.getRoute());
    }
    // === A 提现  end ===
    // === A 会员升级  start ===
    @Bean
    public DirectExchange antMemberLevelExchange() {
        return new DirectExchange(QueueEnum.ANT_MEMBER_LEVEL.getExchange());
    }
    @Bean
    public Queue antMemberLevelQueue() {
        return new Queue(QueueEnum.ANT_MEMBER_LEVEL.getQueue());
    }
    @Bean
    public Binding antMemberLevelBind() {
        return BindingBuilder.bind(antMemberLevelQueue()).to(antMemberLevelExchange()).with(QueueEnum.ANT_MEMBER_LEVEL.getRoute());
    }
    // === A 会员升级  end ===
    // === A k线数据  start ===
    @Bean
    public DirectExchange antKLineExchange() {
        return new DirectExchange(QueueEnum.ANT_K_LINE.getExchange());
    }
    @Bean
    public Queue antKLineQueue() {
        return new Queue(QueueEnum.ANT_K_LINE.getQueue());
    }
    @Bean
    public Binding antKLineBind() {
        return BindingBuilder.bind(antKLineQueue()).to(antKLineExchange()).with(QueueEnum.ANT_K_LINE.getRoute());
    }
    // === A k线数据  end ===
}
src/main/java/cc/mrbird/febs/rabbit/consumer/ChainConsumer.java
@@ -90,4 +90,84 @@
//        log.info("代理升级:{}", id);
//        dappSystemService.agentUp(id);
//    }
    /**
     * 消费---A 入金的消息
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN)
    public void AntACoinInMsg(Long id) {
        log.info("消费---A 入金的消息:{}", id);
        dappSystemService.AntACoinInMsg(id);
    }
    /**
     * 消费---A 入金,转入A底池
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_A_POOL)
    public void AntACoinAPollInMsg(Long id) {
        log.info("消费---A 入金,转入A底池:{}", id);
        dappSystemService.AntACoinAPollInMsg(id);
    }
    /**
     * 消费---A 入金,转入B底池
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_B_POOL)
    public void AntACoinBPollInMsg(Long id) {
        log.info("消费---A 入金,转入B底池:{}", id);
        dappSystemService.AntACoinBPollInMsg(id);
    }
    /**
     * 消费---A 入金,5%节点
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_NODE)
    public void antACoinInNodeMsg(Long id) {
        log.info("消费---A 入金,转入5%节点:{}", id);
        dappSystemService.antACoinInNodeMsg(id);
    }
    /**
     * 消费---A 入金,10%极差奖
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_IN_LEVEL)
    public void antACoinInLevelMsg(Long id) {
        log.info("消费---A 入金,转入10%极差奖:{}", id);
        dappSystemService.antACoinInLevelMsg(id);
    }
    /**
     * 提现
     * @param id
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_A_CION_OUT)
    public void antACoinOutMsg(Long id) {
        log.info("消费---A 提现:{}", id);
        dappSystemService.antACoinOutMsg(id);
    }
    /**
     *  A 代理升级
     * @param memberId
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_MEMBER_LEVEL)
    public void antMemberLevelMsg(Long memberId) {
        log.info("消费---A 代理升级:{}", memberId);
        dappSystemService.antMemberLevelMsg(memberId);
    }
    /**
     *  A k线数据
     * @param type
     */
    @RabbitListener(queues = QueueConstants.QUEUE_ANT_K_LINE)
    public void antKLineMsg(int type) {
        log.info("消费---A k线数据:{}", type);
        dappSystemService.antKLineMsg(type);
    }
}
src/main/java/cc/mrbird/febs/rabbit/producer/ChainProducer.java
@@ -109,4 +109,84 @@
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.BNB_AGENT_UP.getExchange(), QueueEnum.BNB_AGENT_UP.getRoute(), id, correlationData);
    }
    /**
     *  A 入金的消息
     * @param id
     */
    public void sendAntACoinInMsg(Long id) {
        log.info("开始---A 入金的消息:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN.getExchange(), QueueEnum.ANT_A_CION_IN.getRoute(), id, correlationData);
    }
    /**
     *  A 入金,转入A底池
     * @param id
     */
    public void sendAntACoinInAPoolMsg(Long id) {
        log.info("开始---A 入金,转入A底池:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_A_POOL.getExchange(), QueueEnum.ANT_A_CION_IN_A_POOL.getRoute(), id, correlationData);
    }
    /**
     *  A 入金,转入B底池
     * @param id
     */
    public void sendAntACoinInBPoolMsg(Long id) {
        log.info("开始---A 入金,转入B底池:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_B_POOL.getExchange(), QueueEnum.ANT_A_CION_IN_B_POOL.getRoute(), id, correlationData);
    }
    /**
     *  A 入金,5%节点
     * @param id
     */
    public void sendAntACoinInNodeMsg(Long id) {
        log.info("开始---A 入金,转入5%节点:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_NODE.getExchange(), QueueEnum.ANT_A_CION_IN_NODE.getRoute(), id, correlationData);
    }
    /**
     *  A 入金,10%极差奖
     * @param id
     */
    public void sendAntACoinInLevelMsg(Long id) {
        log.info("开始---A 入金,转入10%极差奖:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_IN_LEVEL.getExchange(), QueueEnum.ANT_A_CION_IN_LEVEL.getRoute(), id, correlationData);
    }
    /**
     *  A 提现
     * @param id
     */
    public void sendAntACoinOutMsg(Long id) {
        log.info("开始---A 提现:{}", id);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_A_CION_OUT.getExchange(), QueueEnum.ANT_A_CION_OUT.getRoute(), id, correlationData);
    }
    /**
     *  A 代理升级
     * @param memberId
     */
    public void sendAntMemberLevelMsg(Long memberId) {
        log.info("开始---A 代理升级:{}", memberId);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_MEMBER_LEVEL.getExchange(), QueueEnum.ANT_MEMBER_LEVEL.getRoute(), memberId, correlationData);
    }
    /**
     *  A k线数据
     * @param type
     */
    public void sendAntKLineMsg(int type) {
        log.info("开始---A k线数据:{}", type);
        CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
        rabbitTemplate.convertAndSend(QueueEnum.ANT_K_LINE.getExchange(), QueueEnum.ANT_K_LINE.getRoute(), type, correlationData);
    }
}
src/main/resources/application-dev.yml
@@ -15,11 +15,11 @@
      datasource:
        # 数据源-1,名称为 base
        base:
          username: db_twocoin
          password: db_twocoin123!@#123
          username: ct_test
          password: 123456
          # 154.91.195.148
          driver-class-name: com.mysql.cj.jdbc.Driver
          url: jdbc:mysql://154.91.195.148:3306/db_twocoin?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
          url: jdbc:mysql://120.27.238.55:3406/db_twocoin?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
#          username: ct_test
#          password: 123456
#          driver-class-name: com.mysql.cj.jdbc.Driver
@@ -27,7 +27,7 @@
  redis:
    # Redis数据库索引(默认为 0)
    database: 11
    database: 14
    # Redis服务器地址
    host: 120.27.238.55
    # Redis服务器连接端口
@@ -54,7 +54,7 @@
    publisher-confirm-type: correlated
system:
  online-transfer: false
  online-transfer: true
  chain-listener: false
  reset-job: false
  quartz-job: false
src/main/resources/application-test.yml
@@ -15,20 +15,20 @@
      datasource:
        # 数据源-1,名称为 base
        base:
          username: ct_test
          password: 123456
          username: db_twocoin_test
          password: db_twocoin_test123!@#123
          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://127.0.0.1:3306/db_twocoin_test?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
  redis:
    # Redis数据库索引(默认为 0)
    database: 10
    database: 14
    # Redis服务器地址
    host: 120.27.238.55
    host: 127.0.0.1
    # Redis服务器连接端口
    port: 6379
    # Redis 密码
    password: xcong123
    password: dapp!@#123
    lettuce:
      pool:
        # 连接池中的最小空闲连接
@@ -42,14 +42,19 @@
    # 连接超时时间(毫秒)
    timeout: 5000
  rabbitmq:
    host: 120.27.238.55
    host: 127.0.0.1
    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
  online-transfer: true
  chain-listener: false
  reset-job: false
  quartz-job: false
  debug: false
src/main/resources/mapper/dapp/DappAKlineMapper.xml
New file
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappAKlineMapper">
    <select id="selectListByType" resultType="cc.mrbird.febs.dapp.vo.AKLineVo">
        select
        a.type type,
        a.create_time createTime,
        a.price price
        from dapp_a_kline a
        <where>
            <if test="record.type != null">
                and a.type = #{record.type}
            </if>
        </where>
        order by a.create_time asc
    </select>
    <select id="selectListByTypeAndTime" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where a.type = #{type}
        and date_format(a.create_time, '%Y-%m-%d') in
        <foreach collection="dateStr" separator="," close=")" open="(" item="item">
            #{item}
        </foreach>
        order by a.create_time asc
    </select>
    <select id="selectListByTypeAndLimit" resultType="cc.mrbird.febs.dapp.vo.AKLineLimitVo">
        select
            a.open_price openPrice,
            a.close_price closePrice,
            a.lowest_price lowestPrice,
            a.highest_price highestPrice,
            a.create_time createTime
        from dapp_a_kline a
        where a.type = #{type}
        order by a.create_time desc
        limit #{kLineLimit}
    </select>
    <select id="selectOneByType" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where type in (0,1)
        order by a.create_time desc
        limit 1
    </select>
    <select id="selectListByTypeAndHour" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where date_format(a.create_time, '%Y-%m-%d %H') in
        <foreach collection="dateStr" separator="," close=")" open="(" item="item">
            #{item}
        </foreach>
        order by a.create_time asc
    </select>
</mapper>
src/main/resources/mapper/dapp/DappChargeUsdtMapper.xml
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappChargeUsdtMapper">
    <select id="selectByMaxAmountMemberId" resultType="java.math.BigDecimal">
        select ifnull(MAX(amount),0)
        from dapp_charge_usdt
        where member_id = #{memberId}
    </select>
</mapper>
src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -31,6 +31,24 @@
        order by a.create_time desc, a.id desc
    </select>
    <select id="selectVoInPage" resultType="cc.mrbird.febs.dapp.vo.DappFundFlowVo">
        select
               a.amount amount,
               a.type type,
               date_format(a.create_time, '%Y-%m-%d %h:%m:%s') createTime
        from dapp_fund_flow a
        <where>
            member_id = #{record.memberId}
            <if test="record.type != null">
                and a.type = #{record.type}
            </if>
            <if test="record.status != null">
                and a.status = #{record.status}
            </if>
        </where>
        order by a.create_time desc, a.id desc
    </select>
    <select id="selectListForMemberAndDay" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity">
        select * from dapp_fund_flow
        where member_id=#{memberId} and date_format(create_time, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
src/main/resources/mapper/dapp/DappMemberDao.xml
@@ -10,7 +10,7 @@
    </select>
    <select id="selectMemberInfoByInviteId" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select * from dapp_member where invite_id=#{inviteId}
        select * from dapp_member where invite_id = #{inviteId}
    </select>
    <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
@@ -90,7 +90,7 @@
    <select id="selectMemberByAccountType" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select * from dapp_member
        <where>
            account_type=#{accountType}
            account_type = #{accountType}
        </where>
    </select>
@@ -189,8 +189,57 @@
    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.vo.DappMemberInfoVo">
        select
            a.invite_id inviteId,
            a.account_type accountType
            a.account_type accountType,
            b.ausd_amount ausdAmount,
            b.nft_devote nftDevote,
            b.amount amount,
            c.available_amount propertyAmount,
            d.available_amount exchangeAmount
        from dapp_member a
        where id = #{id}
        left join dapp_usdt_perk b on a.id = b.member_id
        left join dapp_wallet_mine c on a.id = c.member_id
        left join dapp_wallet_coin d on a.id = d.member_id
        where a.id = #{id}
    </select>
    <select id="selectByInviteIds" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select
               *
        from dapp_member
        where  invite_id IN
        <foreach collection = "list" item = "item"  separator=","  open = "(" close = ")" >
            #{item}
        </foreach >
        order by id desc
    </select>
    <select id="selectMemberByAccountTypeAnd" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select
            a.*
        from dapp_member a
        where a.account_type = #{accountType}
        and a.invite_id in (
            select b.referer_id from dapp_member b where b.account_type = #{accountType}
            )
    </select>
    <select id="selectChildAgentListByAccountType" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select *
        from dapp_member
        where
              (find_in_set(#{inviteId}, referer_ids) or invite_id=#{inviteId})
          and account_type = #{accountType}
    </select>
    <select id="selectAllAchieveByInviteId" resultType="java.math.BigDecimal">
        select sum(IFNULL(a.achieve_amount, 0))
        from dapp_usdt_perk a
        inner join dapp_member b on a.member_id = b.id
        where find_in_set(#{inviteId}, b.referer_ids) or b.invite_id = #{inviteId}
    </select>
    <select id="selectMemberByNotAccountType" resultType="cc.mrbird.febs.dapp.entity.DappMemberEntity">
        select * from dapp_member
            where active_status = 1
    </select>
</mapper>
src/main/resources/mapper/dapp/DappMemberNodeMapper.xml
@@ -42,4 +42,11 @@
        order  by a.create_time desc
    </select>
    <select id="selectNodeByNodeCode" resultType="cc.mrbird.febs.dapp.entity.DappMemberNodeEntity">
        select
            a.*
        from dapp_member_node a
        where a.node_code = #{nodeCode}
    </select>
</mapper>
src/main/resources/mapper/dapp/DappUsdtPerkEntityMapper.xml
New file
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappUsdtPerkEntityMapper">
    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappUsdtPerkEntity">
        select *
        from dapp_usdt_perk
        where member_id = #{memberId}
    </select>
</mapper>
src/main/resources/mapper/dapp/DappWalletCoinDao.xml
@@ -3,7 +3,7 @@
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappWalletCoinDao">
    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
        select * from dapp_wallet_coin where member_id=#{memberId}
        select * from dapp_wallet_coin where member_id=#{memberId} for update
    </select>
    <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
@@ -140,4 +140,8 @@
        where
            member_id = #{memberId}
    </update>
    <select id="selectAmountThanZero" resultType="cc.mrbird.febs.dapp.entity.DappWalletCoinEntity">
        select * from dapp_wallet_coin where available_amount > 0
    </select>
</mapper>
src/main/resources/mapper/dapp/DappWalletMineDao.xml
@@ -3,7 +3,7 @@
<mapper namespace="cc.mrbird.febs.dapp.mapper.DappWalletMineDao">
    <select id="selectByMemberId" resultType="cc.mrbird.febs.dapp.entity.DappWalletMineEntity">
        select * from dapp_wallet_mine where member_id=#{memberId}
        select * from dapp_wallet_mine where member_id=#{memberId} for update
    </select>
    <select id="selectInPage" resultType="cc.mrbird.febs.dapp.entity.DappWalletMineEntity">
@@ -32,7 +32,12 @@
        update dapp_wallet_mine
        set total_amount=#{record.totalAmount},
            available_amount=#{record.availableAmount},
            frozen_amount=#{record.frozenAmount},
            version=version+1
        where id=#{record.id} and version=#{record.version}
    </update>
    <select id="selectAmountThanZero" resultType="cc.mrbird.febs.dapp.entity.DappWalletMineEntity">
        select * from dapp_wallet_mine where available_amount > 0
    </select>
</mapper>
src/main/resources/templates/febs/views/dapp/money-change-flow.html
@@ -28,8 +28,8 @@
                                            <select name="type">
                                                <option value=""></option>
                                                <option value="1">购买节点</option>
                                                <option value="3">直推收益</option>
                                                <option value="4">收益</option>
                                                <option value="2">直推收益</option>
                                                <option value="3">收益</option>
                                            </select>
                                        </div>
                                    </div>
@@ -55,8 +55,8 @@
    {{#
    var type = {
    1: {title: '购买节点', color: 'orange'},
    3: {title: '直推收益', color: 'green'},
    4: {title: '收益', color: 'blue'},
    2: {title: '直推收益', color: 'green'},
    3: {title: '收益', color: 'blue'},
    }[d.type];
    }}
    <span class="layui-badge febs-bg-{{type.color}}">{{ type.title }}</span>
src/test/java/cc/mrbird/febs/MemberTest.java
@@ -2,6 +2,7 @@
import cc.mrbird.febs.common.contants.AppContants;
import cc.mrbird.febs.common.contants.SystemConstants;
import cc.mrbird.febs.common.utils.RedisUtils;
import cc.mrbird.febs.dapp.chain.ChainEnum;
import cc.mrbird.febs.dapp.chain.ChainService;
import cc.mrbird.febs.dapp.contract.ContractMain;
@@ -11,8 +12,14 @@
import cc.mrbird.febs.dapp.mapper.DappMemberDao;
import cc.mrbird.febs.dapp.mapper.DataDictionaryCustomMapper;
import cc.mrbird.febs.dapp.service.DappSystemService;
import cc.mrbird.febs.dapp.vo.AKLineLimitVo;
import cc.mrbird.febs.dapp.vo.AKLineVo;
import cc.mrbird.febs.rabbit.producer.ChainProducer;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,6 +28,7 @@
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
/**
@@ -44,13 +52,58 @@
    @Autowired
    private ChainProducer chainProducer;
    @Autowired
    private RedisUtils redisUtils;
    //        String address = dappMemberEntity.getAddress();
//        String hash = ChainService.getInstance(ChainEnum.BSC_USDT.name()).transfer(address, amount);
//        if(StrUtil.isEmpty(hash)){
//            return;
//        }
    public static void main(String[] args) {
        List<JSONObject> objects = new ArrayList<>();
        AKLineVo akLineVo = new AKLineVo();
        akLineVo.setCreateTime(DateUtil.date());
        akLineVo.setClosePrice(BigDecimal.ZERO);
        akLineVo.setOpenPrice(BigDecimal.ZERO);
        akLineVo.setLowestPrice(BigDecimal.ZERO);
        akLineVo.setHighestPrice(BigDecimal.ZERO);
        JSONObject parseObj = JSONUtil.parseObj(akLineVo);
        objects.add(parseObj);
        objects.add(parseObj);
        objects.add(parseObj);
        objects.add(parseObj);
        System.out.println(objects);
    }
    @Test
    public void tranfer(){
//        dappSystemService.antKLineMsg(1);
        dappSystemService.aKlineJobHour();
//        dappSystemService.aKlineJobDay();
//        dappSystemService.AntACoinInMsg(164L);
//        List<JSONObject> objects = new ArrayList<>();
//        AKLineVo akLineVo = new AKLineVo();
//        akLineVo.setCreateTime(DateUtil.date());
//        akLineVo.setClosePrice(BigDecimal.ZERO);
//        akLineVo.setOpenPrice(BigDecimal.ZERO);
//        akLineVo.setLowestPrice(BigDecimal.ZERO);
//        akLineVo.setHighestPrice(BigDecimal.ZERO);
//        JSONObject parseObj = JSONUtil.parseObj(akLineVo);
//        objects.add(parseObj);
//        objects.add(parseObj);
//        objects.add(parseObj);
//        objects.add(parseObj);
//        System.out.println(objects);
//        System.out.println(objects.toString());
//        redisUtils.set("test",objects.toString());
//        Object test = redisUtils.get("test");
//        System.out.println(test.toString());
//        JSONArray jsonArray = JSONUtil.parseArray(test);
//        System.out.println(jsonArray);
//        String hash = ChainService.getInstance(ChainEnum.BNB.name()).transferBaseToken(address, amount);
////        if(StrUtil.isEmpty(hash)){
////            return;
@@ -62,7 +115,7 @@
//        System.out.println(balance);
        dappSystemService.bnbTransferTest(44L);
//        dappSystemService.bnbTransferTest(44L);
        //发送转币消息
@@ -79,6 +132,8 @@
    private DappSystemService dappSystemService;
    @Test
    public void balance() {
        dappSystemService.selectAndInsertDics();
        /**
         * 从contractAddress合约地址中转移对应发行的代币到address中
         */