From 1047866e4e73890bf64c9b35f1a7043b543d64fe Mon Sep 17 00:00:00 2001
From: zainali5120 <512061637@qq.com>
Date: Sun, 15 Nov 2020 11:07:48 +0800
Subject: [PATCH] 交易所到算力内部
---
src/main/resources/mapper/modules/TdFinancialRecordDao.xml | 7 ++
src/main/resources/templates/febs/views/modules/member/withdrawCoin.html | 11 ++-
src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java | 44 ++++++++------
src/main/java/com/xcong/excoin/modules/member/entity/TdFinancialReord.java | 59 +++++++++++++++++++
src/main/java/com/xcong/excoin/modules/member/mapper/TdFinancialReordDao.java | 8 ++
src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java | 1
src/main/resources/mapper/modules/MemberCoinWithdrawMapper.xml | 5 +
src/main/resources/application-test.yml | 10 +-
src/main/resources/application.yml | 2
src/main/java/com/xcong/excoin/modules/member/mapper/MemberCoinAddressMapper.java | 7 ++
src/main/resources/mapper/modules/MemberCoinAddressMapper.xml | 7 ++
11 files changed, 129 insertions(+), 32 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/TdFinancialReord.java b/src/main/java/com/xcong/excoin/modules/member/entity/TdFinancialReord.java
new file mode 100644
index 0000000..b1bb0fd
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/member/entity/TdFinancialReord.java
@@ -0,0 +1,59 @@
+package com.xcong.excoin.modules.member.entity;
+
+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;
+
+
+ /**
+ * 主键
+ */
+ private Long id;
+
+
+ /**
+ * 会员ID
+ */
+ private Long memId;
+
+
+ /**
+ * 类型
+ */
+ private String symbol;
+
+
+ /**
+ * 标题
+ */
+ private String title;
+
+
+ /**
+ * 明细内容
+ */
+ private String content;
+
+
+ /**
+ * 金额
+ */
+ private BigDecimal amount;
+
+
+ /**
+ * 创建时间
+ */
+ private Date createTime;
+
+ private String phone;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/xcong/excoin/modules/member/mapper/MemberCoinAddressMapper.java b/src/main/java/com/xcong/excoin/modules/member/mapper/MemberCoinAddressMapper.java
index b295ea4..a0e3213 100644
--- a/src/main/java/com/xcong/excoin/modules/member/mapper/MemberCoinAddressMapper.java
+++ b/src/main/java/com/xcong/excoin/modules/member/mapper/MemberCoinAddressMapper.java
@@ -2,7 +2,14 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
+import org.apache.ibatis.annotations.Param;
+
+import java.math.BigDecimal;
public interface MemberCoinAddressMapper extends BaseMapper<MemberCoinAddressEntity> {
+ MemberCoinAddressEntity selectSuanliWallet(String address);
+
+ void updateSuanliWallet(@Param("id") Long id,@Param("availableBalance") BigDecimal availableBalance);
+
}
diff --git a/src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java b/src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java
index 1c61502..feb08c1 100644
--- a/src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java
+++ b/src/main/java/com/xcong/excoin/modules/member/mapper/MemberWalletCoinMapper.java
@@ -9,4 +9,5 @@
MemberWalletCoinEntity findWalletCoinByMemberIdAndWalletCode(@Param("memberId")Long memberId, @Param("walletCode")String walletCode);
+
}
diff --git a/src/main/java/com/xcong/excoin/modules/member/mapper/TdFinancialReordDao.java b/src/main/java/com/xcong/excoin/modules/member/mapper/TdFinancialReordDao.java
new file mode 100644
index 0000000..3bea80f
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/member/mapper/TdFinancialReordDao.java
@@ -0,0 +1,8 @@
+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> {
+
+}
diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
index fec245b..9a0677e 100644
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
+++ b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
@@ -13,24 +13,8 @@
import com.xcong.excoin.modules.Sms106Send;
import com.xcong.excoin.modules.member.dto.MemberDetailConfirmDto;
import com.xcong.excoin.modules.member.dto.MemberLimitDto;
-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;
@@ -89,6 +73,7 @@
private final AgentFriendRelationMapper agentFriendRelationMapper;
private final RedisUtils redisUtils;
+ private final TdFinancialReordDao tdFinancialReordDao;
@Override
public IPage<AgentFriendRelationEntity> findAgentInfoListInPage(AgentFriendRelationEntity agentFriendRelationEntity,
@@ -441,6 +426,10 @@
String symbol = selectById.getSymbol();
String address = selectById.getAddress();
int status = selectById.getStatus();
+ BigDecimal feeAmount = selectById.getFeeAmount();
+ if(feeAmount==null){
+ feeAmount = BigDecimal.ZERO;
+ }
BigDecimal amount = selectById.getAmount();
if(status != 1) {
return new FebsResponse().fail().message("只有等待审核的状态才能确认!");
@@ -534,7 +523,24 @@
// usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf("."));
// }
// String s = ethService.tokenSend(address, usdtStr, null);
- }
+ // 判断是不是到交易所的
+ MemberCoinAddressEntity coinAddressEntity = memberCoinAddressMapper.selectSuanliWallet(address);
+ if(coinAddressEntity!=null){
+ // 是的
+ Long walletId = coinAddressEntity.getId();
+ // 插入充值记录
+ TdFinancialReord financialReord = new TdFinancialReord();
+ financialReord.setAmount(amount);
+ financialReord.setTitle("USDT链上充值");
+ financialReord.setContent("USDT链上充值");
+ financialReord.setSymbol(symbol);
+ financialReord.setCreateTime(new Date());
+ financialReord.setMemId(coinAddressEntity.getMemberId());
+ tdFinancialReordDao.insert(financialReord);
+ // 更新钱包
+ memberCoinAddressMapper.updateSuanliWallet(walletId,amount);
+ }
+ }
/**
//短信提醒
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 07a5012..1a1242b 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -15,20 +15,20 @@
datasource:
# 数据源-1,名称为 base
base:
- username: ct_test
+ username: shop_user
password: 123456
driver-class-name: com.mysql.cj.jdbc.Driver
- url: jdbc:mysql://120.27.238.55:3306/kss_framework?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
+ url: jdbc:mysql://47.96.73.250:3306/db_roc?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2b8
redis:
# Redis数据库索引(默认为 0)
- database: 0
+ database: 1
# Redis服务器地址
- host: 127.0.0.1
+ host: 47.96.73.250
# Redis服务器连接端口
port: 6379
# Redis 密码
- password:
+ password: qwer12345678
lettuce:
pool:
# 连接池中的最小空闲连接
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 1b5add6..8bc9691 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -5,7 +5,7 @@
spring:
profiles:
- active: prod
+ active: test
thymeleaf:
cache: false
diff --git a/src/main/resources/mapper/modules/MemberCoinAddressMapper.xml b/src/main/resources/mapper/modules/MemberCoinAddressMapper.xml
index 45e595e..9a1864e 100644
--- a/src/main/resources/mapper/modules/MemberCoinAddressMapper.xml
+++ b/src/main/resources/mapper/modules/MemberCoinAddressMapper.xml
@@ -17,4 +17,11 @@
order by s.create_time desc
</select>
+ <select id="selectSuanliWallet" parameterType="map" resultType="com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity">
+ select mem_id memberId,id from td_coin_wallet where address = #{address}
+ </select>
+
+ <update id="updateSuanliWallet" parameterType="map" >
+ update td_coin_wallet set available_balance = available_balance + #{availableBalance} where id = #{id}
+ </update>
</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/modules/MemberCoinWithdrawMapper.xml b/src/main/resources/mapper/modules/MemberCoinWithdrawMapper.xml
index 4692c5e..9002b09 100644
--- a/src/main/resources/mapper/modules/MemberCoinWithdrawMapper.xml
+++ b/src/main/resources/mapper/modules/MemberCoinWithdrawMapper.xml
@@ -2,7 +2,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.MemberCoinWithdrawMapper">
- <select id="findmemberWithdrawCoinListInPage" resultType="com.xcong.excoin.modules.member.vo.MemberCoinWithdrawVo"> SELECT
+ <select id="findmemberWithdrawCoinListInPage" resultType="com.xcong.excoin.modules.member.vo.MemberCoinWithdrawVo">
+ SELECT
s.id,
s.create_time,
m.email,
@@ -14,7 +15,7 @@
s.fee_amount,
s.symbol,
s.status,
- s.is_inside,
+ case when is_inside = 'N' and EXISTS (select * from td_coin_wallet where address = s.address) then 'J' else s.is_inside end isInside,
concat(auth.first_name,auth.second_name) as realName,
(select phone from member where id = (select member_id from member_coin_address where address =s.address and symbol =s.symbol and is_biyict=1)) insidePhone
FROM
diff --git a/src/main/resources/mapper/modules/TdFinancialRecordDao.xml b/src/main/resources/mapper/modules/TdFinancialRecordDao.xml
new file mode 100644
index 0000000..2e5f30d
--- /dev/null
+++ b/src/main/resources/mapper/modules/TdFinancialRecordDao.xml
@@ -0,0 +1,7 @@
+<?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>
\ No newline at end of file
diff --git a/src/main/resources/templates/febs/views/modules/member/withdrawCoin.html b/src/main/resources/templates/febs/views/modules/member/withdrawCoin.html
index 5194fc1..3039741 100644
--- a/src/main/resources/templates/febs/views/modules/member/withdrawCoin.html
+++ b/src/main/resources/templates/febs/views/modules/member/withdrawCoin.html
@@ -68,11 +68,10 @@
<!-- <span class="layui-badge-dot febs-bg-orange"></span> 无权限-->
<!-- </span>-->
{{# if(d.status === 1) { }}
- <a lay-event="confirm" shiro:hasPermission="coin:check">确认</a>
- <a lay-event="cancel" shiro:hasPermission="coin:check">拒绝</a>
- <a lay-event="examine" >查看</a>
+ <a lay-event="confirm" shiro:hasPermission="coin:check" >确认</a>
+ <a lay-event="cancel" shiro:hasPermission="coin:check" >拒绝</a>
{{# } else { }}
- <a lay-event="examine" >查看</a>
+
{{# } }}
</script>
<!-- 表格操作栏 end -->
@@ -168,7 +167,9 @@
templet: function (d) {
if (d.isInside === 'Y') {
return '<span style="color:red;">是</span>'
- } else {
+ } else if(d.isInside === 'J') {
+ return '<span style="color:red;">算力</span>'
+ }else{
return '<span style="color:green;">否</span>'
}
},minWidth: 100,align:'center'},
--
Gitblit v1.9.1