xiaoyong931011
2022-12-06 2fc3a28539dfce94f851f1f0722a64b05574499c
20221130
3 files modified
16 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java 8 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/dapp/DappFundFlowDao.xml 6 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -34,4 +34,6 @@
    int updateStatusById(@Param("status")int status, @Param("id")Long id);
    DappFundFlowEntity selectByStateAndVersionAndFromHashLimitOne(@Param("status")int withdrawStatusAgree, @Param("version")int withdrawStatusAgree1);
    DappFundFlowEntity selectBymemberIdAndType(@Param("memberId")Long id, @Param("type")int type);
}
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -219,6 +219,10 @@
                type = 6;
            }
            if (transferDto.getId() == null) {
                DappFundFlowEntity fundFlowOld = dappFundFlowDao.selectBymemberIdAndType(member.getId(),type);
                if(ObjectUtil.isNotEmpty(fundFlowOld)){
                    throw new FebsException("Do not repeat purchase");
                }
                DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), transferDto.getAmount(), type, 1, transferDto.getFee(), transferDto.getTxHash());
                dappFundFlowDao.insert(fundFlow);
                return fundFlow.getId();
@@ -227,12 +231,12 @@
            if ("success".equals(transferDto.getFlag())) {
                DappFundFlowEntity flow = dappFundFlowDao.selectById(transferDto.getId());
                if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
                    return null;
                    throw new FebsException("Do not repeat purchase");
                }
                //是否已经加入动能
                DappSystemProfit dappSystemProfitIng = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
                if(ObjectUtil.isNotEmpty(dappSystemProfitIng)){
                    return null;
                    throw new FebsException("Do not repeat purchase");
                }
                //插入一条会员入列记录,即加入动能队列
src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -113,4 +113,10 @@
            id ASC
            LIMIT 1
    </select>
    <select id="selectBymemberIdAndType" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity">
        select * from dapp_fund_flow
        where member_id = #{memberId}
          and type = #{type}
    </select>
</mapper>