src/main/java/com/xcong/excoin/modules/member/entity/TdCoinWallet.java
New file @@ -0,0 +1,73 @@ package com.xcong.excoin.modules.member.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; /** * 会员资产表 Entity * * @author MrBird * @date 2020-09-26 19:21:08 */ @Data @TableName("td_coin_wallet") public class TdCoinWallet { /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) private Long id; /** * 会员ID */ @TableField("mem_id") private Long memId; /** * 地址 */ @TableField("address") private String address; /** * 币种 */ @TableField("symbol") private String symbol; /** * 私钥 */ @TableField("private_key") private String privateKey; /** * 币种细类 */ @TableField("tag") private String tag; /** * 用户标识 */ @TableField("mem_code") private String memCode; /** * 可用余额 */ @TableField("available_balance") private BigDecimal availableBalance; /** * 冻结金额 */ @TableField("frozen_balance") private BigDecimal frozenBalance; } src/main/java/com/xcong/excoin/modules/member/entity/TdFinancialReord.java
New file @@ -0,0 +1,59 @@ package com.xcong.excoin.modules.member.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import java.math.BigDecimal; import java.util.Date; @Data @TableName("td_financial_reord") public class TdFinancialReord { private static final long serialVersionUID = 1L; /** * 主键 */ @TableId(value = "id", type= IdType.AUTO) private Long id; /** * 会员ID */ private Long memId; /** * 类型 */ private String symbol; /** * 标题 */ private String title; /** * 明细内容 */ private String content; /** * 金额 */ private BigDecimal amount; /** * 创建时间 */ private Date createTime; } src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java
@@ -1,12 +1,18 @@ package com.xcong.excoin.modules.member.mapper; import com.xcong.excoin.modules.member.entity.TdCoinWallet; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; import java.math.BigDecimal; public interface MemberWalletCoinMapper extends BaseMapper<MemberWalletCoinEntity> { MemberWalletCoinEntity findWalletCoinByMemberIdAndWalletCode(@Param("memberId")Long memberId, @Param("walletCode")String walletCode); TdCoinWallet selectTdCoinWalletByAddress(@Param("address") String address, @Param("symbol") String symbol); int updateTdCoinWalletAvaliable(@Param("money") BigDecimal money, @Param("address") String address); } src/main/java/com/xcong/excoin/modules/member/mapper/TdFinancialReordDao.java
New file @@ -0,0 +1,7 @@ package com.xcong.excoin.modules.member.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.xcong.excoin.modules.member.entity.TdFinancialReord; public interface TdFinancialReordDao extends BaseMapper<TdFinancialReord> { } src/main/java/com/xcong/excoin/modules/member/service/RocService.java
@@ -10,13 +10,13 @@ */ public class RocService { private final static String URL = "http://api.rocwallet.cc"; private final static String URL = "http://wallet.rfncwallet.vip"; private final static String CREATE_WALLET= "/init/createaccount"; private final static String TRANSFER_METHOD= "/transfer/transferWithPrivateKey"; private final static String TOTAL_ADDRESS = "ROC0f23b4d74e63473497d342fe98fcd436"; private final static String TOTAL_PRIVATE_KEY = "5dd9f1caa18d46dfa3063e349eff32992b3043f510c645"; private final static String TOTAL_ADDRESS = "RFNCe0cdafb0b8d945bcbcce39f416e292c0"; private final static String TOTAL_PRIVATE_KEY = "fb603d3339534f6cbf92465e0ee2738068358f2861fb41"; private final static BigDecimal fee = new BigDecimal("0.006"); public static String transfer(BigDecimal balance,String toAddress,String symbol){ TransferModel transferModel = new TransferModel(); src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -11,24 +11,8 @@ import com.xcong.excoin.common.entity.QueryRequest; import com.xcong.excoin.modules.Sms106Send; import com.xcong.excoin.modules.member.dto.MemberDetailConfirmDto; import com.xcong.excoin.modules.member.entity.AgentFriendRelationEntity; import com.xcong.excoin.modules.member.entity.MemberAccountMoneyChangeEntity; import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity; import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity; import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity; import com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity; import com.xcong.excoin.modules.member.entity.MemberEntity; import com.xcong.excoin.modules.member.entity.MemberQuickBuySaleEntity; import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity; import com.xcong.excoin.modules.member.mapper.AgentFriendRelationMapper; import com.xcong.excoin.modules.member.mapper.MemberAccountMoneyChangeMapper; import com.xcong.excoin.modules.member.mapper.MemberAuthenticationMapper; import com.xcong.excoin.modules.member.mapper.MemberCoinAddressMapper; import com.xcong.excoin.modules.member.mapper.MemberCoinChargeMapper; import com.xcong.excoin.modules.member.mapper.MemberCoinWithdrawMapper; import com.xcong.excoin.modules.member.mapper.MemberMapper; import com.xcong.excoin.modules.member.mapper.MemberQuickBuySaleMapper; import com.xcong.excoin.modules.member.mapper.MemberWalletCoinMapper; import com.xcong.excoin.modules.member.entity.*; import com.xcong.excoin.modules.member.mapper.*; import com.xcong.excoin.modules.member.service.EthService; import com.xcong.excoin.modules.member.service.IMemberService; import com.xcong.excoin.modules.member.service.RocService; @@ -85,6 +69,8 @@ private final MemberAuthenticationMapper memberAuthenticationMapper; private final AgentFriendRelationMapper agentFriendRelationMapper; private final TdFinancialReordDao tdFinancialReordDao; @Override public IPage<AgentFriendRelationEntity> findAgentInfoListInPage(AgentFriendRelationEntity agentFriendRelationEntity, @@ -471,9 +457,9 @@ } // 转币 需要扣除手续费 amount = amount.subtract(selectById.getFeeAmount()); if("ROC".equals(symbol) && !"Y".equals(selectById.getIsInside())){ if("RFNC".equals(symbol) && !"Y".equals(selectById.getIsInside())){ // 如果是ROC 则自动转 String transfer = RocService.transfer(amount, address, "ROC"); String transfer = RocService.transfer(amount, address, "RFNC"); if(!"success".equals(transfer)){ FebsResponse febsResponse = new FebsResponse(); return febsResponse.fail().message(transfer); @@ -490,6 +476,22 @@ memberWalletCoinMapper.updateById(walletCoin); if ("Y".equals(selectById.getIsInside())) { // 查询算力系统中是否存在该地址 TdCoinWallet tdCoinWallet = memberWalletCoinMapper.selectTdCoinWalletByAddress(address, "USDT"); if (tdCoinWallet != null) { // 更新算力系统中用户钱包余额 memberWalletCoinMapper.updateTdCoinWalletAvaliable(amount, address); TdFinancialReord tdFinancialReord = new TdFinancialReord(); tdFinancialReord.setAmount(amount); tdFinancialReord.setCreateTime(new Date()); tdFinancialReord.setMemId(tdCoinWallet.getMemId()); tdFinancialReord.setSymbol("USDT"); tdFinancialReord.setTitle("USDT交易所转账"); tdFinancialReord.setContent("USDT交易所转账"); // 插入算力系统中财务记录 tdFinancialReordDao.insert(tdFinancialReord); } else { Map<String, Object> columnMap = new HashMap<>(); columnMap.put("symbol", symbol); columnMap.put("address", address); @@ -521,6 +523,7 @@ memberAccountMoneyChangeEntity.setUpdateTime(new Date()); memberAccountMoneyChangeMapper.insert(memberAccountMoneyChangeEntity); } } Map<String, Object> columnMaps = new HashMap<>(); columnMaps.put("withdraw_id", selectById.getId()); src/main/resources/application-prod.yml
@@ -2,7 +2,7 @@ datasource: dynamic: # 是否开启 SQL日志输出,生产环境建议关闭,有性能损耗 p6spy: false p6spy: true hikari: connection-timeout: 30000 max-lifetime: 1800000 src/main/resources/mapper/modules/MemberWalletCoinMapper.xml
@@ -7,4 +7,14 @@ select * from member_wallet_coin where member_id = #{memberId} and wallet_code = #{walletCode} </select> <select id="selectTdCoinWalletByAddress" resultType="com.xcong.excoin.modules.member.entity.TdCoinWallet"> select * from td_coin_wallet where address=#{address} and symbol=#{symbol} </select> <update id="updateTdCoinWalletAvaliable"> update td_coin_wallet set available_balance=available_balance+#{money} where address=#{address} </update> </mapper> src/main/resources/mapper/modules/TdFinancialRecordDao.xml
New file @@ -0,0 +1,5 @@ <?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="com.xcong.excoin.modules.member.mapper.TdFinancialReordDao"> </mapper> src/main/resources/templates/febs/views/modules/orderCoin/orderCoin.html
@@ -116,7 +116,7 @@ } else if (d.ipo == 0) { return '<span style="color:gray;">否</span>' } else{ return '<span style="color:red;">是</span>' return '<span>-</span>' } }, minWidth: 20,align:'center'},