From 078a41e738820e052007fdc77fb0ee851eabadf1 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Thu, 16 Apr 2026 10:40:22 +0800
Subject: [PATCH] refactor(blockchain): 删除区块链相关功能模块
---
/dev/null | 14 -------
src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java | 8 ----
pom.xml | 48 ------------------------
3 files changed, 0 insertions(+), 70 deletions(-)
diff --git a/CoreTechnicalStrategy_Usage_Guide.md b/CoreTechnicalStrategy_Usage_Guide.md
deleted file mode 100644
index ace716c..0000000
--- a/CoreTechnicalStrategy_Usage_Guide.md
+++ /dev/null
@@ -1,150 +0,0 @@
-# CoreTechnicalStrategy 使用指南
-
-## 功能概述
-CoreTechnicalStrategy 是一个集成了多种技术指标的交易策略类,用于生成做多、做空、买入和卖出信号。它整合了以下核心指标:
-- 三重 EMA 交叉系统 (9/21/55 周期)
-- 波动率自适应布林带
-- MACD 能量柱分级策略
-- RSI (相对强弱指标)
-- KDJ 指标
-
-## 所需参数
-
-### 1. 初始化参数
-```java
-CoreTechnicalStrategy strategy = new CoreTechnicalStrategy();
-```
-
-### 2. 初始化价格历史
-在使用策略之前,需要先初始化价格历史数据:
-```java
-List<BigDecimal> historicalPrices = Arrays.asList(
- new BigDecimal(30000),
- new BigDecimal(30100),
- new BigDecimal(30200),
- // 添加更多历史价格数据,建议至少包含 60 个数据点
-);
-strategy.init(historicalPrices);
-```
-
-### 3. 获取交易信号参数
-调用 `getSignal` 方法获取交易信号,需要传入以下参数:
-
-| 参数名 | 类型 | 描述 | 示例值 |
-|--------|------|------|--------|
-| accountName | String | 账户名称 | "main_account" |
-| markPx | String | 当前标记价格 | "30500.50" |
-| posSide | String | 当前持仓方向 | "long" 或 "short" 或 "net" |
-
-### 4. 持仓方向说明
-- `"long"`: 多头持仓
-- `"short"`: 空头持仓
-- `"net"`: 净持仓(无方向)
-
-## 使用示例
-
-```java
-import com.xcong.excoin.modules.okxNewPrice.indicator.strategy.CoreTechnicalStrategy;
-import com.xcong.excoin.modules.okxNewPrice.okxWs.param.TradeRequestParam;
-import com.xcong.excoin.modules.okxNewPrice.okxWs.param.TradeSignal;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class CoreTechnicalStrategyExample {
- public static void main(String[] args) {
- // 1. 创建策略实例
- CoreTechnicalStrategy strategy = new CoreTechnicalStrategy();
-
- // 2. 准备历史价格数据
- List<BigDecimal> historicalPrices = new ArrayList<>();
- // 假设我们有过去 100 个价格数据
- for (int i = 0; i < 100; i++) {
- historicalPrices.add(new BigDecimal(30000 + i * 10));
- }
-
- // 3. 初始化策略
- strategy.initialize();
-
- // 4. 更新初始价格历史
- strategy.updatePrices(historicalPrices);
-
- // 5. 定期更新价格(例如每分钟获取一次最新价格)
- // 这里的价格是指交易资产的当前市场价格,如加密货币的标记价格或股票的实时价格
- BigDecimal newMarketPrice = new BigDecimal("31050.75");
- List<BigDecimal> newPrices = Collections.singletonList(newMarketPrice);
- strategy.updatePrices(newPrices);
-
- // 6. 获取交易信号
- String accountName = "trading_account";
- String currentPrice = newMarketPrice.toString();
- String currentPosition = "net"; // 当前无持仓
-
- TradeRequestParam tradeParam = strategy.getSignal(accountName, currentPrice, currentPosition);
-
- // 7. 处理交易信号
- if (tradeParam.getSignal() == TradeSignal.BUY) {
- System.out.println("执行买入操作");
- // 调用交易API执行买入
- } else if (tradeParam.getSignal() == TradeSignal.SELL) {
- System.out.println("执行卖出操作");
- // 调用交易API执行卖出
- } else {
- System.out.println("无交易信号");
- }
- }
-}
-
-## 返回值说明
-
-`getSignal` 方法返回 `TradeRequestParam` 对象,包含以下主要属性:
-
-| 属性名 | 类型 | 描述 |
-|--------|------|------|
-| accountName | String | 账户名称 |
-| markPx | String | 当前标记价格 |
-| posSide | String | 持仓方向 |
-| signal | TradeSignal | 交易信号:BUY、SELL 或 NO_SIGNAL |
-| side | String | 交易方向:"buy" 或 "sell" |
-| tradeType | String | 交易类型:"open"(开仓)或 "close"(平仓) |
-
-## 核心指标逻辑说明
-
-### 1. 三重 EMA 交叉系统
-- **多头排列**:9EMA > 21EMA > 55EMA
-- **空头排列**:9EMA < 21EMA < 55EMA
-- **震荡过滤**:当三线粘合度 < 2% 时暂停交易
-
-### 2. 波动率自适应布林带
-- **动态标准差倍数**:根据 ATR(平均真实范围)自动调整
- - ATR < 0.5% 时,使用 2 倍标准差
- - 0.5% ≤ ATR < 1% 时,使用 2.5 倍标准差
- - ATR ≥ 1% 时,使用 3 倍标准差
-- **做空信号**:价格突破上轨 + 成交量放大
-- **做多信号**:价格触及下轨 + 正资金费率
-
-### 3. MACD 能量柱分级策略
-- **多头入场**:当前能量柱 > 0 且面积增速 > 前周期 20%
-- **空头反转**:能量柱顶背离 + RSI > 70 区域死叉
-
-## 注意事项
-
-1. **数据充足性**:确保提供足够的历史价格数据(至少 60 个数据点),以便所有指标能准确计算
-
-2. **价格更新**:策略不会自动更新价格历史,需要外部定期调用 `updatePrices` 方法添加新价格。这里的价格是指交易资产的市场价格(如加密货币的当前标记价格、股票的实时价格等),用于计算技术指标。
-
-3. **参数调整**:可以根据市场情况调整指标参数,如 EMA 周期、布林带参数等
-
-4. **风险控制**:本策略仅提供交易信号,实际交易时应结合风险控制措施
-
-## 错误处理
-
-- 如果策略未初始化或价格历史为空,将返回 NO_SIGNAL
-- 如果计算过程中发生异常,将返回 NO_SIGNAL 并记录错误日志
-
-## 依赖关系
-
-- Java 8 或更高版本
-- Lombok 库(用于自动生成 getter/setter 方法)
-- Apache Commons Math 库(用于数学计算)
\ No newline at end of file
diff --git a/MacdMaStrategy_Analysis.md b/MacdMaStrategy_Analysis.md
deleted file mode 100644
index 16e7228..0000000
--- a/MacdMaStrategy_Analysis.md
+++ /dev/null
@@ -1,224 +0,0 @@
-# MacdMaStrategy.java 类逻辑梳理
-
-## 1. 类概述
-
-MacdMaStrategy.java是一个专为ETH合约设计的MACD+MA复合交易策略实现类,结合了移动平均线(MA)的趋势判断能力和MACD指标的动量分析能力,通过RSI和波动率指标进行风险控制和信号过滤。
-
-## 2. 核心组成部分
-
-### 2.1 技术指标实例
-
-类中初始化了以下技术指标:
-
-```java
-// MACD指标:用于判断价格动量和趋势变化
-private final MACD macd = new MACD();
-// 30日移动平均线:ETH波动较大,使用更短的周期捕捉趋势变化
-private final MovingAverage ma30 = new MovingAverage(30);
-// 100日移动平均线:ETH作为高波动资产,长期趋势判断使用更短周期
-private final MovingAverage ma100 = new MovingAverage(100);
-// RSI指标(10周期):ETH波动快,使用更短周期提高响应速度
-private final RSI rsi = new RSI(10);
-// 波动率指标(15周期):ETH波动频繁,使用更短周期捕捉市场变化
-private final Volatility volatility = new Volatility(15);
-```
-
-### 2.2 状态变量
-
-```java
-// 最新价格:用于策略判断
-private BigDecimal lastPrice;
-// 当前市场趋势:牛市/熊市
-private TrendDirection trend;
-```
-
-### 2.3 枚举类型
-
-定义了两个内部枚举类型用于状态表示:
-
-```java
-enum PositionStatus { FLAT, LONG, SHORT } // 持仓状态:空仓/多头/空头
-enum TrendDirection { BULLISH, BEARISH } // 趋势方向:牛市/熊市
-```
-
-## 3. 策略执行流程
-
-### 3.1 主执行入口
-
-```java
-public void execute(List<BigDecimal> prices) {
- // 验证输入数据完整性:策略需要至少200个价格数据点
- if (prices.size() < 200) {
- throw new IllegalArgumentException("至少需要200个价格数据点才能运行该策略");
- }
- updateIndicators(prices); // 更新所有技术指标
- getTrend(); // 确定当前市场趋势
-}
-```
-
-### 3.2 指标更新
-
-```java
-private void updateIndicators(List<BigDecimal> prices) {
- // 先计算波动率指标,因为MACD需要用它来动态调整周期
- volatility.calculate(prices);
- // 计算MACD指标并传入波动率参数,实现动态周期调整
- macd.calculate(prices, volatility.getValue());
- // 计算移动平均线指标
- ma30.calculate(prices); // 计算30日移动平均线
- ma100.calculate(prices); // 计算100日移动平均线
- // 计算RSI指标
- rsi.calculate(prices);
- // 更新最新价格
- lastPrice = prices.get(prices.size()-1);
-}
-```
-
-### 3.3 趋势判断
-
-```java
-public TrendDirection getTrend() {
- return determineTrend();
-}
-
-private TrendDirection determineTrend() {
- BigDecimal currentMa100 = ma100.getMa(); // 获取当前100日移动平均线
- // 根据最新价格与100日MA的关系判断趋势:价格高于100日MA为牛市,否则为熊市
- return lastPrice.compareTo(currentMa100) > 0 ?
- TrendDirection.BULLISH : TrendDirection.BEARISH;
-}
-```
-
-## 4. 交易信号生成
-
-### 4.1 入场信号检查
-
-```java
-public TradeRequestParam getOrderParamOpen(TradeRequestParam tradeRequestParam) {
- return checkEntrySignal(tradeRequestParam);
-}
-
-private TradeRequestParam checkEntrySignal(TradeRequestParam tradeRequestParam) {
- String poSide = null;
- BigDecimal currentMa30 = ma30.getMa();
- BigDecimal currentDif = macd.getDif();
- BigDecimal currentDea = macd.getDea();
- BigDecimal macdBar = macd.getMacdBar();
- BigDecimal currentRsi = rsi.getRsi();
- BigDecimal currentVolatility = volatility.getValue();
-
- if (trend == TrendDirection.BULLISH) {
- // 牛市入场条件:MACD多头信号、MACD柱状图为正、价格在30日MA之上、RSI合理、波动率适中
- boolean macdBull = currentDif.compareTo(currentDea) > 0;
- boolean macdBarPositive = macdBar.compareTo(BigDecimal.ZERO) > 0;
- BigDecimal priceMaDiff = lastPrice.subtract(currentMa30);
- boolean priceAboveMAWithStrength = priceMaDiff.compareTo(currentMa30.multiply(new BigDecimal("0.005"))) > 0;
- boolean rsiInRange = currentRsi.compareTo(new BigDecimal(40)) > 0 && currentRsi.compareTo(new BigDecimal(65)) < 0;
- boolean volatilityModerate = currentVolatility.compareTo(new BigDecimal("0.005")) > 0 &&
- currentVolatility.compareTo(new BigDecimal("0.05")) < 0;
-
- if (macdBull && macdBarPositive && priceAboveMAWithStrength && rsiInRange && volatilityModerate) {
- poSide = CoinEnums.POSSIDE_LONG.getCode();
- }
- } else if (trend == TrendDirection.BEARISH) {
- // 熊市入场条件:MACD空头信号、MACD柱状图为负、价格在30日MA之下、RSI合理、波动率适中
- boolean macdBear = currentDif.compareTo(currentDea) < 0;
- boolean macdBarNegative = macdBar.compareTo(BigDecimal.ZERO) < 0;
- BigDecimal priceMaDiff = currentMa30.subtract(lastPrice);
- boolean priceBelowMAWithStrength = priceMaDiff.compareTo(currentMa30.multiply(new BigDecimal("0.005"))) > 0;
- boolean rsiInRange = currentRsi.compareTo(new BigDecimal(35)) > 0 && currentRsi.compareTo(new BigDecimal(60)) < 0;
- boolean volatilityModerate = currentVolatility.compareTo(new BigDecimal("0.005")) > 0 &&
- currentVolatility.compareTo(new BigDecimal("0.05")) < 0;
-
- if (macdBear && macdBarNegative && priceBelowMAWithStrength && rsiInRange && volatilityModerate) {
- poSide = CoinEnums.POSSIDE_SHORT.getCode();
- }
- }
- tradeRequestParam.setPosSide(poSide);
- return tradeRequestParam;
-}
-```
-
-### 4.2 离场信号检查
-
-```java
-public TradeRequestParam getOrderParamClose(TradeRequestParam tradeRequestParam) {
- return checkExitSignal(tradeRequestParam);
-}
-
-private TradeRequestParam checkExitSignal(TradeRequestParam tradeRequestParam) {
- BigDecimal currentMa30 = ma30.getMa();
- BigDecimal currentDif = macd.getDif();
- BigDecimal currentDea = macd.getDea();
- String posSide = tradeRequestParam.getPosSide();
-
- if (posSide == CoinEnums.POSSIDE_LONG.getCode()) {
- // 多头持仓离场条件:MACD转为空头信号且价格跌破30日MA
- boolean macdExit = currentDif.compareTo(currentDea) < 0;
- boolean priceExit = lastPrice.compareTo(currentMa30) < 0;
-
- if (macdExit && priceExit) {
- tradeRequestParam.setSide(CoinEnums.SIDE_SELL.getCode());
- }
- } else if (posSide == CoinEnums.POSSIDE_SHORT.getCode()) {
- // 空头持仓离场条件:MACD转为多头信号且价格突破30日MA
- boolean macdExit = currentDif.compareTo(currentDea) > 0;
- boolean priceExit = lastPrice.compareTo(currentMa30) > 0;
-
- if (macdExit && priceExit) {
- tradeRequestParam.setSide(CoinEnums.SIDE_BUY.getCode());
- }
- }
- return tradeRequestParam;
-}
-```
-
-## 5. 交易过滤机制
-
-### 5.1 交易跳过检查
-
-```java
-public boolean getSkip() {
- return shouldSkipTrade();
-}
-
-private boolean shouldSkipTrade() {
- // 波动率过滤:当波动率小于1%时,市场活跃度不足,跳过交易
- if (volatility.getValue().compareTo(new BigDecimal("0.01")) < 0) {
- return true;
- }
-
- // RSI极端值过滤:
- // 1. 牛市中RSI>65表示超买,避免追高
- // 2. 熊市中RSI<35表示超卖,避免追空
- if (trend == TrendDirection.BULLISH && rsi.getRsi().compareTo(new BigDecimal(65)) > 0) {
- return true;
- }
- if (trend == TrendDirection.BEARISH && rsi.getRsi().compareTo(new BigDecimal(35)) < 0) {
- return true;
- }
- return false;
-}
-```
-
-## 6. 策略核心特点
-
-1. **动态参数调整**:MACD周期根据市场波动率自动调整,适应ETH高波动特性
-2. **多重指标验证**:结合MACD、MA、RSI和波动率指标进行综合判断
-3. **严格的风险控制**:通过波动率过滤和RSI极端值过滤降低交易风险
-4. **精确的入场时机**:要求价格在MA之上/之下有一定偏离,避免假突破
-5. **明确的离场条件**:MACD信号反转且价格突破MA时离场,确保及时止盈止损
-
-## 7. 代码优化建议
-
-1. **完善日志记录**:在关键决策点添加日志记录,便于策略调试和分析
-2. **增加止盈止损机制**:当前代码缺少明确的止盈止损价格设置和判断
-3. **仓位管理**:建议添加基于风险的仓位计算逻辑
-4. **策略参数外部化**:将策略参数(如周期、阈值)配置为外部参数,便于调整
-5. **结果返回优化**:execute方法可以返回策略执行结果,方便调用方获取交易信号
-
-## 8. 总结
-
-MacdMaStrategy.java实现了一个完整的MACD+MA复合交易策略,专为ETH合约设计。该策略通过结合多种技术指标,实现了趋势判断、入场时机选择和风险控制的功能。策略执行流程清晰,从指标更新到趋势判断,再到交易信号生成和过滤,形成了一个完整的交易决策系统。
-
-该策略的核心优势在于动态参数调整和多重指标验证,能够较好地适应ETH高波动的市场特性,同时通过严格的过滤机制降低交易风险。
\ No newline at end of file
diff --git a/indicator_package_documentation.md b/indicator_package_documentation.md
deleted file mode 100644
index 280a23a..0000000
--- a/indicator_package_documentation.md
+++ /dev/null
@@ -1,288 +0,0 @@
-# com.xcong.excoin.modules.okxNewPrice.indicator 包文档
-
-## 1. 包概述
-
-该包实现了一套完整的技术指标分析系统,包含基础指标计算、高级指标策略以及信号生成功能。主要用于加密货币交易中的技术分析和策略决策,支持三重EMA交叉系统、波动率自适应布林带、MACD能量柱分级策略等高级分析方法。
-
-## 2. 类层次结构
-
-```
-├── IndicatorBase (抽象基类)
-│ ├── MA (简单移动平均线)
-│ ├── AdvancedMA (三重EMA交叉系统)
-│ ├── BOLL (波动率自适应布林带)
-│ ├── MACD (移动平均线收敛发散)
-│ ├── RSI (相对强弱指标)
-│ └── KDJ (随机指标)
-└── strategy/
- ├── TechnicalIndicatorStrategy (策略接口)
- ├── AbstractTechnicalIndicatorStrategy (策略抽象基类)
- ├── CoreTechnicalStrategy (核心技术指标策略)
- ├── ComprehensiveTechnicalStrategy (综合技术指标策略)
- └── TradeSignal (交易信号枚举)
-```
-
-## 3. 核心类详解
-
-### 3.1 IndicatorBase (指标基类)
-
-**功能**:提供所有技术指标的通用计算方法
-
-**核心方法**:
-- `calculateMA(List<BigDecimal> prices, int period)` - 计算移动平均值
-- `calculateEMA(List<BigDecimal> prices, int period, BigDecimal prevEMA)` - 计算指数移动平均值
-- `calculateStdDev(List<BigDecimal> prices, int period)` - 计算标准差
-- `getRecentPrices(List<BigDecimal> prices, int period)` - 获取最近N个价格数据
-
-**使用场景**:作为所有指标类的父类,提供基础计算功能
-
-### 3.2 MA (移动平均线)
-
-**功能**:实现标准周期的移动平均线指标
-
-**支持的周期**:
-- MA5/MA10/MA20/MA30/MA60 (简单移动平均线)
-- EMA5/EMA10/EMA20/EMA30/EMA60 (指数移动平均线)
-
-**核心方法**:
-- `calculate(List<BigDecimal> prices)` - 计算所有周期的移动平均线
-- `isGoldenCross()` - 判断金叉信号
-- `isDeathCross()` - 判断死叉信号
-
-**使用场景**:用于基本趋势判断和交叉信号分析
-
-### 3.3 AdvancedMA (高级移动平均线)
-
-**功能**:实现三重EMA交叉系统,用于高级趋势分析
-
-**支持的周期**:EMA9/EMA21/EMA55 (三重EMA交叉系统)
-
-**核心方法**:
-- `calculateTripleEMA(List<BigDecimal> prices)` - 计算三重EMA指标
-- `isBullish()` - 判断多头排列 (9EMA > 21EMA > 55EMA)
-- `isBearish()` - 判断空头排列 (9EMA < 21EMA < 55EMA)
-- `calculatePercent()` - 计算三线粘合度
-- `isUpAndDown()` - 判断震荡行情 (粘合度 < 2%)
-
-**使用场景**:用于判断市场趋势强度和过滤震荡行情
-
-### 3.4 BOLL (布林带)
-
-**功能**:实现波动率自适应布林带指标
-
-**计算逻辑**:
-- 中轨(MB)= N日移动平均线
-- 上轨(UP)= 中轨 + K倍标准差
-- 下轨(DN)= 中轨 - K倍标准差
-
-**核心方法**:
-- `calculate(List<BigDecimal> prices)` - 计算布林带指标
-- `isBreakUpper()` - 判断价格突破上轨
-- `isBreakLower()` - 判断价格跌破下轨
-- `isReturnFromUpper()` - 判断价格回归上轨下方
-- `isReturnFromLower()` - 判断价格回归下轨上方
-- `calculateBandWidth()` - 计算布林带宽度
-
-**使用场景**:用于判断价格波动范围和突破信号
-
-### 3.5 MACD (移动平均线收敛发散)
-
-**功能**:实现MACD指标,包括DIF、DEA和柱状图
-
-**计算逻辑**:
-- DIF = EMA(12) - EMA(26)
-- DEA = EMA(DIF, 9)
-- MACD柱状图 = (DIF - DEA) * 2
-
-**核心方法**:
-- `calculate(List<BigDecimal> prices)` - 计算MACD指标
-- `isGoldenCross()` - 判断金叉信号(DIF上穿DEA)
-- `isDeathCross()` - 判断死叉信号(DIF下穿DEA)
-
-**使用场景**:用于判断价格动量和趋势强度
-
-### 3.6 RSI (相对强弱指标)
-
-**功能**:实现相对强弱指标,用于判断超买超卖
-
-**计算逻辑**:
-- RSI = 100 - (100 / (1 + (平均上涨幅度 / 平均下跌幅度)))
-
-**核心方法**:
-- `calculate(List<BigDecimal> prices)` - 计算RSI指标
-- `isOverbought()` - 判断超买 (RSI > 70)
-- `isOversold()` - 判断超卖 (RSI < 30)
-- `isExtremelyOverbought()` - 判断严重超买 (RSI > 80)
-- `isExtremelyOversold()` - 判断严重超卖 (RSI < 20)
-
-**使用场景**:用于判断市场情绪和价格反转点
-
-### 3.7 KDJ (随机指标)
-
-**功能**:实现KDJ指标,用于判断价格反转和超买超卖
-
-**计算逻辑**:
-- RSV = (收盘价 - N日内最低价) / (N日内最高价 - N日内最低价) * 100
-- K = 2/3 * 前一日K值 + 1/3 * 当日RSV
-- D = 2/3 * 前一日D值 + 1/3 * 当日K值
-- J = 3*K - 2*D
-
-**核心方法**:
-- `calculate(List<BigDecimal> prices)` - 计算KDJ指标
-- `isOverbought()` - 判断超买 (K > 80)
-- `isOversold()` - 判断超卖 (K < 20)
-- `isGoldenCross()` - 判断金叉信号(K线上穿D线)
-- `isDeathCross()` - 判断死叉信号(K线下穿D线)
-
-**使用场景**:用于判断价格短期反转和超买超卖
-
-## 4. 策略相关类
-
-### 4.1 TechnicalIndicatorStrategy (策略接口)
-
-**功能**:定义技术指标策略的基本方法
-
-**核心方法**:
-- `initialize()` - 初始化策略
-- `updatePrices(List<BigDecimal> prices)` - 更新价格数据
-- `getSignal()` - 获取交易信号
-- `getStrategyName()` - 获取策略名称
-- `isValid()` - 判断策略是否有效
-
-**使用场景**:作为所有技术指标策略的接口,定义统一的方法规范
-
-### 4.2 AbstractTechnicalIndicatorStrategy (策略抽象基类)
-
-**功能**:提供技术指标策略的通用功能
-
-**核心功能**:
-- 价格历史管理(最多保存100条记录)
-- 策略初始化
-- 价格更新
-- 交易请求参数创建
-
-**使用场景**:作为所有具体策略的父类,提供基础功能
-
-### 4.3 TradeSignal (交易信号枚举)
-
-**功能**:定义所有可能的交易信号类型
-
-**信号类型**:
-- NO_SIGNAL (无信号)
-- BUY (买入)
-- SELL (卖出)
-- OPEN_LONG (开多)
-- CLOSE_LONG (平多)
-- OPEN_SHORT (开空)
-- CLOSE_SHORT (平空)
-- STOP_LOSS (止损)
-- TAKE_PROFIT (止盈)
-
-**使用场景**:用于策略生成和传递交易信号
-
-### 4.4 CoreTechnicalStrategy (核心技术指标策略)
-
-**功能**:整合三重EMA交叉系统、波动率自适应布林带、MACD能量柱分级策略等高级指标
-
-**核心特点**:
-- 波动率自适应布林带(根据ATR动态调整标准差倍数)
-- MACD能量柱面积指标(累计过去5根柱体积分)
-- 多重指标综合分析(EMA、MACD、RSI、KDJ、BOLL)
-- 震荡行情过滤(三线粘合度 < 2%)
-
-**交易信号生成规则**:
-- 多头入场:当前柱体>0且面积增速>前周期20%
-- 空头入场:当前柱体<0且面积增速>前周期20%
-- 突破上轨+成交量放大3倍=做空信号
-- 触及下轨+期货资金费率转正=做多信号
-- 空头反转:柱体顶背离+RSI>70区域死叉
-- 多头反转:柱体底背离+RSI<30区域金叉
-
-**使用场景**:用于复杂的技术分析和交易决策
-
-### 4.5 ComprehensiveTechnicalStrategy (综合技术指标策略)
-
-**功能**:整合MACD、KDJ、RSI、BOLL等指标生成交易信号
-
-**核心特点**:
-- 基于多空方向分别分析信号
-- 结合超买超卖条件和指标交叉信号
-- 简化的信号生成逻辑
-
-**交易信号生成规则**:
-- 多头方向:RSI超卖+KDJ金叉或布林带下轨突破+MACD金叉=买入信号
-- 多头方向:RSI超买+KDJ死叉或布林带上轨突破+MACD死叉=卖出信号
-- 空头方向:RSI超买+KDJ死叉或布林带上轨突破+MACD死叉=卖出信号
-- 空头方向:RSI超卖+KDJ金叉或布林带下轨突破+MACD金叉=买入信号
-
-**使用场景**:用于较为简单的技术分析和交易决策
-
-## 5. 工作流程
-
-```
-1. 初始化策略(initialize())
-2. 更新价格数据(updatePrices())
-3. 计算技术指标(calculate())
-4. 分析交易信号(analyzeSignal())
-5. 生成交易请求参数(createTradeRequestParam())
-6. 执行交易操作
-```
-
-## 6. 如何使用
-
-### 6.1 基本使用示例
-
-```java
-// 创建策略实例
-CoreTechnicalStrategy strategy = new CoreTechnicalStrategy();
-
-// 初始化策略
-strategy.initialize();
-
-// 更新价格数据(需要外部定期调用)
-List<BigDecimal> prices = new ArrayList<>();
-// 添加价格数据...
-strategy.updatePrices(prices);
-
-// 获取交易信号
-TradeRequestParam param = strategy.getSignal("account1", "45000.0", "long");
-
-// 处理交易信号
-if (TradeSignal.BUY.equals(param.getSignal())) {
- // 执行买入操作
-} else if (TradeSignal.SELL.equals(param.getSignal())) {
- // 执行卖出操作
-}
-```
-
-### 6.2 参数说明
-
-- `accountName`:账户名称,用于标识交易账户
-- `markPx`:当前标记价格,用于计算指标和生成信号
-- `posSide`:仓位方向,取值为"long"(多头)或"short"(空头)
-
-### 6.3 价格更新说明
-
-策略不会自动更新价格历史,需要外部定期调用`updatePrices()`方法添加新价格。价格历史最多保存100条记录,超过时会自动移除最旧的价格记录。
-
-## 7. 代码优化建议
-
-1. **性能优化**:
- - 考虑使用缓存机制存储已计算的指标值
- - 对于高频更新的场景,可实现增量计算
-
-2. **功能扩展**:
- - 添加更多技术指标(如ATR、OBV等)
- - 实现回测功能,支持历史数据验证
-
-3. **鲁棒性提升**:
- - 增加异常处理和参数验证
- - 实现策略监控和告警机制
-
-4. **可维护性**:
- - 提取常量到配置文件
- - 增强日志记录,便于调试和分析
-
-## 8. 总结
-
-该包提供了一套完整的技术指标分析系统,支持从基础指标计算到高级策略分析的全流程。通过整合多种技术指标,实现了复杂的交易信号生成逻辑,可用于加密货币交易中的技术分析和策略决策。系统设计遵循面向对象原则,具有良好的可扩展性和可维护性。
\ No newline at end of file
diff --git a/lib/abi-0.4.0.jar b/lib/abi-0.4.0.jar
deleted file mode 100644
index cf65d8d..0000000
--- a/lib/abi-0.4.0.jar
+++ /dev/null
Binary files differ
diff --git a/lib/huobi-client-1.0.8-SNAPSHOT.jar b/lib/huobi-client-1.0.8-SNAPSHOT.jar
deleted file mode 100644
index 09f96ca..0000000
--- a/lib/huobi-client-1.0.8-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/lib/ripple-core-0.0.1-SNAPSHOT.jar b/lib/ripple-core-0.0.1-SNAPSHOT.jar
deleted file mode 100644
index e3744e0..0000000
--- a/lib/ripple-core-0.0.1-SNAPSHOT.jar
+++ /dev/null
Binary files differ
diff --git a/lib/tron-sdk.jar b/lib/tron-sdk.jar
deleted file mode 100644
index f2eb481..0000000
--- a/lib/tron-sdk.jar
+++ /dev/null
Binary files differ
diff --git a/pom.xml b/pom.xml
index 2c27f4e..2544a4b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,26 +37,11 @@
<dependencies>
<dependency>
- <groupId>ripple</groupId>
- <artifactId>ripple</artifactId>
- <version>0.0.1</version>
- <scope>system</scope>
- <systemPath>${basedir}/lib/ripple-core-0.0.1-SNAPSHOT.jar</systemPath>
- </dependency>
-
- <dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20230618</version>
</dependency>
-
-
- <dependency>
- <groupId>org.web3j</groupId>
- <artifactId>core</artifactId>
- <version>4.5.5</version>
- </dependency>
<dependency>
@@ -70,19 +55,6 @@
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.6.0</version>
- </dependency>
-
- <!-- https://mvnrepository.com/artifact/org.web3j/parity -->
- <dependency>
- <groupId>org.web3j</groupId>
- <artifactId>parity</artifactId>
- <version>4.5.10</version>
- <exclusions>
- <exclusion>
- <artifactId>core</artifactId>
- <groupId>org.web3j</groupId>
- </exclusion>
- </exclusions>
</dependency>
<dependency>
@@ -176,18 +148,6 @@
<version>${mysql-driver.version}</version>
</dependency>
- <dependency>
- <groupId>org.web3j</groupId>
- <artifactId>core</artifactId>
- <version>4.5.5</version>
- </dependency>
- <!-- https://mvnrepository.com/artifact/org.web3j/parity -->
- <dependency>
- <groupId>org.web3j</groupId>
- <artifactId>parity</artifactId>
- <version>4.5.10</version>
- </dependency>
-
<!-- 参数校验 start -->
<dependency>
<groupId>javax.validation</groupId>
@@ -277,14 +237,6 @@
<version>${aliyun-oss.version}</version>
</dependency>
- <dependency>
- <groupId>com.huobi.sdk</groupId>
- <artifactId>huobi-client</artifactId>
- <version>1.0.8-SNAPSHOT</version>
- <scope>system</scope>
- <systemPath>${basedir}/lib/huobi-client-1.0.8-SNAPSHOT.jar</systemPath>
- </dependency>
-
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
diff --git a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java b/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
deleted file mode 100644
index a59ba96..0000000
--- a/src/main/java/com/xcong/excoin/common/LoginUserUtils.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.xcong.excoin.common;
-
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.exception.GlobalException;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.SpringContextHolder;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.http.HttpRequest;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-
-/**
- * 登陆用户工具类
- *
- * @author wzy
- * @date 2020-05-14
- **/
-@Slf4j
-public class LoginUserUtils {
-
- private static final String ANON = "anonymousUser";
-
- public static MemberEntity getAppLoginUser() {
- if (SecurityContextHolder.getContext().getAuthentication().getPrincipal().equals(ANON)) {
- throw new GlobalException("无法获取登陆信息");
- } else {
- return (MemberEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- }
- }
-
- public static String getAppLoginUserToken() {
- return (String) SecurityContextHolder.getContext().getAuthentication().getCredentials();
- }
-
- public static void resetAppLoginUser(MemberEntity memberEntity) {
- String token = getAppLoginUserToken();
- RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
- String jsonStr = redisUtils.getString(AppContants.PC_LOGIN_PREFIX + token);
- if (StrUtil.isNotBlank(jsonStr)) {
- redisUtils.set(AppContants.PC_LOGIN_PREFIX + token, JSONObject.toJSONString(memberEntity));
- } else {
- redisUtils.set(AppContants.APP_LOGIN_PREFIX + token, JSONObject.toJSONString(memberEntity));
- }
- }
-
- /**
- * mybatis 拦截器专用
- *
- * @return MemberEntity
- */
- public static MemberEntity getUser() {
- if (SecurityContextHolder.getContext().getAuthentication() == null) {
- return null;
- }
-
- if (SecurityContextHolder.getContext().getAuthentication().getPrincipal().equals(ANON)) {
- return null;
- } else {
- return (MemberEntity) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
- }
- }
-
- public static boolean isBrowser(HttpServletRequest request) {
- String userAgent = request.getHeader("user-agent");
- if (userAgent.toLowerCase().contains("mobile") || userAgent.contains("CFNetwork") || userAgent.toLowerCase().contains("okhttp")) {
- return false;
- }
- return true;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/common/system/bean/LoginUserBean.java b/src/main/java/com/xcong/excoin/common/system/bean/LoginUserBean.java
deleted file mode 100644
index 0924317..0000000
--- a/src/main/java/com/xcong/excoin/common/system/bean/LoginUserBean.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.xcong.excoin.common.system.bean;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetails;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-12
- **/
-@Getter
-@AllArgsConstructor
-public class LoginUserBean implements UserDetails {
-
- private final MemberEntity memberEntity;
-
- private final List<Long> roles;
-
- private final List<GrantedAuthority> authorities;
-
- @JsonIgnore
- @Override
- public String getPassword() {
- return memberEntity.getPassword();
- }
-
- @JsonIgnore
- @Override
- public String getUsername() {
- return "";
- }
-
- @JsonIgnore
- @Override
- public boolean isAccountNonExpired() {
- return true;
- }
-
- @JsonIgnore
- @Override
- public boolean isAccountNonLocked() {
- return true;
- }
-
- @JsonIgnore
- @Override
- public boolean isCredentialsNonExpired() {
- return true;
- }
-
- @JsonIgnore
- @Override
- public boolean isEnabled() {
- return true;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java b/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java
deleted file mode 100644
index 4754bb5..0000000
--- a/src/main/java/com/xcong/excoin/common/system/controller/LoginController.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.xcong.excoin.common.system.controller;
-
-import cn.hutool.core.codec.Base64;
-import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.SecureUtil;
-import cn.hutool.crypto.asymmetric.KeyType;
-import cn.hutool.crypto.asymmetric.RSA;
-import cn.hutool.crypto.asymmetric.Sign;
-import cn.hutool.crypto.asymmetric.SignAlgorithm;
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.annotations.SubmitRepeat;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.bean.LoginUserBean;
-import com.xcong.excoin.common.system.dto.LoginDto;
-import com.xcong.excoin.common.system.dto.RegisterDto;
-import com.xcong.excoin.configurations.properties.ApplicationProperties;
-import com.xcong.excoin.configurations.properties.SecurityProperties;
-import com.xcong.excoin.modules.member.service.MemberService;
-import com.xcong.excoin.utils.RedisUtils;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.core.Authentication;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Author wzy
- * @Date 2020/5/11
- * @email wangdoubleone@gmail.com
- * @Version V1.0
- **/
-@Slf4j
-@Api(value = "登陆注册类", tags = "登陆注册类")
-@RestController
-@RequestMapping(value = "/")
-public class LoginController {
-
- @Resource
- private MemberService memberservice;
-
- @Resource
- private ApplicationProperties applicationProperties;
-
- @Resource
- private SecurityProperties securityProperties;
-
- @Resource
- private AuthenticationManagerBuilder authenticationManagerBuilder;
-
- @Resource
- private RedisUtils redisUtils;
-
- @ApiOperation(value = "登陆接口", notes = "登陆接口")
- @PostMapping("/login")
- public Result login(@RequestBody @Validated LoginDto loginDto, HttpServletRequest request) {
- // 将账号密码交给spring security验证,并调用userServiceDetails
- UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(loginDto.getUsername(), SecureUtil.md5(loginDto.getPassword()));
- Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authToken);
-
- // 获取当前验证过后的用户
- LoginUserBean loginUserBean = (LoginUserBean) authentication.getPrincipal();
-
- // 生成UUID作为token
- String token = IdUtil.simpleUUID();
- String redisToken = "";
- String redisMember = "";
- if (LoginUserUtils.isBrowser(request)) {
- redisToken = AppContants.PC_LOGIN_PREFIX + token;
- redisMember = AppContants.PC_LOGIN_PREFIX + loginUserBean.getMemberEntity().getId();
- } else {
- redisToken = AppContants.APP_LOGIN_PREFIX + token;
- redisMember = AppContants.APP_LOGIN_PREFIX + loginUserBean.getMemberEntity().getId();
- }
-
- if (StrUtil.isNotBlank(redisUtils.getString(redisMember))) {
- if (redisMember.contains(AppContants.APP_LOGIN_PREFIX)) {
- redisUtils.del(AppContants.APP_LOGIN_PREFIX + redisUtils.getString(redisMember));
- } else {
- redisUtils.del(AppContants.PC_LOGIN_PREFIX + redisUtils.getString(redisMember));
- }
- }
- redisUtils.set(redisToken, JSONObject.toJSONString(loginUserBean.getMemberEntity()), applicationProperties.getRedisExpire());
- redisUtils.set(redisMember, token);
- Map<String, Object> authInfo = new HashMap<>();
- // 开启debug模式,则将加密后的token返回
- if (applicationProperties.isDebug()) {
- authInfo.put("token", token);
- authInfo.put("rsaToken", AppContants.TOKEN_START_WITH + generateAsaToken(token));
- authInfo.put("user", loginUserBean);
- } else {
- authInfo.put("token", token);
- authInfo.put("user", loginUserBean);
- }
- return Result.ok("success", authInfo);
- }
-
- public String generateAsaToken(String token) {
- RSA rsa = new RSA(null, securityProperties.getPublicKey());
- return rsa.encryptBase64(token + "_" + System.currentTimeMillis(), KeyType.PublicKey);
- }
-
- @SubmitRepeat
- @ApiOperation(value = "app注册接口", notes = "app注册接口,验证码必须输入可默认为123456")
- @PostMapping(value = "/register")
- public Result register(@RequestBody @Validated RegisterDto registerDto) {
- return memberservice.register(registerDto);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/common/system/mapper/CandlestickMapper.java b/src/main/java/com/xcong/excoin/common/system/mapper/CandlestickMapper.java
deleted file mode 100644
index 4e6fca1..0000000
--- a/src/main/java/com/xcong/excoin/common/system/mapper/CandlestickMapper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.common.system.mapper;
-
-import com.huobi.client.model.Candlestick;
-import com.xcong.excoin.modules.symbols.parameter.vo.KlineDataVo;
-import com.xcong.excoin.utils.api.response.KlineReturn;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-/**
- * @author wzy
- * @date 2020-05-29
- **/
-@Mapper
-public abstract class CandlestickMapper {
- public static final CandlestickMapper INSTANCE = Mappers.getMapper(CandlestickMapper.class);
-
- @Mapping(source = "timestamp", target = "time")
- public abstract KlineDataVo toKlineDataVo(Candlestick candlestick);
-
-}
diff --git a/src/main/java/com/xcong/excoin/common/system/service/UserDetailsServiceImpl.java b/src/main/java/com/xcong/excoin/common/system/service/UserDetailsServiceImpl.java
deleted file mode 100644
index d08afa0..0000000
--- a/src/main/java/com/xcong/excoin/common/system/service/UserDetailsServiceImpl.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.xcong.excoin.common.system.service;
-
-import cn.hutool.crypto.SecureUtil;
-import cn.hutool.crypto.asymmetric.Sign;
-import cn.hutool.crypto.asymmetric.SignAlgorithm;
-import com.xcong.excoin.common.exception.GlobalException;
-import com.xcong.excoin.common.system.bean.LoginUserBean;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.core.userdetails.UsernameNotFoundException;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @Author wzy
- * @Date 2020/5/11
- * @email wangdoubleone@gmail.com
- * @Version V1.0
- **/
-@Slf4j
-@Service("userDetailsService")
-public class UserDetailsServiceImpl implements UserDetailsService {
-
- @Resource
- private MemberDao memberDao;
-
- @Override
- public LoginUserBean loadUserByUsername(String username) throws UsernameNotFoundException {
- log.info("#登陆账号:{}#", username);
- List<GrantedAuthority> grantedAuthorities = new ArrayList<>();
-// GrantedAuthority grantedAuthority = new SimpleGrantedAuthority("ROLE_ADMIN");
-// grantedAuthorities.add(grantedAuthority);
-
- MemberEntity memberEntity = memberDao.selectMemberInfoByAccount(username);
- if (memberEntity != null) {
- memberEntity.setPassword(new BCryptPasswordEncoder().encode(memberEntity.getPassword()));
- } else {
- throw new UsernameNotFoundException("");
- }
-
- if (MemberEntity.ACCOUNT_STATUS_DISABLED == memberEntity.getAccountStatus()) {
- throw new GlobalException(MessageSourceUtils.getString("member_service_0092"));
- }
-
- return new LoginUserBean(memberEntity, null, null);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/SwaggerConfig.java b/src/main/java/com/xcong/excoin/configurations/SwaggerConfig.java
deleted file mode 100644
index 1b79633..0000000
--- a/src/main/java/com/xcong/excoin/configurations/SwaggerConfig.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.xcong.excoin.configurations;
-
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import io.swagger.annotations.Api;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.ParameterBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.schema.ModelRef;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Parameter;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @Author wzy
- * @Date 2020/5/11
- * @email wangdoubleone@gmail.com
- * @Version V1.0
- **/
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig {
-
- @Bean
- public Docket createRestApi(){
- // 添加请求参数,我们这里把token作为请求头部参数传入后端
- ParameterBuilder parameterBuilder = new ParameterBuilder();
- List<Parameter> parameters = new ArrayList<Parameter>();
- parameterBuilder.name("Authorization").description("令牌").modelRef(new ModelRef("string")).parameterType("header")
- .required(false).build();
- parameters.add(parameterBuilder.build());
- return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
- .paths(PathSelectors.any()).build().globalOperationParameters(parameters).ignoredParameterTypes(MemberEntity.class);
- }
-
- private ApiInfo apiInfo(){
- return new ApiInfoBuilder()
- .title("ExCoin")
- .description("This is a restful api document of ExCoin.")
- .version("1.0")
- .build();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java b/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
index 06994e0..140d052 100644
--- a/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
+++ b/src/main/java/com/xcong/excoin/configurations/WebMvcConfig.java
@@ -3,14 +3,11 @@
import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.xcong.excoin.configurations.properties.AliOssProperties;
-import com.xcong.excoin.configurations.security.UserAuthenticationArgumentResolver;
-import com.xcong.excoin.utils.SpringContextHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
@@ -27,11 +24,6 @@
@Resource
private AliOssProperties aliOssProperties;
-
- @Override
- public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
- resolvers.add(new UserAuthenticationArgumentResolver());
- }
/**
* 设置cors跨域支持
diff --git a/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java b/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java
deleted file mode 100644
index 5e69b7a..0000000
--- a/src/main/java/com/xcong/excoin/configurations/interceptor/MybatisInterceptor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.xcong.excoin.configurations.interceptor;
-
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.executor.Executor;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.mapping.SqlCommandType;
-import org.apache.ibatis.plugin.*;
-import org.apache.ibatis.session.defaults.DefaultSqlSession;
-import org.springframework.stereotype.Component;
-
-import java.util.*;
-
-/**
- * mybatis拦截器,自动注入创建人、创建时间、修改人、修改时间
- *
- * @author wzy
- * @date 2020-05-13
- **/
-@Slf4j
-@Component
-@Intercepts({@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})})
-public class MybatisInterceptor implements Interceptor {
- @Override
- public Object intercept(Invocation invocation) throws Throwable {
- MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
- SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
-
- Object parameter = invocation.getArgs()[1];
- if (parameter == null) {
- return invocation.proceed();
- }
-
- if (SqlCommandType.INSERT == sqlCommandType) {
- if (parameter instanceof DefaultSqlSession.StrictMap) {
- Map map = (Map) parameter;
- List list = (List) map.get("list");
- for (Object o : list) {
- injectForInsert(o);
- }
- } else {
- injectForInsert(parameter);
- }
- }
-
- if (SqlCommandType.UPDATE == sqlCommandType) {
- if (parameter instanceof DefaultSqlSession.StrictMap) {
- Map map = (Map) parameter;
- List list = (List) map.get("list");
- for (Object o : list) {
- injectForUpdate(o);
- }
- } else {
- injectForUpdate(parameter);
- }
- }
-
- return invocation.proceed();
- }
-
- @Override
- public Object plugin(Object o) {
- return Plugin.wrap(o, this);
- }
-
- @Override
- public void setProperties(Properties properties) {
-
- }
-
- public void injectForInsert(Object o) {
- MemberEntity member = LoginUserUtils.getUser();
- if (o instanceof BaseEntity) {
- BaseEntity baseEntity = (BaseEntity) o;
- if (member != null) {
- String by = member.getPhone() != null ? member.getPhone() : member.getEmail();
- baseEntity.setCreateBy(by);
- baseEntity.setUpdateBy(by);
- } else {
- baseEntity.setCreateBy(AppContants.SYSTEM_USER);
- baseEntity.setUpdateBy(AppContants.SYSTEM_USER);
- }
- baseEntity.setCreateTime(new Date());
- baseEntity.setUpdateTime(new Date());
- }
- }
-
- public void injectForUpdate(Object o) {
- MemberEntity member = LoginUserUtils.getUser();
- if (o instanceof BaseEntity) {
- BaseEntity baseEntity = (BaseEntity) o;
- if (member != null) {
- String by = member.getPhone() != null ? member.getPhone() : member.getEmail();
- baseEntity.setUpdateBy(by);
- } else {
- baseEntity.setUpdateBy(AppContants.SYSTEM_USER);
- }
- baseEntity.setUpdateTime(new Date());
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/security/TokenConfigurer.java b/src/main/java/com/xcong/excoin/configurations/security/TokenConfigurer.java
deleted file mode 100644
index a998762..0000000
--- a/src/main/java/com/xcong/excoin/configurations/security/TokenConfigurer.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.configurations.security;
-
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.web.DefaultSecurityFilterChain;
-import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
-
-/**
- * @author wzy
- * @date 2020-05-12
- **/
-@RequiredArgsConstructor
-public class TokenConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
-
- @Override
- public void configure(HttpSecurity http) {
- TokenFilter customFilter = new TokenFilter();
- http.addFilterBefore(customFilter, UsernamePasswordAuthenticationFilter.class);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java b/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
deleted file mode 100644
index 362eb8b..0000000
--- a/src/main/java/com/xcong/excoin/configurations/security/TokenFilter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.xcong.excoin.configurations.security;
-
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.asymmetric.KeyType;
-import cn.hutool.crypto.asymmetric.RSA;
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.exception.GlobalException;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.bean.LoginUserBean;
-import com.xcong.excoin.configurations.properties.ApplicationProperties;
-import com.xcong.excoin.configurations.properties.SecurityProperties;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.SpringContextHolder;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.util.StringUtils;
-import org.springframework.web.filter.GenericFilterBean;
-
-import javax.servlet.FilterChain;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.ArrayList;
-
-/**
- * @author wzy
- * @date 2020-05-12
- **/
-@Slf4j
-public class TokenFilter extends GenericFilterBean {
-
- private final ApplicationProperties applicationProperties = SpringContextHolder.getBean(ApplicationProperties.class);
-
- private final SecurityProperties securityProperties = SpringContextHolder.getBean(SecurityProperties.class);
-
- private final RedisUtils redisUtils = SpringContextHolder.getBean(RedisUtils.class);
-
- @Override
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
- HttpServletRequest request = (HttpServletRequest) servletRequest;
- HttpServletResponse response = (HttpServletResponse) servletResponse;
- String token = resolveToken(request);
-
- if (!AppContants.TIME_OUT.equals(token)) {
- if (StrUtil.isNotBlank(token)) {
- String redisKey = "";
- // 根据user-agent判断pc端还是app端
- if (LoginUserUtils.isBrowser(request)) {
- redisKey = AppContants.PC_LOGIN_PREFIX + token;
- } else {
- redisKey = AppContants.APP_LOGIN_PREFIX + token;
- }
-
- String loginStr = (String) redisUtils.get(redisKey);
- if (StrUtil.isNotBlank(loginStr)) {
- MemberEntity loginUser = JSONObject.parseObject(loginStr, MemberEntity.class);
- Authentication authentication = new UsernamePasswordAuthenticationToken(loginUser, token, new ArrayList<>());
- SecurityContextHolder.getContext().setAuthentication(authentication);
- redisUtils.expire(redisKey, 36000);
- } else {
- log.info("token无法查询:{}", token);
- SecurityContextHolder.clearContext();
- }
- } else {
-// log.info("token为空:{}", request.getRequestURI());
- SecurityContextHolder.clearContext();
- }
- } else {
- response.setHeader("TimeOut", AppContants.TIME_OUT);
- SecurityContextHolder.clearContext();
- }
- filterChain.doFilter(servletRequest, servletResponse);
- }
-
- /**
- * 解析前端传来的token,先去掉Bearer,在rsa解密得到token_time,返回token,并判断time与当前是否在5s内
- *
- * @param request
- * @return
- */
- private String resolveToken(HttpServletRequest request) {
- try {
- String bearerToken = request.getHeader(AppContants.TOKEN_HEADER);
- if (StringUtils.hasText(bearerToken) && bearerToken.startsWith(AppContants.TOKEN_START_WITH)) {
- // 去掉令牌前缀
- String rsaToken = bearerToken.replace(AppContants.TOKEN_START_WITH, "");
- RSA rsa = new RSA(securityProperties.getPrivateKey(), null);
- String[] tokens = StrUtil.split(rsa.decryptStr(rsaToken, KeyType.PrivateKey), "_");
-
- if (verifyTokenExpired(Long.parseLong(tokens[1]))) {
- return tokens[0];
- } else {
-// log.info("前面token为{}", tokens[0]);
-// log.info("时间为:{}, 当前时间为:{}", tokens[1], System.currentTimeMillis());
- return AppContants.TIME_OUT;
- }
- }
-// log.info("bearerToken---->{}", bearerToken);
- } catch (Exception e) {
- log.error("#解析token异常#", e);
- return null;
- }
- return null;
- }
-
- private Boolean verifyTokenExpired(Long time) {
- boolean isDebug = applicationProperties.isDebug();
- if (!isDebug) {
- long currentTime = System.currentTimeMillis();
- return currentTime - time <= 10000;
- }
- return true;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/security/UserAuthenticationArgumentResolver.java b/src/main/java/com/xcong/excoin/configurations/security/UserAuthenticationArgumentResolver.java
deleted file mode 100644
index 5dee717..0000000
--- a/src/main/java/com/xcong/excoin/configurations/security/UserAuthenticationArgumentResolver.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.xcong.excoin.configurations.security;
-
-import com.xcong.excoin.common.annotations.UserAuth;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import org.springframework.core.MethodParameter;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.web.bind.support.WebDataBinderFactory;
-import org.springframework.web.context.request.NativeWebRequest;
-import org.springframework.web.method.support.HandlerMethodArgumentResolver;
-import org.springframework.web.method.support.ModelAndViewContainer;
-
-/**
- * 自动注入登陆用户
- *
- * @author wzy
- * @date 2020-05-13
- **/
-public class UserAuthenticationArgumentResolver implements HandlerMethodArgumentResolver {
-
- @Override
- public boolean supportsParameter(MethodParameter parameter) {
- return parameter.getParameterAnnotation(UserAuth.class) != null && parameter.getParameterType().equals(MemberEntity.class);
- }
-
- @Override
- public Object resolveArgument(MethodParameter methodParameter, ModelAndViewContainer modelAndViewContainer, NativeWebRequest nativeWebRequest, WebDataBinderFactory webDataBinderFactory) throws Exception {
- Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
- if (authentication == null) {
- return null;
- }
-
- MemberEntity auth = null;
- if (authentication.getPrincipal() != null) {
- auth = (MemberEntity) authentication.getPrincipal();
- }
- return auth;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java b/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java
deleted file mode 100644
index dfe6523..0000000
--- a/src/main/java/com/xcong/excoin/configurations/security/WebSecurityConfig.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.xcong.excoin.configurations.security;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.http.HttpMethod;
-import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
-import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.core.userdetails.UserDetailsService;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.security.crypto.password.PasswordEncoder;
-import org.springframework.security.web.AuthenticationEntryPoint;
-import org.springframework.security.web.access.AccessDeniedHandler;
-
-import javax.annotation.Resource;
-
-/**
- * @author wzy
- * @date 2020-05-11
- **/
-@Slf4j
-@Configuration
-@EnableWebSecurity
-@EnableGlobalMethodSecurity(prePostEnabled = true)
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
-
- @Resource
- private UserDetailsService userDetailsService;
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.httpBasic().and().
- cors().and().csrf().disable()
- .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint())
- .and()
- .authorizeRequests()
- .antMatchers(HttpMethod.OPTIONS, "/**").permitAll()
- .antMatchers("/login").permitAll()
- .antMatchers("/register").permitAll()
- .antMatchers("/swagger**/**").permitAll()
- .antMatchers("/webjars/**").permitAll()
- .antMatchers("/v2/**").permitAll()
- .antMatchers("/api/symbols/**").permitAll()
- .antMatchers("/common/**").permitAll()
- .antMatchers("/api/exchange/**").permitAll()
- .antMatchers("/api/member/getMemberAccountInfo").permitAll()
- .antMatchers("/api/member/memberForgetPwd").permitAll()
- .antMatchers("/api/member/memberCoinInfoList").permitAll()
- .antMatchers("/api/member/getPcVersionInfo").permitAll()
- .antMatchers("/api/member/getAppVersionInfo").permitAll()
- .antMatchers("/api/orderCoin/searchSymbolResultList").permitAll()
- .antMatchers("/api/orderCoin/findCollect").permitAll()
- .anyRequest().authenticated()
- .and().apply(securityConfiguereAdapter());
- }
-
- @Override
- protected void configure(AuthenticationManagerBuilder auth) throws Exception {
- auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
- }
-
- @Bean
- public PasswordEncoder passwordEncoder() {
- return new BCryptPasswordEncoder();
- }
-
- @Bean
- public AccessDeniedHandler accessDeniedHandler() {
- return new CustomAccessDeniedHandler();
- }
-
- @Bean
- public AuthenticationEntryPoint authenticationEntryPoint() {
- return new CustomAuthenticationEntryPoint();
- }
-
- public TokenConfigurer securityConfiguereAdapter() {
- return new TokenConfigurer();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/controller/BlockController.java b/src/main/java/com/xcong/excoin/modules/blackchain/controller/BlockController.java
deleted file mode 100644
index e024e8d..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/controller/BlockController.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.xcong.excoin.modules.blackchain.controller;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.blackchain.service.BlockSerive;
-import com.xcong.excoin.utils.RedisUtils;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Api(value = "链上钱包接口", tags = "链上钱包接口")
-@RestController
-@RequestMapping(value = "/api/block")
-public class BlockController {
-
-
-
- @Autowired
- RedisUtils redisUtils;
- @Autowired
- BlockSerive blockSerive;
- /**
- * BTC
- * @param token
- * @return
- */
- @ApiOperation(value = "链上生成钱包地址接口", notes = "链上生成钱包地址接口")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/findBlockAddress")
- public Result findBlockAddress(String symbol) {
- return blockSerive.findBlockAddress(symbol);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/model/EosResult.java b/src/main/java/com/xcong/excoin/modules/blackchain/model/EosResult.java
deleted file mode 100644
index ca0bd19..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/model/EosResult.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.blackchain.model;
-
-import lombok.Data;
-
-/**
- * 数据样例
- * EosResult(quantity=2.0000 EOS, memo=aa, from=okbtothemoon, to=biueeostoken, accountActionSeq=2)
- */
-@Data
-public class EosResult {
- /**
- * 转账数量
- */
- private String quantity;
-
- /**
- * 转账标记
- */
- private String memo;
- private String from;
- private String to;
-
- /**
- * 这笔转账对应于这个账户的序号
- */
- private Integer accountActionSeq;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransResult.java b/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransResult.java
deleted file mode 100644
index a9bf035..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransResult.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.xcong.excoin.modules.blackchain.model;
-
-import java.util.List;
-
-// https://github.com/ripple/rippled-historical-database#get-account-transaction-history
-public class XrpTransResult {
- private String result; //success
- private Integer count; //
- private String marker;//
-
- //transactions
- List<XrpTransactions> transactions;
-
- public String getResult() {
- return result;
- }
-
- public void setResult(String result) {
- this.result = result;
- }
-
- public Integer getCount() {
- return count;
- }
-
- public void setCount(Integer count) {
- this.count = count;
- }
-
- public String getMarker() {
- return marker;
- }
-
- public void setMarker(String marker) {
- this.marker = marker;
- }
-
- public List<XrpTransactions> getTransactions() {
- return transactions;
- }
-
- public void setTransactions(List<XrpTransactions> transactions) {
- this.transactions = transactions;
- }
-
-
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransactions.java b/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransactions.java
deleted file mode 100644
index f69f00f..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTransactions.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.xcong.excoin.modules.blackchain.model;
-
-public class XrpTransactions {
-
- private String hash;
- private Integer ledger_index;
- private String date;//2019-10-28T15:01:01+00:00
- private XrpTx tx;
-
- public String getHash() {
- return hash;
- }
- public void setHash(String hash) {
- this.hash = hash;
- }
- public Integer getLedger_index() {
- return ledger_index;
- }
- public void setLedger_index(Integer ledger_index) {
- this.ledger_index = ledger_index;
- }
- public String getDate() {
- return date;
- }
- public void setDate(String date) {
- this.date = date;
- }
- public XrpTx getTx() {
- return tx;
- }
- public void setTx(XrpTx tx) {
- this.tx = tx;
- }
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTx.java b/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTx.java
deleted file mode 100644
index 9b7a883..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/model/XrpTx.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.xcong.excoin.modules.blackchain.model;
-
-import lombok.Data;
-
-@Data
-public class XrpTx {
- private String transactionType;
- private Integer flags;
- private Integer sequence;
- private Integer destinationTag; // 对应的用户标签
- private Integer amount; // 金额 除以1000000 一百万
- private Integer fee; // 手续费
- private String account; // 转账人
- private String destination; // 收款人(收款人是系统账户 说明是转入)
-
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/BchService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/BchService.java
deleted file mode 100644
index eb142df..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/BchService.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-
-
-public class BchService {
-
-
- private static BchService service = null;
- private final static String RESULT = "result";
- private final static String METHOD_SEND_TO_ADDRESS = "sendtoaddress";
- private final static String METHOD_GET_TRANSACTION = "gettransaction";
- private final static String METHOD_LIST_TRANSACTIONS = "listtransactions";
- private final static String METHOD_GET_BLOCK_COUNT = "getblockcount";
- private final static String METHOD_NEW_ADDRESS = "getnewaddress";
- private final static String METHOD_GET_BALANCE = "getbalance";
- private final static String METHOD_GET_BALANCE_ADDRESS = "getreceivedbyaddress";
- private final static String METHOD_WALLET_PASSPHRASE = "walletpassphrase";
- private final static String METHOD_WALLET_LOCK = "walletlock";
-
- private String url = "http://121.40.86.163:1882";
- private String username = "biyi";
- private String password = "biyi12345";
-
- public static BchService getInstance() {
- if (service != null) {
- return service;
- }
- return new BchService();
- }
-
- private BchService() {
- }
-
- /**
- * 创建BTC钱包 每个账户对应一个地址 方便后续操作
- * @param mId 账户
- * @return
- */
- public static Map<String, String> createWallet(String mId) {
- BchService btcService = getInstance();
- // 创建钱包地址
- String address = btcService.getAddress(mId);
- // 私钥
- String privateKey = btcService.dumpprivkey(address);
- Map<String, String> result = new HashMap<String,String>();
- result.put("address", address);
- result.put("privateKey", privateKey);
- return result;
- }
- public String getAddress(String label) {
- try {
- JSONObject json = doRequest(METHOD_NEW_ADDRESS,label);
- if (isError(json)) {
- return "";
- }
- return json.getString(RESULT);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private JSONObject doRequest(String method, Object... params) {
- JSONObject param = new JSONObject();
- param.put("id", System.currentTimeMillis() + "");
- param.put("jsonrpc", "2.0");
- param.put("method", method);
- if (params != null) {
- param.put("params", params);
- }
- String creb = Base64.encodeBase64String((username + ":" + password).getBytes());
- Map<String, String> headers = new HashMap<>(2);
- headers.put("Authorization", "Basic " + creb);
- return JSON.parseObject(HttpUtil.jsonPost(url, headers, param.toJSONString()));
- }
-
- private boolean isError(JSONObject json) {
- if (json == null || (StringUtils.isNotEmpty(json.getString("error")) && json.get("error") != "null")) {
- return true;
- }
- return false;
- }
-
- public String dumpprivkey(String address) {
- try {
- JSONObject obj = doRequest("dumpprivkey", address);
- System.out.println(obj);
- if (!isError(obj)) {
- return obj.getString(RESULT);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 查询给定地址的总收款额(只计算接受的)
- * @param address
- * @return
- */
- public BigDecimal getBalance(String address) {
- JSONObject json = doRequest(METHOD_GET_BALANCE_ADDRESS,address,3);
- if (!isError(json)) {
- return new BigDecimal(json.getString(RESULT));
- } else {
- return null;
- }
- }
-
- public String METHOD_GET_BLOCK_COUNT() {
- JSONObject json = doRequest(METHOD_GET_BLOCK_COUNT);
- if (!isError(json)) {
- return json.getString(RESULT);
- } else {
- return null;
- }
- }
- public static void main(String[] args) {
- BchService ser = new BchService();
- //ser.getBalance("36RiLqCrnFfBoyUUHpGvEotXiMRtrJG8dp");
- //System.out.println(ser.METHOD_GET_BLOCK_COUNT());
- System.out.println(ser.getBalance("36RiLqCrnFfBoyUUHpGvEotXiMRtrJG8dp"));
- }
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/BigDecimalUtil.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/BigDecimalUtil.java
deleted file mode 100644
index 3043a0f..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/BigDecimalUtil.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.DecimalFormat;
-
-/**
- * 数据计算工具类
- *
- * @author cloud cloud
- * @create 2017/10/11
- **/
-public class BigDecimalUtil {
-
-
- /**
- * 基本单位
- */
- private static final BigDecimal UNIT = new BigDecimal(100000000);
-
- /**
- * 对double数据进行取精度.
- * @param value double数据.
- * @param scale 精度位数(保留的小数位数).
- * @param roundingMode 精度取值方式.
- * @return 精度计算后的数据.
- */
- public static double round(double value, int scale,
- int roundingMode) {
- BigDecimal bd = new BigDecimal(value);
- bd = bd.setScale(scale, roundingMode);
- double d = bd.doubleValue();
- bd = null;
- return d;
- }
-
- /**
- * 获取四位小数的字符串,小数位不够补充0
- * @param value
- * @return X.0000
- */
- public static String getFourString(double value){
- DecimalFormat df = new DecimalFormat("0.0000");
- return df.format(value);
- }
-
-
- /**
- * double 相加
- * @param d1
- * @param d2
- * @return
- */
- public static double sum(Double d1,Double d2){
- BigDecimal bd1 = new BigDecimal(d1.toString());
- BigDecimal bd2 = new BigDecimal(d2.toString());
- return bd1.add(bd2).doubleValue();
- }
-
- public static double sum(String a,String b){
- BigDecimal pa = new BigDecimal(a);
- BigDecimal pb = new BigDecimal(b);
- return pa.add(pb).doubleValue();
- }
-
-
- /**
- * double 相减
- * @param d1
- * @param d2
- * @return
- */
- public static double sub(double d1,double d2){
- BigDecimal bd1 = new BigDecimal(Double.toString(d1));
- BigDecimal bd2 = new BigDecimal(Double.toString(d2));
- return bd1.subtract(bd2).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue();
- }
-
- /**
- * double 乘法
- * @param d1
- * @param d2
- * @return
- */
- public static double mul(double d1,double d2){
- BigDecimal bd1 = new BigDecimal(Double.toString(d1));
- BigDecimal bd2 = new BigDecimal(Double.toString(d2));
- return bd1.multiply(bd2).setScale(6,BigDecimal.ROUND_HALF_UP).doubleValue();
- }
-
-
- /**
- * double 除法
- * @param d1
- * @param d2
- * @param scale 四舍五入 小数点位数
- * @return
- */
- public static double div(double d1,double d2,int scale){
- // 当然在此之前,你要判断分母是否为0,
- // 为0你可以根据实际需求做相应的处理
-
- BigDecimal bd1 = new BigDecimal(Double.toString(d1));
- BigDecimal bd2 = new BigDecimal(Double.toString(d2));
- return bd1.divide
- (bd2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
- }
-
- /**
- * 长整数相乘
- * @param pa
- * @param pb
- * @return
- */
- public static long longMul(long pa,long pb){
- BigDecimal b1 = new BigDecimal(pa);
- BigDecimal b2 = new BigDecimal(pb);
- return b1.multiply(b2).longValue();
- }
-
- public static long longMul(long pa ,Double rate){
- BigDecimal b1 = new BigDecimal(pa);
- BigDecimal b2 = new BigDecimal(rate.toString());
- b2 = b2.setScale(6,BigDecimal.ROUND_HALF_UP);
- return b1.multiply(b2).longValue();
- }
-
- public static long longMul(long pa ,String rate){
- BigDecimal b1 = new BigDecimal(pa);
- BigDecimal b2 = new BigDecimal(rate);
- return b1.multiply(b2).longValue();
- }
-
- /**
- * 长整数相减
- * @param pa
- * @param pb
- * @return
- */
- public static long longSub(long pa,long pb){
- BigDecimal b1 = new BigDecimal(pa);
- BigDecimal b2 = new BigDecimal(pb);
- return b1.subtract(b2).longValue();
- }
-
- /**
- * 长整数相加
- * @param pa
- * @param pb
- * @return
- */
- public static long longAdd(long pa,long pb){
- BigDecimal b1 = new BigDecimal(pa);
- BigDecimal b2 = new BigDecimal(pb);
- return b1.add(b2).longValue();
- }
-
- /**
- * 入参转化
- * @param value
- * @return
- */
- public static long inputConvert(Double value){
- BigDecimal input = new BigDecimal(value.toString());
- return input.multiply(UNIT).longValue();
- }
-
- /**
- * 输出转化
- * @param value
- * @return
- */
- public static double outputConvert(long value){
- BigDecimal output = new BigDecimal(value);
- return output.divide(UNIT,6, RoundingMode.DOWN).doubleValue();
- }
-
- public static void main(String[] args) {
- long res = longMul(100000000,0.000009999999);
- System.out.println(res);
-
- }
-
- public static long sum(Long d1,String d2){
- BigDecimal bd1 = new BigDecimal(d1.toString());
- BigDecimal bd2 = new BigDecimal(d2);
- return bd1.add(bd2).longValue();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/BlockSerive.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/BlockSerive.java
deleted file mode 100644
index 4784320..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/BlockSerive.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import com.xcong.excoin.common.response.Result;
-
-public interface BlockSerive {
-
- Result findBlockAddress(String symbol);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/BtcService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/BtcService.java
deleted file mode 100644
index b8a4c84..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/BtcService.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-
-
-public class BtcService {
-
-
- private static BtcService service = null;
- private final static String RESULT = "result";
- private final static String METHOD_SEND_TO_ADDRESS = "sendtoaddress";
- private final static String METHOD_GET_TRANSACTION = "gettransaction";
- private final static String METHOD_LIST_TRANSACTIONS = "listtransactions";
- private final static String METHOD_GET_BLOCK_COUNT = "getblockcount";
- private final static String METHOD_NEW_ADDRESS = "getnewaddress";
- private final static String METHOD_GET_BALANCE = "getbalance";
- private final static String METHOD_GET_BALANCE_ADDRESS = "getreceivedbyaddress";
- private final static String METHOD_WALLET_PASSPHRASE = "walletpassphrase";
- private final static String METHOD_WALLET_LOCK = "walletlock";
-
- private String url = "http://120.55.86.146:1880";
- private String username = "biyi";
- private String password = "biyi1234";
-
- public static BtcService getInstance() {
- if (service != null) {
- return service;
- }
- return new BtcService();
- }
-
- private BtcService() {
- }
-
- /**
- * 创建BTC钱包 每个账户对应一个地址 方便后续操作
- * @param mId 账户
- * @return
- */
- public static Map<String, String> createWallet(String mId) {
- BtcService btcService = getInstance();
- // 创建钱包地址
- String address = btcService.getAddress(mId);
- // 私钥
- String privateKey = btcService.dumpprivkey(address);
- Map<String, String> result = new HashMap<String,String>();
- result.put("address", address);
- result.put("privateKey", privateKey);
- return result;
- }
- public String getAddress(String label) {
- try {
- JSONObject json = doRequest(METHOD_NEW_ADDRESS,label);
- if (isError(json)) {
- return "";
- }
- return json.getString(RESULT);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private JSONObject doRequest(String method, Object... params) {
- JSONObject param = new JSONObject();
- param.put("id", System.currentTimeMillis() + "");
- param.put("jsonrpc", "2.0");
- param.put("method", method);
- if (params != null) {
- param.put("params", params);
- }
- String creb = Base64.encodeBase64String((username + ":" + password).getBytes());
- Map<String, String> headers = new HashMap<>(2);
- headers.put("Authorization", "Basic " + creb);
- return JSON.parseObject(HttpUtil.jsonPost(url, headers, param.toJSONString()));
- }
-
- private boolean isError(JSONObject json) {
- if (json == null || (StringUtils.isNotEmpty(json.getString("error")) && json.get("error") != "null")) {
- return true;
- }
- return false;
- }
-
- public String dumpprivkey(String address) {
- try {
- JSONObject obj = doRequest("dumpprivkey", address);
- System.out.println(obj);
- if (!isError(obj)) {
- return obj.getString(RESULT);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 查询给定地址的总收款额(只计算接受的)
- * @param address
- * @return
- */
- public BigDecimal getBalance(String address) {
- JSONObject json = doRequest(METHOD_GET_BALANCE_ADDRESS,address,3);
- if (!isError(json)) {
- return new BigDecimal(json.getString(RESULT));
- } else {
- return null;
- }
- }
-
- public String METHOD_GET_BLOCK_COUNT() {
- JSONObject json = doRequest(METHOD_GET_BLOCK_COUNT);
- if (!isError(json)) {
- return json.getString(RESULT);
- } else {
- return null;
- }
- }
- public static void main(String[] args) {
- BtcService ser = new BtcService();
- //ser.getBalance("36RiLqCrnFfBoyUUHpGvEotXiMRtrJG8dp");
- //System.out.println(ser.METHOD_GET_BLOCK_COUNT());
- System.out.println(ser.getBalance("36RiLqCrnFfBoyUUHpGvEotXiMRtrJG8dp"));
- }
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/EosService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/EosService.java
deleted file mode 100644
index 4aad013..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/EosService.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.modules.blackchain.model.EosResult;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class EosService {
- // 正式网络 https://api-v2.eosasia.one https://proxy.eosnode.tools
- // 测试网络 https://api-kylin.eosasia.one
- // "eosqxyx11111", "5JJB2oiCXwASK9fumjyTgbtHcwDVedVRaZda1kBhFuQcmjnrDWB"
- //private final static String account = "huobideposit";
- public final static String ACCOUNT = "biueeostoken";
- // private String account;
- private final static String EOS_NAME = "EOS";
- public static final String K_mnemonic = "mnemonic";
- public static final String K_privateKey = "privateKey";
- public static final String K_publicKey = "publicKey";
- private static final String EOS_TOKEN = "eosio.token";
- private static final String ACTION_TRANSFER = "transfer";
-
-
- public static void main(String[] args) throws Exception {
-
- List<EosResult> actions = getActions(0, 3);
- for(EosResult eosResult:actions){
- System.out.println(eosResult.toString());
- String quantity = eosResult.getQuantity();
- String amountStr = quantity.split("")[0];
- System.out.println(quantity);
- System.out.println(new BigDecimal(amountStr));
- }
- }
-
-
- /**
- *
- * @param pos 从第几条开始(包括pos)
- * @param offset 查询条数
- * @return
- */
- public static List<EosResult> getActions(int pos, int offset) {
- JSONObject param = new JSONObject();
- param.put("account_name", ACCOUNT);
- param.put("pos", pos);
- param.put("offset", offset);
- Map<String, String> header = new HashMap<String, String>();
- header.put("content-type", "application/json");
- String res = HttpUtil.post("https://api.eosflare.io/v1/eosflare/get_actions", null, param.toJSONString(), header);
- System.out.println(res);
- List<EosResult> results = new ArrayList<>();
- try {
-
- JSONObject jsonObject = JSONObject.parseObject(res);
- JSONArray actions = jsonObject.getJSONArray("actions");
- if (actions != null && actions.size() > 0) {
- int size = actions.size();
- EosResult eosResult = null;
- for (int i = 0; i < size; i++) {
- JSONObject jsonObject1 = actions.getJSONObject(i);
- // 当前交易序号
- Object account_action_seq = jsonObject1.get("account_action_seq");
- JSONObject action_trace = jsonObject1.getJSONObject("action_trace");
- JSONObject act = action_trace.getJSONObject("act");
- Object account = act.get("account");
- if (!EOS_TOKEN.equals(account)) {
- continue;
- }
- eosResult = JSONObject.parseObject(act.getString("data"), EosResult.class);
- eosResult.setAccountActionSeq((Integer) account_action_seq);
- results.add(eosResult);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return results;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/EthService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/EthService.java
deleted file mode 100644
index 5638359..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/EthService.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ExecutionException;
-
-import org.web3j.abi.FunctionEncoder;
-import org.web3j.abi.FunctionReturnDecoder;
-import org.web3j.abi.TypeReference;
-import org.web3j.abi.datatypes.Address;
-import org.web3j.abi.datatypes.Function;
-import org.web3j.abi.datatypes.Type;
-import org.web3j.abi.datatypes.generated.Uint256;
-import org.web3j.crypto.Credentials;
-import org.web3j.crypto.RawTransaction;
-import org.web3j.crypto.TransactionEncoder;
-import org.web3j.crypto.WalletUtils;
-import org.web3j.protocol.Web3j;
-import org.web3j.protocol.admin.Admin;
-import org.web3j.protocol.core.DefaultBlockParameterName;
-import org.web3j.protocol.core.Request;
-import org.web3j.protocol.core.methods.request.Transaction;
-import org.web3j.protocol.core.methods.response.*;
-import org.web3j.protocol.http.HttpService;
-import org.web3j.utils.Convert;
-import org.web3j.utils.Numeric;
-import org.web3j.utils.Convert.Unit;
-
-/**
- * ETH类,使用Web3j 下面为使用教程
- * https://kauri.io/article/925d923e12c543da9a0a3e617be963b4/manage-an-ethereum-account-with-java-and-web3js
- *
- * @author Administrator
- *
- */
-
-public class EthService {
-
- private static String ethWalletPath = "/home/javaweb/webresource/eth";
- // private static String ethWalletPath="E://";
- private Web3j web3j;
- // private Admin admin;
- // private Parity parity;
- /**
- * 服务器地址
- */
- //private static final String ETH_UTL = "https://mainnet.infura.io/v3/882c66ebcfc141abbea22b948fa44321";
- private static final String ETH_UTL = "http://120.55.86.146:8545";
-
- public EthService() {
- try {
- HttpService service = new HttpService(ETH_UTL);
- web3j = Web3j.build(service);
- // parity = Parity.build(service);
- // admin = Admin.build(service);
- } catch (Exception e) {
- System.out.println("liangjieshibao");
- // logger.error("==============虚拟币-以太坊链接获取失败!");
- e.printStackTrace();
- }
- }
-
- /**
- * 查询ETH余额
- *
- * @param address
- * @return
- */
- public static BigDecimal getEthBlance(String address) {
- Web3j web3 = Web3j.build(new HttpService(ETH_UTL));
- EthGetBalance balanceWei;
- try {
- balanceWei = web3.ethGetBalance(address, DefaultBlockParameterName.LATEST).send();
- if (balanceWei.getResult() == null) {
- return null;
- }
- BigDecimal balanceInEther = Convert.fromWei(balanceWei.getBalance().toString(), Unit.ETHER);
- return balanceInEther;
- } catch (Exception e) {
- System.out.println("ETH查询失败:" + address);
- e.printStackTrace();
- }
- return null;
-
- }
-
- /**
- * 创建ETH钱包
- *
- * @return
- */
- public static Map<String, String> createEth() {
- Map<String, String> wallet = new HashMap<String, String>();
- try {
- String walletPassword = "secr3t";
- // 文件路径
- String walletDirectory = ethWalletPath;
-
- String walletName = WalletUtils.generateNewWalletFile(walletPassword, new File(walletDirectory));
- System.out.println("wallet location: " + walletDirectory + "/" + walletName);
- Credentials credentials = WalletUtils.loadCredentials(walletPassword, walletDirectory + "/" + walletName);
- String accountAddress = credentials.getAddress();
- String privateKey = credentials.getEcKeyPair().getPrivateKey().toString(16);
- // 钱包地址
- wallet.put("address", accountAddress);
- // 钱包私钥
- wallet.put("privateKey", privateKey);
- // 产生的钱包文件地址
- wallet.put("walletLocation", walletDirectory + "/" + walletName);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return wallet;
- }
-
- public boolean checkTransferResult(String hash) {
- // 0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816 交易hash
- Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = web3j.ethGetTransactionReceipt(hash);
- EthGetTransactionReceipt send = null;
- try {
- send = ethGetTransactionReceiptRequest.send();
- if(send!=null){
- TransactionReceipt result = send.getResult();
- if(result!=null){
- String status = result.getStatus();
- System.out.println(status);//0x1
- if("0x1".equals(status)){
- return true;
- }else{
- return false;
- }
- }
-
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- return false;
- }
- return false;
- }
-
- public static void main(String[] args) throws IOException {
- HttpService service = new HttpService(ETH_UTL);
- Web3j build = Web3j.build(service);
- //Request<?, EthTransaction> ethTransactionRequest = build.ethGetTransactionByHash("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
- Request<?, EthGetTransactionReceipt> ethGetTransactionReceiptRequest = build.ethGetTransactionReceipt("0xa3e6a0ccc3aac30d866a86ca9c0477dd58b7b061787ba40b16c3844803273816");
- EthGetTransactionReceipt send = ethGetTransactionReceiptRequest.send();
- String status = send.getResult().getStatus();
- System.out.println(status);//0x1
-// EthTransaction send = ethTransactionRequest.send();
-// String input = send.getResult().getInput();
-// System.out.println(input);
- }
-
- /**
- *
- * 方法描述:获取代币余额
- *
- * @param fromAddress
- * @param
- * @param
- * @return long
- */
- public BigDecimal tokenGetBalance(String fromAddress) {
- try {
- // 合约地址
- String contractAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7";
- int decimal = 6;
- String methodName = "balanceOf";
- List<Type> inputParameters = new ArrayList<>();
- List<TypeReference<?>> outputParameters = new ArrayList<>();
- Address address = new Address(fromAddress);
- inputParameters.add(address);
- TypeReference<Uint256> typeReference = new TypeReference<Uint256>() {
- };
- outputParameters.add(typeReference);
- Function function = new Function(methodName, inputParameters, outputParameters);
- String data = FunctionEncoder.encode(function);
- Transaction transaction = Transaction.createEthCallTransaction(fromAddress, contractAddress, data);
-
- EthCall ethCall;
- BigInteger balanceValue = BigInteger.ZERO;
- try {
- ethCall = web3j.ethCall(transaction, DefaultBlockParameterName.LATEST).send();
- List<Type> results = FunctionReturnDecoder.decode(ethCall.getValue(), function.getOutputParameters());
- balanceValue = (BigInteger) results.get(0).getValue();
- } catch (IOException e) {
- e.printStackTrace();
- }
- double res = BigDecimalUtil.div(new BigDecimal(balanceValue).doubleValue(), Math.pow(10, decimal), 8);
- if (res > 0) {
- return new BigDecimal(res);
- }
- } catch (Exception e) {
- // logger.error("==============以太坊代币链接获取失败!");
- e.printStackTrace();
- }
- return BigDecimal.ZERO;
- }
-
- // USDT
- public String tokenSend(String privateKey, String fromAddress, String toAddress, String amount)
- throws InterruptedException, ExecutionException {
- // Web3j web3j = Web3j.build(new
- // HttpService("https://mainnet.infura.io/v3/882c66ebcfc141abbea22b948fa44321"));
- String contractAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7";
- Credentials credentials = Credentials.create(privateKey);
-
- EthGetTransactionCount ethGetTransactionCount = web3j
- .ethGetTransactionCount(fromAddress, DefaultBlockParameterName.LATEST).sendAsync().get();
-
- BigInteger nonce = ethGetTransactionCount.getTransactionCount();
-
- Function function = new Function("transfer",
- Arrays.asList(new Address(toAddress), new Uint256(new BigInteger(amount))),
- Arrays.asList(new TypeReference<Type>() {
- }));
-
- String encodedFunction = FunctionEncoder.encode(function);
-
- RawTransaction rawTransaction = RawTransaction.createTransaction(nonce,
- Convert.toWei("70", Convert.Unit.GWEI).toBigInteger(),// 给矿工开的转账单价 单价越高越快
- Convert.toWei("60000", Convert.Unit.WEI).toBigInteger(), contractAddress, encodedFunction);//里程上限
- // 10*80000/1000000000=0.0008 手续费
-
- byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
- String hexValue = Numeric.toHexString(signedMessage);
-
- // log.debug("transfer hexValue:" + hexValue);
-
- EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).sendAsync().get();
-
-
- if (ethSendTransaction.hasError()) {
- // log.info("transfer error:", ethSendTransaction.getError().getMessage());
- return "";
- } else {
- String transactionHash = ethSendTransaction.getTransactionHash();
- // log.info("Transfer transactionHash:" + transactionHash);
- return transactionHash;
- }
- }
-
- public String ethSend(String privateKey, String fromAddress, String toAddress, String amount)
- throws InterruptedException, ExecutionException {
- // Web3j web3j = Web3j.build(new
- // HttpService("https://mainnet.infura.io/v3/882c66ebcfc141abbea22b948fa44321"));
-
- Credentials credentials = Credentials.create(privateKey);
-
- EthGetTransactionCount ethGetTransactionCount = web3j
- .ethGetTransactionCount(fromAddress, DefaultBlockParameterName.LATEST).sendAsync().get();
-
- BigInteger nonce = ethGetTransactionCount.getTransactionCount();
- BigInteger value = Convert.toWei(amount, Convert.Unit.ETHER).toBigInteger();
- RawTransaction rawTransaction = RawTransaction.createEtherTransaction(nonce,
- Convert.toWei("50", Convert.Unit.GWEI).toBigInteger(),
- Convert.toWei("60000", Convert.Unit.WEI).toBigInteger(), toAddress, value);
- byte[] signedMessage = TransactionEncoder.signMessage(rawTransaction, credentials);
- String hexValue = Numeric.toHexString(signedMessage);
-
- EthSendTransaction ethSendTransaction = web3j.ethSendRawTransaction(hexValue).sendAsync().get();
- if (ethSendTransaction.hasError()) {
- // log.info("transfer error:", ethSendTransaction.getError().getMessage());
- return "";
- } else {
- String transactionHash = ethSendTransaction.getTransactionHash();
- // log.info("Transfer transactionHash:" + transactionHash);
- return transactionHash;
- }
- }
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/HttpUtil.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/HttpUtil.java
deleted file mode 100644
index a146fe4..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/HttpUtil.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-/**
- * @author: DengJiong
- * @date: 2018-05-09 18:43
- * @description:
- */
-
-import org.apache.commons.lang3.StringUtils;
-
-import javax.net.ssl.*;
-import java.io.*;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * http 工具类
- *
- * @author cloud cloud
- * @create 2017/10/18
- **/
-public class HttpUtil {
-
- private static final String CHARSET = "UTF-8";
- private static final String HTTP_POST = "POST";
- private static final String HTTP_GET = "GET";
-
- private static final String HTTP_PUT = "PUT";
-
- /**
- * Send GET request
- */
- public static String get(String url, Map<String, String> queryParas, Map<String, String> headers) {
- HttpURLConnection conn = null;
- try {
- conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), HTTP_GET, headers);
- conn.connect();
- return readResponseString(conn);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (conn != null) {
- conn.disconnect();
- }
- }
- }
-
- public static String get(String url, Map<String, String> queryParas) {
- return get(url, queryParas, null);
- }
-
- public static String get(String url) {
- return get(url, null, null);
- }
-
- public static String jsonGet(String url,Map<String,String> params){
- Map<String,String> headers = new HashMap<>();
- headers.put("Content-Type","application/json");
- return get(url,params,headers);
- }
-
-
- /**
- * Send POST request
- */
- public static String post(String url, Map<String, String> queryParas, String data, Map<String, String> headers) {
- HttpURLConnection conn = null;
- try {
- conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), HTTP_POST, headers);
- conn.connect();
- OutputStream out = conn.getOutputStream();
- out.write(data.getBytes(CHARSET));
- out.flush();
- out.close();
- return readResponseString(conn);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (conn != null) {
- conn.disconnect();
- }
- }
- }
-
- public static String post(String url, Map<String, String> queryParas, String data) {
- return post(url, queryParas, data, null);
- }
-
- public static String post(String url, String data, Map<String, String> headers) {
- return post(url, null, data, headers);
- }
-
- public static String post(String url, String data) {
- return post(url, null, data, null);
- }
-
- public static String jsonPost(String url,String data){
- Map<String,String> headers = new HashMap<>();
- headers.put("Content-Type","application/json");
- return post(url,null,data,headers);
- }
-
- public static String jsonPost(String url,Map<String,String>headers,String data){
- if(headers == null){
- headers = new HashMap<>();
- }
- headers.put("Content-Type","application/json");
- return post(url,null,data,headers);
- }
-
- /**
- * Send POST request
- */
- public static String put(String url, Map<String, String> queryParas, String data, Map<String, String> headers) {
- HttpURLConnection conn = null;
- try {
- conn = getHttpConnection(buildUrlWithQueryString(url, queryParas), HTTP_PUT, headers);
- conn.connect();
- OutputStream out = conn.getOutputStream();
- out.write(data.getBytes(CHARSET));
- out.flush();
- out.close();
- return readResponseString(conn);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (conn != null) {
- conn.disconnect();
- }
- }
- }
-
-
-
- public static String jsonPut(String url,String data){
- Map<String,String> headers = new HashMap<>();
- headers.put("Content-Type","application/json");
- return put(url,null,data,headers);
- }
-
-
- /**
- * https 域名校验
- */
- private static class TrustAnyHostnameVerifier implements HostnameVerifier {
- @Override
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }
- }
-
- /**
- * https 证书管理
- */
- private static class TrustAnyTrustManager implements X509TrustManager {
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
- }
-
- private static SSLSocketFactory initSSLSocketFactory() {
- try {
- TrustManager[] tm = {new TrustAnyTrustManager()};
- SSLContext sslContext = SSLContext.getInstance("TLS", "SunJSSE");
- sslContext.init(null, tm, new java.security.SecureRandom());
- return sslContext.getSocketFactory();
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private static final SSLSocketFactory sslSocketFactory = initSSLSocketFactory();
- private static final TrustAnyHostnameVerifier trustAnyHostnameVerifier = new TrustAnyHostnameVerifier();
-
- private static HttpURLConnection getHttpConnection(String url, String method, Map<String, String> headers) throws Exception {
- URL _url = new URL(url);
- HttpURLConnection conn = (HttpURLConnection)_url.openConnection();
- if (conn instanceof HttpsURLConnection) {
- ((HttpsURLConnection)conn).setSSLSocketFactory(sslSocketFactory);
- ((HttpsURLConnection)conn).setHostnameVerifier(trustAnyHostnameVerifier);
- }
- conn.setRequestMethod(method);
- conn.setDoOutput(true);
- conn.setDoInput(true);
- conn.setConnectTimeout(30000);
- conn.setReadTimeout(30000);
- conn.setUseCaches(false); // Post 请求不能使用缓存
- if(headers != null){
- String contentType = headers.get("Content-Type");
- if(StringUtils.isNotEmpty(contentType)){
- conn.setRequestProperty("Content-Type",contentType);
- }else{
- conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
- }
- }
- conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36");
- if (headers != null && !headers.isEmpty())
- for (Map.Entry<String, String> entry : headers.entrySet())
- conn.setRequestProperty(entry.getKey(), entry.getValue());
-
- return conn;
- }
-
- private static String readResponseString(HttpURLConnection conn) {
- StringBuilder sb = new StringBuilder();
- InputStream inputStream = null;
- try {
- inputStream = conn.getInputStream();
- BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, CHARSET));
- String line = null;
- while ((line = reader.readLine()) != null){
- sb.append(line).append("\n");
- }
- return sb.toString();
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- finally {
- if (inputStream != null) {
- try {
- inputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- /**
- * Build queryString of the url
- */
- private static String buildUrlWithQueryString(String url, Map<String, String> queryParas) {
- if (queryParas == null || queryParas.isEmpty())
- return url;
-
- StringBuilder sb = new StringBuilder(url);
- boolean isFirst;
- if (url.indexOf("?") == -1) {
- isFirst = true;
- sb.append("?");
- }
- else {
- isFirst = false;
- }
-
- for (Map.Entry<String, String> entry : queryParas.entrySet()) {
- if (isFirst) isFirst = false;
- else sb.append("&");
-
- String key = entry.getKey();
- String value = entry.getValue();
- if (!StringUtils.isEmpty(value)){
- try {value = URLEncoder.encode(value, CHARSET);} catch (UnsupportedEncodingException e) {throw new RuntimeException(e);}
- sb.append(key).append("=").append(value);
- }
- }
- return sb.toString();
- }
-}
-
-
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java
deleted file mode 100644
index 87d9239..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/Impl/BlockSeriveImpl.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service.Impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.blackchain.service.BlockSerive;
-import com.xcong.excoin.modules.blackchain.service.BtcService;
-import com.xcong.excoin.modules.blackchain.service.EthService;
-import com.xcong.excoin.modules.blackchain.service.LtcService;
-import com.xcong.excoin.modules.blackchain.service.UsdtService;
-import com.xcong.excoin.modules.blackchain.service.XrpService;
-import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.RedisUtils;
-
-@Slf4j
-@Service
-public class BlockSeriveImpl implements BlockSerive {
-
- @Resource
- RedisUtils redisUtil;
- @Resource
- MemberDao memberDao;
- @Resource
- MemberCoinAddressDao memberMapper;
-
- @Override
- public Result findBlockAddress(String symbol) {
- //获取用户ID
- String mId = LoginUserUtils.getAppLoginUser().getId().toString();
- MemberEntity member = memberDao.selectById(mId);
- if (member == null) {
- return Result.fail(MessageSourceUtils.getString("member_service_0003"));
- }
- String lable = "ERC20";
- Result result = new Result();
- try {
- Map<String, String> map = new HashMap<String, String>();
- MemberCoinAddressEntity memberCoinAddress = new MemberCoinAddressEntity();
-
- if ("USDT".equals(symbol)) {
- memberCoinAddress = memberMapper.selectBlockAddressWithTag(Long.parseLong(mId), symbol, lable);
- } else {
- memberCoinAddress = memberMapper.selectBlockAddress(Long.parseLong(mId), symbol);
- }
- log.info("--->{}", memberCoinAddress);
- if (memberCoinAddress != null) {
- map.put("address", memberCoinAddress.getAddress());
- map.put("lable", memberCoinAddress.getLabel());
- result.setData(map);
- result.setCode(0);
- } else {
- String address = "";
- String key = "";
- String uuid = member.getInviteId();
- switch (symbol) {
- case "BTC":
- Map<String, String> btcMap = UsdtService.createWallet(mId);
- address = btcMap.get("address");
- key = btcMap.get("privateKey");
- map.put("address", address);
- break;
- case "ETH":
- Map<String, String> ethMap = EthService.createEth();
- address = ethMap.get("address");
- key = ethMap.get("privateKey");
- map.put("address", address);
- break;
- case "BCH":
- MemberCoinAddressEntity btcAddress = memberMapper.selectBlockAddress(Long.parseLong(mId), "BTC");
- if (btcAddress != null) {
- address = btcAddress.getAddress();
- key = btcAddress.getPrivateKey();
- map.put("address", address);
- } else {
- Map<String, String> bchMap = BtcService.createWallet(mId);
- address = bchMap.get("address");
- key = bchMap.get("privateKey");
- map.put("address", address);
-
- MemberCoinAddressEntity coinAddress = new MemberCoinAddressEntity();
- coinAddress.setAddress(address);
- coinAddress.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_YES);
- coinAddress.setMemberId(Long.parseLong(mId));
- coinAddress.setPrivateKey(key);
- coinAddress.setSymbol("BTC");
- coinAddress.setLabel(uuid);
- memberMapper.insert(coinAddress);
- }
- break;
- case "EOS":
- address = "biyicteos123";
- map.put("address", address);
- map.put("lable", uuid);
- break;
- case "XRP":
- address = "biyicteos123";
- map.put("address", address);
- map.put("lable", uuid);
- break;
- case "LTC":
- Map<String, String> ltcMap = LtcService.createWallet(mId);
- address = ltcMap.get("address");
- key = ltcMap.get("privateKey");
- map.put("address", address);
- break;
- case "ETC":
- MemberCoinAddressEntity ethAddress = memberMapper.selectBlockAddress(Long.parseLong(mId), "ETH");
- if (ethAddress != null) {
- address = ethAddress.getAddress();
- key = ethAddress.getPrivateKey();
- map.put("address", address);
- } else {
- Map<String, String> etcMap = EthService.createEth();
- address = etcMap.get("address");
- key = etcMap.get("privateKey");
- map.put("address", address);
-
- MemberCoinAddressEntity coinAddress = new MemberCoinAddressEntity();
- coinAddress.setAddress(address);
- coinAddress.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_YES);
- coinAddress.setMemberId(Long.parseLong(mId));
- coinAddress.setPrivateKey(key);
- coinAddress.setSymbol("ETH");
- coinAddress.setLabel(uuid);
- memberMapper.insert(coinAddress);
- }
-
- break;
- case "USDT":
- if ("OMNI".equals(lable)) {
- MemberCoinAddressEntity btcAddress2 = memberMapper.selectBlockAddress(Long.parseLong(mId), "BTC");
- if (btcAddress2 != null) {
- address = btcAddress2.getAddress();
- key = btcAddress2.getPrivateKey();
- map.put("address", address);
- } else {
- //如果BTC地址不存在,创建一个BTC地址
- Map<String, String> usdtMap = UsdtService.createWallet(mId);
- address = usdtMap.get("address");
- key = usdtMap.get("privateKey");
- map.put("address", address);
-
- MemberCoinAddressEntity coinAddress = new MemberCoinAddressEntity();
- coinAddress.setAddress(address);
- coinAddress.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_YES);
- coinAddress.setMemberId(Long.parseLong(mId));
- coinAddress.setPrivateKey(key);
- coinAddress.setSymbol("BTC");
- coinAddress.setLabel(uuid);
- memberMapper.insert(coinAddress);
- }
-
- } else {
- MemberCoinAddressEntity ethAddress2 = memberMapper.selectBlockAddress(Long.parseLong(mId), "ETH");
- if (ethAddress2 != null) {
- address = ethAddress2.getAddress();
- key = ethAddress2.getPrivateKey();
- map.put("address", address);
- } else {
- Map<String, String> usdtMap = EthService.createEth();
- address = usdtMap.get("address");
- key = usdtMap.get("privateKey");
- map.put("address", address);
-
- MemberCoinAddressEntity coinAddress = new MemberCoinAddressEntity();
- coinAddress.setAddress(address);
- coinAddress.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_YES);
- coinAddress.setMemberId(Long.parseLong(mId));
- coinAddress.setPrivateKey(key);
- coinAddress.setSymbol("ETH");
- coinAddress.setLabel(uuid);
- memberMapper.insert(coinAddress);
- }
- }
- break;
- default:
- break;
- }
- MemberCoinAddressEntity coinAddress = new MemberCoinAddressEntity();
- coinAddress.setAddress(address);
- coinAddress.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_YES);
- coinAddress.setMemberId(Long.parseLong(mId));
- coinAddress.setPrivateKey(key);
- coinAddress.setSymbol(symbol);
- coinAddress.setLabel(uuid);
- if (symbol.equals("USDT")) {
- coinAddress.setTag(lable);
- }
-
- memberMapper.insert(coinAddress);
- result.setData(map);
- result.setCode(0);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/LtcService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/LtcService.java
deleted file mode 100644
index 9acd8a1..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/LtcService.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-
-
-public class LtcService {
-
- private static LtcService service = null;
- private final static String RESULT = "result";
- private final static String METHOD_SEND_TO_ADDRESS = "sendtoaddress";
- private final static String METHOD_GET_TRANSACTION = "gettransaction";
- private final static String METHOD_LIST_TRANSACTIONS = "listtransactions";
- private final static String METHOD_GET_BLOCK_COUNT = "getblockcount";
- private final static String METHOD_NEW_ADDRESS = "getnewaddress";
- private final static String METHOD_GET_BALANCE = "getbalance";
- private final static String METHOD_WALLET_PASSPHRASE = "walletpassphrase";
- private final static String METHOD_WALLET_LOCK = "walletlock";
- private final static String METHOD_GET_BALANCE_ADDRESS = "getreceivedbyaddress";
-
- private String url = "http://121.40.86.163:1888";
- private String username = "biyiltc";
- private String password = "biyiltc";
-
- public static LtcService getInstance() {
- if (service != null) {
- return service;
- }
- return new LtcService();
- }
-
- private LtcService() {
- }
-
- /**
- * 创建BTC钱包 每个账户对应一个地址 方便后续操作
- * @param mId 账户
- * @return
- */
- public static Map<String, String> createWallet(String mId) {
- LtcService btcService = getInstance();
- // 创建钱包地址
- String address = btcService.getAddress(mId);
- // 私钥
- String privateKey = btcService.dumpprivkey(address);
- Map<String, String> result = new HashMap<String,String>();
- result.put("address", address);
- result.put("privateKey", privateKey);
- return result;
- }
- public String getAddress(String label) {
- try {
- JSONObject json = doRequest(METHOD_NEW_ADDRESS,label);
- //JSONObject json = doRequest(METHOD_NEW_ADDRESS);
- if (isError(json)) {
- return "";
- }
- return json.getString(RESULT);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private JSONObject doRequest(String method, Object... params) {
- JSONObject param = new JSONObject();
- param.put("id", System.currentTimeMillis() + "");
- param.put("jsonrpc", "2.0");
- param.put("method", method);
- if (params != null) {
- param.put("params", params);
- }
- String creb = Base64.encodeBase64String((username + ":" + password).getBytes());
- Map<String, String> headers = new HashMap<>(2);
- headers.put("Authorization", "Basic " + creb);
- return JSON.parseObject(HttpUtil.jsonPost(url, headers, param.toJSONString()));
- }
-
- private boolean isError(JSONObject json) {
- if (json == null || (StringUtils.isNotEmpty(json.getString("error")) && json.get("error") != "null")) {
- return true;
- }
- return false;
- }
-
- public String dumpprivkey(String address) {
- try {
- JSONObject obj = doRequest("dumpprivkey", address);
- //System.out.println(obj);
- if (!isError(obj)) {
- return obj.getString(RESULT);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 查询给定地址的总收款额(只计算接受的)
- * @param address
- * @return
- */
- public BigDecimal getBalance(String address) {
- JSONObject json = doRequest(METHOD_GET_BALANCE_ADDRESS,address,3);
- if (!isError(json)) {
- return new BigDecimal(json.getString(RESULT));
- } else {
- return null;
- }
- }
-
- public static void main(String[] args) {
- BigDecimal s = LtcService.getInstance().getBalance("MS6UBteTkQYbbBg5xEPWUQ1PPG7zkxY368");
- System.out.println(s);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtEthService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtEthService.java
deleted file mode 100644
index b3aea54..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtEthService.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao;
-import com.xcong.excoin.modules.member.dao.MemberCoinChargeDao;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
-import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-/**
- * @author wzy
- * @date 2020-07-03
- **/
-@Slf4j
-@Component
-public class UsdtEthService {
-
- private static final BigDecimal LIMIT = new BigDecimal("50");
- private static final BigDecimal LIMIT_ETH = new BigDecimal("0.2");
- private static final BigDecimal FEE = new BigDecimal("0.005");
- private static final BigDecimal ETH_TR_FEE = new BigDecimal("0.0032");
-
- public static String ETH_FEE = "0.005";
-
- public static final String TOTAL_ADDRESS = "0x067b4bE5d7B05560AE539Fc8f10597D854ae056D";
- public static final String TOTAL_PRIVATE = "1fb7288c8c88c37d6f79e9617822bffc8d3635bf2d808c5f6afdee9bb326e49c";
-
- @Resource
- private MemberCoinChargeDao memberCoinChargeDao;
- @Resource
- private MemberCoinAddressDao memberCoinAddressDao;
- @Resource
- private MemberWalletCoinDao memberWalletCoinDao;
-
- public void pool() throws ExecutionException, InterruptedException {
- List<MemberCoinChargeEntity> list = memberCoinChargeDao.selectAllBySymbolAndTag(CoinTypeEnum.USDT.name(), "ERC20", 1);
- if (CollUtil.isNotEmpty(list)) {
- EthService ethService = new EthService();
-
- for (MemberCoinChargeEntity coinCharge : list) {
- // 首先根据每个地址查询其是否有ETH 如果没有就充值ETH并设置1 表示初始状态 status=2(待充值)3:表示已提过
- String address = coinCharge.getAddress();
- Long memberId = coinCharge.getMemberId();
- BigDecimal lastAmount = coinCharge.getLastAmount();
- if (lastAmount == null || lastAmount.compareTo(LIMIT) < 0) {
- continue;
- }
-
- BigDecimal usdt = ethService.tokenGetBalance(address);
- log.info("地址:{}, 金额:{}", address, usdt);
- if (usdt != null && usdt.compareTo(LIMIT) > 0) {
- usdt = usdt.subtract(new BigDecimal("0.01"));
-
- // 查询eth是否足够
- BigDecimal eth = EthService.getEthBlance(address);
- log.info("地址:{}, ETH:{}", address, eth);
- if (eth != null && eth.compareTo(FEE) >= 0) {
- MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddressDao.selectBlockAddressWithTag(memberId, CoinTypeEnum.USDT.name(), "ERC20");
- if (memberCoinAddressEntity == null) {
- continue;
- }
-
- String privateKey = memberCoinAddressEntity.getPrivateKey();
-
- usdt = usdt.multiply(new BigDecimal("1000000"));
- String usdtStr = usdt.toPlainString();
- if (usdtStr.contains(".")) {
- usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf("."));
- }
-
- String hash = ethService.tokenSend(privateKey, address, TOTAL_ADDRESS, usdtStr);
- log.info("归集:{}", hash);
- if (StrUtil.isNotBlank(hash)) {
- // 归集成功更新状态 先保存本次的hash值,待交易成功后再更新
- coinCharge.setHash(hash);
- memberCoinChargeDao.updateById(coinCharge);
- }
- } else {
- String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE);
- log.info("转手续费:{}", hash);
- }
- }
- }
- }
- }
-
-
- public void ethPool() throws ExecutionException, InterruptedException {
- List<MemberCoinChargeEntity> list = memberCoinChargeDao.selectAllBySymbolAndTag(CoinTypeEnum.ETH.name(), null, 1);
- if (CollUtil.isNotEmpty(list)) {
- EthService ethService = new EthService();
- for (MemberCoinChargeEntity coinCharge : list) {
- String address = coinCharge.getAddress();
- Long memberId = coinCharge.getMemberId();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.ETH.name());
- if (walletCoin == null) {
- continue;
- }
-
- BigDecimal earlyBalance = walletCoin.getEarlyBalance();
-
- if (earlyBalance == null || earlyBalance.compareTo(LIMIT_ETH) < 0) {
- continue;
- }
-
- BigDecimal eth = EthService.getEthBlance(address);
- if (eth != null && eth.compareTo(LIMIT_ETH) >= 0) {
- MemberCoinAddressEntity coinAddress = memberCoinAddressDao.selectBlockAddressWithTag(memberId, CoinTypeEnum.ETH.name(), null);
- String privateKey = coinAddress.getPrivateKey();
-
- BigDecimal tr = eth.subtract(ETH_TR_FEE);
- String hash = ethService.ethSend(privateKey, address, TOTAL_ADDRESS, tr.toPlainString());
- if (StrUtil.isNotBlank(hash)) {
- coinCharge.setHash(hash);
- coinCharge.setLastAmount(new BigDecimal("0.0001"));
- coinCharge.setStatus(3);
- memberCoinChargeDao.updateById(coinCharge);
- }
- }
- }
- }
- }
-
- /**
- * 定时查询该归集转账交易是否成功
- */
- public void usdtEthPoolCheck() {
- // 首先查询需要确认的交易
- List<MemberCoinChargeEntity> list = memberCoinChargeDao.selectAllBySymbolAndTag(CoinTypeEnum.USDT.name(), "ERC20", null);
- EthService ethService = new EthService();
-
- if (CollectionUtils.isNotEmpty(list)) {
- for (MemberCoinChargeEntity appeal : list) {
- String hash = appeal.getHash();
- boolean b = ethService.checkTransferResult(hash);
- if (b) {
- appeal.setStatus(3);
- appeal.setLastAmount(new BigDecimal("0.0001"));
-
- // 表示这笔归集转账已经成功
- // 更新状态
- memberCoinChargeDao.updateById(appeal);
- }
- }
- }
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtService.java
deleted file mode 100644
index bfb5074..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/UsdtService.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-
-public class UsdtService {
-// public static void main(String[] args) throws IOException {
-// ECKey key = new ECKey();
-// //logger.info("We created a new key:\n" + key);
-// // TEST 网络
-// NetworkParameters params = MainNetParams.get();
-// Address addressFromKey = key.toAddress(params);
-// System.out.println("Public Address generated: " + addressFromKey);
-// //logger.info("Public Address generated: " + addressFromKey);
-// String privateKey = key.getPrivateKeyEncoded(params).toString();
-// System.out.println("Private key is: " + privateKey);
-// //logger.info("Private key is: " + privateKey);
-// //logger.info("Private Hex key is: " + key.getPrivateKeyAsHex());
-// Wallet wallet = new Wallet(TestNet3Params.get());
-// File walletFile = new File("D//:test.wallet");
-// wallet.importKey(key);
-// wallet.saveToFile(walletFile);
-// }
-
- private static UsdtService service = null;
- private final static String RESULT = "result";
- private final static String METHOD_SEND_TO_ADDRESS = "sendtoaddress";
- private final static String METHOD_GET_TRANSACTION = "gettransaction";
- private final static String METHOD_LIST_TRANSACTIONS = "listtransactions";
- private final static String METHOD_GET_BLOCK_COUNT = "getblockcount";
- private final static String METHOD_NEW_ADDRESS = "getnewaddress";
- private final static String METHOD_GET_BALANCE = "getbalance";
- private final static String METHOD_GET_BALANCE_ADDRESS = "getreceivedbyaddress";
- private final static String METHOD_WALLET_PASSPHRASE = "walletpassphrase";
- private final static String METHOD_WALLET_LOCK = "walletlock";
-
- private String url = "http://120.55.86.146:1880";
- private String username = "biyi";
- private String password = "biyi1234";
-
- public static UsdtService getInstance() {
- if (service != null) {
- return service;
- }
- return new UsdtService();
- }
-
- private UsdtService() {
- }
-
- /**
- * 创建BTC钱包 每个账户对应一个地址 方便后续操作
- *
- * @param mId 账户
- * @return
- */
- public static Map<String, String> createWallet(String mId) {
- UsdtService btcService = getInstance();
- // 创建钱包地址
- String address = btcService.getAddress(mId);
- // 私钥
- String privateKey = btcService.dumpprivkey(address);
- Map<String, String> result = new HashMap<String, String>();
- result.put("address", address);
- result.put("privateKey", privateKey);
- return result;
- }
-
- public String getAddress(String label) {
- try {
- JSONObject json = doRequest(METHOD_NEW_ADDRESS, label);
- if (isError(json)) {
- return "";
- }
- return json.getString(RESULT);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private JSONObject doRequest(String method, Object... params) {
- JSONObject param = new JSONObject();
- param.put("id", System.currentTimeMillis() + "");
- param.put("jsonrpc", "2.0");
- param.put("method", method);
- if (params != null) {
- param.put("params", params);
- }
- String creb = Base64.encodeBase64String((username + ":" + password).getBytes());
- Map<String, String> headers = new HashMap<>(2);
- headers.put("Authorization", "Basic " + creb);
- return JSON.parseObject(HttpUtil.jsonPost(url, headers, param.toJSONString()));
- }
-
- private boolean isError(JSONObject json) {
- if (json == null || (StringUtils.isNotEmpty(json.getString("error")) && json.get("error") != "null")) {
- return true;
- }
- return false;
- }
-
- public String dumpprivkey(String address) {
- try {
- JSONObject obj = doRequest("dumpprivkey", address);
- System.out.println(obj);
- if (!isError(obj)) {
- return obj.getString(RESULT);
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 查询给定地址的总收款额(只计算接受的)
- *
- * @param address
- * @return
- */
- public BigDecimal getBalance(String address) {
- try {
- JSONObject json = doRequest("omni_getbalance", address, 31);
- if (!isError(json)) {
- return new BigDecimal(json.getJSONObject(RESULT).get("balance").toString());
- } else {
- return null;
- }
- } catch (Exception e) {
- e.printStackTrace();
- System.out.println("BTC-USDT查询余额失败");
- return null;
- }
-
- }
-
- public String METHOD_GET_BLOCK_COUNT() {
- JSONObject json = doRequest(METHOD_GET_BLOCK_COUNT);
- if (!isError(json)) {
- return json.getString(RESULT);
- } else {
- return null;
- }
- }
-
-
-
-
-
- public static void main(String[] args) {
-
- System.out.println(UsdtService.getInstance().getBalance("1PLCr8A2z7YLEtoPLJdzzqpfb3Ym87UCtt"));
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/blackchain/service/XrpService.java b/src/main/java/com/xcong/excoin/modules/blackchain/service/XrpService.java
deleted file mode 100644
index 781eee7..0000000
--- a/src/main/java/com/xcong/excoin/modules/blackchain/service/XrpService.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.xcong.excoin.modules.blackchain.service;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.text.MessageFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.ripple.core.coretypes.AccountID;
-import com.ripple.core.coretypes.Amount;
-import com.ripple.core.coretypes.uint.UInt32;
-import com.ripple.core.types.known.tx.signed.SignedTransaction;
-import com.ripple.core.types.known.tx.txns.Payment;
-import com.xcong.excoin.modules.blackchain.model.XrpTransResult;
-
-public class XrpService {
-
- /**
- * 平台钱包地址
- */
- public final static String ACCOUNT="rKMGEyjXErL2dx9ck5QXFJVH8onSfHF5gn";
- /**
- * 官方接口地址
- */
- private static String getUrl = "https://data.ripple.com";
- private String postUrl = "https://s1.ripple.com:51234";
-
- /**
- * 结果类型
- */
- private final static String TES_SUCCESS = "tesSUCCESS";
-
-
-
-
-
- /**
- * start YYYY-MM-DDThh:mm:ssZ String - Timestamp Start time of query range. The default is the
- * earliest date available.
- * end String - Timestamp End time of query range. The
- * default is the current date.
- * min_sequence String Minimum sequence number to
- * query.
- * max_sequence String Max sequence number to query.
- * type String Restrict results to a specified transaction type.
- * result String Restrict results to a specified transaction result.
- * binary Boolean Return results in binary format.
- * descending Boolean If true, return results in reverse chronological order.The default is false.
- * limit Integer Maximum results per page. The default is 20. Cannot be more than 1,000.
- * marker String Pagination key from previously
- * returned response.
- *
- * https://github.com/ripple/rippled-historical-database
- * 接口文档:https://xrpl.org/data-api.html#get-account
- */
- public static XrpTransResult getTransactions(Date start) {
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- String startTime = dateFormat.format(start);
- String url ="https://data.ripple.com/v2/accounts/"+ACCOUNT+"/transactions?type=Payment&result=tesSUCCESS&limit=100&start="+startTime;
- // 十分钟查一次 每次100条
- String result = HttpUtil.get(url);
- try {
- JSONObject json = JSONObject.parseObject(result);
- XrpTransResult res = json.toJavaObject(XrpTransResult.class);
- return res;
- }catch(Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
deleted file mode 100644
index 64df9f2..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package com.xcong.excoin.modules.coin.controller;
-
-import java.math.BigDecimal;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo;
-
-import io.swagger.annotations.*;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
-import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceDto;
-import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceFromAgentDto;
-import com.xcong.excoin.modules.coin.service.CoinService;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Api(value = "会员资产接口", tags = "会员资产接口")
-@RestController
-@RequestMapping(value = "/api/walletCoin")
-public class CoinController {
-
- @Resource
- private CoinService coinService;
-
- /**
- * 获取我的总资产
- * @return
- */
- @ApiOperation(value = "获取我的总资产", notes = "获取我的总资产")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = AllWalletCoinVo.class)})
- @GetMapping(value = "/getAllWalletCoin")
- public Result getAllWalletCoin() {
- return coinService.getAllWalletCoin();
- }
- /**
- * 获取我的币币资产信息
- * @return
- */
- @ApiOperation(value = "获取我的币币账户信息", notes = "获取我的币币账户信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberWalletCoinVo.class)})
- @GetMapping(value = "/getWalletCoin")
- public Result getWalletCoin() {
- return coinService.getWalletCoin();
- }
-
- /**
- * 获取币币账户某个币种信息
- * @return
- */
- @ApiOperation(value="获取币币账户某个币种信息", notes="获取币币账户某个币种信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberWalletCoinInfoVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/getWalletCoinBySymbol")
- public Result getWalletCoinBySymbol(String symbol) {
- return coinService.getWalletCoinBySymbol(symbol);
- }
-
- /**
- * --todo
- * 获取我的合约资产信息
- * @return
- */
- @ApiOperation(value="获取我的合约账户信息", notes="获取我的合约账户信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberWalletContractInfoVo.class)})
- @GetMapping(value="/getWalletContractById")
- public Result getWalletContractById() {
- return coinService.getWalletContractById();
- }
-
- /**
- * 查询合约账户里面的可用资产余额
- * @return
- */
- @ApiOperation(value="查询合约账户里面的可用资产余额", notes="查询合约账户里面的可用资产余额")
- @GetMapping(value="/findWalletContractBySymbol")
- public Result findWalletContractBySymbol() {
- return coinService.findWalletContractBySymbol();
- }
-
- /**
- * 查询币币账户里面的可用资产余额
- * @return
- */
- @ApiOperation(value="查询币币账户里面的可用资产余额", notes="查询币币账户里面的可用资产余额")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value="/findWalletCoinBySymbol")
- public Result findWalletCoinBysymbol(String symbol) {
- return coinService.findWalletCoinBySymbol(symbol);
- }
-
- /**
- * 查询代理账户里面的资产余额
- * @return
- */
- @ApiOperation(value="查询代理账户信息", notes="查询代理账户信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberWalletAgentInfoVo.class)})
- @GetMapping(value="/findWalletAgentBySymbol")
- public Result findWalletAgentBySymbol() {
- return coinService.findWalletAgentBySymbol();
- }
-
- /**
- * 获取币币资产交易记录
- * @return
- */
- @ApiOperation(value="获取币币资产交易记录", notes="获取币币资产交易记录")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)})
- @PostMapping(value="/getWalletCoinRecords")
- public Result getWalletCoinRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) {
- return coinService.getWalletCoinRecords(recordsPageDto);
- }
-
- /**
- * 获取合约资产交易记录
- * @return
- */
- @ApiOperation(value="获取合约资产交易记录", notes="获取合约资产交易记录")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)})
- @PostMapping(value="/getWalletContractRecords")
- public Result getWalletContractRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) {
- return coinService.getWalletContractRecords(recordsPageDto);
- }
-
- /**
- * 获取代理资产交易记录
- * @return
- */
- @ApiOperation(value="获取代理资产交易记录", notes="获取代理资产交易记录")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAccountMoneyChangeInfoVo.class)})
- @PostMapping(value="/getWalletAgentRecords")
- public Result getWalletAgentRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) {
- return coinService.getWalletAgentRecords(recordsPageDto);
- }
-
- /**
- * 获取代理资产佣金入账
- * @return
- */
- @ApiOperation(value="获取代理资产佣金入账", notes="获取代理资产佣金入账")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAgentIntoInfoVo.class)})
- @PostMapping(value="/getWalletAgentIntoRecords")
- public Result getWalletAgentIntoRecords(@RequestBody @Valid RecordsPageDto recordsPageDto) {
- return coinService.getWalletAgentIntoRecords(recordsPageDto);
- }
-
- /**
- * 币币账户USDT划转到合约账户
- * @return
- */
- @ApiOperation(value="币币账户USDT划转到合约账户", notes="币币账户USDT划转到合约账户")
- @PostMapping(value="/coinWalletTransferToContract")
- public Result coinWalletTransferToContract(@RequestBody @Valid TransferOfBalanceDto transferOfBalanceDto) {
- BigDecimal balance = transferOfBalanceDto.getBalance();
- String symbol = transferOfBalanceDto.getSymbol();
- return coinService.coinWalletTransferToContract(balance,symbol);
- }
-
- /**
- * 合约账户划转到币币USDT账户
- * @return
- */
- @ApiOperation(value="合约账户划转到币币USDT账户", notes="合约账户划转到币币USDT账户")
- @PostMapping(value="/contractTransferToWalletCoin")
- public Result contractTransferToWalletCoin(@RequestBody @Valid TransferOfBalanceDto transferOfBalanceDto) {
- BigDecimal balance = transferOfBalanceDto.getBalance();
- String symbol = transferOfBalanceDto.getSymbol();
- return coinService.contractTransferToWalletCoin(balance,symbol);
- }
-
- /**
- * 代理账户划转到USDT账户
- * @return
- */
- @ApiOperation(value="代理账户划转到合约或币币USDT账户", notes="代理账户划转到合约或币币USDT账户")
- @PostMapping(value="/agentTransferToWalletCoin")
- public Result agentTransferToWalletCoin(@RequestBody @Valid TransferOfBalanceFromAgentDto transferOfBalanceFromAgentDto) {
- BigDecimal balance = transferOfBalanceFromAgentDto.getBalance();
- Integer transfertype = transferOfBalanceFromAgentDto.getTransfertype();
- return coinService.agentTransferToWalletCoin(balance,transfertype);
- }
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java
deleted file mode 100644
index f9f4ece..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.xcong.excoin.modules.coin.controller;
-
-import java.math.BigDecimal;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.parameter.dto.CancelEntrustWalletCoinOrderDto;
-import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto;
-import com.xcong.excoin.modules.coin.parameter.dto.FindCollectDto;
-import com.xcong.excoin.modules.coin.parameter.dto.SubmitSalesWalletCoinOrderDto;
-import com.xcong.excoin.modules.coin.parameter.vo.FindCollectListVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinListVo;
-import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo;
-import com.xcong.excoin.modules.coin.service.OrderCoinService;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@Api(value = "币币交易接口", tags = "币币交易接口")
-@RestController
-@RequestMapping(value = "/api/orderCoin")
-public class OrderCoinController {
-
- @Resource
- OrderCoinService orderCoinService;
-
- /**
- * 进入交易页面
- * @return
- */
- @ApiOperation(value = "进入交易页面", notes = "进入交易页面")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = TransactionPageOfWalletCoinVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/enterTransactionPageOfWalletCoin")
- public Result enterTransactionPageOfWalletCoin(String symbol) {
- return orderCoinService.enterTransactionPageOfWalletCoin(symbol);
- }
-
- /**
- * 提交买卖订单
- * @return
- */
- @ApiOperation(value = "提交买卖订单", notes = "提交买卖订单")
- @PostMapping(value="/submitSalesWalletCoinOrder")
- public Result submitSalesWalletCoinOrder(@RequestBody @Valid SubmitSalesWalletCoinOrderDto submitSalesWalletCoinOrderDto) {
- String symbol = submitSalesWalletCoinOrderDto.getSymbol();
- Integer type = submitSalesWalletCoinOrderDto.getType();
- Integer tradeType = submitSalesWalletCoinOrderDto.getTradeType();
- BigDecimal price = submitSalesWalletCoinOrderDto.getPrice();
- BigDecimal amount = submitSalesWalletCoinOrderDto.getAmount();
- return orderCoinService.submitSalesWalletCoinOrder(symbol,type,tradeType,price,amount);
- }
-
- /**
- * 获取委托单数据
- * @return
- */
- @ApiOperation(value = "获取委托单数据", notes = "获取委托单数据")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinListVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query"),
- @ApiImplicitParam(name = "status", value = "状态 1:委托中2:撤单3:已成交", required = true, dataType = "int", paramType="query")
- })
- @GetMapping(value = "/getEntrustWalletCoinOrder")
- public Result getEntrustWalletCoinOrder(String symbol,Integer status) {
- return orderCoinService.getEntrustWalletCoinOrder(symbol,status);
- }
-
- /**
- * 撤销委托订单
- * @return
- */
- @ApiOperation(value = "撤销委托订单", notes = "撤销委托订单")
- @PostMapping(value="/cancelEntrustWalletCoinOrder")
- public Result cancelEntrustWalletCoinOrder(@RequestBody @Valid CancelEntrustWalletCoinOrderDto cancelEntrustWalletCoinOrderDto) {
- String orderId = cancelEntrustWalletCoinOrderDto.getOrderId();
- return orderCoinService.cancelEntrustWalletCoinOrder(orderId);
- }
-
- /**
- * 获取币币交易历史订单信息
- * @return
- */
- @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
- @PostMapping(value="/findAllWalletCoinOrder")
- public Result findAllWalletCoinOrder(@RequestBody @Validated FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) {
- return orderCoinService.findAllWalletCoinOrder(findAllWalletCoinOrderDto);
- }
-
- /**
- * 获取一条币币交易历史订单信息
- * @return
- */
- @ApiOperation(value = "获取一条币币交易历史订单信息", notes = "获取一条币币交易历史订单信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "orderId", value = "订单ID", required = true, dataType = "Long", paramType="query")
- })
- @GetMapping(value = "/findWalletCoinOrder")
- public Result findWalletCoinOrder(Long orderId) {
- return orderCoinService.findWalletCoinOrder(orderId);
- }
-
- /**
- * 币币自选|取消自选
- * @return
- */
- @ApiOperation(value = "币币自选|取消自选", notes = "币币自选|取消自选")
- @PostMapping(value="/findCollect")
- public Result findCollect(@RequestBody @Valid FindCollectDto findCollectDto) {
- String symbol = findCollectDto.getSymbol();
- Integer type = findCollectDto.getType();
- return orderCoinService.findCollect(symbol,type);
- }
-
- /**
- * 币币是否自选
- * @return
- */
- @ApiOperation(value = "币币是否自选", notes = "币币是否自选")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberSelectSymbolsVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/checkIsCollect")
- public Result checkIsCollect(String symbol) {
- return orderCoinService.checkIsCollect(symbol);
- }
-
- /**
- * 已自选的币种
- * @return
- */
- @ApiOperation(value = "已自选的币种", notes = "已自选的币种")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = FindCollectListVo.class)})
- @GetMapping(value = "/findCollectList")
- public Result findCollectList() {
- return orderCoinService.findCollectList();
- }
-
- /**
- * 币种搜索
- * @return
- */
- @ApiOperation(value = "币种搜索", notes = "币种搜索")
- @GetMapping(value = "/searchSymbolResultList")
- public Result searchSymbolResultList() {
- return orderCoinService.searchSymbolResultList();
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountFlowEntityDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountFlowEntityDao.java
deleted file mode 100644
index 64af089..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountFlowEntityDao.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.xcong.excoin.modules.coin.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.coin.entity.MemberAccountFlowEntity;
-
-public interface MemberAccountFlowEntityDao extends BaseMapper<MemberAccountFlowEntity>{
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java
deleted file mode 100644
index 2319534..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountMoneyChangeDao.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.xcong.excoin.modules.coin.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-
-public interface MemberAccountMoneyChangeDao extends BaseMapper<MemberAccountMoneyChange>{
-
- List<MemberAccountMoneyChange> selectWalletCoinRecordsByMemIdTypeSymbol(Long memberId);
-
- List<MemberAccountMoneyChange> selectWalletContractRecordsByMemIdTypeSymbol(@Param("symbol")String symbol, @Param("memberId")Long memberId);
-
- List<MemberAccountMoneyChange> selectWalletAgentRecordByMemIdTypeSymbol(@Param("symbol")String symbol, @Param("memberId")Long memberId);
-
- List<MemberAccountMoneyChange> selectWalletAgentIntoRecordsByMemIdTypeSymbol(@Param("memberId")Long memberId);
-
- IPage<MemberAccountMoneyChange> selectWalletCoinRecordsInPage(Page<OrderCoinsDealEntity> page,
- @Param("record") MemberAccountMoneyChange memberAccountMoneyChange);
-
- IPage<MemberAccountMoneyChange> selectWalletContractRecordsInPage(Page<OrderCoinsDealEntity> page,
- @Param("record") MemberAccountMoneyChange memberAccountMoneyChange);
-
- IPage<MemberAccountMoneyChange> selectWalletAgentRecordsInPage(Page<OrderCoinsDealEntity> page,
- @Param("record") MemberAccountMoneyChange memberAccountMoneyChange);
-
- IPage<MemberAccountMoneyChange> selectWalletAgentIntoRecordsByMemIdTypeSymbol(Page<OrderCoinsDealEntity> page,
- @Param("record")MemberAccountMoneyChange memberAccountMoneyChange);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberSelectSymbolsDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberSelectSymbolsDao.java
deleted file mode 100644
index 4bd7721..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/MemberSelectSymbolsDao.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberSelectSymbolsEntity;
-
-public interface MemberSelectSymbolsDao extends BaseMapper<MemberSelectSymbolsEntity>{
-
- List<MemberSelectSymbolsEntity> selectSymbolByMemIdAndSymbol(@Param("memberId")Long memberId,@Param("symbol")String symbol);
-
- List<MemberSelectSymbolsEntity> selectSymbolByMemId(@Param("memberId")Long memberId);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java
deleted file mode 100644
index ab900b8..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.coin.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-
-public interface OrderCoinDealDao extends BaseMapper<OrderCoinsDealEntity>{
-
- List<OrderCoinsDealEntity> selectAllWalletCoinOrder(@Param("memberId")Long memberId);
-
- List<OrderCoinsDealEntity> selectAllWalletCoinOrderBySymbol(@Param("memberId")Long memberId,@Param("symbol")String symbol);
-
- OrderCoinsDealEntity selectWalletCoinOrder(@Param("memberId")Long memberId,@Param("orderId")Long orderId);
-
- IPage<OrderCoinsDealEntity> findAllWalletCoinOrderInPage(Page<OrderCoinsDealEntity> page,
- @Param("record") OrderCoinsDealEntity orderCoinsDealEntity);
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinsDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinsDao.java
deleted file mode 100644
index beed401..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinsDao.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.xcong.excoin.modules.coin.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
-
-public interface OrderCoinsDao extends BaseMapper<OrderCoinsEntity>{
-
- long getOrderCountByToday(@Param("now")String now,@Param("tomorrow") String tomorrow);
-
- List<OrderCoinsEntity> findCoinOrderListByMemberIdAndSysmbol(@Param("memberId")Long memberId,@Param("symbol")String symbol,@Param("status")int status);
-
- OrderCoinsEntity findWalletCoinOrderByOrderNo(@Param("orderNo")String orderNo);
-
- List<OrderCoinsEntity> selectAllEntrustingCoinOrderList();
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountFlowEntity.java b/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountFlowEntity.java
deleted file mode 100644
index 396540b..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountFlowEntity.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.xcong.excoin.modules.coin.entity;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-/**
- * 会员账户流水情况
- */
-@Data
-@TableName("member_account_flow")
-public class MemberAccountFlowEntity extends BaseEntity {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 会员ID
- */
- private Long memberId;
-
- /**
- * 价格
- */
- private BigDecimal price;
-
- /**
- * 用户余额
- */
- private BigDecimal balance;
-
- /**
- * 来源
- */
- private String source;
-
- public static final String SOURCE_BUY = "币币买入";
- public static final String SOURCE_SALE = "币币卖出";
- public static final String SOURCE_CANCEL = "撤销币币委托单";
-
- /**
- * 币种
- */
- private String symbol;
-
- /**
- * 备注
- */
- private String remark;
- public static final String REMARK_BUY = "买入";
- public static final String REMARK_SALE = "卖出";
- public static final String REMARK_CANCEL = "撤销";
- public static final String REMARK_RETURNBALANCE = "返回金额:";
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java b/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java
deleted file mode 100644
index 35f5d7a..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountMoneyChange.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.xcong.excoin.modules.coin.entity;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-@Data
-@TableName("member_account_money_change")
-public class MemberAccountMoneyChange extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 类型【1:币币资产2:合约资产3:代理资产】
- */
- public static final Integer TYPE_WALLET_COIN = 1;
- public static final Integer TYPE_WALLET_CONTRACT = 2;
- public static final Integer TYPE_WALLET_AGENT = 3;
- /**
- * 状态【0:待审核 1:成功2:失败】
- */
- public static final Integer STATUS_WAIT_INTEGER = 0;
- public static final Integer STATUS_SUCCESS_INTEGER = 1;
- public static final Integer STATUS_FAIL_INTEGER = 2;
-
- private Long memberId;
-
- /**
- * 币种
- */
- private String symbol;
-
- /**
- * 金额
- */
- private BigDecimal amount;
- /**
- * 记录内容
- */
- private String content;
- /**
- * 类型【1:币币资产2:合约资产3:代理资产】
- */
- private int type;
- /**
- * 状态【0:待审核 1:成功2:失败】
- */
- private int status;
- /**
- * 提币ID
- */
- private Long withdrawId;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java b/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java
deleted file mode 100644
index de6f514..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.xcong.excoin.modules.coin.entity;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-/**
- * 币币订单成交表
- */
-@Data
-@TableName("coins_order_deal")
-public class OrderCoinsDealEntity extends BaseEntity{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * 会员ID
- */
- private Long memberId;
- /**
- * 订单主表ID
- */
- private Long orderId;
- /**
- * 订单编号
- */
- private String orderNo;
- /**
- * 订单类型 1、买入2、卖出
- */
- private Integer orderType;
- public static final Integer ORDERTYPE_BUY = 1;
- public static final Integer ORDERTYPE_SELL = 2;
- /**
- * 交易类型 1:市价2:限价
- */
- private Integer tradeType;
- public static final Integer TRADETYPE_MARKETPRICE = 1;
- public static final Integer TRADETYPE_FIXEDPRICE = 2;
-
- /**
- * 状态 2:撤单3:已成交
- */
- private Integer orderStatus;
- public static final Integer ORDERSTATUS_CANCEL = 2;
- public static final Integer ORDERSTATUS_DONE = 3;
- /**
- * 币种
- */
- private String symbol;
- /**
- * 数量
- */
- private BigDecimal symbolCnt;
- /**
- * 委托价
- */
- private BigDecimal entrustPrice;
- /**
- * 成交价
- */
- private BigDecimal dealPrice;
- /**
- * 成交金额
- */
- private BigDecimal dealAmount;
- /**
- * 手续费
- */
- private BigDecimal feeAmount;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java b/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java
deleted file mode 100644
index 54cadd8..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package com.xcong.excoin.modules.coin.entity;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-/**
- * 币币订单表
- */
-@Data
-@TableName("coins_order")
-public class OrderCoinsEntity extends BaseEntity{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 会员ID
- */
- private Long memberId;
- /**
- * 订单编号
- */
- private String orderNo;
- /**
- * 订单类型 1、买入2、卖出
- */
- private Integer orderType;
- public static final Integer ORDERTYPE_BUY = 1;
- public static final Integer ORDERTYPE_SELL = 2;
-
- /**
- * 币种
- */
- private String symbol;
- /**
- * 市场价
- */
- private BigDecimal markPrice;
- /**
- * 委托量
- */
- private BigDecimal entrustCnt;
- /**
- * 委托价
- */
- private BigDecimal entrustPrice;
- /**
- * 成交量
- */
- private BigDecimal dealCnt;
- /**
- * 成交价
- */
- private BigDecimal dealPrice;
- /**
- * 成交金额
- */
- private BigDecimal dealAmount;
- /**
- * 状态 1:委托中2:撤单3:已成交
- */
- private Integer orderStatus;
- public static final Integer ORDERSTATUS_DODING = 1;
- public static final Integer ORDERSTATUS_CANCEL = 2;
- public static final Integer ORDERSTATUS_DONE = 3;
-
- /**
- * 交易类型 1:市价2:限价
- */
- private Integer tradeType;
- public static final Integer TRADETYPE_MARKETPRICE = 1;
- public static final Integer TRADETYPE_FIXEDPRICE = 2;
-
- /**
- * 手续费
- */
- private BigDecimal feeAmount;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java
deleted file mode 100644
index 6ff5422..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/mapper/MemberAccountMoneyChangeMapper.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.coin.mapper;
-
-import java.util.List;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
-
-@Mapper
-public abstract class MemberAccountMoneyChangeMapper {
-
- public static final MemberAccountMoneyChangeMapper INSTANCE = Mappers.getMapper(MemberAccountMoneyChangeMapper.class);
-
- public abstract MemberAccountMoneyChangeInfoVo entityToVoOrder(MemberAccountMoneyChange memberAccountMoneyChange);
-
- public abstract List<MemberAccountMoneyChangeInfoVo> orderEntitiesToOrderListVo(List<MemberAccountMoneyChange> memberAccountMoneyChanges);
-
- public abstract Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo(IPage<MemberAccountMoneyChange> memberAccountMoneyChanges);
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderCoinsDealMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderCoinsDealMapper.java
deleted file mode 100644
index e2375b2..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderCoinsDealMapper.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.modules.coin.mapper;
-
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-/**
- * @author wzy
- * @date 2020-07-01
- **/
-@Mapper
-public abstract class OrderCoinsDealMapper {
-
- public static final OrderCoinsDealMapper INSTANCE = Mappers.getMapper(OrderCoinsDealMapper.class);
-
- @Mapping(target = "symbolCnt", source = "entrustCnt")
- public abstract OrderCoinsDealEntity orderToOrderDeal(OrderCoinsEntity orderCoinsEntity);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java
deleted file mode 100644
index ddd13a3..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.coin.mapper;
-
-import java.util.List;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
-
-@Mapper
-public abstract class OrderWalletCoinDealMapper {
-
- public static final OrderWalletCoinDealMapper INSTANCE = Mappers.getMapper(OrderWalletCoinDealMapper.class);
-
- public abstract OrderWalletCoinDealVo entityToVoOrder(OrderCoinsDealEntity orderCoinsDealEntity);
-
- public abstract List<OrderWalletCoinDealVo> orderEntitiesToOrderListVo(List<OrderCoinsDealEntity> orderEntities);
-
- public abstract Page<OrderWalletCoinDealVo> pageEntityToPageVo(IPage<OrderCoinsDealEntity> orderCoins);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java
deleted file mode 100644
index 742896f..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.mapper;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinVo;
-
-@Mapper
-public abstract class OrderWalletCoinMapper {
-
- public static final OrderWalletCoinMapper INSTANCE = Mappers.getMapper(OrderWalletCoinMapper.class);
-
- public abstract OrderWalletCoinVo entityToVo(OrderCoinsEntity orderCoinsEntity);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CancelEntrustWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CancelEntrustWalletCoinOrderDto.java
deleted file mode 100644
index 19ff619..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CancelEntrustWalletCoinOrderDto.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "CancelEntrustWalletCoinOrderDto", description = "撤销委托订单")
-public class CancelEntrustWalletCoinOrderDto {
-
- @NotNull(message = "订单ID不能为空")
- @ApiModelProperty(value = "订单ID", example = "100")
- private String orderId;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java
deleted file mode 100644
index 7990a5d..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindAllWalletCoinOrderDto.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "FindAllWalletCoinOrderDto", description = "获取币币交易历史订单信息参数接受类")
-public class FindAllWalletCoinOrderDto {
-
- @NotNull
- @Min(1)
- @ApiModelProperty(value = "第几页", example = "1")
- private int pageNum;
-
- @NotNull
- @ApiModelProperty(value = "每页数量", example = "10")
- private int pageSize;
-
- @NotNull
- @ApiModelProperty(value = "币种", example = "BTC")
- private String symbol;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindCollectDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindCollectDto.java
deleted file mode 100644
index 5367b10..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindCollectDto.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "FindCollectDto", description = "币币自选|取消自选参数接收类")
-public class FindCollectDto {
-
- @NotNull(message = "币种")
- @ApiModelProperty(value = "币种", example = "BTC")
- private String symbol;
-
- @NotNull(message = "币币自选")
- @ApiModelProperty(value = "自选标识1:选中0:未选中", example = "1")
- private Integer type;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/InOrderCoinDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/InOrderCoinDto.java
deleted file mode 100644
index 2a54cf0..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/InOrderCoinDto.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "InOrderCoinDto", description = "进入交易页面参数接收类")
-public class InOrderCoinDto {
-
- @NotNull(message = "划转金额不能为空")
- @ApiModelProperty(value = "划转金额", example = "100")
- private BigDecimal balance;
-
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "USDT")
- private String symbol;
-
- @NotNull(message = "账户类型不能为空")
- @ApiModelProperty(value = "账户类型", example = "1")
- private Integer transfertype;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java
deleted file mode 100644
index c1e9fdd..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/RecordsPageDto.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "RecordsPageDto", description = "资产交易记录参数接受类")
-public class RecordsPageDto {
-
- @NotNull
- @Min(1)
- @ApiModelProperty(value = "第几页", example = "1")
- private int pageNum;
-
- @NotNull
- @ApiModelProperty(value = "每页数量", example = "10")
- private int pageSize;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java
deleted file mode 100644
index b15186a..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "SubmitSalesWalletCoinOrderDto", description = "提交买卖订单参数接收类")
-public class SubmitSalesWalletCoinOrderDto {
-
-
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "BTC")
- private String symbol;
-
- @NotNull(message = "交易类型不能为空")
- @ApiModelProperty(value = "买入卖出类型买入:1,卖出:2", example = "1")
- private Integer type;
-
- @NotNull(message = "交易方式不能为空")
- @ApiModelProperty(value = "市价:1,限价:2", example = "1")
- private Integer tradeType;
-
- @Min(0)
- @NotNull(message = "数量不能为空")
- @ApiModelProperty(value = "数量", example = "100")
- private BigDecimal amount;
-
- @NotNull(message = "建仓价不能为空")
- @ApiModelProperty(value = "建仓价", example = "20.0000")
- private BigDecimal price;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceDto.java
deleted file mode 100644
index e1f9967..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceDto.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "TransferOfBalanceDto", description = "资金划转参数接收类")
-public class TransferOfBalanceDto {
-
- @NotNull(message = "划转金额不能为空")
- @ApiModelProperty(value = "划转金额", example = "100")
- private BigDecimal balance;
-
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "USDT")
- private String symbol;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceFromAgentDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceFromAgentDto.java
deleted file mode 100644
index bd7f8d4..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/TransferOfBalanceFromAgentDto.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-@Data
-@ApiModel(value = "TransferOfBalanceFromAgentDto", description = "资金划转参数接收类")
-public class TransferOfBalanceFromAgentDto {
-
- @NotNull(message = "划转金额不能为空")
- @ApiModelProperty(value = "划转金额", example = "100")
- private BigDecimal balance;
-
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "USDT")
- private String symbol;
-
- @NotNull(message = "账户类型不能为空")
- @ApiModelProperty(value = "转账类型1:转币币,2:转合约", example = "1")
- private Integer transfertype;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/AllWalletCoinVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/AllWalletCoinVo.java
deleted file mode 100644
index d1e4ae2..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/AllWalletCoinVo.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "AllWalletCoinVo", description = "信息返回")
-public class AllWalletCoinVo {
-
- @ApiModelProperty(value = "账户总USDT")
- private BigDecimal totalUsdt;
-
- @ApiModelProperty(value = "账户总RMB")
- private BigDecimal totalCny;
-
- @ApiModelProperty(value = "币币USDT")
- private BigDecimal walletUsdt;
-
- @ApiModelProperty(value = "合约USDT")
- private BigDecimal contractUsdt;
-
- @ApiModelProperty(value = "代理USDT")
- private BigDecimal agentUsdt;
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/FindCollectListVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/FindCollectListVo.java
deleted file mode 100644
index 2d68aad..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/FindCollectListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "FindCollectListVo", description = "币币是否自选返回")
-public class FindCollectListVo {
-
- @ApiModelProperty(value = "币币自选")
- private List<MemberSelectSymbolsVo> memberSelectSymbolsVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java
deleted file mode 100644
index 69306a0..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAccountMoneyChangeInfoVo", description = "资产交易记录详情信息返回")
-public class MemberAccountMoneyChangeInfoVo {
-
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
- /**
- * 金额
- */
- @ApiModelProperty(value = "金额")
- private BigDecimal amount;
- /**
- * 记录内容
- */
- @ApiModelProperty(value = "记录内容")
- private String content;
- /**
- * 类型【1:币币资产2:合约资产3:代理资产】
- */
- @ApiModelProperty(value = "类型【1:币币资产2:合约资产3:代理资产】")
- private int type;
- /**
- * 状态【0:待审核 1:成功2:失败】
- */
- @ApiModelProperty(value = "状态【0:待审核 1:成功2:失败】")
- private int status;
-
- @ApiModelProperty(value = "时间")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date updateTime;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeVo.java
deleted file mode 100644
index c1de610..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAccountMoneyChangeVo", description = "资产交易记录信息返回")
-public class MemberAccountMoneyChangeVo {
-
- @ApiModelProperty(value = "资产交易记录详情信息")
- private List<MemberAccountMoneyChangeInfoVo> memberAccountMoneyChangeInfoVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAgentIntoInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAgentIntoInfoVo.java
deleted file mode 100644
index ed7ecbb..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAgentIntoInfoVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAgentIntoInfoVo", description = "佣金入账记录信息返回")
-public class MemberAgentIntoInfoVo {
-
- @ApiModelProperty(value = "资产交易记录详情信息")
- private List<MemberAccountMoneyChangeInfoVo> memberAccountMoneyChangeInfoVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java
deleted file mode 100644
index d5cc0e2..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberSelectSymbolsVo", description = "币币是否自选返回")
-public class MemberSelectSymbolsVo {
- /**
- * 会员ID
- */
- @ApiModelProperty(value = "是否自选1:选中0:未选中")
- private Integer isCollect;
- public static final Integer ISCOLLECT_YES = 1;
- public static final Integer ISCOLLECT_NO = 0;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletAgentInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletAgentInfoVo.java
deleted file mode 100644
index 5961d16..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletAgentInfoVo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberWalletAgentInfoVo", description = "代理账户信息返回")
-public class MemberWalletAgentInfoVo {
-
- /**
- * 总金额
- */
- @ApiModelProperty(value = "总金额")
- private BigDecimal totalBalance;
-
- /**
- * 总人民币金额
- */
- @ApiModelProperty(value = "总人民币金额")
- private BigDecimal totalRMBBalance;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinInfoVo.java
deleted file mode 100644
index 2098c61..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinInfoVo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-public class MemberWalletCoinInfoVo {
-
- /**
- * 用户Id
- */
- @ApiModelProperty(value = "用户Id")
- private Long memberId;
-
- /**
- * 钱包标识
- */
- @ApiModelProperty(value = "币种名称")
- private String walletCode;
-
- /**
- * 可用余额
- */
- @ApiModelProperty(value = "可用余额")
- private BigDecimal availableBalance;
-
- /**
- * 总金额
- */
- @ApiModelProperty(value = "总金额")
- private BigDecimal totalBalance;
-
- /**
- * 冻结金额
- */
- @ApiModelProperty(value = "冻结金额")
- private BigDecimal frozenBalance;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinVo.java
deleted file mode 100644
index ad0580e..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletCoinVo.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @author xy
- */
-@Data
-@ApiModel(value = "MemberWalletCoinVo", description = "币币账户信息返回")
-public class MemberWalletCoinVo {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "账户总USDT")
- private BigDecimal totalUsdt;
-
- @ApiModelProperty(value = "账户总RMB")
- private BigDecimal totalCny;
-
- @ApiModelProperty(value = "币种详情")
- private List<MemberWalletCoinInfoVo> memberWalletCoinInfoVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletContractInfoVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletContractInfoVo.java
deleted file mode 100644
index 89bcb7a..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletContractInfoVo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberWalletContractInfoVo", description = "合约账户信息返回")
-public class MemberWalletContractInfoVo {
-
- /**
- * 用户Id
- */
- @ApiModelProperty(value = "用户Id")
- private Long memberId;
-
- /**
- * 可用余额
- */
- @ApiModelProperty(value = "可用余额")
- private BigDecimal availableBalance;
-
- /**
- * 总金额
- */
- @ApiModelProperty(value = "总金额")
- private BigDecimal totalBalance;
-
- /**
- * 总人民币金额
- */
- @ApiModelProperty(value = "总人民币金额")
- private BigDecimal totalRMBBalance;
-
- /**
- * 冻结金额
- */
- @ApiModelProperty(value = "冻结金额")
- private BigDecimal frozenBalance;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealListVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealListVo.java
deleted file mode 100644
index da1059f..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "OrderWalletCoinDealListVo", description = "币币交易历史订单信息返回")
-public class OrderWalletCoinDealListVo {
-
- @ApiModelProperty(value = "历史订单详情")
- private List<OrderWalletCoinDealVo> orderWalletCoinDealVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealVo.java
deleted file mode 100644
index 0b5d4a7..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealVo.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "OrderWalletCoinDealVo", description = "历史订单详情")
-public class OrderWalletCoinDealVo {
- /**
- * 会员ID
- */
- @ApiModelProperty(value = "会员ID")
- private Long memberId;
- /**
- * 订单主表ID
- */
- @ApiModelProperty(value = "订单主表ID")
- private Long orderId;
- /**
- * 订单编号
- */
- @ApiModelProperty(value = "订单编号")
- private String orderNo;
- /**
- * 订单类型 1、买入2、卖出
- */
- @ApiModelProperty(value = "订单类型 1、买入2、卖出")
- private Integer orderType;
- /**
- * 交易类型 1:市价2:限价
- */
- @ApiModelProperty(value = "交易类型 1:市价2:限价")
- private Integer tradeType;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
- /**
- * 数量
- */
- @ApiModelProperty(value = "数量")
- private BigDecimal symbolCnt;
- /**
- * 委托价
- */
- @ApiModelProperty(value = "委托价")
- private BigDecimal entrustPrice;
- /**
- * 成交价
- */
- @ApiModelProperty(value = "成交价")
- private BigDecimal dealPrice;
- /**
- * 成交金额
- */
- @ApiModelProperty(value = "成交金额")
- private BigDecimal dealAmount;
- /**
- * 状态 2:撤单3:已成交
- */
- @ApiModelProperty(value = "状态 2:撤单3:已成交")
- private Integer orderStatus;
-
- /**
- * 手续费
- */
- @ApiModelProperty(value = "手续费")
- private BigDecimal feeAmount;
-
- @ApiModelProperty(value = "时间")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date updateTime;
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinListVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinListVo.java
deleted file mode 100644
index f85f3ee..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "OrderWalletCoinListVo", description = "委托单返回")
-public class OrderWalletCoinListVo {
-
- @ApiModelProperty(value = "委托单")
- private List<OrderWalletCoinVo> orderWalletCoinVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java
deleted file mode 100644
index 8a6f509..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "OrderWalletCoinVo", description = "订单详情")
-public class OrderWalletCoinVo {
- /**
- * 订单ID
- */
- @ApiModelProperty(value = "ID")
- private Long id;
- /**
- * 订单编号
- */
- @ApiModelProperty(value = "订单编号")
- private String orderNo;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
-
- /**
- * 订单类型 1、买入2、卖出
- */
- @ApiModelProperty(value = "订单类型")
- private Integer orderType;
- /**
- * 市场价
- */
- @ApiModelProperty(value = "市场价")
- private BigDecimal markPrice;
- /**
- * 委托量
- */
- @ApiModelProperty(value = "委托量")
- private BigDecimal entrustCnt;
- /**
- * 委托价
- */
- @ApiModelProperty(value = "委托价")
- private BigDecimal entrustPrice;
- /**
- * 成交量
- */
- @ApiModelProperty(value = "成交量")
- private BigDecimal dealCnt;
- /**
- * 成交价
- */
- @ApiModelProperty(value = "成交价")
- private BigDecimal dealPrice;
- /**
- * 成交金额
- */
- @ApiModelProperty(value = "成交金额")
- private BigDecimal dealAmount;
- /**
- * 手续费
- */
- @ApiModelProperty(value = "手续费")
- private BigDecimal feeAmount;
-
- @ApiModelProperty(value = "时间")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date updateTime;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/TransactionPageOfWalletCoinVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/TransactionPageOfWalletCoinVo.java
deleted file mode 100644
index ec1ceb3..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/TransactionPageOfWalletCoinVo.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.xcong.excoin.modules.coin.parameter.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "TransactionPageOfWalletCoinVo", description = "进入交易页面返回")
-public class TransactionPageOfWalletCoinVo {
- /**
- * 是否自选
- */
- @ApiModelProperty(value = "是否自选")
- private Integer isCollect;
- public static final Integer ISCOLLECT_YES = 1;
- public static final Integer ISCOLLECT_NO = 0;
- /**
- * 点差
- */
- @ApiModelProperty(value = "点差")
- private BigDecimal spread;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
- /**
- * 买入卖出类型
- */
- @ApiModelProperty(value = "买入卖出类型")
- private String type;
- /**
- * 手续费
- */
- @ApiModelProperty(value = "手续费率")
- private BigDecimal feeRatio;
- /**
- * 用户可用金额
- */
- @ApiModelProperty(value = "买入用户可用金额")
- private BigDecimal availableBalanceBuy;
-
- /**
- * 用户可用金额
- */
- @ApiModelProperty(value = "卖出用户可用金额")
- private BigDecimal availableBalanceSell;
- /**
- * 当前价
- */
- @ApiModelProperty(value = "当前价")
- private BigDecimal currentPrice;
- /**
- * 比例
- */
- @ApiModelProperty(value = "比例")
- private BigDecimal cnyUsdt;
- /**
- * 换算成人民币之后的价格
- */
- @ApiModelProperty(value = "换算成人民币之后的价格")
- private BigDecimal currentPriceCny;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/BlockCoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/BlockCoinService.java
deleted file mode 100644
index e617f0a..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/BlockCoinService.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.coin.service;
-
-public interface BlockCoinService {
-
- public void updateEthUsdt();
-
- public void updateEth();
-
- public void updateBtcUsdt();
-
- public void updateBtc();
-
- public void updateEos();
-
- public void updateXrp();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java
deleted file mode 100644
index 58cdd57..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/CoinService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.xcong.excoin.modules.coin.service;
-
-import java.math.BigDecimal;
-
-import javax.validation.Valid;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-
-public interface CoinService extends IService<MemberWalletCoinEntity>{
-
- public Result getWalletCoin();
-
- public Result getWalletContractById();
-
- public Result coinWalletTransferToContract(BigDecimal balance, String symbol);
-
- public Result contractTransferToWalletCoin(BigDecimal balance, String symbol);
-
- public Result findWalletContractBySymbol();
-
- public Result findWalletCoinBySymbol(String symbol);
-
- public Result agentTransferToWalletCoin(BigDecimal balance, Integer transfertype);
-
- public Result findWalletAgentBySymbol();
-
- public Result getWalletCoinBySymbol(String symbol);
-
- public Result getWalletAgentIntoRecords(@Valid RecordsPageDto recordsPageDto);
-
- public Result getWalletCoinRecords(@Valid RecordsPageDto recordsPageDto);
-
- public Result getWalletContractRecords(@Valid RecordsPageDto recordsPageDto);
-
- public Result getWalletAgentRecords(@Valid RecordsPageDto recordsPageDto);
-
- public Result getAllWalletCoin();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java
deleted file mode 100644
index a8f2914..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package com.xcong.excoin.modules.coin.service;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
-import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto;
-
-public interface OrderCoinService extends IService<OrderCoinsEntity>{
-
- public String generateSimpleSerialno(String userId);
-
- Result enterTransactionPageOfWalletCoin(String symbol);
-
- Result submitSalesWalletCoinOrder(String symbol, Integer type, Integer tradeType, BigDecimal price,
- BigDecimal amount);
-
- public Result getEntrustWalletCoinOrder(String symbol, Integer status);
-
- public Result cancelEntrustWalletCoinOrder(String orderId);
-
- public Result findAllWalletCoinOrder(FindAllWalletCoinOrderDto findAllWalletCoinOrderDto);
-
- public Result findWalletCoinOrder(Long orderId);
-
- public Result findCollect(String symbol, Integer type);
-
- public Result checkIsCollect(String symbol);
-
- public Result findCollectList();
-
- public Result searchSymbolResultList();
-
- public void dealEntrustCoinOrder();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java
deleted file mode 100644
index a0ef93b..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/BlockCoinServiceImpl.java
+++ /dev/null
@@ -1,431 +0,0 @@
-package com.xcong.excoin.modules.coin.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.StrUtil;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.modules.blackchain.model.EosResult;
-import com.xcong.excoin.modules.blackchain.model.XrpTransResult;
-import com.xcong.excoin.modules.blackchain.model.XrpTransactions;
-import com.xcong.excoin.modules.blackchain.model.XrpTx;
-import com.xcong.excoin.modules.blackchain.service.*;
-import com.xcong.excoin.modules.coin.service.BlockCoinService;
-import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao;
-import com.xcong.excoin.modules.member.dao.MemberCoinChargeDao;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
-import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import com.xcong.excoin.utils.LogRecordUtils;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import com.xcong.excoin.utils.dingtalk.DingTalkUtils;
-import com.xcong.excoin.utils.mail.Sms106Send;
-import com.xcong.excoin.utils.mail.SubMailSend;
-import lombok.extern.slf4j.Slf4j;
-import lombok.val;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-07-02
- **/
-@Slf4j
-@Service
-public class BlockCoinServiceImpl implements BlockCoinService {
-
- @Resource
- private MemberCoinAddressDao memberCoinAddressDao;
- @Resource
- private MemberDao memberDao;
- @Resource
- private MemberCoinChargeDao memberCoinChargeDao;
- @Resource
- private MemberWalletCoinDao memberWalletCoinDao;
-
- @Resource
- private RedisUtils redisUtils;
-
- private final static String EOS_SEQ_KEY="eos_seq_key";
-
- private final static String xrp_update_key = "xrp_update_key";
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void updateEthUsdt() {
- List<MemberCoinAddressEntity> list = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.USDT.name(), "ERC20");
- if (CollUtil.isNotEmpty(list)) {
- EthService ethService = new EthService();
- for (MemberCoinAddressEntity addressEntity : list) {
- String address = addressEntity.getAddress();
- Long memberId = addressEntity.getMemberId();
-
- if (StrUtil.isBlank(address)) {
- continue;
- }
-
- BigDecimal balance = ethService.tokenGetBalance(address);
- if (balance != null && balance.compareTo(new BigDecimal("0.1")) > 0) {
- balance = balance.setScale(8, RoundingMode.CEILING);
-
- BigDecimal early = BigDecimal.ZERO;
- MemberCoinChargeEntity chargeEntity = memberCoinChargeDao.selectNewestChargeRecord(memberId, CoinTypeEnum.USDT.name(), "ERC20");
- if (chargeEntity != null) {
- BigDecimal lastAmount = chargeEntity.getLastAmount();
- if (lastAmount != null) {
- early = lastAmount;
- }
- }
-
- MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.USDT.name());
- if (walletCoinEntity == null) {
- continue;
- }
-
- if (balance.compareTo(early) > 0) {
- BigDecimal newBalance = balance.subtract(early);
- memberWalletCoinDao.updateBlockBalance(walletCoinEntity.getId(), newBalance, balance, 0);
-
- String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "ERC20", balance);
- // 插入财务记录
- LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.USDT.name(), 1, 1);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- String amount = newBalance.toPlainString() + "USDT-ERC20";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
- }
- }
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void updateEth() {
- List<MemberCoinAddressEntity> list = memberCoinAddressDao.selectAllBlockAddressBySymbol(CoinTypeEnum.ETH.name());
- if (CollUtil.isNotEmpty(list)) {
- for (MemberCoinAddressEntity coinAddressEntity : list) {
- String address = coinAddressEntity.getAddress();
- Long memberId = coinAddressEntity.getMemberId();
-
- BigDecimal balance = EthService.getEthBlance(address);
- if (balance != null && new BigDecimal("0.01").compareTo(balance) < 0) {
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.ETH.name());
-
- if (walletCoin == null) {
- continue;
- }
-
- BigDecimal early = BigDecimal.ZERO;
- MemberCoinChargeEntity coinChargeEntity = memberCoinChargeDao.selectNewestChargeRecord(memberId, CoinTypeEnum.ETH.name(), null);
- if (coinChargeEntity != null) {
- BigDecimal lastAmount = coinChargeEntity.getLastAmount();
- if (lastAmount != null) {
- early = lastAmount;
- }
- }
-
- balance = balance.setScale(8, RoundingMode.CEILING);
- if (balance.compareTo(early) > 0) {
- log.info("#ETH更新:{},{},{}#", memberId, balance, early);
-
- BigDecimal newBalance = balance.subtract(early);
- memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0);
- String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.ETH.name(), null, balance);
-
- // 插入财务记录
- LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.ETH.name(), 1, 1);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- String amount = newBalance.toPlainString() + "ETH";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
- }
- }
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void updateBtcUsdt() {
- List<MemberCoinAddressEntity> list = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.USDT.name(), "OMNI");
- if (CollUtil.isNotEmpty(list)) {
- UsdtService usdtService = UsdtService.getInstance();
-
- for (MemberCoinAddressEntity coinAddressEntity : list) {
- String address = coinAddressEntity.getAddress();
- Long memberId = coinAddressEntity.getMemberId();
-
- BigDecimal balance = usdtService.getBalance(address);
- if (balance != null && balance.compareTo(new BigDecimal("0.1")) > 0) {
- MemberCoinChargeEntity memberCoinChargeEntity = memberCoinChargeDao.selectNewestChargeRecord(memberId, CoinTypeEnum.USDT.name(), "OMNI");
- BigDecimal early = BigDecimal.ZERO;
- if (memberCoinChargeEntity != null) {
- BigDecimal lastAmount = memberCoinChargeEntity.getLastAmount();
- if (lastAmount != null) {
- early = lastAmount;
- }
- }
-
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.USDT.name());
- if (walletCoin == null) {
- continue;
- }
-
- if (balance.compareTo(early) > 0) {
- BigDecimal newBalance = balance.subtract(early);
-
- memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0);
- String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.USDT.name(), "OMNI", balance);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- String amount = newBalance.toPlainString() + "USDT-OMNI";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
- }
- }
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void updateBtc() {
- List<MemberCoinAddressEntity> list = memberCoinAddressDao.selectAllBlockAddressBySymbol(CoinTypeEnum.BTC.name());
- if (CollUtil.isNotEmpty(list)) {
- BtcService btcService = BtcService.getInstance();
- for (MemberCoinAddressEntity coinAddressEntity : list) {
- String address = coinAddressEntity.getAddress();
- Long memberId = coinAddressEntity.getMemberId();
-
- BigDecimal balance = btcService.getBalance(address);
-
- if (balance != null && balance.compareTo(new BigDecimal("0.00012")) > 0) {
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.BTC.name());
- if (walletCoin == null) {
- continue;
- }
-
- BigDecimal early = BigDecimal.ZERO;
- MemberCoinChargeEntity coinCharge = memberCoinChargeDao.selectNewestChargeRecord(memberId, CoinTypeEnum.BTC.name(), null);
- if (coinCharge != null) {
- BigDecimal lastAmount = coinCharge.getLastAmount();
- if (lastAmount != null) {
- early = lastAmount;
- }
- }
-
- if (balance.compareTo(early) > 0) {
- log.info("#btc同步:{}, {}, {}#", memberId, balance, early);
- BigDecimal newBalance = balance.subtract(early);
- memberWalletCoinDao.updateBlockBalance(walletCoin.getId(), newBalance, balance, 0);
-
- String orderNo = insertCoinCharge(address, memberId, newBalance, CoinTypeEnum.BTC.name(), null, balance);
- LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", newBalance, CoinTypeEnum.BTC.name(), 1, 1);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- String amount = newBalance.toPlainString() + "BTC";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
- }
- }
- }
-
- @Override
- public void updateEos() {
- // 获取上次读取的序号
- int pos= 0;
- //每次获取的条数
- int offset = 10;
-
- String eosSeq = redisUtils.getString(EOS_SEQ_KEY);
- if(StringUtils.isNotBlank(eosSeq)){
- pos = Integer.valueOf(eosSeq);
- }
- // 记录最大的seq
- int seq = pos;
- List<EosResult> actions = EosService.getActions(pos, offset);
- if(CollectionUtils.isNotEmpty(actions)){
- for(EosResult eosResult:actions){
- String to = eosResult.getTo();
- Integer accountActionSeq = eosResult.getAccountActionSeq();
- if(accountActionSeq>seq){
- seq = accountActionSeq;
- }
- if(!EosService.ACCOUNT.equals(to)){
- // 判断是否是收款
- continue;
- }
- // 处理收款
- String quantity = eosResult.getQuantity();
- String memo = eosResult.getMemo();
- if(StringUtils.isBlank(memo)){
- // 没有标记的跳过
- continue;
- }
- if(StringUtils.isNotBlank(quantity)){
- // 转账额
- String amountStr = quantity.split("")[0];
- BigDecimal amount = new BigDecimal(amountStr);
- List<MemberCoinAddressEntity> memberCoinAddress = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.EOS.name(), memo);
- if(CollectionUtils.isNotEmpty(memberCoinAddress)){
- MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddress.get(0);
- // 用户ID
- Long memberId = memberCoinAddressEntity.getMemberId();
- MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.EOS.name());
- if(memberCoinAddressEntity!=null){
- memberWalletCoinDao.updateBlockBalance(memberWalletCoinEntity.getId(),amount,BigDecimal.ZERO,0);
- // 添加冲币记录
- String orderNo = insertCoinCharge(EosService.ACCOUNT,memberId,amount,CoinTypeEnum.EOS.name(),memo,BigDecimal.ZERO);
- LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", amount, CoinTypeEnum.EOS.name(), 1, 1);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- //String amountEos = amountStr + "EOS";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
- }
- }
- }
- // 最后更新seq 即下次查询的起始位置 在本次最大的基础上加一
- if(seq>0 && seq>pos){
- redisUtils.set(EOS_SEQ_KEY,seq+1);
- }
- }
-
- public void updateXrp() {
- // 首先去查redis上的上次同步时间
- Object lastUpdateTime = redisUtils.get(xrp_update_key);
- SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-dd hh:mm:ss");
- Date start =null;
- if(lastUpdateTime==null) {
- // 没有 说明是第一次同步 此时从第一天开始同步2020 0716开始
- try {
- start = format.parse("2020-07-16 12:00:00");
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }else {
- // 有上次时间
- try {
- start = format.parse(lastUpdateTime.toString());
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
-
- // 去查询上次同步时间后的所有记录
- XrpTransResult result = XrpService.getTransactions(start);
- // 写入本次更新时间
- String updateTime = format.format(new Date());
- redisUtils.set(xrp_update_key, updateTime);
- // 判断有无
- List<XrpTransactions> list = result.getTransactions();
- if(CollectionUtils.isNotEmpty(list)) {
- // 不为空 说明有转入记录
- for(XrpTransactions item:list) {
- XrpTx data = item.getTx();
- Integer amountOld = data.getAmount();
- // 除以1000000
- BigDecimal amount = new BigDecimal(amountOld).divide(new BigDecimal(1000000));
- Integer memoInt = data.getDestinationTag();
- // 没有标签直接返回
- if(memoInt==null){
- continue;
- }
- String memo = memoInt.toString();
- String destination = data.getDestination();
- // 判断收款人是不是系统账号
- if(!XrpService.ACCOUNT.equals(destination)){
- continue;
- }
- List<MemberCoinAddressEntity> memberCoinAddress = memberCoinAddressDao.selectAllBlockAddressBySymbolAndTag(CoinTypeEnum.XRP.name(), memo);
- if(CollectionUtils.isNotEmpty(memberCoinAddress)){
- MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddress.get(0);
- // 用户ID
- Long memberId = memberCoinAddressEntity.getMemberId();
- MemberWalletCoinEntity memberWalletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, CoinTypeEnum.XRP.name());
- if(memberCoinAddressEntity!=null){
- memberWalletCoinDao.updateBlockBalance(memberWalletCoinEntity.getId(),amount,BigDecimal.ZERO,0);
- // 添加冲币记录
- String orderNo = insertCoinCharge(XrpService.ACCOUNT,memberId,amount,CoinTypeEnum.XRP.name(),memo,BigDecimal.ZERO);
- LogRecordUtils.insertMemberAccountMoneyChange(memberId, "转入", amount, CoinTypeEnum.XRP.name(), 1, 1);
-
- ThreadPoolUtils.sendDingTalk(5);
- MemberEntity member = memberDao.selectById(memberId);
- if (StrUtil.isNotBlank(member.getPhone())) {
- //String amountEos = amount + "XRP";
- Sms106Send.sendRechargeMsg(member.getPhone(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- } else {
- SubMailSend.sendRechargeMail(member.getEmail(), DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MINUTE_PATTERN), orderNo);
- }
- }
- }
-
- }
- }
-
- }
-
- private String generateNo() {
- // 生成订单号
- Long timestamp = System.currentTimeMillis();
- // 随机数
- int random = (int) (Math.random() * 10);
- return String.valueOf(timestamp).substring(2) + random;
- }
-
- public String insertCoinCharge(String address, Long memberId, BigDecimal newBalance, String symbol, String tag, BigDecimal lastAmount) {
- MemberCoinChargeEntity memberCoinChargeEntity = new MemberCoinChargeEntity();
- memberCoinChargeEntity.setAddress(address);
- memberCoinChargeEntity.setMemberId(memberId);
- memberCoinChargeEntity.setAmount(newBalance);
- memberCoinChargeEntity.setSymbol(symbol);
- memberCoinChargeEntity.setTag(tag);
- memberCoinChargeEntity.setStatus(1);
- memberCoinChargeEntity.setLastAmount(lastAmount);
- String orderNo = generateNo();
- memberCoinChargeEntity.setOrderCode(orderNo);
- memberCoinChargeDao.insert(memberCoinChargeEntity);
- return orderNo;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
deleted file mode 100644
index e7ddaae..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java
+++ /dev/null
@@ -1,577 +0,0 @@
-package com.xcong.excoin.modules.coin.service.impl;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.coin.mapper.MemberAccountMoneyChangeMapper;
-import com.xcong.excoin.modules.coin.parameter.dto.RecordsPageDto;
-import com.xcong.excoin.modules.coin.parameter.vo.AllWalletCoinVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberAccountMoneyChangeInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberAgentIntoInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletAgentInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinInfoVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletCoinVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberWalletContractInfoVo;
-import com.xcong.excoin.modules.coin.service.CoinService;
-import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.RedisUtils;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-
-@Service
-public class CoinServiceImpl extends ServiceImpl<MemberWalletCoinDao, MemberWalletCoinEntity> implements CoinService {
-
- //@Resource
- //SymbolsService symbolsService;
- @Resource
- PlatformCnyUsdtExchangeDao cnyUsdtExchangeDao;
- @Resource
- MemberWalletCoinDao memberWalletCoinDao;
- @Resource
- MemberWalletContractDao memberWalletContractDao;
- @Resource
- MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
- @Resource
- MemberWalletAgentDao memberWalletAgentDao;
- @Resource
- RedisUtils redisUtils;
-
-
- @Override
- public Result getWalletCoin() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
-
- BigDecimal totalUsdts = BigDecimal.ZERO;
- if (!StrUtil.isEmpty(memberId.toString())) {
-
- List<MemberWalletCoinEntity> memberWalletCoinlist = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
- List<MemberWalletCoinInfoVo> memberWalletCoinInfoVolist = new ArrayList<MemberWalletCoinInfoVo>();
-
- if (CollUtil.isNotEmpty(memberWalletCoinlist)) {
- for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinlist) {
- MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
- memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId());
- memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setWalletCode(memberWalletCoinEntity.getWalletCode());
- memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo);
- }
- }
-
- if (CollUtil.isNotEmpty(memberWalletCoinInfoVolist)) {
- for (MemberWalletCoinInfoVo walletCoin : memberWalletCoinInfoVolist) {
- if (MemberWalletCoinEnum.WALLETCOINCODE.getValue().equals(walletCoin.getWalletCode())) {
- BigDecimal totalUsdt = BigDecimal.ZERO;
- totalUsdt = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
- totalUsdts = totalUsdts.add(totalUsdt);
- BigDecimal totalCny = totalUsdt.multiply(cnyUsdt);
- walletCoin.setTotalBalance(totalCny);
- } else {
- BigDecimal amount = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
- // 获取最新价
- BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(walletCoin.getWalletCode()+"/USDT")));
- BigDecimal totalUsdt = BigDecimal.ZERO;
- //Double closePrice = symbolsService.getCloseSymbolsBySymbolsName(walletCoin.getWalletCode()+"/USDT");
- totalUsdt = totalUsdt.add(amount.multiply(closePrice));
- totalUsdts = totalUsdts.add(totalUsdt);
- walletCoin.setTotalBalance(totalUsdt.multiply(cnyUsdt));
- }
- }
- }
- MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo();
- memberWalletCoinVo.setTotalUsdt(totalUsdts.setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinVo.setTotalCny(totalUsdts.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinVo.setMemberWalletCoinInfoVo(memberWalletCoinInfoVolist);
- return Result.ok(memberWalletCoinVo);
- } else {
- List<MemberWalletCoinInfoVo> memberWalletCoinlist = new ArrayList<MemberWalletCoinInfoVo>();
- MemberWalletCoinInfoVo coin = new MemberWalletCoinInfoVo();
- coin.setAvailableBalance(BigDecimal.ZERO);
- coin.setTotalBalance(BigDecimal.ZERO);
- coin.setFrozenBalance(BigDecimal.ZERO);
- coin.setWalletCode(CoinTypeEnum.BTC.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.ETH.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.LTC.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.BCH.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.USDT.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.EOS.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.XRP.toString());
- memberWalletCoinlist.add(coin);
- coin.setWalletCode(CoinTypeEnum.ETC.toString());
- memberWalletCoinlist.add(coin);
-
- MemberWalletCoinVo memberWalletCoinVo = new MemberWalletCoinVo();
- memberWalletCoinVo.setTotalUsdt(totalUsdts.setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinVo.setTotalCny(totalUsdts.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinVo.setMemberWalletCoinInfoVo(memberWalletCoinlist);
- return Result.ok(memberWalletCoinVo);
- }
- }
-
- @Override
- public Result getWalletCoinBySymbol(String symbol) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
- MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
- memberWalletCoinInfoVo.setFrozenBalance(walletCoin.getFrozenBalance());
- memberWalletCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance());
- memberWalletCoinInfoVo.setMemberId(memberId);
- memberWalletCoinInfoVo.setWalletCode(symbol);
- if (!StrUtil.isEmpty(memberId.toString())) {
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
- BigDecimal total = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
-
- if (MemberWalletCoinEnum.WALLETCOINCODE.getValue().equals(walletCoin.getWalletCode())) {
- memberWalletCoinInfoVo.setTotalBalance(total.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
-
- } else {
- BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol+"/USDT")));
- //Double closePrice = symbolsService.getCloseSymbolsBySymbolsName(wallet.getCode()+"/USDT");
- memberWalletCoinInfoVo.setTotalBalance(total.multiply(closePrice).multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
- }
- }
- return Result.ok(memberWalletCoinInfoVo);
- }
-
- @Override
- public Result getWalletContractById() {
-
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
-
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- if (ObjectUtil.isEmpty(walletContract)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0001"));
- }
-
- MemberWalletContractInfoVo memberWalletContractInfoVo = new MemberWalletContractInfoVo();
- memberWalletContractInfoVo.setFrozenBalance(walletContract.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletContractInfoVo.setAvailableBalance(walletContract.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletContractInfoVo.setTotalBalance(walletContract.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletContractInfoVo.setTotalRMBBalance(walletContract.getTotalBalance().multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
-
- return Result.ok(memberWalletContractInfoVo);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result coinWalletTransferToContract(BigDecimal balance, String symbol) {
- if (balance.compareTo(BigDecimal.ZERO) <= 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0004"));
- }
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- if (!StrUtil.isEmpty(memberId.toString())) {
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
- BigDecimal available = walletCoin.getAvailableBalance();
- // 扣币
- BigDecimal total = available.subtract(balance);
- if (total.compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0005"));
- }
- BigDecimal subtract = walletCoin.getTotalBalance().subtract(balance);
- walletCoin.setAvailableBalance(total);
- walletCoin.setTotalBalance(subtract);
- int updateWalletCoinById = memberWalletCoinDao.updateById(walletCoin);
- if (updateWalletCoinById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0096"));
- }
- // 加币
- // 查询合约账户
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- BigDecimal availableBalance = walletContract.getAvailableBalance();
- BigDecimal add = availableBalance.add(balance);
- walletContract.setAvailableBalance(add);
- BigDecimal totalBalance = walletContract.getTotalBalance();
- BigDecimal totalBigDecimal = totalBalance.add(balance);
- walletContract.setTotalBalance(totalBigDecimal);
- int updateWalletContractById = memberWalletContractDao.updateById(walletContract);
- if (updateWalletContractById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0096"));
- }
- //添加币币资金划转历史记录
- MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTTOCONTRACT.getValue());
- memberAccountRecord.setMemberId(memberId);
- memberAccountRecord.setAmount(balance.negate());
- memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
- memberAccountRecord.setSymbol(MemberWalletCoinEnum.WALLETCOINCODE.getValue());
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
-
- //添加合约资金划转历史记录
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTFROMWALLETCOIN.getValue());
- memberAccountRecord.setSymbol(MemberWalletCoinEnum.WALLETCOINCODE.getValue());
- memberAccountRecord.setAmount(balance);
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_CONTRACT);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
- }
- return Result.ok(MessageSourceUtils.getString("member_service_0006"));
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result contractTransferToWalletCoin(BigDecimal balance, String symbol) {
- if (balance.compareTo(BigDecimal.ZERO) <= 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0004"));
- }
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- BigDecimal availableBalance = walletContract.getAvailableBalance();
- // 扣币
- BigDecimal availableSubtract = availableBalance.subtract(balance);
- if (availableSubtract.compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0007"));
- }
- BigDecimal totalBalance = walletContract.getTotalBalance();
- BigDecimal totalSubtract = totalBalance.subtract(balance);
-
- walletContract.setAvailableBalance(availableSubtract);
- walletContract.setTotalBalance(totalSubtract);
- int updateWalletCoinById = memberWalletContractDao.updateById(walletContract);
- if (updateWalletCoinById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0096"));
- }
- // 加币
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
- BigDecimal walletCoinAvailableBalance = walletCoin.getAvailableBalance();
- BigDecimal CoinAvailableBalance = walletCoinAvailableBalance.add(balance);
- BigDecimal walletCoinTotalBalance = walletCoin.getTotalBalance();
- BigDecimal CoinTotalBalance = walletCoinTotalBalance.add(balance);
-
- walletCoin.setAvailableBalance(CoinAvailableBalance);
- walletCoin.setTotalBalance(CoinTotalBalance);
- int updateById = memberWalletCoinDao.updateById(walletCoin);
- if (updateById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0096"));
- }
-
- //添加资金划转历史记录
- MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTTOWALLETCOIN.getValue());
- memberAccountRecord.setMemberId(memberId);
- memberAccountRecord.setAmount(balance.negate());
- memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
- memberAccountRecord.setSymbol(walletCode);
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_CONTRACT);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
-
- //添加资金划转历史记录
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTFROMCONTRACT.getValue());
- memberAccountRecord.setSymbol(walletCode);
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN);
- memberAccountRecord.setAmount(balance);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
- return Result.ok(MessageSourceUtils.getString("member_service_0006"));
- }
-
- @Override
- public Result findWalletContractBySymbol() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- BigDecimal availableBalance = walletContract.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN);
- return Result.ok(availableBalance);
- }
-
- @Override
- public Result findWalletCoinBySymbol(String symbol) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
- BigDecimal availableBalance = walletCoin.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN);
- return Result.ok(availableBalance);
- }
-
- @Override
- public Result getWalletCoinRecords(RecordsPageDto recordsPageDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
- MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
- memberAccountMoneyChange.setMemberId(memberId);
- IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletCoinRecordsInPage(page, memberAccountMoneyChange);
- Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list);
-
- return Result.ok(pageEntityToPageVo);
- }
-
- @Override
- public Result getWalletContractRecords(RecordsPageDto recordsPageDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
- MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
- memberAccountMoneyChange.setMemberId(memberId);
- IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletContractRecordsInPage(page, memberAccountMoneyChange);
- Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list);
- return Result.ok(pageEntityToPageVo);
- }
-
- @Override
- public Result getWalletAgentRecords(RecordsPageDto recordsPageDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
- MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
- memberAccountMoneyChange.setMemberId(memberId);
- IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentRecordsInPage(page, memberAccountMoneyChange);
- Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = MemberAccountMoneyChangeMapper.INSTANCE.pageEntityToPageVo(list);
-
- return Result.ok(pageEntityToPageVo);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result agentTransferToWalletCoin(BigDecimal balance, Integer transfertype) {
- if (balance.compareTo(BigDecimal.ZERO) <= 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0004"));
- }
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- // 扣币
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, walletCode);
- BigDecimal availableBalance = walletAgent.getAvailableBalance();
- BigDecimal totalBalance = walletAgent.getTotalBalance();
-
- BigDecimal available = availableBalance.subtract(balance);
- if (available.compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0008"));
- }
- BigDecimal total = totalBalance.subtract(balance);
- if (total.compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0008"));
- }
-
- walletAgent.setAvailableBalance(available);
- walletAgent.setTotalBalance(total);
-
- int i = memberWalletAgentDao.updateById(walletAgent);
- if (i < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0095"));
- }
- //添加资金划转历史记录
- MemberAccountMoneyChange memberAccountRecord = new MemberAccountMoneyChange();
- //代理账户转币币
- if (MemberAccountMoneyChange.TYPE_WALLET_COIN.equals(transfertype)) {
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
- BigDecimal walletCoinAvailableBalance = walletCoin.getAvailableBalance();
- BigDecimal walletCoinTotalBalance = walletCoin.getTotalBalance();
-
- walletCoin.setAvailableBalance(walletCoinAvailableBalance.add(balance));
- walletCoin.setTotalBalance(walletCoinTotalBalance.add(balance));
-
- int updateById = memberWalletCoinDao.updateById(walletCoin);
- if (updateById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0095"));
- }
- //添加资金划转历史记录
- memberAccountRecord.setMemberId(memberId);
- memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
- memberAccountRecord.setSymbol(walletCode);
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTFROMAGENT.getValue());
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN);
- memberAccountRecord.setAmount(balance);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTTOWALLETCOIN.getValue());
-
- } else if (MemberAccountMoneyChange.TYPE_WALLET_CONTRACT.equals(transfertype)) {
- //代理账户转合约
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- BigDecimal walletContractAvailableBalance = walletContract.getAvailableBalance();
- BigDecimal walletContractTotalBalance = walletContract.getTotalBalance();
-
- walletContract.setAvailableBalance(walletContractAvailableBalance.add(balance));
- walletContract.setTotalBalance(walletContractTotalBalance.add(balance));
-
- int updateById = memberWalletContractDao.updateById(walletContract);
- if (updateById < 1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0095"));
- }
-
- //添加资金划转历史记录
- memberAccountRecord.setMemberId(memberId);
- memberAccountRecord.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
- memberAccountRecord.setSymbol(walletCode);
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTFROMAGENT.getValue());
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_CONTRACT);
- memberAccountRecord.setAmount(balance);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
- memberAccountRecord.setContent(MemberWalletCoinEnum.CONTENTTOCONTRACT.getValue());
- }
- memberAccountRecord.setAmount(balance.negate());
- memberAccountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_AGENT);
- memberAccountMoneyChangeDao.insert(memberAccountRecord);
-
- return Result.ok(MessageSourceUtils.getString("member_service_0006"));
- }
-
- @Override
- public Result findWalletAgentBySymbol() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
-
- MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, walletCode);
- BigDecimal availableBalance = walletAgent.getAvailableBalance();
-
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
- BigDecimal multiply = availableBalance.multiply(cnyUsdt);
-
- MemberWalletAgentInfoVo memberWalletAgentInfoVo = new MemberWalletAgentInfoVo();
- memberWalletAgentInfoVo.setTotalBalance(availableBalance.setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletAgentInfoVo.setTotalRMBBalance(multiply.setScale(4, BigDecimal.ROUND_DOWN));
- return Result.ok(memberWalletAgentInfoVo);
- }
-
- @Override
- public Result getWalletAgentIntoRecords(RecordsPageDto recordsPageDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<OrderCoinsDealEntity> page = new Page<>(recordsPageDto.getPageNum(), recordsPageDto.getPageSize());
- MemberAccountMoneyChange memberAccountMoneyChange = new MemberAccountMoneyChange();
- memberAccountMoneyChange.setMemberId(memberId);
- IPage<MemberAccountMoneyChange> list = memberAccountMoneyChangeDao.selectWalletAgentIntoRecordsByMemIdTypeSymbol(page, memberAccountMoneyChange);
- List<MemberAccountMoneyChange> contractRecordList = list.getRecords();
- List<MemberAccountMoneyChangeInfoVo> arrayList = new ArrayList<>();
- if(CollUtil.isNotEmpty(contractRecordList)) {
- if (ObjectUtil.isNotNull(contractRecordList)) {
- for (MemberAccountMoneyChange memberAccountMoneyChanges : contractRecordList) {
- MemberAccountMoneyChangeInfoVo memberAccountMoneyChangeInfoVo = new MemberAccountMoneyChangeInfoVo();
- memberAccountMoneyChangeInfoVo.setAmount(memberAccountMoneyChanges.getAmount());
- memberAccountMoneyChangeInfoVo.setContent(memberAccountMoneyChanges.getContent());
- memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChanges.getStatus());
- memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChanges.getSymbol());
- memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChanges.getType());
- memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChanges.getUpdateTime());
- arrayList.add(memberAccountMoneyChangeInfoVo);
- }
- }
- }
- Page<MemberAccountMoneyChangeInfoVo> pageEntityToPageVo = new Page<>();
- pageEntityToPageVo.setRecords(arrayList);
-
- return Result.ok(pageEntityToPageVo);
- }
-
- @Override
- public Result getAllWalletCoin() {
- //获取【币币】
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
- AllWalletCoinVo allWalletCoinVo = new AllWalletCoinVo();
-
- BigDecimal totalUsdts = BigDecimal.ZERO;
- if (!StrUtil.isEmpty(memberId.toString())) {
-
- List<MemberWalletCoinEntity> memberWalletCoinlist = memberWalletCoinDao.selectMemberWalletCoinsByMemberId(memberId);
- List<MemberWalletCoinInfoVo> memberWalletCoinInfoVolist = new ArrayList<MemberWalletCoinInfoVo>();
-
- if (CollUtil.isNotEmpty(memberWalletCoinlist)) {
- for (MemberWalletCoinEntity memberWalletCoinEntity : memberWalletCoinlist) {
- MemberWalletCoinInfoVo memberWalletCoinInfoVo = new MemberWalletCoinInfoVo();
- memberWalletCoinInfoVo.setAvailableBalance(memberWalletCoinEntity.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setFrozenBalance(memberWalletCoinEntity.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setMemberId(memberWalletCoinEntity.getMemberId());
- memberWalletCoinInfoVo.setTotalBalance(memberWalletCoinEntity.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN));
- memberWalletCoinInfoVo.setWalletCode(memberWalletCoinEntity.getWalletCode());
- memberWalletCoinInfoVolist.add(memberWalletCoinInfoVo);
- }
- }
-
- if (CollUtil.isNotEmpty(memberWalletCoinInfoVolist)) {
- for (MemberWalletCoinInfoVo walletCoin : memberWalletCoinInfoVolist) {
- if (MemberWalletCoinEnum.WALLETCOINCODE.getValue().equals(walletCoin.getWalletCode())) {
- BigDecimal totalUsdt = BigDecimal.ZERO;
- totalUsdt = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
- totalUsdts = totalUsdts.add(totalUsdt);
- } else {
- BigDecimal amount = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
- // 获取最新价
- BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(walletCoin.getWalletCode()+"/USDT")));
- BigDecimal totalUsdt = BigDecimal.ZERO;
- totalUsdt = totalUsdt.add(amount.multiply(closePrice));
- totalUsdts = totalUsdts.add(totalUsdt);
- }
- }
- }
- }
- allWalletCoinVo.setWalletUsdt(totalUsdts.setScale(4, BigDecimal.ROUND_DOWN));
- //获取【合约】
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId, walletCode);
- if (ObjectUtil.isEmpty(walletContract)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0001"));
- }
- allWalletCoinVo.setContractUsdt(walletContract.getTotalBalance().setScale(4, BigDecimal.ROUND_DOWN));
- totalUsdts = totalUsdts.add(walletContract.getTotalBalance());
- //获取【代理】
- MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(memberId, walletCode);
- BigDecimal availableBalance = walletAgent.getAvailableBalance();
- allWalletCoinVo.setAgentUsdt(availableBalance.setScale(4, BigDecimal.ROUND_DOWN));
- totalUsdts = totalUsdts.add(availableBalance);
-
- allWalletCoinVo.setTotalUsdt(totalUsdts.setScale(4, BigDecimal.ROUND_DOWN));
- allWalletCoinVo.setTotalCny(totalUsdts.multiply(cnyUsdt).setScale(4, BigDecimal.ROUND_DOWN));
- return Result.ok(allWalletCoinVo);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java b/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
deleted file mode 100644
index c96299f..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
+++ /dev/null
@@ -1,641 +0,0 @@
-package com.xcong.excoin.modules.coin.service.impl;
-
-import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import com.xcong.excoin.modules.coin.mapper.OrderCoinsDealMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsCoinEntity;
-
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.coin.dao.MemberAccountFlowEntityDao;
-import com.xcong.excoin.modules.coin.dao.MemberSelectSymbolsDao;
-import com.xcong.excoin.modules.coin.dao.OrderCoinDealDao;
-import com.xcong.excoin.modules.coin.dao.OrderCoinsDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountFlowEntity;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
-import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper;
-import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinMapper;
-import com.xcong.excoin.modules.coin.parameter.dto.FindAllWalletCoinOrderDto;
-import com.xcong.excoin.modules.coin.parameter.vo.FindCollectListVo;
-import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinListVo;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinVo;
-import com.xcong.excoin.modules.coin.parameter.vo.TransactionPageOfWalletCoinVo;
-import com.xcong.excoin.modules.coin.service.OrderCoinService;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.entity.MemberSelectSymbolsEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
-import com.xcong.excoin.modules.platform.dao.PlatformSymbolsCoinDao;
-import com.xcong.excoin.modules.platform.dao.TradeSettingDao;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.RedisUtils;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.RandomUtil;
-import cn.hutool.core.util.StrUtil;
-
-@Service
-public class OrderCoinServiceImpl extends ServiceImpl<OrderCoinsDao, OrderCoinsEntity> implements OrderCoinService {
-
- @Resource
- TradeSettingDao platformTradeSettingDao;
- @Resource
- MemberWalletCoinDao memberWalletCoinDao;
- @Resource
- MemberSelectSymbolsDao memberSelectSymbolsDao;
- @Resource
- PlatformCnyUsdtExchangeDao cnyUsdtExchangeDao;
- @Resource
- OrderCoinsDao orderCoinsDao;
- @Resource
- OrderCoinDealDao orderCoinDealDao;
- @Resource
- MemberAccountFlowEntityDao memberAccountFlowEntityDao;
- @Resource
- RedisUtils redisUtils;
- @Resource
- PlatformSymbolsCoinDao platformSymbolsCoinDao;
-
- @Override
- public String generateSimpleSerialno(String userId) {
- StringBuilder sb = new StringBuilder();
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
- Date now = new Date();
- sb.append(sd.format(now));
- Calendar calendar = new GregorianCalendar();
- calendar.setTime(now);
- calendar.add(calendar.DATE, 1);
- Date nextDate = calendar.getTime();
- if (StrUtil.isNotEmpty(userId)) {
- sb.append(userId);
- }
- sb.append(RandomUtil.randomInt(2));
- long count = orderCoinsDao.getOrderCountByToday(sdf.format(now), sdf.format(nextDate));
- count++;
- int size = 4;
- for (int i = 0; i < size - String.valueOf(count).length(); i++) {
- sb.append("0");
- }
- sb.append(count);
- return sb.toString();
- }
-
- @Override
- public Result enterTransactionPageOfWalletCoin(String symbol) {
- if (StrUtil.isBlank(symbol)) {
- return Result.fail(MessageSourceUtils.getString("order_service_0001"));
- }
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- //获取该币种的币币账户信息
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
-
- PlatformTradeSettingEntity tradeSetting = platformTradeSettingDao.findTradeSetting();
- if (ObjectUtil.isEmpty(tradeSetting)) {
- return Result.fail(MessageSourceUtils.getString("order_service_0003"));
- }
- //获取USDT的币币账户信息
- MemberWalletCoinEntity walletCoinUsdt = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId,
- MemberWalletCoinEnum.WALLETCOINCODE.getValue());
-
- BigDecimal closePrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol + "/USDT")));
-
- List<MemberSelectSymbolsEntity> memSymbols = memberSelectSymbolsDao.selectSymbolByMemIdAndSymbol(memberId, symbol);
-
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
- BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
- TransactionPageOfWalletCoinVo transactionPageOfWalletCoinVo = new TransactionPageOfWalletCoinVo();
- //是否自选
- if (CollUtil.isEmpty(memSymbols)) {
- transactionPageOfWalletCoinVo.setIsCollect(TransactionPageOfWalletCoinVo.ISCOLLECT_NO);
- } else {
- transactionPageOfWalletCoinVo.setIsCollect(TransactionPageOfWalletCoinVo.ISCOLLECT_YES);
- }
- if (ObjectUtil.isEmpty(walletCoin))
- return Result.fail(MessageSourceUtils.getString("order_service_0003"));
- // 点差
- transactionPageOfWalletCoinVo.setSpread(tradeSetting.getSpread().setScale(4, BigDecimal.ROUND_DOWN));
- // 手续费用率
- transactionPageOfWalletCoinVo.setFeeRatio(tradeSetting.getCoinFeeRatio().setScale(4, BigDecimal.ROUND_DOWN));
- // 用户可用金额
- transactionPageOfWalletCoinVo.setAvailableBalanceBuy(walletCoinUsdt.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
- transactionPageOfWalletCoinVo.setAvailableBalanceSell(walletCoin.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
- //当前价
- transactionPageOfWalletCoinVo.setCurrentPrice(closePrice.setScale(4, BigDecimal.ROUND_DOWN));
- //比例
- transactionPageOfWalletCoinVo.setCnyUsdt(cnyUsdt.setScale(4, BigDecimal.ROUND_DOWN));
- //换算成人民币的币种价格
- transactionPageOfWalletCoinVo.setCurrentPriceCny(cnyUsdt.multiply(closePrice).setScale(4, BigDecimal.ROUND_DOWN));
-
- transactionPageOfWalletCoinVo.setSymbol(symbol);
- return Result.ok(transactionPageOfWalletCoinVo);
- }
-
- @Override
- @Transactional
- public Result submitSalesWalletCoinOrder(String symbol, Integer type, Integer tradeType, BigDecimal price, BigDecimal amount) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- BigDecimal nowPriceinBigDecimal = price;
- //查询当前价
- BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol + "/USDT")));
-
- // 获取交易管理的杠杠倍率,手续费率等信息,由平台进行设置
- symbol = symbol.toUpperCase();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
- if (ObjectUtil.isEmpty(walletCoin)) {
- return Result.fail(MessageSourceUtils.getString("order_service_0003"));
- }
- // 查询交易设置
- PlatformTradeSettingEntity tradeSetting = platformTradeSettingDao.findTradeSetting();
- if (ObjectUtil.isEmpty(tradeSetting)) {
- return Result.fail(MessageSourceUtils.getString("order_service_0009"));
- }
- // 手续费用(手续费=建仓价X数量X手续费率)
- BigDecimal closingPrice = price.multiply(amount).multiply(tradeSetting.getCoinFeeRatio());
- //总费用 = 成交价*数量+手续费
- BigDecimal totalPayPrice = price.multiply(amount).add(closingPrice);
- BigDecimal totalPayPricCoin = nowPrice.multiply(amount).add(closingPrice);
-
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletCoinEntity walletCoinUsdt = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) {
- //买入,所需总费用跟用户USDT金额进行比较
- BigDecimal availableBalance = walletCoinUsdt.getAvailableBalance();
- if (totalPayPrice.compareTo(availableBalance) > 0 || totalPayPricCoin.compareTo(availableBalance) > 0) {
- return Result.fail(MessageSourceUtils.getString("order_service_0010"));
- }
- } else {
- //卖出,所需总费用跟用户所对应的币种金额进行比较
- BigDecimal availableBalance = walletCoin.getAvailableBalance();
- if (amount.compareTo(availableBalance) > 0) {
- return Result.fail(MessageSourceUtils.getString("order_service_0010"));
- }
- }
-
- // 创建订单
- OrderCoinsEntity order = new OrderCoinsEntity();
- if ((OrderCoinsEntity.TRADETYPE_FIXEDPRICE.equals(tradeType) && type.equals(1) && price.compareTo(nowPrice) < 0)
- || (OrderCoinsEntity.TRADETYPE_FIXEDPRICE.equals(tradeType) && type.equals(2) && price.compareTo(nowPrice) > 0)) {
- // 如果是限价交易直接插入主表数据
- order.setMemberId(memberId);
- order.setOrderNo(generateSimpleSerialno(memberId.toString()));
- order.setOrderType(type);
- order.setSymbol(symbol);
- order.setMarkPrice(nowPrice);
- order.setEntrustCnt(amount);
- order.setEntrustPrice(price);
- order.setDealCnt(amount);
- order.setDealPrice(price);
- order.setDealAmount(totalPayPrice);
- order.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_DODING);
- order.setTradeType(tradeType);
- order.setFeeAmount(closingPrice);
- orderCoinsDao.insert(order);
-
- //更新用户钱包信息
- //冻结相应的资产
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) {
- //如果是买入,所对应的币种增加,USDT账户减少金额
- BigDecimal availableBalance = walletCoinUsdt.getAvailableBalance().subtract(totalPayPrice);
- BigDecimal frozenBalance = walletCoinUsdt.getFrozenBalance().add(totalPayPrice);
- walletCoinUsdt.setAvailableBalance(availableBalance);
- walletCoinUsdt.setFrozenBalance(frozenBalance);
- memberWalletCoinDao.updateById(walletCoinUsdt);
- } else {
- //如果是卖出,币种减少,USDT增加
- BigDecimal availableBalance = walletCoin.getAvailableBalance().subtract(amount);
- BigDecimal frozenBalance = walletCoin.getFrozenBalance().add(amount);
- walletCoin.setAvailableBalance(availableBalance);
- walletCoin.setFrozenBalance(frozenBalance);
- memberWalletCoinDao.updateById(walletCoin);
- }
- } else {
- //如果是市价交易,主表和附表都需要插入数据
- order.setMemberId(memberId);
- order.setOrderNo(generateSimpleSerialno(memberId.toString()));
- order.setOrderType(type);
- order.setSymbol(symbol);
- order.setMarkPrice(nowPrice);
- order.setEntrustCnt(amount);
- order.setEntrustPrice(price);
- order.setDealCnt(amount);
- if ((OrderCoinsEntity.TRADETYPE_FIXEDPRICE.equals(tradeType) && type.equals(1) && price.compareTo(nowPrice) >= 0)
- || (OrderCoinsEntity.TRADETYPE_FIXEDPRICE.equals(tradeType) && type.equals(2) && price.compareTo(nowPrice) <= 0)) {
- // 手续费用(手续费=建仓价X数量X手续费率)
- closingPrice = nowPrice.multiply(amount).multiply(tradeSetting.getCoinFeeRatio());
- //总费用 = 成交价*数量+手续费
- totalPayPrice = nowPrice.multiply(amount).add(closingPrice);
- price = nowPrice;
- }
- order.setDealPrice(nowPrice);
- order.setDealAmount(totalPayPrice);
- order.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_DONE);
- order.setTradeType(tradeType);
- order.setFeeAmount(closingPrice);
- orderCoinsDao.insert(order);
-
- OrderCoinsDealEntity detail = new OrderCoinsDealEntity();
- detail.setMemberId(memberId);
- detail.setOrderId(order.getId());
- detail.setOrderNo(order.getOrderNo());
- detail.setOrderType(type);
- detail.setTradeType(tradeType);
- detail.setSymbol(symbol);
- detail.setSymbolCnt(amount);
- detail.setEntrustPrice(nowPriceinBigDecimal);
- detail.setDealPrice(nowPrice);
- detail.setDealAmount(totalPayPrice);
- detail.setFeeAmount(closingPrice);
- detail.setOrderStatus(OrderCoinsDealEntity.ORDERSTATUS_DONE);
- orderCoinDealDao.insert(detail);
-
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) {
- //如果是买入,所对应的币种增加,USDT账户减少金额
- // 更新用户的可用金额
- walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(amount));
- memberWalletCoinDao.updateById(walletCoin);
-
- walletCoinUsdt.setAvailableBalance(walletCoinUsdt.getAvailableBalance().subtract(totalPayPrice));
- memberWalletCoinDao.updateById(walletCoinUsdt);
- } else {
- //如果是卖出,币种减少,USDT增加
- walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().subtract(amount));
- memberWalletCoinDao.updateById(walletCoin);
-
- BigDecimal subtract = totalPayPrice.subtract(closingPrice).subtract(closingPrice);
- walletCoinUsdt.setAvailableBalance(walletCoinUsdt.getAvailableBalance().add(subtract));
- memberWalletCoinDao.updateById(walletCoinUsdt);
- }
- }
- // 流水记录
- MemberAccountFlowEntity record = new MemberAccountFlowEntity();
- record.setMemberId(memberId);
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) {
- record.setPrice(totalPayPrice.setScale(4, BigDecimal.ROUND_DOWN));
- record.setSource(MemberAccountFlowEntity.SOURCE_BUY + symbol);
- record.setRemark(MemberAccountFlowEntity.REMARK_BUY + symbol + ":" + amount);
- } else {
- record.setPrice(totalPayPrice.negate().setScale(4, BigDecimal.ROUND_DOWN));
- record.setSource(MemberAccountFlowEntity.SOURCE_SALE + symbol);
- record.setRemark(MemberAccountFlowEntity.REMARK_SALE + symbol + ":" + amount);
- }
- record.setSymbol(symbol);
- record.setBalance(walletCoinUsdt.getAvailableBalance());
-
- memberAccountFlowEntityDao.insert(record);
-
- return Result.ok(MessageSourceUtils.getString("order_service_0011"));
- }
-
- @Override
- public Result getEntrustWalletCoinOrder(String symbol, Integer status) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- OrderWalletCoinListVo orderWalletCoinListVo = new OrderWalletCoinListVo();
-
- List<OrderWalletCoinVo> arrayList = new ArrayList<>();
- List<OrderCoinsEntity> findCoinOrderListByMemberIdAndSysmbol = orderCoinsDao.findCoinOrderListByMemberIdAndSysmbol(memberId, symbol, status);
- if (CollUtil.isNotEmpty(findCoinOrderListByMemberIdAndSysmbol)) {
- for (OrderCoinsEntity orderCoinsEntity : findCoinOrderListByMemberIdAndSysmbol) {
- OrderWalletCoinVo entityToVo = OrderWalletCoinMapper.INSTANCE.entityToVo(orderCoinsEntity);
- entityToVo.setFeeAmount(entityToVo.getFeeAmount()== null
- ? BigDecimal.ZERO : entityToVo.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setMarkPrice(entityToVo.getMarkPrice()== null
- ? BigDecimal.ZERO : entityToVo.getMarkPrice().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setEntrustCnt(entityToVo.getEntrustCnt()== null
- ? BigDecimal.ZERO : entityToVo.getEntrustCnt().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setEntrustPrice(entityToVo.getEntrustPrice()== null
- ? BigDecimal.ZERO : entityToVo.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setDealCnt(entityToVo.getDealCnt()== null
- ? BigDecimal.ZERO : entityToVo.getDealCnt().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setDealPrice(entityToVo.getDealPrice()== null
- ? BigDecimal.ZERO : entityToVo.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN));
- entityToVo.setDealAmount(entityToVo.getDealAmount()== null
- ? BigDecimal.ZERO : entityToVo.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN));
- arrayList.add(entityToVo);
- }
- }
- orderWalletCoinListVo.setOrderWalletCoinVo(arrayList);
- return Result.ok(arrayList);
- }
-
- @Override
- @Transactional
- public Result cancelEntrustWalletCoinOrder(String orderId) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- OrderCoinsEntity orderCoinsEntity = orderCoinsDao.selectById(orderId);
- if (ObjectUtil.isNotEmpty(orderCoinsEntity) && orderCoinsEntity.getMemberId() == memberId) {
- if (orderCoinsEntity.getOrderStatus() == OrderCoinsEntity.ORDERSTATUS_CANCEL) {
- return Result.fail(MessageSourceUtils.getString("order_service_0012"));
- }
- orderCoinsEntity.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_CANCEL);
- orderCoinsDao.updateById(orderCoinsEntity);
-
- String symbol = orderCoinsEntity.getSymbol();
-
- OrderCoinsDealEntity detail = new OrderCoinsDealEntity();
- detail.setMemberId(memberId);
- detail.setOrderId(orderCoinsEntity.getId());
- detail.setOrderNo(generateSimpleSerialno(memberId.toString()));
- detail.setOrderType(orderCoinsEntity.getOrderType());
- detail.setTradeType(orderCoinsEntity.getTradeType());
- detail.setSymbol(symbol);
- detail.setOrderStatus(OrderCoinsDealEntity.ORDERSTATUS_CANCEL);
- detail.setSymbolCnt(orderCoinsEntity.getEntrustCnt());
- detail.setEntrustPrice(orderCoinsEntity.getEntrustPrice());
- detail.setDealPrice(orderCoinsEntity.getDealPrice());
- detail.setDealAmount(orderCoinsEntity.getDealAmount());
- detail.setFeeAmount(orderCoinsEntity.getFeeAmount());
- orderCoinDealDao.insert(detail);
-
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(orderCoinsEntity.getOrderType())) {
- //如果是限价买入,撤单将USDT账户冻结金额返回
- String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
-
- if (ObjectUtil.isNotEmpty(walletCoin)) {
- //手续费 = 开仓价*数量*手续费率
- //返还金额=开仓价*未成交数量+手续费
- BigDecimal returnBalance = orderCoinsEntity.getDealAmount();
-
- walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(returnBalance));
- walletCoin.setFrozenBalance(walletCoin.getFrozenBalance().subtract(returnBalance));
- memberWalletCoinDao.updateById(walletCoin);
- // 流水记录
- MemberAccountFlowEntity record = new MemberAccountFlowEntity();
- record.setSource(MemberAccountFlowEntity.SOURCE_CANCEL);
- record.setRemark(MemberAccountFlowEntity.REMARK_CANCEL + symbol + MemberAccountFlowEntity.REMARK_RETURNBALANCE + returnBalance);
- record.setBalance(walletCoin.getAvailableBalance());
- record.setMemberId(memberId);
- record.setSymbol(symbol);
- record.setPrice(returnBalance);
- memberAccountFlowEntityDao.insert(record);
- return Result.ok(MessageSourceUtils.getString("order_service_0013"));
- }
- } else {
- //如果是限价卖出,撤单将对应的钱包冻结金额返回
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
- if (ObjectUtil.isNotEmpty(walletCoin)) {
-
- BigDecimal returnBalance = orderCoinsEntity.getEntrustCnt();
- walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(returnBalance));
- walletCoin.setFrozenBalance(walletCoin.getFrozenBalance().subtract(returnBalance));
- memberWalletCoinDao.updateById(walletCoin);
- // 流水记录
- MemberAccountFlowEntity record = new MemberAccountFlowEntity();
- record.setSource(MemberAccountFlowEntity.SOURCE_CANCEL);
- record.setRemark(MemberAccountFlowEntity.REMARK_CANCEL + symbol + MemberAccountFlowEntity.REMARK_RETURNBALANCE + returnBalance);
- record.setBalance(walletCoin.getAvailableBalance());
- record.setMemberId(memberId);
- record.setSymbol(symbol);
- record.setPrice(walletCoin.getFrozenBalance());
- memberAccountFlowEntityDao.insert(record);
- return Result.ok(MessageSourceUtils.getString("order_service_0013"));
- }
- }
- }
- return Result.fail(MessageSourceUtils.getString("order_service_0043"));
- }
-
- @Override
- public Result findAllWalletCoinOrder(FindAllWalletCoinOrderDto findAllWalletCoinOrderDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
-
- Page<OrderCoinsDealEntity> page = new Page<>(findAllWalletCoinOrderDto.getPageNum(), findAllWalletCoinOrderDto.getPageSize());
- OrderCoinsDealEntity orderCoinsDealEntity = new OrderCoinsDealEntity();
- orderCoinsDealEntity.setMemberId(memberId);
- orderCoinsDealEntity.setSymbol(findAllWalletCoinOrderDto.getSymbol());
- IPage<OrderCoinsDealEntity> list = orderCoinDealDao.findAllWalletCoinOrderInPage(page, orderCoinsDealEntity);
- Page<OrderWalletCoinDealVo> pageEntityToPageVo = OrderWalletCoinDealMapper.INSTANCE.pageEntityToPageVo(list);
- List<OrderWalletCoinDealVo> records = pageEntityToPageVo.getRecords();
- if(CollUtil.isNotEmpty(records)) {
- for(OrderWalletCoinDealVo orderWalletCoinDealVo : records) {
- orderWalletCoinDealVo.setFeeAmount(orderWalletCoinDealVo.getFeeAmount() == null
- ? BigDecimal.ZERO : orderWalletCoinDealVo.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN));
-
- orderWalletCoinDealVo.setDealAmount(orderWalletCoinDealVo.getDealAmount() == null
- ? BigDecimal.ZERO : orderWalletCoinDealVo.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN));
-
- orderWalletCoinDealVo.setSymbolCnt(orderWalletCoinDealVo.getSymbolCnt() == null
- ? BigDecimal.ZERO : orderWalletCoinDealVo.getSymbolCnt().setScale(4, BigDecimal.ROUND_DOWN));
-
- orderWalletCoinDealVo.setEntrustPrice(orderWalletCoinDealVo.getEntrustPrice() == null
- ? BigDecimal.ZERO : orderWalletCoinDealVo.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN));
-
- orderWalletCoinDealVo.setDealPrice(orderWalletCoinDealVo.getDealPrice() == null
- ? BigDecimal.ZERO : orderWalletCoinDealVo.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN));
- }
- }
-
-
- return Result.ok(pageEntityToPageVo);
- }
-
- @Override
- public Result findWalletCoinOrder(Long orderId) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- OrderCoinsDealEntity selectWalletCoinOrder = orderCoinDealDao.selectWalletCoinOrder(orderId, memberId);
- OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(selectWalletCoinOrder);
- if(ObjectUtil.isNotEmpty(entityToVo)) {
- entityToVo.setFeeAmount(entityToVo.getFeeAmount() == null
- ? BigDecimal.ZERO : entityToVo.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN));
-
- entityToVo.setDealAmount(entityToVo.getDealAmount() == null
- ? BigDecimal.ZERO : entityToVo.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN));
-
- entityToVo.setSymbolCnt(entityToVo.getSymbolCnt() == null
- ? BigDecimal.ZERO : entityToVo.getSymbolCnt().setScale(4, BigDecimal.ROUND_DOWN));
-
- entityToVo.setEntrustPrice(entityToVo.getEntrustPrice() == null
- ? BigDecimal.ZERO : entityToVo.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN));
-
- entityToVo.setDealPrice(entityToVo.getDealPrice() == null
- ? BigDecimal.ZERO : entityToVo.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN));
- }
- return Result.ok(entityToVo);
- }
-
- @Override
- public Result findCollect(String symbol, Integer type) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- if (type == 1) {
- //添加自选
- MemberSelectSymbolsEntity symbols = new MemberSelectSymbolsEntity();
- symbols.setMemberId(memberId);
- symbols.setSymbol(symbol);
- memberSelectSymbolsDao.insert(symbols);
- return Result.ok(MessageSourceUtils.getString("order_service_0015"));
- } else {
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("symbol", symbol);
- columnMap.put("member_id", memberId);
- memberSelectSymbolsDao.deleteByMap(columnMap);
- ;
- return Result.ok(MessageSourceUtils.getString("order_service_0016"));
- }
- }
-
- @Override
- public Result checkIsCollect(String symbol) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberSelectSymbolsVo memberSelectSymbolsVo = new MemberSelectSymbolsVo();
- List<MemberSelectSymbolsEntity> selectSymbolByMemIdAndSymbol = memberSelectSymbolsDao.selectSymbolByMemIdAndSymbol(memberId, symbol);
-
- if (CollUtil.isNotEmpty(selectSymbolByMemIdAndSymbol)) {
- memberSelectSymbolsVo.setIsCollect(MemberSelectSymbolsVo.ISCOLLECT_YES);
- } else {
- memberSelectSymbolsVo.setIsCollect(MemberSelectSymbolsVo.ISCOLLECT_NO);
- }
- memberSelectSymbolsVo.setSymbol(symbol);
- return Result.ok(memberSelectSymbolsVo);
- }
-
- @Override
- public Result findCollectList() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- List<MemberSelectSymbolsEntity> selectByMap = memberSelectSymbolsDao.selectSymbolByMemId(memberId);
-
- FindCollectListVo findCollectListVo = new FindCollectListVo();
- List<MemberSelectSymbolsVo> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (MemberSelectSymbolsEntity memberSelectSymbolsEntity : selectByMap) {
- MemberSelectSymbolsVo memberSelectSymbolsVo = new MemberSelectSymbolsVo();
- memberSelectSymbolsVo.setSymbol(memberSelectSymbolsEntity.getSymbol());
- arrayList.add(memberSelectSymbolsVo);
- }
- }
- findCollectListVo.setMemberSelectSymbolsVo(arrayList);
-
- return Result.ok(findCollectListVo);
- }
-
- @Override
- public Result searchSymbolResultList() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- FindCollectListVo findCollectListVo = new FindCollectListVo();
- List<MemberSelectSymbolsVo> list = new ArrayList<>();
-
- Map<String, Object> columnMap = new HashMap<>();
- List<PlatformSymbolsCoinEntity> selectByMap = platformSymbolsCoinDao.selectByMap(columnMap);
-
- List<MemberSelectSymbolsEntity> selectSymbolByMemIdAndSymbol = memberSelectSymbolsDao.selectSymbolByMemId(memberId);
- for (PlatformSymbolsCoinEntity platformSymbolsCoinEntity : selectByMap) {
- MemberSelectSymbolsVo memberSelectSymbolsVo = new MemberSelectSymbolsVo();
- memberSelectSymbolsVo.setSymbol(platformSymbolsCoinEntity.getName());
- if (CollUtil.isNotEmpty(selectSymbolByMemIdAndSymbol)) {
- for (MemberSelectSymbolsEntity memberSelectSymbolsEntity : selectSymbolByMemIdAndSymbol) {
- if (platformSymbolsCoinEntity.getName().equals(memberSelectSymbolsEntity.getSymbol())) {
- memberSelectSymbolsVo.setIsCollect(MemberSelectSymbolsVo.ISCOLLECT_YES);
- }
- }
- } else {
- memberSelectSymbolsVo.setIsCollect(MemberSelectSymbolsVo.ISCOLLECT_NO);
- }
- list.add(memberSelectSymbolsVo);
- }
- findCollectListVo.setMemberSelectSymbolsVo(list);
- return Result.ok(findCollectListVo);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public void dealEntrustCoinOrder() {
- List<OrderCoinsEntity> list = orderCoinsDao.selectAllEntrustingCoinOrderList();
- if (CollUtil.isNotEmpty(list)) {
- for (OrderCoinsEntity orderCoinsEntity : list) {
- BigDecimal nowPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(orderCoinsEntity.getSymbol() + "/USDT")));
- // 下单时市场价
- BigDecimal markPrice = orderCoinsEntity.getMarkPrice();
- // 委托价
- BigDecimal entrustPrice = orderCoinsEntity.getEntrustPrice();
-
- //如果当时委托价小于市价
- if (entrustPrice.compareTo(markPrice) < 0) {
- if (nowPrice.compareTo(entrustPrice) > 0) {
- continue;
- }
- } else {
- //委托价大于市价
- if (nowPrice.compareTo(entrustPrice) < 0) {
- continue;
- }
- }
-
- BigDecimal fee = entrustPrice.multiply(orderCoinsEntity.getEntrustCnt()).multiply(new BigDecimal("0.002")).setScale(8, BigDecimal.ROUND_HALF_UP);
-
- BigDecimal dealAmount = entrustPrice.multiply(orderCoinsEntity.getEntrustCnt());
-
- OrderCoinsDealEntity orderCoinsDealEntity = OrderCoinsDealMapper.INSTANCE.orderToOrderDeal(orderCoinsEntity);
- orderCoinsDealEntity.setDealAmount(dealAmount);
- orderCoinsDealEntity.setDealPrice(entrustPrice);
- orderCoinsDealEntity.setFeeAmount(fee);
- orderCoinsDealEntity.setOrderStatus(OrderCoinsDealEntity.ORDERSTATUS_DONE);
- orderCoinsDealEntity.setId(null);
- orderCoinDealDao.insert(orderCoinsDealEntity);
-
- orderCoinsDao.deleteById(orderCoinsEntity.getId());
-
- MemberWalletCoinEntity walletCoinEntity = memberWalletCoinDao.selectWalletCoinBymIdAndCode(orderCoinsEntity.getMemberId(), orderCoinsEntity.getSymbol());
- MemberWalletCoinEntity usdt = memberWalletCoinDao.selectWalletCoinBymIdAndCode(orderCoinsEntity.getMemberId(), "USDT");
-
- BigDecimal frozen = BigDecimal.ZERO;
- BigDecimal total = BigDecimal.ZERO;
- // 买入
- if (OrderCoinsEntity.ORDERTYPE_BUY.equals(orderCoinsEntity.getOrderType())) {
- BigDecimal newCoins = walletCoinEntity.getAvailableBalance().add(orderCoinsEntity.getEntrustCnt());
- BigDecimal newCoinTotal = walletCoinEntity.getTotalBalance().add(orderCoinsEntity.getEntrustCnt());
- walletCoinEntity.setAvailableBalance(newCoins);
- walletCoinEntity.setTotalBalance(newCoinTotal);
- memberWalletCoinDao.updateById(walletCoinEntity);
-
- frozen = usdt.getFrozenBalance().subtract(dealAmount.add(fee));
- total = usdt.getTotalBalance().subtract(dealAmount.add(fee));
- usdt.setFrozenBalance(frozen);
- usdt.setTotalBalance(total);
- memberWalletCoinDao.updateById(usdt);
- } else {
- walletCoinEntity.setFrozenBalance(walletCoinEntity.getFrozenBalance().subtract(orderCoinsEntity.getEntrustCnt()));
- walletCoinEntity.setTotalBalance(walletCoinEntity.getTotalBalance().subtract(orderCoinsEntity.getEntrustCnt()));
- memberWalletCoinDao.updateById(walletCoinEntity);
-
- usdt.setAvailableBalance(usdt.getAvailableBalance().add(dealAmount.add(fee)));
- usdt.setTotalBalance(usdt.getTotalBalance().add(dealAmount.add(fee)));
- memberWalletCoinDao.updateById(usdt);
- }
- }
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractEntrustOrderController.java b/src/main/java/com/xcong/excoin/modules/contract/controller/ContractEntrustOrderController.java
deleted file mode 100644
index 7d1430b..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractEntrustOrderController.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.xcong.excoin.modules.contract.controller;
-
-import cn.hutool.core.util.StrUtil;
-import com.xcong.excoin.common.enumerates.SymbolEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitEntrustDto;
-import com.xcong.excoin.modules.contract.parameter.vo.ContractEntrustVo;
-import com.xcong.excoin.modules.contract.service.ContractEntrustOrderService;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.TypeJudgeUtils;
-import com.xcong.excoin.utils.api.response.Symbol;
-import io.swagger.annotations.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-
-/**
- * 合约委托订单controller
- *
- * @author wzy
- * @date 2020-05-27
- **/
-@Slf4j
-@Api(value = "ContractEntrustOrderController", tags = "合约委托订单接口类")
-@RestController
-@RequestMapping(value = "/api/contractEntrust")
-public class ContractEntrustOrderController {
-
- @Resource
- private ContractEntrustOrderService contractEntrustOrderService;
-
- @ApiOperation(value = "合约提交委托订单", notes = "提交委托订单")
- @PostMapping(value = "/submitEntrustOrder")
- public Result submitEntrustOrder(@RequestBody @Validated SubmitEntrustDto submitEntrustDto) {
- if (StrUtil.isBlank(SymbolEnum.getNameByValue(submitEntrustDto.getSymbol()))) {
- return Result.fail(MessageSourceUtils.getString("illegal_symbol"));
- }
-
- if (!TypeJudgeUtils.entrustType(submitEntrustDto.getEntrustType())) {
- return Result.fail(MessageSourceUtils.getString("illegal_type"));
- }
-
- return contractEntrustOrderService.addContractEntrustOrder(submitEntrustDto);
- }
-
- @ApiOperation(value = "获取当前委托单列表", notes = "获取当前委托单列表")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = ContractEntrustVo.class)
- })
- @GetMapping(value = "/findCurrentEntrustOrderList")
- public Result findCurrentEntrustOrderList(@ApiParam(name = "symbol", value = "币种", example = "BTC/USDT") @RequestParam(value = "symbol", required = false) String symbol) {
- return contractEntrustOrderService.findEntrustOrderList(symbol);
- }
-
-
- @ApiOperation(value = "撤销委托单", notes = "撤销委托单")
- @GetMapping(value = "/cancelEntrustOrder")
- public Result cancelEntrustOrder(@ApiParam(name = "id", value = "委托单ID", required = true, example = "1") @RequestParam("id") Long id) {
- return contractEntrustOrderService.cancelEntrustOrder(id);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractHoldOrderController.java b/src/main/java/com/xcong/excoin/modules/contract/controller/ContractHoldOrderController.java
deleted file mode 100644
index 71fafda..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractHoldOrderController.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.contract.controller;
-
-import io.swagger.annotations.Api;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Slf4j
-@Api(value = "ContractHoldOrderController", tags = "合约持仓订单接口类")
-@RestController
-@RequestMapping(value = "/api/contractHold")
-public class ContractHoldOrderController {
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractOrderController.java b/src/main/java/com/xcong/excoin/modules/contract/controller/ContractOrderController.java
deleted file mode 100644
index 0be9cc1..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/controller/ContractOrderController.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.xcong.excoin.modules.contract.controller;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.parameter.dto.*;
-import com.xcong.excoin.modules.contract.parameter.vo.ContractMoneyInfoVo;
-import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderListVo;
-import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.contract.service.ContractOrderService;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import io.swagger.annotations.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Slf4j
-@Api(value = "ContractOrderController", tags = "合约订单接口类")
-@RestController
-@RequestMapping(value = "/api/contractOrder")
-public class ContractOrderController {
-
- @Resource
- private ContractHoldOrderService contractHoldOrderService;
-
- @Resource
- private ContractOrderService contractOrderService;
-
- @ApiOperation(value = "市价提交合约订单")
- @PostMapping(value = "/submitOrder")
- public Result submitOrder(@RequestBody SubmitOrderDto submitOrderDto) {
- return contractHoldOrderService.submitOrder(submitOrderDto);
- }
-
- @ApiOperation(value = "查询当前持仓订单列表 -- 轮询")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = HoldOrderListVo.class)
- })
- @GetMapping(value = "/findHoldOrderList")
- public Result findHoldOrderList(@ApiParam(name = "symbol", value = "币种", example = "BTC/USDT") @RequestParam(value = "symbol", required = false) String symbol) {
- return contractHoldOrderService.findHoldOrderList(symbol);
- }
-
- @ApiOperation(value = "根据Id查询持仓订单详情")
- @GetMapping(value = "/findHoldOrderDetail")
- public Result findHoldOrderDetail(@ApiParam(name = "id", value = "持仓ID", required = true, example = "1") @RequestParam(value = "id") Long id) {
- return contractHoldOrderService.findHoldOrderDetailById(id);
- }
-
- @ApiOperation(value = "根据Id平仓")
- @GetMapping(value = "/closingOrder")
- public Result closingOrder(@ApiParam(name = "id", value = "持仓ID", required = true, example = "1") @RequestParam(value = "id") Long id) {
- return contractHoldOrderService.cancelHoldOrder(id);
- }
-
- @ApiOperation(value = "一键平仓")
- @PostMapping(value = "/oneKeyClosing")
- public Result oneKeyClosing(@RequestBody SymbolDto symbolDto) {
- return contractHoldOrderService.cancelHoldOrderBatch(symbolDto);
- }
-
- @ApiOperation(value = "设置止盈止损")
- @PostMapping(value = "/setTargetProfitOrLoss")
- public Result setTargetProfitOrLoss(@RequestBody @Validated ProfitOrLessDto profitOrLessDto) {
- return contractHoldOrderService.setTargetProfitOrLess(profitOrLessDto);
- }
-
- @ApiOperation(value = "调整保证金")
- @PostMapping(value = "/changeBond")
- public Result changeBond(@RequestBody @Validated ChangeBondDto changeBondDto) {
- return contractHoldOrderService.changeBond(changeBondDto);
- }
-
- @ApiOperation(value = "分页查询历史订单列表")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = OrderListVo.class)
- })
- @PostMapping(value = "/findHistoryOrderList")
- public Result findHistoryOrderList(@RequestBody @Validated OrderListDto orderListDto) {
- return contractHoldOrderService.findOrderList(orderListDto);
- }
-
- @ApiOperation(value = "获取合约页面资产信息")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = ContractMoneyInfoVo.class)
- })
- @GetMapping(value = "/findContractMoneyInfo")
- public Result findContractMoneyInfo(@ApiParam(name = "symbol", value = "币种", required = true, example = "BTC/USDT") @RequestParam(value = "symbol") String symbol) {
- return contractHoldOrderService.findContractMoneyInfo(symbol);
- }
-
- @ApiOperation(value = "调整杠杆")
- @PostMapping(value = "/changeLeverRate")
- public Result changeLeverRate(@RequestBody @Validated ChangeLeverRateDto changeLeverRateDto) {
- return contractHoldOrderService.changeLeverRate(changeLeverRateDto);
- }
-
- @ApiOperation(value = "查询历史委托订单详情")
- @GetMapping(value = "/findOrderDetailById")
- public Result findOrderDetailById(@ApiParam(name = "id", value = "订单id", required = true, example = "1") @RequestParam(value = "id") Long id) {
- return contractHoldOrderService.findOrderDetailById(id);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractEntrustOrderDao.java b/src/main/java/com/xcong/excoin/modules/contract/dao/ContractEntrustOrderDao.java
deleted file mode 100644
index 3f07e27..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractEntrustOrderDao.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.contract.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface ContractEntrustOrderDao extends BaseMapper<ContractEntrustOrderEntity> {
-
- public ContractEntrustOrderEntity selectEntrustOrderByIdAndMemberId(@Param("id") Long id, @Param("memberId") Long memberId);
-
- public List<ContractEntrustOrderEntity> selectEntrustOrderListByMemberId(@Param("memberId") Long memberId);
-
- public List<ContractEntrustOrderEntity> selectEntrustOrderListByMemberIdAndSymbol(@Param("memberId") Long memberId, @Param("symbol") String symbol);
-
- public List<ContractEntrustOrderEntity> selectEntrustOrderListByIds(@Param("list") List<Long> list);
-
- public List<ContractEntrustOrderEntity> selectAllEntrustOrder();
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractHoldOrderDao.java b/src/main/java/com/xcong/excoin/modules/contract/dao/ContractHoldOrderDao.java
deleted file mode 100644
index dd1f6ac..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractHoldOrderDao.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.xcong.excoin.modules.contract.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface ContractHoldOrderDao extends BaseMapper<ContractHoldOrderEntity> {
- /**
- * 根据ids更新所有订单的平仓状态
- *
- * @param list
- * @return
- */
- int updateContractHoldOrderCanNotClosingByIds(@Param("list") List<OrderModel> list, @Param("batchNo") String batchNo);
-
- /**
- * 根据批次号查询次仓订单
- *
- * @param batchNo
- * @return
- */
- List<ContractHoldOrderEntity> selectContractHoldOrderByBatchNo(@Param("batchNo") String batchNo);
-
- /**
- * 更新该订单为可平仓状态
- *
- * @param id
- */
- public void updateOrderIsCanClosingAndBatchNoById(@Param("id") Long id);
-
- public List<ContractHoldOrderEntity> selectHoldOrderListByMemberId(@Param("memberId") Long memberId);
-
- public List<ContractHoldOrderEntity> selectHoldOrderListByMemberIdAndSymbol(@Param("memberId") Long memberId, @Param("symbol") String symbol);
-
- public ContractHoldOrderEntity selectHoldOrderByMemberIdAndId(@Param("memberId") Long memberId, @Param("id") Long id);
-
- public int updateHoldOrderIsCanClosingById(@Param("isCanClosing") int isCanClosing, @Param("id") Long id);
-
- public List<ContractHoldOrderEntity> selectAllHoldOrder();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractOrderDao.java b/src/main/java/com/xcong/excoin/modules/contract/dao/ContractOrderDao.java
deleted file mode 100644
index aaea6dc..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/dao/ContractOrderDao.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.xcong.excoin.modules.contract.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.OrderListDto;
-import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * @author helius
- */
-public interface ContractOrderDao extends BaseMapper<ContractOrderEntity> {
-
- public IPage<ContractOrderEntity> selectContractOrderInPage(Page<ContractOrderEntity> page, @Param("record") ContractOrderEntity contractOrderEntity);
-
- public ContractOrderEntity selectOrderDetailByIdAndMemberId(@Param("id") Long id, @Param("memberId") Long memberId);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractEntrustOrderEntity.java b/src/main/java/com/xcong/excoin/modules/contract/entity/ContractEntrustOrderEntity.java
deleted file mode 100644
index ee1067b..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractEntrustOrderEntity.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package com.xcong.excoin.modules.contract.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Data
-@TableName("contract_entrust_order")
-public class ContractEntrustOrderEntity extends BaseEntity {
-
- public static final int ENTRUST_TYPE_OPEN_MORE = 1;
-
- public static final int ENTRUST_TYPE_OPEN_LESS = 2;
-
- public static final int ENTRUST_TYPE_CLOSE_MORE = 3;
-
- public static final int ENTRUST_TYPE_CLOSE_LESS = 4;
-
- /**
- * 逐仓
- */
- public static final int POSITION_TYPE_ADD = 1;
-
- /**
- * 全仓
- */
- public static final int POSITION_TYPE_ALL = 2;
-
-
- /**
- * 会员ID
- */
- private Long memberId;
-
- /**
- * 订单编号
- */
- private String orderNo;
-
- /**
- * 仓位类型 1逐仓2全仓
- */
- private int positionType;
-
- /**
- * 委托类型 1开多,2开空,3平多,4平空
- */
- private int entrustType;
-
- /**
- * 委托价格
- */
- private BigDecimal entrustPrice;
-
- /**
- * 委托金额
- */
- private BigDecimal entrustAmount;
-
- /**
- * 币种
- */
- private String symbol;
-
- /**
- * 数量
- */
- private int symbolCnt;
-
- /**
- * 币种规格
- */
- private BigDecimal symbolSku;
-
- /**
- * 杠杆倍率
- */
- private int leverRatio;
-
- /**
- * 保证金
- */
- private BigDecimal bondAmount;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractHoldOrderEntity.java b/src/main/java/com/xcong/excoin/modules/contract/entity/ContractHoldOrderEntity.java
deleted file mode 100644
index 7da4069..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractHoldOrderEntity.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.xcong.excoin.modules.contract.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 合约持仓订单表
- *
- * @author wzy
- * @date 2020-05-27
- **/
-@Data
-@TableName("contract_hold_order")
-public class ContractHoldOrderEntity extends BaseEntity {
-
- /**
- * 是否可平仓 1-是
- */
- public static final int ORDER_CAN_CLOSING_Y = 1;
- /**
- * 是否可平仓 0-否
- */
- public static final int ORDER_CAN_CLOSING_N = 0;
-
- /**
- * 开多
- */
- public static final int OPENING_TYPE_MORE = 1;
-
- /**
- * 开空
- */
- public static final int OPENING_TYPE_LESS = 2;
-
- /**
- * 交易类型 市价
- */
- public static final int TRADE_TYPE_MARK = 1;
-
- /**
- * 交易类型 限价
- */
- public static final int TRADE_TYPE_LIMIT = 2;
-
- /**
- * 会员Id
- */
- private Long memberId;
-
- /**
- * 订单编号
- */
- private String orderNo;
-
- /**
- * 仓位类型 1-逐仓 2-全仓
- */
- private int positionType;
-
- /**
- * 交易类型 1-市价 2-限价
- */
- private int tradeType;
-
- /**
- * 币种
- */
- private String symbol;
-
- /**
- * 手数
- */
- private int symbolCnt;
-
- /**
- * 可平张数(仅全仓模式)
- */
- private int symbolCntSale;
-
- /**
- * 币种规格
- */
- private BigDecimal symbolSku;
-
- /**
- * 开仓价
- */
- private BigDecimal openingPrice;
-
- /**
- * 开仓类型 1-开多 2-开空
- */
- private int openingType;
-
- /**
- * 开仓手续费
- */
- private BigDecimal openingFeeAmount;
-
- /**
- * 保证金
- */
- private BigDecimal bondAmount;
-
- /**
- * 杠杆倍率
- */
- private int leverRatio;
-
- /**
- * 市场价
- */
- private BigDecimal markPrice;
-
- /**
- * 止损价
- */
- private BigDecimal stopLossPrice;
-
- /**
- * 止盈价
- */
- private BigDecimal stopProfitPrice;
-
- /**
- * 预付款金额
- */
- private BigDecimal prePaymentAmount;
-
- /**
- * 预估强平价
- */
- private BigDecimal forceClosingPrice;
-
- private int operateNo;
-
- /**
- * 是否可平仓 0-否 1-是
- */
- private int isCanClosing;
-
- /**
- * 批次号 队列平仓时使用,避免重复
- */
- public String batchNo;
-
- /**
- * 持仓费
- */
- private BigDecimal holdAmount;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractOrderEntity.java b/src/main/java/com/xcong/excoin/modules/contract/entity/ContractOrderEntity.java
deleted file mode 100644
index 9a82765..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/entity/ContractOrderEntity.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package com.xcong.excoin.modules.contract.entity;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.FieldStrategy;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * 合约订单历史表
- *
- * @author wzy
- * @date 2020-05-27
- **/
-@Data
-@TableName("contract_order")
-public class ContractOrderEntity extends BaseEntity {
-
- /**
- * 交易类型 市价
- */
- public static final int TRADE_TYPE_MARK_PRICE = 1;
-
- /**
- * 交易类型 限价
- */
- public static final int TRADE_TYPE_LIMIT_PRICE = 2;
-
- /**
- * 订单状态 撤单
- */
- public static final int ORDER_STATUS_CANCEL = 2;
-
- /**
- * 订单状态 成交
- */
- public static final int ORDER_STATUS_SUCCESS = 1;
-
- /**
- * 订单类型 开多
- */
- public static final int ORDER_TYPE_OPEN_MORE = 1;
-
- /**
- * 订单类型 开空
- */
- public static final int ORDER_TYPE_OPEN_LESS = 2;
-
- /**
- * 订单类型 平多
- */
- public static final int ORDER_TYPE_CLOSE_MORE = 3;
-
- /**
- * 订单类型 平空
- */
- public static final int ORDER_TYPE_CLOSE_LESS = 4;
-
-
- /**
- * 会员Id
- */
- private Long memberId;
-
- /**
- * 订单编号
- */
- private String orderNo;
-
- /**
- * 仓位类型 1-逐仓 2-全仓
- */
- private int positionType;
-
- /**
- * 交易类型 1-市价 2-限价
- */
- private int tradeType;
-
- /**
- * 订单类型 - 1开多,2开空,3平多,4平空
- */
- private int orderType;
-
- /**
- * 订单状态 - 1成交 2撤单
- */
- private int orderStatus = 1;
-
- /**
- * 委托开仓价
- */
- private BigDecimal entrustOpeningPrice;
-
- /**
- * 委托时间
- */
- private Date entrustTime;
-
- /**
- * 币种
- */
- private String symbol;
-
- /**
- * 手数
- */
- private int symbolCnt;
-
- /**
- * 币种规格
- */
- private BigDecimal symbolSku;
-
- /**
- * 平仓价
- */
- private BigDecimal closingPrice;
-
- /**
- * 平仓手续费
- */
- private BigDecimal closingFeeAmount;
-
- /**
- * 平仓时间
- */
- private Date closingTime;
-
- /**
- * 平仓类型 2平多3平空4爆仓平多5爆仓平空6止盈平多7止盈平空8止损平多9止损平空
- */
- private int closingType;
-
- /**
- * 杠杆倍率
- */
- private int leverRatio;
-
- /**
- * 止损价
- */
- private BigDecimal stopLossPrice;
-
- /**
- * 止盈价
- */
- private BigDecimal stopProfitPrice;
-
- /**
- * 盈亏金额
- */
- private BigDecimal rewardAmount;
-
- /**
- * 盈亏比例
- */
- private BigDecimal rewardRatio;
-
- /**
- * 开仓价
- */
- private BigDecimal openingPrice;
-
- /**
- * 开仓手续费
- */
- private BigDecimal openingFeeAmount;
-
- private Date openingTime;
-
- /**
- * 预付款金额
- */
- private BigDecimal prePaymentAmount;
-
- /**
- * 保证金
- */
- private BigDecimal bondAmount;
-
- /**
- * 市场价
- */
- private BigDecimal markPrice;
-
- /**
- * 预估强平价
- */
- private BigDecimal forceClosingPrice;
-
- /**
- * 持仓费
- */
- private BigDecimal holdAmount;
-
- private int operateNo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractEntrustOrderEntityMapper.java b/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractEntrustOrderEntityMapper.java
deleted file mode 100644
index a80d1ef..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractEntrustOrderEntityMapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.xcong.excoin.modules.contract.mapper;
-
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitEntrustDto;
-import com.xcong.excoin.modules.contract.parameter.vo.ContractEntrustVo;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-28
- **/
-@Mapper
-public abstract class ContractEntrustOrderEntityMapper {
- public static final ContractEntrustOrderEntityMapper INSTANCE = Mappers.getMapper(ContractEntrustOrderEntityMapper.class);
-
- public abstract ContractEntrustOrderEntity submitEntrustDtoToEntity(SubmitEntrustDto dto);
-
- @Mapping(source = "entrustPrice", target = "entrustOpeningPrice")
- @Mapping(source = "createTime", target = "entrustTime")
- @Mapping(source = "entrustAmount", target = "prePaymentAmount")
- @Mapping(source = "entrustType", target = "orderType")
- public abstract ContractOrderEntity entrustOrderToOrder(ContractEntrustOrderEntity orderEntity);
-
- @Mapping(source = "createTime", target = "entrustTime")
- @Mapping(source = "entrustType", target = "type")
- public abstract ContractEntrustVo entityToContractEntrustVo(ContractEntrustOrderEntity orderEntity);
-
- public abstract List<ContractEntrustVo> entityListToVoList(List<ContractEntrustOrderEntity> list);
-
- @Mapping(source = "entrustAmount", target = "prePaymentAmount")
- public abstract ContractHoldOrderEntity entrustOrderToHoldOrder(ContractEntrustOrderEntity entrustOrderEntity);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractHoldOrderEntityMapper.java b/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractHoldOrderEntityMapper.java
deleted file mode 100644
index b2ad5e4..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractHoldOrderEntityMapper.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.xcong.excoin.modules.contract.mapper;
-
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderDetailVo;
-import com.xcong.excoin.modules.contract.parameter.vo.HoldOrderListVo;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-/**
- * @author wzy
- * @date 2020-05-31
- **/
-@Mapper
-public abstract class ContractHoldOrderEntityMapper {
- public static final ContractHoldOrderEntityMapper INSTANCE = Mappers.getMapper(ContractHoldOrderEntityMapper.class);
-
- @Mapping(target = "orderType", source = "openingType")
- @Mapping(target = "openingTime", source = "createTime")
- public abstract ContractOrderEntity holdOrderToOrder(ContractHoldOrderEntity holdOrderEntity);
-
- public abstract HoldOrderListVo holdOrderToDto(ContractHoldOrderEntity holdOrderEntity);
-
- @Mapping(target = "openingTime", source = "createTime")
- public abstract HoldOrderDetailVo holdOrderToOrderDetailVo(ContractHoldOrderEntity holdOrderEntity);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractOrderEntityMapper.java b/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractOrderEntityMapper.java
deleted file mode 100644
index b2e3ee2..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/mapper/ContractOrderEntityMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.contract.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.vo.OrderDetailVo;
-import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo;
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-06-05
- **/
-@Mapper
-public abstract class ContractOrderEntityMapper {
- public static final ContractOrderEntityMapper INSTANCE = Mappers.getMapper(ContractOrderEntityMapper.class);
-
- public abstract OrderListVo orderEntityToOrderListVo(ContractOrderEntity orderEntity);
-
- public abstract List<OrderListVo> orderEntitiesToOrderListVo(List<ContractOrderEntity> orderEntities);
-
- public abstract Page<OrderListVo> pageEntityToPageVo(IPage<ContractOrderEntity> orderEntityIPage);
-
- public abstract OrderDetailVo entityToDetailVo(ContractOrderEntity orderEntity);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeBondDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeBondDto.java
deleted file mode 100644
index cbac1d1..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeBondDto.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-06-02
- **/
-@Data
-@ApiModel(value = "ChangeBondDto", description = "调整保证金接口接受参数类")
-public class ChangeBondDto {
-
- public static final int TYPE_ADD = 1;
-
- public static final int TYPE_REDUCE = 2;
-
- @NotNull
- @ApiModelProperty(value = "订单ID", example = "1")
- private Long id;
-
- @NotNull
- @ApiModelProperty(value = "类型 1-增加2-减少", example = "1")
- private Integer type;
-
- @NotNull
- @Min(0)
- @ApiModelProperty(value = "金额", example = "90.00")
- private BigDecimal amount;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeLeverRateDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeLeverRateDto.java
deleted file mode 100644
index 4ba4265..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ChangeLeverRateDto.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author wzy
- * @Date 2020/6/5
- **/
-@Data
-@ApiModel(value = "ChangeLeverRateDto", description = "调整杠杆接口接收参数类")
-public class ChangeLeverRateDto {
-
- @NotNull
- @ApiModelProperty(value = "杠杆", example = "100")
- private int leverRate;
-
- @NotNull
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/OrderListDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/OrderListDto.java
deleted file mode 100644
index d194891..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/OrderListDto.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-/**
- * @Author wzy
- * @Date 2020/6/5
- **/
-@Data
-@ApiModel(value = "OrderListDto", description = "历史委托订单列表接口参数接受类")
-public class OrderListDto {
-
- @NotNull
- @Min(1)
- @ApiModelProperty(value = "第几页", example = "1")
- private int pageNum;
-
- @NotNull
- @ApiModelProperty(value = "每页数量", example = "10")
- private int pageSize;
-
- @NotNull
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ProfitOrLessDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ProfitOrLessDto.java
deleted file mode 100644
index ea0e60f..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/ProfitOrLessDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.DecimalMin;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-06-02
- **/
-@Data
-@ApiModel(value = "ProfitOrLessDto", description = "设置止盈止损接口参数类")
-public class ProfitOrLessDto {
-
- @NotNull
- @ApiModelProperty(value = "订单ID", example = "1")
- private Long id;
-
- @ApiModelProperty(value = "止盈价", example = "9000.00")
- private BigDecimal stopProfitPrice;
-
- @ApiModelProperty(value = "止损价", example = "9000.00")
- private BigDecimal stopLessPrice;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitEntrustDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitEntrustDto.java
deleted file mode 100644
index bf588cb..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitEntrustDto.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Data
-@ApiModel(value = "SubmitEntrustDto", description = "提交委托订单接口接受类")
-public class SubmitEntrustDto {
-
- @NotNull()
- @Min(1)
- @ApiModelProperty(value = "委托价", example = "9000.00")
- private BigDecimal entrustPrice;
-
- @NotNull
- @ApiModelProperty(value = "委托类型 1开多 2开空 3平多 4平空", example = "1")
- private int entrustType;
-
- @NotBlank
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-
- @NotNull
- @Min(1)
- @ApiModelProperty(value = "币种数量", example = "1")
- private int symbolCnt;
-
- @NotNull
- @ApiModelProperty(value = "杠杆倍率", example = "100")
- private int leverRatio;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitOrderDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitOrderDto.java
deleted file mode 100644
index 2a6c692..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SubmitOrderDto.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * @author wzy
- * @date 2020-05-31
- **/
-@Data
-@ApiModel(value = "SubmitOrderDto", description = "提交订单接口接受类")
-public class SubmitOrderDto {
-
- @NotNull
- @ApiModelProperty(value = "订单类型 1开多 2开空", example = "1")
- private int orderType;
-
- @NotBlank
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-
- @NotNull
- @Min(1)
- @ApiModelProperty(value = "币种数量", example = "1")
- private int symbolCnt;
-
- @NotNull
- @ApiModelProperty(value = "杠杆倍率", example = "100")
- private int leverRatio;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SymbolDto.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SymbolDto.java
deleted file mode 100644
index 4319d46..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/dto/SymbolDto.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @author wzy
- * @date 2020-06-03
- **/
-@Data
-@ApiModel(value = "SymbolDto", description = "币种dto")
-public class SymbolDto {
-
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractEntrustVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractEntrustVo.java
deleted file mode 100644
index 1203690..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractEntrustVo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.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;
-
-/**
- * @author wzy
- * @date 2020-05-29
- **/
-@Data
-@ApiModel(value = "ContractEntrustVo", description = "合约委托")
-public class ContractEntrustVo {
-
- @ApiModelProperty(value = "委托单ID")
- private Long id;
-
- @ApiModelProperty(value = "委托价")
- private BigDecimal entrustPrice;
-
- @ApiModelProperty(value = "委托数量")
- private int symbolCnt;
-
- @ApiModelProperty(value = "保证金")
- private BigDecimal bondAmount;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone="GMT+8")
- @ApiModelProperty(value = "委托时间")
- private Date entrustTime;
-
- @ApiModelProperty(value = "委托类型 1-开多 2-开空")
- private int type;
-
- public String getBondAmount() {
- return bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractMoneyInfoVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractMoneyInfoVo.java
deleted file mode 100644
index 8ae1d67..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/ContractMoneyInfoVo.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @Author wzy
- * @Date 2020/6/2
- **/
-@Data
-@ApiModel(value = "ContractMoneyInfoVo", description = "合约资产信息接口返回参数类")
-public class ContractMoneyInfoVo {
-
- @ApiModelProperty(value = "占用保证金")
- private BigDecimal beUsedBondAmount;
-
- @ApiModelProperty(value = "冻结保证金")
- private BigDecimal frozenBondAmount;
-
- @ApiModelProperty(value = "手续费率")
- private BigDecimal feeRatio;
-
- @ApiModelProperty(value = "权益")
- private BigDecimal equity;
-
- @ApiModelProperty(value = "合约杠杆")
- private Integer leverRate;
-
- @ApiModelProperty(value = "倍率")
- private BigDecimal leverAgeRatio;
-
- @ApiModelProperty(value = "可用余额")
- private BigDecimal availableBalance;
-
- @ApiModelProperty(value = "最新价")
- private BigDecimal newPrice;
-
- @ApiModelProperty(value = "规格")
- private BigDecimal symbolSku;
-
- public BigDecimal getBeUsedBondAmount() {
- return beUsedBondAmount.setScale(4, BigDecimal.ROUND_DOWN);
- }
-
- public BigDecimal getFrozenBondAmount() {
- return frozenBondAmount.setScale(4, BigDecimal.ROUND_DOWN);
- }
-
- public BigDecimal getEquity() {
- return equity.setScale(4, BigDecimal.ROUND_DOWN);
- }
-
- public BigDecimal getAvailableBalance() {
- return availableBalance.setScale(4, BigDecimal.ROUND_DOWN);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderDetailVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderDetailVo.java
deleted file mode 100644
index 66f370b..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderDetailVo.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.vo;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @author wzy
- * @date 2020-06-01
- **/
-@Data
-@ApiModel(value = "HoldOrderDetailVo", description = "获取持仓订单详情接口返回类")
-public class HoldOrderDetailVo {
-
- @ApiModelProperty("订单编号")
- private String orderNo;
-
- @ApiModelProperty("交易类型 1-市价2-限价")
- private int tradeType;
-
- @ApiModelProperty("币种")
- private String symbol;
-
- @ApiModelProperty("张数")
- private int symbolCnt;
-
- @ApiModelProperty("规格")
- private BigDecimal symbolSku;
-
- @ApiModelProperty("开仓价")
- private BigDecimal openingPrice;
-
- @ApiModelProperty("开仓类型 1-开多 2-开空")
- private int openingType;
-
- @ApiModelProperty("开仓手续费")
- private BigDecimal openingFeeAmount;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- @ApiModelProperty("开仓时间")
- private Date openingTime;
-
- @ApiModelProperty("保证金")
- private BigDecimal bondAmount;
-
- @ApiModelProperty("持仓费")
- private BigDecimal holdAmount;
-
- @ApiModelProperty("预估强平价")
- private BigDecimal forceClosingPrice;
-
- @ApiModelProperty("止损价")
- private BigDecimal stopLossPrice;
-
- @ApiModelProperty("止盈价")
- private BigDecimal stopProfitPrice;
-
- @ApiModelProperty("倍率杠杆")
- private int leverRatio;
-
- public String getOpeningPrice() {
- return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getOpeningFeeAmount() {
- return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getBondAmount() {
- return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getHoldAmount() {
- return holdAmount == null ? "" : holdAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getForceClosingPrice() {
- return forceClosingPrice == null ? "" : forceClosingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public void setOpeningFeeAmount(BigDecimal openingFeeAmount, BigDecimal feeSpread) {
- this.openingFeeAmount = openingFeeAmount == null ? openingFeeAmount : openingFeeAmount.multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderListVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderListVo.java
deleted file mode 100644
index e06bff3..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/HoldOrderListVo.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.vo;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.Date;
-
-/**
- * @author wzy
- * @date 2020-06-01
- **/
-@Data
-@ApiModel(value = "HoldOrderListVo", description = "获取当前持仓列表接口返回数据类")
-public class HoldOrderListVo {
-
- @ApiModelProperty(value = "订单ID", example = "1")
- private Long id;
-
- @ApiModelProperty(value = "开仓均价", example = "9000.00")
- private BigDecimal openingPrice;
-
- @ApiModelProperty(value = "止损")
- private BigDecimal stopLossPrice;
-
- @ApiModelProperty(value = "止盈")
- private BigDecimal stopProfitPrice;
-
- @ApiModelProperty(value = "保证金")
- private BigDecimal bondAmount;
-
- @ApiModelProperty(value = "强平价")
- private BigDecimal forceClosingPrice;
-
- @ApiModelProperty(value = "杠杆倍率")
- private int leverRatio;
-
- @ApiModelProperty(value = "订单类型 1-开多 2-开空")
- private int openingType;
-
- @ApiModelProperty(value = "币种")
- private String symbol;
-
- @ApiModelProperty(value = "张数")
- private int symbolCnt;
-
- @ApiModelProperty(value = "回报率")
- private BigDecimal returnRate;
-
- @ApiModelProperty(value = "盈亏")
- private BigDecimal profitOrLoss;
-
- @ApiModelProperty(value = "可增加的最大保证金")
- private BigDecimal canAddMaxBond;
-
- @ApiModelProperty(value = "可减少最大保证金")
- private BigDecimal canReduceMaxBond;
-
- @ApiModelProperty(value = "开仓时间")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date createTime;
-
- @ApiModelProperty(value = "交易类型 1-市价 2-限价")
- private Integer tradeType;
-
- public String getOpeningPrice() {
- return openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getBondAmount() {
- return bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getForceClosingPrice() {
- return forceClosingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getProfitOrLoss() {
- return profitOrLoss.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public BigDecimal getCanAddMaxBond() {
- return canAddMaxBond.setScale(4, BigDecimal.ROUND_DOWN);
- }
-
- public BigDecimal getCanReduceMaxBond() {
- return canReduceMaxBond.setScale(4, BigDecimal.ROUND_DOWN);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderDetailVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderDetailVo.java
deleted file mode 100644
index 2939331..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderDetailVo.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.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;
-
-/**
- * @author wzy
- * @date 2020-06-05
- **/
-@Data
-@ApiModel(value = "OrderDetailVo", description = "历史委托订单详情接口返回参数类")
-public class OrderDetailVo {
-
- @ApiModelProperty("交易类型 1-市价2-限价")
- private int tradeType;
-
- @ApiModelProperty("订单类型 -1撤单,1开多,2开空,3平多,4平空")
- private int orderType;
-
- @ApiModelProperty("订单编号")
- private String orderNo;
-
- @ApiModelProperty("委托开仓价")
- private BigDecimal entrustOpeningPrice;
-
- @ApiModelProperty("委托时间")
- private Date entrustTime;
-
- @ApiModelProperty("币种")
- private String symbol;
-
- @ApiModelProperty("张数")
- private int symbolCnt;
-
- @ApiModelProperty("平仓价")
- private BigDecimal closingPrice;
-
- @ApiModelProperty("平仓手续费")
- private BigDecimal closingFeeAmount;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- @ApiModelProperty("平仓时间")
- private Date closingTime;
-
- @ApiModelProperty("平仓类型 2平多3平空4爆仓平多5爆仓平空6止盈平多7止盈平空8止损平多9止损平空")
- private int closingType;
-
- @ApiModelProperty("止损价")
- private BigDecimal stopLossPrice;
-
- @ApiModelProperty("止盈价")
- private BigDecimal stopProfitPrice;
-
- @ApiModelProperty("盈亏金额")
- private BigDecimal rewardAmount;
-
- @ApiModelProperty("盈亏比例")
- private BigDecimal rewardRatio;
-
- @ApiModelProperty("开仓价")
- private BigDecimal openingPrice;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- @ApiModelProperty("开仓时间")
- private Date openingTime;
-
- @ApiModelProperty("开仓手续费")
- private BigDecimal openingFeeAmount;
-
- @ApiModelProperty("保证金")
- private BigDecimal bondAmount;
-
- @ApiModelProperty("持仓费")
- private BigDecimal holdAmount;
-
- @ApiModelProperty("杠杆")
- private int leverRatio;
-
- public String getClosingPrice() {
- return closingPrice == null ? "" : closingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getClosingFeeAmount() {
- return closingFeeAmount == null ? "" : closingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getRewardAmount() {
- return rewardAmount == null ? "" : rewardAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getOpeningPrice() {
- return openingPrice == null ? "" : openingPrice.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getOpeningFeeAmount() {
- return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getBondAmount() {
- return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getHoldAmount() {
- return holdAmount == null ? "" : holdAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public void setClosingFeeAmount(BigDecimal closingFeeAmount, BigDecimal feeSpread) {
- this.closingFeeAmount = closingFeeAmount == null ? closingFeeAmount : closingFeeAmount.multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN);
- }
-
- public void setOpeningFeeAmount(BigDecimal openingFeeAmount, BigDecimal feeSpread) {
- this.openingFeeAmount = openingFeeAmount == null ? openingFeeAmount : openingFeeAmount.multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderListVo.java b/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderListVo.java
deleted file mode 100644
index 24701bb..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/parameter/vo/OrderListVo.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.xcong.excoin.modules.contract.parameter.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;
-
-/**
- * @author wzy
- * @date 2020-06-05
- **/
-@Data
-@ApiModel(value = "OrderListVo", description = "历史委托订单接口返回参数类")
-public class OrderListVo {
-
- @ApiModelProperty("订单ID")
- private Long id;
-
- @ApiModelProperty("订单类型 1开多,2开空,3平多,4平空")
- private int orderType;
-
- @ApiModelProperty("订单状态 1成交 2撤单")
- private int orderStatus;
-
- @ApiModelProperty("开仓均价")
- private BigDecimal openingPrice;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- @ApiModelProperty("开仓价")
- private Date openingTime;
-
- @ApiModelProperty("开仓手续费")
- private BigDecimal openingFeeAmount;
-
- @ApiModelProperty("保证金")
- private BigDecimal bondAmount;
-
- @ApiModelProperty("张数")
- private int symbolCnt;
-
- @ApiModelProperty("已实现盈亏")
- private BigDecimal rewardAmount;
-
- @ApiModelProperty("平仓类型 2平多3平空4爆仓平多5爆仓平空6止盈平多7止盈平空8止损平多9止损平空")
- private int closingType;
-
- @ApiModelProperty("平仓手续费")
- private BigDecimal closingFeeAmount;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- @ApiModelProperty("平仓时间")
- private Date closingTime;
-
- @ApiModelProperty("平仓价格")
- private BigDecimal closingPrice;
-
- @ApiModelProperty("强平价")
- private BigDecimal forceClosingPrice;
-
- @ApiModelProperty(value = "交易类型 1-市价 2-限价")
- private Integer tradeType;
-
- public String getOpeningFeeAmount() {
- return openingFeeAmount == null ? "" : openingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
-
- public String getClosingFeeAmount() {
- return closingFeeAmount == null ? "" : closingFeeAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getBondAmount() {
- return bondAmount == null ? "" : bondAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-
- public String getRewardAmount() {
- return rewardAmount == null ? "" : rewardAmount.setScale(4, BigDecimal.ROUND_DOWN).toPlainString();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/ContractEntrustOrderService.java b/src/main/java/com/xcong/excoin/modules/contract/service/ContractEntrustOrderService.java
deleted file mode 100644
index 2e27705..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/ContractEntrustOrderService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.contract.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitEntrustDto;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface ContractEntrustOrderService extends IService<ContractEntrustOrderEntity> {
-
- public Result addContractEntrustOrder(SubmitEntrustDto submitEntrustDto);
-
- public Result findEntrustOrderList(String symbol);
-
- public Result cancelEntrustOrder(Long id);
-
- public List<ContractEntrustOrderEntity> selectEntrustOrderListByIds( List<Long> list);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/ContractHoldOrderService.java b/src/main/java/com/xcong/excoin/modules/contract/service/ContractHoldOrderService.java
deleted file mode 100644
index eb2d903..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/ContractHoldOrderService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.xcong.excoin.modules.contract.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.*;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface ContractHoldOrderService extends IService<ContractHoldOrderEntity> {
-
- public Result submitOrder(SubmitOrderDto submitOrderDto);
-
- public int updateContractHoldOrderCanNotClosingByIds(List<OrderModel> list, String batchNo);
-
- public List<ContractHoldOrderEntity> selectContractHoldOrderByBatchNo(String batchNo);
-
- public void updateOrderIsCanClosingAndBatchNoById(Long id);
-
- public Result findHoldOrderList(String symbol);
-
- public Result cancelHoldOrder(Long id);
-
- public Result cancelHoldOrderBatch(SymbolDto symbolDto);
-
- public Result setTargetProfitOrLess(ProfitOrLessDto profitOrLessDto);
-
- public Result changeBond(ChangeBondDto changeBondDto);
-
- public Result findContractMoneyInfo(String symbol);
-
- public Result changeLeverRate(ChangeLeverRateDto changeLeverRateDto);
-
- public Result findHoldOrderDetailById(Long id);
-
- public Result findOrderList(OrderListDto orderListDto);
-
- public Result findOrderDetailById(Long id);
-
- public void calHoldOrderHoldFeeAmount();
-
- public void calHoldFeeAmountForBondAmount();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/ContractOrderService.java b/src/main/java/com/xcong/excoin/modules/contract/service/ContractOrderService.java
deleted file mode 100644
index 86cbb33..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/ContractOrderService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.xcong.excoin.modules.contract.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitOrderDto;
-
-/**
- * @author helius
- */
-public interface ContractOrderService extends IService<ContractOrderEntity> {
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/RabbitOrderService.java b/src/main/java/com/xcong/excoin/modules/contract/service/RabbitOrderService.java
deleted file mode 100644
index 670735f..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/RabbitOrderService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.xcong.excoin.modules.contract.service;
-
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface RabbitOrderService {
-
- public void cancelHoldOrder(List<Long> ids);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractEntrustOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractEntrustOrderServiceImpl.java
deleted file mode 100644
index cda4dcf..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractEntrustOrderServiceImpl.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package com.xcong.excoin.modules.contract.service.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.MemberWalletCoinEnum;
-import com.xcong.excoin.common.enumerates.RabbitPriceTypeEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.service.CommonService;
-import com.xcong.excoin.modules.contract.dao.ContractEntrustOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.mapper.ContractEntrustOrderEntityMapper;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitEntrustDto;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitOrderDto;
-import com.xcong.excoin.modules.contract.parameter.vo.ContractEntrustVo;
-import com.xcong.excoin.modules.contract.service.ContractEntrustOrderService;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import com.xcong.excoin.utils.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Slf4j
-@Service
-public class ContractEntrustOrderServiceImpl extends ServiceImpl<ContractEntrustOrderDao, ContractEntrustOrderEntity> implements ContractEntrustOrderService {
-
- @Resource
- private ContractEntrustOrderDao contractEntrustOrderDao;
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private CacheSettingUtils cacheSettingUtils;
-
- @Resource
- private ContractOrderDao contractOrderDao;
-
- @Resource
- private CommonService commonService;
-
- @Resource
- private OrderProducer producer;
-
- @Resource
- private ContractHoldOrderService contractHoldOrderService;
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public Result addContractEntrustOrder(SubmitEntrustDto submitEntrustDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(submitEntrustDto.getSymbol())));
-
- // 委托开仓
- if (submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_MORE || submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_LESS) {
- // 开多委托价不能大于当前价
- if (submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_MORE) {
- if (submitEntrustDto.getEntrustPrice().compareTo(newPrice) > -1) {
- SubmitOrderDto submitOrderDto = new SubmitOrderDto();
- submitOrderDto.setOrderType(submitEntrustDto.getEntrustType());
- submitOrderDto.setSymbol(submitEntrustDto.getSymbol());
- submitOrderDto.setSymbolCnt(submitEntrustDto.getSymbolCnt());
- submitOrderDto.setLeverRatio(submitEntrustDto.getLeverRatio());
- return contractHoldOrderService.submitOrder(submitOrderDto);
- }
- }
-
- // 开空委托价不能小于当前价
- if (submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_LESS) {
- if (submitEntrustDto.getEntrustPrice().compareTo(newPrice) < 1) {
- SubmitOrderDto submitOrderDto = new SubmitOrderDto();
- submitOrderDto.setOrderType(submitEntrustDto.getEntrustType());
- submitOrderDto.setSymbol(submitEntrustDto.getSymbol());
- submitOrderDto.setSymbolCnt(submitEntrustDto.getSymbolCnt());
- submitOrderDto.setLeverRatio(submitEntrustDto.getLeverRatio());
- return contractHoldOrderService.submitOrder(submitOrderDto);
- }
- }
-
- MemberWalletContractEntity walletContract = memberWalletContractDao.selectById(memberEntity.getId());
-
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(submitEntrustDto.getSymbol());
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
-
- // 保证金计算 -- 建仓价X规格X手数X(1/杠杆倍率)
- BigDecimal bondAmount = submitEntrustDto.getEntrustPrice().multiply(lotNumber).multiply(new BigDecimal(submitEntrustDto.getSymbolCnt())).multiply((BigDecimal.ONE.divide(BigDecimal.valueOf(submitEntrustDto.getLeverRatio()), 8, BigDecimal.ROUND_DOWN)));
-
- // 开仓手续费 建仓价*规格*手数*手续费率
- BigDecimal openFeePrice = submitEntrustDto.getEntrustPrice().multiply(lotNumber)
- .multiply(new BigDecimal(submitEntrustDto.getSymbolCnt()))
- .multiply(tradeSettingEntity.getFeeRatio().divide(new BigDecimal(100)))
- .setScale(8, BigDecimal.ROUND_DOWN);
- log.info("手续费:{}", openFeePrice);
-
- // 预付款
- BigDecimal entrustTotalAmount = bondAmount.add(openFeePrice).add(openFeePrice);
- log.info("预付款:{}", entrustTotalAmount);
-
- if (entrustTotalAmount.compareTo(walletContract.getAvailableBalance()) > -1) {
- return Result.fail(MessageSourceUtils.getString("member_service_0085"));
- }
-
- ContractEntrustOrderEntityMapper convert = ContractEntrustOrderEntityMapper.INSTANCE;
- ContractEntrustOrderEntity entrustOrderEntity = convert.submitEntrustDtoToEntity(submitEntrustDto);
- entrustOrderEntity.setOrderNo(commonService.generateOrderNo(memberEntity.getId()));
- entrustOrderEntity.setMemberId(memberEntity.getId());
- entrustOrderEntity.setBondAmount(bondAmount.add(openFeePrice));
- entrustOrderEntity.setSymbolSku(lotNumber);
- entrustOrderEntity.setEntrustAmount(entrustTotalAmount);
- // 暂默认逐仓
- entrustOrderEntity.setPositionType(ContractEntrustOrderEntity.POSITION_TYPE_ADD);
-
- int i = contractEntrustOrderDao.insert(entrustOrderEntity);
-
- memberWalletContractDao.increaseWalletContractBalanceById(entrustTotalAmount.negate(), null, entrustOrderEntity.getBondAmount(), walletContract.getId());
- if (i > 0) {
-
- // 发送委托单队列消息
- if (submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_MORE) {
- OrderModel model = new OrderModel(entrustOrderEntity.getId(), RabbitPriceTypeEnum.ENTRUST_OPEN_MORE.getValue(), submitEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), submitEntrustDto.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
-
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), entrustTotalAmount, walletContract.getAvailableBalance().subtract(entrustTotalAmount), submitEntrustDto.getSymbol(), "委托买涨", "买涨:" + submitEntrustDto.getSymbol());
- } else {
- OrderModel model = new OrderModel(entrustOrderEntity.getId(), RabbitPriceTypeEnum.ENTRUST_OPEN_LESS.getValue(), submitEntrustDto.getEntrustPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), submitEntrustDto.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
-
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), entrustTotalAmount, walletContract.getAvailableBalance().subtract(entrustTotalAmount), submitEntrustDto.getSymbol(), "委托买跌", "买跌:" + submitEntrustDto.getSymbol());
- }
-
- return Result.ok(MessageSourceUtils.getString("result_success_msg"));
- } else {
- return Result.fail(MessageSourceUtils.getString("result_fail_msg"));
- }
- }
-
- // 委托平仓 (全仓模式)
- if (submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_CLOSE_MORE || submitEntrustDto.getEntrustType() == ContractEntrustOrderEntity.ENTRUST_TYPE_CLOSE_LESS) {
- return Result.fail("功能暂未开放,敬请期待");
- }
-
- return Result.fail(MessageSourceUtils.getString("result_fail_msg"));
- }
-
- @Override
- public Result findEntrustOrderList(String symbol) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- List<ContractEntrustOrderEntity> list = contractEntrustOrderDao.selectEntrustOrderListByMemberIdAndSymbol(memberEntity.getId(), symbol);
- List<ContractEntrustVo> resultList = ContractEntrustOrderEntityMapper.INSTANCE.entityListToVoList(list);
- return Result.ok(resultList);
- }
-
- @Override
- @Transactional(rollbackFor = Exception.class)
- public Result cancelEntrustOrder(Long id) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- // 查询该委托单是否为该用户所有
- ContractEntrustOrderEntity entrustOrderEntity = contractEntrustOrderDao.selectEntrustOrderByIdAndMemberId(id, memberEntity.getId());
- if (entrustOrderEntity == null) {
- return Result.fail(MessageSourceUtils.getString("entrust_order_not_exist"));
- }
-
- MemberWalletContractEntity walletContractEntity = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), MemberWalletCoinEnum.WALLETCOINCODE.getValue());
-
- BigDecimal total = entrustOrderEntity.getEntrustAmount();
- memberWalletContractDao.increaseWalletContractBalanceById(total, null, entrustOrderEntity.getBondAmount().negate(), walletContractEntity.getId());
-
- ContractOrderEntity orderEntity = ContractEntrustOrderEntityMapper.INSTANCE.entrustOrderToOrder(entrustOrderEntity);
- orderEntity.setTradeType(ContractOrderEntity.TRADE_TYPE_MARK_PRICE);
- orderEntity.setOrderStatus(ContractOrderEntity.ORDER_STATUS_CANCEL);
- int i = contractOrderDao.insert(orderEntity);
-
- contractEntrustOrderDao.deleteById(entrustOrderEntity.getId());
-
- // 插入财务流水
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), total, walletContractEntity.getAvailableBalance().add(total), entrustOrderEntity.getSymbol(), "撤销委托单", "撤销委托单");
- if (i > 0) {
- return Result.ok(MessageSourceUtils.getString("cancellation_success"));
- }
- return Result.fail(MessageSourceUtils.getString("cancellation_fail"));
- }
-
- @Override
- public List<ContractEntrustOrderEntity> selectEntrustOrderListByIds(List<Long> list) {
- return contractEntrustOrderDao.selectEntrustOrderListByIds(list);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
deleted file mode 100644
index dcbb704..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractHoldOrderServiceImpl.java
+++ /dev/null
@@ -1,710 +0,0 @@
-package com.xcong.excoin.modules.contract.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import com.alibaba.druid.sql.visitor.functions.If;
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.enumerates.RabbitPriceTypeEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.service.CommonService;
-import com.xcong.excoin.modules.contract.dao.ContractEntrustOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper;
-import com.xcong.excoin.modules.contract.mapper.ContractOrderEntityMapper;
-import com.xcong.excoin.modules.contract.parameter.dto.*;
-import com.xcong.excoin.modules.contract.parameter.vo.*;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberLevelRateDao;
-import com.xcong.excoin.modules.member.dao.MemberSettingDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.*;
-import com.xcong.excoin.modules.platform.dao.TradeSettingDao;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import com.xcong.excoin.utils.*;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import jnr.a64asm.Mem;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import sun.rmi.runtime.Log;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Slf4j
-@Service
-public class ContractHoldOrderServiceImpl extends ServiceImpl<ContractHoldOrderDao, ContractHoldOrderEntity> implements ContractHoldOrderService {
-
- @Resource
- private ContractHoldOrderDao contractHoldOrderDao;
-
- @Resource
- private ContractOrderDao contractOrderDao;
-
- @Resource
- private ContractEntrustOrderDao contractEntrustOrderDao;
-
- @Resource
- private CommonService commonService;
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Resource
- private MemberLevelRateDao memberLevelRateDao;
-
- @Resource
- private CacheSettingUtils cacheSettingUtils;
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private OrderProducer producer;
-
- @Resource
- private MemberDao memberDao;
- @Resource
- private MemberSettingDao memberSettingDao;
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public Result submitOrder(SubmitOrderDto submitOrderDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(submitOrderDto.getSymbol())));
-
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name());
-
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
-
- MemberSettingEntity memberSetting = memberSettingDao.selectMemberSettingByMemberId(memberEntity.getId());
- BigDecimal spread = memberSetting.getSpread();
- // 规格
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(submitOrderDto.getSymbol());
-
- // 开仓价
- BigDecimal openingPrice = BigDecimal.ZERO;
-
- // 开多
- if (submitOrderDto.getOrderType() == ContractHoldOrderEntity.OPENING_TYPE_MORE) {
- // 市场价*(1 + (点差/10000))
- openingPrice = newPrice.multiply(BigDecimal.ONE.add(spread.divide(new BigDecimal(10000)))).setScale(8, BigDecimal.ROUND_DOWN);
-
- // 开空
- } else if (submitOrderDto.getOrderType() == ContractHoldOrderEntity.OPENING_TYPE_LESS) {
- // 市场价*(1 - (点差/10000))
- openingPrice = newPrice.multiply(BigDecimal.ONE.subtract(spread.divide(new BigDecimal(10000)))).setScale(8, BigDecimal.ROUND_DOWN);
- } else {
- return Result.fail("未知类型");
- }
-
- log.info("开仓价:{}", openingPrice);
- // 开仓手续费 建仓价*规格*手数*手续费率
- BigDecimal openFeePrice = openingPrice.multiply(lotNumber)
- .multiply(new BigDecimal(submitOrderDto.getSymbolCnt()))
- .multiply(tradeSettingEntity.getFeeRatio().divide(new BigDecimal(100)))
- .setScale(8, BigDecimal.ROUND_DOWN);
- log.info("开仓手续费:{}", openFeePrice);
-
- // 保证金 建仓价*规格*手数*(1/杠杆倍率)
- BigDecimal bondAmount = openingPrice.multiply(lotNumber).multiply(new BigDecimal(submitOrderDto.getSymbolCnt()))
- .multiply(BigDecimal.ONE.divide(new BigDecimal(submitOrderDto.getLeverRatio())))
- .setScale(8, BigDecimal.ROUND_DOWN);
- log.info("保证金:{}", bondAmount);
-
- // 预付款为 --> 保证金+开仓手续费+平仓手续费 (开仓平仓手续费相同)
- BigDecimal prePaymentAmount = bondAmount.add(openFeePrice).add(openFeePrice);
- log.info("预付款:{}", prePaymentAmount);
-
- if (prePaymentAmount.compareTo(walletContract.getAvailableBalance()) > -1) {
- return Result.fail("可用金额不足");
- }
-
- // 预估强平价
- BigDecimal forceClosingPrice = CalculateUtil.getForceSetPrice(bondAmount, openingPrice, submitOrderDto.getSymbolCnt(), lotNumber, submitOrderDto.getOrderType(), memberEntity);
- log.info("强平价:{}", forceClosingPrice);
-
- ContractHoldOrderEntity holdOrderEntity = new ContractHoldOrderEntity();
- holdOrderEntity.setMemberId(memberEntity.getId());
- holdOrderEntity.setOrderNo(commonService.generateOrderNo(memberEntity.getId()));
- holdOrderEntity.setPositionType(ContractEntrustOrderEntity.POSITION_TYPE_ADD);
- holdOrderEntity.setTradeType(ContractHoldOrderEntity.TRADE_TYPE_MARK);
- holdOrderEntity.setSymbol(submitOrderDto.getSymbol());
- holdOrderEntity.setSymbolCnt(submitOrderDto.getSymbolCnt());
- holdOrderEntity.setSymbolSku(lotNumber);
- holdOrderEntity.setLeverRatio(submitOrderDto.getLeverRatio());
- holdOrderEntity.setForceClosingPrice(forceClosingPrice);
- holdOrderEntity.setOpeningFeeAmount(openFeePrice);
- holdOrderEntity.setOpeningPrice(openingPrice);
- holdOrderEntity.setOpeningType(submitOrderDto.getOrderType());
- holdOrderEntity.setMarkPrice(newPrice);
- holdOrderEntity.setIsCanClosing(ContractHoldOrderEntity.ORDER_CAN_CLOSING_Y);
- holdOrderEntity.setPrePaymentAmount(prePaymentAmount);
- holdOrderEntity.setBondAmount(bondAmount.add(openFeePrice));
- holdOrderEntity.setOperateNo(1);
-
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity);
- contractOrderEntity.setOpeningTime(new Date());
- contractHoldOrderDao.insert(holdOrderEntity);
- int i = contractOrderDao.insert(contractOrderEntity);
-
- if (i > 0) {
- memberWalletContractDao.increaseWalletContractBalanceById(prePaymentAmount.negate(), openFeePrice.negate(), null, walletContract.getId());
-
- // 发送爆仓消息
- sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), forceClosingPrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo());
-
- // 计算佣金
- ThreadPoolUtils.calReturnMoney(memberEntity.getId(), contractOrderEntity.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_OPEN);
-
- // 插入财务流水
- if (submitOrderDto.getOrderType() == ContractHoldOrderEntity.OPENING_TYPE_MORE) {
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), prePaymentAmount, walletContract.getAvailableBalance().subtract(prePaymentAmount), submitOrderDto.getSymbol(), "买涨持仓", "买涨:" + submitOrderDto.getSymbol());
- } else {
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), prePaymentAmount, walletContract.getAvailableBalance().subtract(prePaymentAmount), submitOrderDto.getSymbol(), "买跌持仓", "买跌:" + submitOrderDto.getSymbol());
- }
- return Result.ok("提交成功");
- }
- return Result.fail("提交失败");
- }
-
- @Override
- public int updateContractHoldOrderCanNotClosingByIds(List<OrderModel> list, String batchNo) {
- return contractHoldOrderDao.updateContractHoldOrderCanNotClosingByIds(list, batchNo);
- }
-
- @Override
- public List<ContractHoldOrderEntity> selectContractHoldOrderByBatchNo(String batchNo) {
- return contractHoldOrderDao.selectContractHoldOrderByBatchNo(batchNo);
- }
-
- @Override
- public void updateOrderIsCanClosingAndBatchNoById(Long id) {
- contractHoldOrderDao.updateOrderIsCanClosingAndBatchNoById(id);
- }
-
- @Override
- public Result findHoldOrderList(String symbol) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- List<ContractHoldOrderEntity> list = contractHoldOrderDao.selectHoldOrderListByMemberIdAndSymbol(memberEntity.getId(), symbol);
- MemberWalletContractEntity walletContractEntity = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name());
- if (CollUtil.isNotEmpty(list)) {
- BigDecimal totalProfitOrLoss = BigDecimal.ZERO;
- List<HoldOrderListVo> resultList = new ArrayList<>();
- for (ContractHoldOrderEntity holdOrderEntity : list) {
- HoldOrderListVo holdOrderListVo = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToDto(holdOrderEntity);
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol());
- // 盈亏
- BigDecimal rewardRatio = BigDecimal.ZERO;
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- // (最新价-开仓价)*规格*张数
- rewardRatio = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(lotNumber).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- // 开空
- } else {
- // (开仓价-最新价)*规格*张数
- rewardRatio = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(lotNumber).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- }
-
- if (memberEntity.getIsProfit() == MemberEntity.IS_PROFIT_Y) {
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
- if (rewardRatio.compareTo(BigDecimal.ZERO) > -1) {
- rewardRatio = rewardRatio.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam()));
- } else {
-// rewardRatio = rewardRatio.multiply(BigDecimal.ONE.add(tradeSettingEntity.getProfitParam()));
- }
- }
-
- // 回报率
- BigDecimal returnRate = rewardRatio.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN);
-
- // 成本价格
- BigDecimal costPrice = holdOrderEntity.getOpeningPrice()
- .multiply(lotNumber)
- .multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()))
- .divide(new BigDecimal(holdOrderEntity.getLeverRatio()), 8, BigDecimal.ROUND_DOWN);
-
- // 可增加最大保证金
-// BigDecimal canAddMaxBond = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()).subtract(costPrice);
-// if (canAddMaxBond.compareTo(BigDecimal.ZERO) < 0) {
-// canAddMaxBond = BigDecimal.ZERO;
-// }
- BigDecimal canReduceMaxBond = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getPrePaymentAmount());
-
- if (rewardRatio.compareTo(BigDecimal.ZERO) < 0) {
- canReduceMaxBond = canReduceMaxBond.add(rewardRatio);
- }
-
- if (canReduceMaxBond.compareTo(BigDecimal.ZERO) < 0) {
- canReduceMaxBond = BigDecimal.ZERO;
- }
-
- holdOrderListVo.setCanReduceMaxBond(canReduceMaxBond);
- holdOrderListVo.setCanAddMaxBond(walletContractEntity.getAvailableBalance());
- holdOrderListVo.setReturnRate(returnRate);
- holdOrderListVo.setProfitOrLoss(rewardRatio);
- resultList.add(holdOrderListVo);
- totalProfitOrLoss = totalProfitOrLoss.add(rewardRatio);
- }
-
- Map<String, Object> result = new HashMap<>();
- result.put("hold", resultList);
- result.put("totalProfitOrLoss", totalProfitOrLoss.setScale(4, BigDecimal.ROUND_DOWN).toPlainString());
- return Result.ok(result);
- }
- return Result.ok("success");
- }
-
- @Override
- public Result cancelHoldOrder(Long id) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectHoldOrderByMemberIdAndId(memberEntity.getId(), id);
- if (holdOrderEntity == null) {
- return Result.fail("订单不存在");
- }
-
- if (ContractHoldOrderEntity.ORDER_CAN_CLOSING_N == holdOrderEntity.getIsCanClosing()) {
- return Result.fail("订单暂不可平仓");
- }
-
- contractHoldOrderDao.updateHoldOrderIsCanClosingById(ContractHoldOrderEntity.ORDER_CAN_CLOSING_N, id);
- // 发送平仓消息
- List<Long> ids = new ArrayList<>();
- ids.add(id);
- producer.sendCloseTrade(JSONObject.toJSONString(ids));
-
- return Result.ok("平仓成功");
- }
-
- @Override
- public Result cancelHoldOrderBatch(SymbolDto symbolDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectHoldOrderListByMemberIdAndSymbol(memberEntity.getId(), symbolDto.getSymbol());
- if (CollUtil.isEmpty(holdOrderEntities)) {
- return Result.fail("订单不存在");
- }
-
- List<Long> ids = new ArrayList<>();
- for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
- contractHoldOrderDao.updateHoldOrderIsCanClosingById(ContractHoldOrderEntity.ORDER_CAN_CLOSING_N, holdOrderEntity.getId());
- ids.add(holdOrderEntity.getId());
- }
- producer.sendCloseTrade(JSONObject.toJSONString(ids));
- return Result.ok("平仓成功");
- }
-
- @Override
- public Result setTargetProfitOrLess(ProfitOrLessDto profitOrLessDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectHoldOrderByMemberIdAndId(memberEntity.getId(), profitOrLessDto.getId());
- if (holdOrderEntity == null) {
- return Result.fail("订单不存在");
- }
-
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
- // 开仓价
- BigDecimal openPrice = holdOrderEntity.getOpeningPrice();
- // 设置的止盈止损价
- BigDecimal stopProfitPrice = profitOrLessDto.getStopProfitPrice();
-
- BigDecimal stopLessPrice = profitOrLessDto.getStopLessPrice();
-
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- if (stopProfitPrice != null) {
- // 当前价大于开仓价
- if (newPrice.compareTo(openPrice) > 0) {
- // 如果止盈价小于当前价
- if (stopProfitPrice.compareTo(newPrice) < 0) {
- return Result.fail("止盈价必须高于当前价");
- }
- } else {
- if (stopProfitPrice.compareTo(openPrice) < 0) {
- return Result.fail("止盈价必须高于开仓价");
- }
- }
- }
-
- if (stopLessPrice != null) {
- if (newPrice.compareTo(openPrice) > 0) {
- if (stopLessPrice.compareTo(openPrice) > 0) {
- return Result.fail("止损价必须低于开仓价");
- }
- } else {
- if (stopLessPrice.compareTo(newPrice) > 0) {
- return Result.fail("止损价必须低于当前价");
- }
- }
- }
- // 开空
- } else {
- if (stopProfitPrice != null) {
- if (newPrice.compareTo(openPrice) > 0) {
- if (stopProfitPrice.compareTo(openPrice) > 0) {
- return Result.fail("止盈价必须低于开仓价");
- }
- } else {
- if (stopProfitPrice.compareTo(newPrice) > 0) {
- return Result.fail("止盈价必须低于当前价");
- }
- }
- }
- if (stopLessPrice != null) {
- if (newPrice.compareTo(openPrice) > 0) {
- if (stopLessPrice.compareTo(newPrice) < 0) {
- return Result.fail("止损价必须高于当前价");
- }
- } else {
- if (stopLessPrice.compareTo(openPrice) < 0) {
- return Result.fail("止损价必须高于开仓价");
- }
- }
- }
- }
-
- holdOrderEntity.setStopProfitPrice(stopProfitPrice);
- holdOrderEntity.setStopLossPrice(stopLessPrice);
-
- int i = contractHoldOrderDao.updateById(holdOrderEntity);
- if (i > 0) {
- OrderModel model = null;
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- // 开多止盈
- if (stopProfitPrice != null) {
- model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.CLOSE_MORE_STOP_PROFIT.getValue(), stopProfitPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 开多止损
- if (stopLessPrice != null) {
- model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.CLOSE_MORE_STOP_LESS.getValue(), stopLessPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- } else {
- // 开空止盈
- if (stopProfitPrice != null) {
- model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.CLOSE_LESS_STOP_PROFIT.getValue(), stopProfitPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 开空止损
- if (stopLessPrice != null) {
- model = new OrderModel(holdOrderEntity.getId(), RabbitPriceTypeEnum.CLOSE_LESS_STOP_LESS.getValue(), stopLessPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), holdOrderEntity.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- }
- return Result.ok("设置成功");
- }
- return Result.fail("设置失败");
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public Result changeBond(ChangeBondDto changeBondDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectHoldOrderByMemberIdAndId(memberEntity.getId(), changeBondDto.getId());
- if (holdOrderEntity == null) {
- return Result.fail("订单不存在");
- }
-
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name());
-
- // 增加保证金
- if (ChangeBondDto.TYPE_ADD == changeBondDto.getType()) {
- if (changeBondDto.getAmount().compareTo(walletContract.getAvailableBalance()) > 0) {
- return Result.fail("可用余额不足");
- }
- memberWalletContractDao.increaseWalletContractBalanceById(changeBondDto.getAmount().negate(), null, null, walletContract.getId());
- holdOrderEntity.setBondAmount(holdOrderEntity.getBondAmount().add(changeBondDto.getAmount()));
- // 减少保证金
- } else {
- if (holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getPrePaymentAmount()).subtract(changeBondDto.getAmount()).compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail("超出保证金最大减少金额");
- }
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
-
- BigDecimal rewardRatio = BigDecimal.ZERO;
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- // (最新价-开仓价)*规格*张数
- rewardRatio = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(holdOrderEntity.getSymbolSku()).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- // 开空
- } else {
- // (开仓价-最新价)*规格*张数
- rewardRatio = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(holdOrderEntity.getSymbolSku()).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- }
-
- if (memberEntity.getIsProfit() == MemberEntity.IS_PROFIT_Y) {
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
- if (rewardRatio.compareTo(BigDecimal.ZERO) > -1) {
- rewardRatio = rewardRatio.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam()));
- }
- }
-
- if (rewardRatio.compareTo(BigDecimal.ZERO) < 0) {
- BigDecimal canReduceMax = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getPrePaymentAmount()).add(rewardRatio);
- if (canReduceMax.subtract(changeBondDto.getAmount()).compareTo(BigDecimal.ZERO) < 0) {
- return Result.fail("超出保证金最大减少金额");
- }
- }
-
- memberWalletContractDao.increaseWalletContractBalanceById(changeBondDto.getAmount(), null, null, walletContract.getId());
- holdOrderEntity.setBondAmount(holdOrderEntity.getBondAmount().subtract(changeBondDto.getAmount()));
- }
-
- BigDecimal forceClosingPrice = CalculateUtil.getForceSetPrice(holdOrderEntity.getBondAmount(), holdOrderEntity.getOpeningPrice(), holdOrderEntity.getSymbolCnt(), holdOrderEntity.getSymbolSku(), holdOrderEntity.getOpeningType(), memberEntity);
- holdOrderEntity.setForceClosingPrice(forceClosingPrice);
- holdOrderEntity.setOperateNo(holdOrderEntity.getOperateNo() + 1);
-
- int i = contractHoldOrderDao.updateById(holdOrderEntity);
-
- if (i > 0) {
- // 发送爆仓消息
- sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), forceClosingPrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo());
- return Result.ok("调整成功");
- }
- return Result.fail("调整失败");
- }
-
- @Override
- public Result findContractMoneyInfo(String symbol) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- BigDecimal newPriceSymbol = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol)));
-
- // 当前合约委托单
- List<ContractEntrustOrderEntity> entrustOrderEntities = contractEntrustOrderDao.selectEntrustOrderListByMemberId(memberEntity.getId());
-
- // 当前持仓列表
- List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectHoldOrderListByMemberId(memberEntity.getId());
-
- // 冻结保证金 -- 即委托单中的保证金之和
- BigDecimal frozenBondAmount = BigDecimal.ZERO;
- if (CollUtil.isNotEmpty(entrustOrderEntities)) {
- for (ContractEntrustOrderEntity entrustOrderEntity : entrustOrderEntities) {
- frozenBondAmount = frozenBondAmount.add(entrustOrderEntity.getBondAmount());
- }
- }
-
- // 占用保证金 -- 即持仓单中的保证金之和
- BigDecimal beUsedBondAmount = BigDecimal.ZERO;
- // 总盈利
- BigDecimal totalProfitOrLess = BigDecimal.ZERO;
- if (CollUtil.isNotEmpty(holdOrderEntities)) {
- for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol());
- beUsedBondAmount = beUsedBondAmount.add(holdOrderEntity.getBondAmount());
-
- // 单个订单盈利
- BigDecimal profitOrLess = BigDecimal.ZERO;
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- profitOrLess = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt())).multiply(lotNumber);
- // 开空
- } else {
- profitOrLess = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt())).multiply(lotNumber);
- }
-
- if (MemberEntity.IS_PROFIT_Y == memberEntity.getIsProfit()) {
- if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) {
- profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam()));
- } else {
- profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam()));
- }
- }
-
- totalProfitOrLess = totalProfitOrLess.add(profitOrLess);
- }
- }
-
- MemberWalletContractEntity walletContractEntity = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name());
-
- MemberLevelRateEntity rateEntity = memberLevelRateDao.selectLeverRateByMemberIdAndSymbol(memberEntity.getId(), symbol);
-
- // 权益
- BigDecimal equity = walletContractEntity.getTotalBalance().add(totalProfitOrLess);
-
- ContractMoneyInfoVo contractMoneyInfoVo = new ContractMoneyInfoVo();
- contractMoneyInfoVo.setAvailableBalance(walletContractEntity.getAvailableBalance());
- contractMoneyInfoVo.setBeUsedBondAmount(beUsedBondAmount);
- contractMoneyInfoVo.setFrozenBondAmount(frozenBondAmount);
- contractMoneyInfoVo.setEquity(equity);
- contractMoneyInfoVo.setFeeRatio(tradeSetting.getFeeRatio());
- contractMoneyInfoVo.setLeverAgeRatio(tradeSetting.getLeverageRatio());
- contractMoneyInfoVo.setNewPrice(newPriceSymbol);
- contractMoneyInfoVo.setSymbolSku(cacheSettingUtils.getSymbolSku(symbol));
- contractMoneyInfoVo.setLeverRate(rateEntity.getLevelRateUp());
- return Result.ok(contractMoneyInfoVo);
- }
-
- @Override
- public Result changeLeverRate(ChangeLeverRateDto changeLeverRateDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- MemberLevelRateEntity levelRateEntity = memberLevelRateDao.selectLeverRateByMemberIdAndSymbol(memberEntity.getId(), changeLeverRateDto.getSymbol());
- levelRateEntity.setLevelRateUp(changeLeverRateDto.getLeverRate());
- levelRateEntity.setLevelRateDown(changeLeverRateDto.getLeverRate());
- int i = memberLevelRateDao.updateById(levelRateEntity);
- if (i > 0) {
- return Result.ok("调整成功");
- }
- return Result.fail("调整失败");
- }
-
- @Override
- public Result findHoldOrderDetailById(Long id) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectHoldOrderByMemberIdAndId(memberEntity.getId(), id);
- if (holdOrderEntity == null) {
- return Result.fail("订单不存在");
- }
-
- HoldOrderDetailVo holdOrderDetailVo = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrderDetailVo(holdOrderEntity);
- BigDecimal feeSpread = cacheSettingUtils.getTradeSetting().getFeeSpreadRatio();
-// holdOrderDetailVo.setOpeningFeeAmount(holdOrderDetailVo.getOpeningFeeAmount().multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN));
- holdOrderDetailVo.setOpeningFeeAmount(holdOrderEntity.getOpeningFeeAmount(), feeSpread);
- return Result.ok(holdOrderDetailVo);
- }
-
- @Override
- public Result findOrderList(OrderListDto orderListDto) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- Page<ContractOrderEntity> page = new Page<>(orderListDto.getPageNum(), orderListDto.getPageSize());
- ContractOrderEntity contractOrderEntity = new ContractOrderEntity();
- contractOrderEntity.setMemberId(memberEntity.getId());
- contractOrderEntity.setSymbol(orderListDto.getSymbol());
- IPage<ContractOrderEntity> list = contractOrderDao.selectContractOrderInPage(page, contractOrderEntity);
- Page<OrderListVo> result = ContractOrderEntityMapper.INSTANCE.pageEntityToPageVo(list);
- return Result.ok(result);
- }
-
- @Override
- public Result findOrderDetailById(Long id) {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
- ContractOrderEntity contractOrderEntity = contractOrderDao.selectOrderDetailByIdAndMemberId(id, memberEntity.getId());
- if (contractOrderEntity == null) {
- return Result.fail("订单不存在");
- }
-
- OrderDetailVo orderDetailVo = ContractOrderEntityMapper.INSTANCE.entityToDetailVo(contractOrderEntity);
- BigDecimal feeSpread = cacheSettingUtils.getTradeSetting().getFeeSpreadRatio();
-// orderDetailVo.setClosingFeeAmount(orderDetailVo.getClosingFeeAmount() == null ? orderDetailVo.getClosingFeeAmount() : orderDetailVo.getClosingFeeAmount().multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN));
-// orderDetailVo.setOpeningFeeAmount(orderDetailVo.getOpeningFeeAmount() == null ? orderDetailVo.getOpeningFeeAmount() : orderDetailVo.getOpeningFeeAmount().multiply(feeSpread).setScale(8, BigDecimal.ROUND_DOWN));
- orderDetailVo.setOpeningFeeAmount(contractOrderEntity.getOpeningFeeAmount(), feeSpread);
- orderDetailVo.setClosingFeeAmount(contractOrderEntity.getClosingFeeAmount(), feeSpread);
- return Result.ok(orderDetailVo);
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void calHoldOrderHoldFeeAmount() {
- List<ContractHoldOrderEntity> list = contractHoldOrderDao.selectAllHoldOrder();
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
-
- if (CollUtil.isNotEmpty(list)) {
- for (ContractHoldOrderEntity holdOrderEntity : list) {
- BigDecimal holdAmount = holdOrderEntity.getHoldAmount();
- if (holdAmount == null) {
- holdAmount = BigDecimal.ZERO;
- }
-
- BigDecimal thisTimeHold = holdOrderEntity.getBondAmount().multiply(tradeSettingEntity.getDoingRatio());
- log.info("订单编号:{}, 持仓费:{}", holdOrderEntity.getOrderNo(), thisTimeHold);
- MemberWalletContractEntity walletContractEntity = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(holdOrderEntity.getMemberId(), CoinTypeEnum.USDT.name());
-
- // 判断当前可用余额是否大于目前持仓费,若大于则扣可用余额,若小于则扣保证金中的金额
- if (thisTimeHold.compareTo(walletContractEntity.getAvailableBalance()) < 0) {
- memberWalletContractDao.increaseWalletContractBalanceById(thisTimeHold.negate(), thisTimeHold.negate(), null, walletContractEntity.getId());
-
- holdOrderEntity.setHoldAmount(holdAmount.add(thisTimeHold));
- contractHoldOrderDao.updateById(holdOrderEntity);
- } else {
- BigDecimal available = walletContractEntity.getAvailableBalance();
- BigDecimal lessAmount = thisTimeHold.subtract(available);
- MemberEntity memberEntity = memberDao.selectById(holdOrderEntity.getMemberId());
- memberWalletContractDao.increaseWalletContractBalanceById(available.negate(), available.negate(), null, walletContractEntity.getId());
-
- BigDecimal newBondAmount = holdOrderEntity.getBondAmount().subtract(lessAmount);
-
- BigDecimal newForcePrice = CalculateUtil.getForceSetPrice(newBondAmount.subtract(holdOrderEntity.getOpeningFeeAmount()), holdOrderEntity.getOpeningPrice(), holdOrderEntity.getSymbolCnt(), holdOrderEntity.getSymbolSku(), holdOrderEntity.getOpeningType(), memberEntity);
-
- holdOrderEntity.setHoldAmount(holdAmount.add(thisTimeHold));
- holdOrderEntity.setBondAmount(newBondAmount);
- holdOrderEntity.setForceClosingPrice(newForcePrice);
- holdOrderEntity.setOperateNo(holdOrderEntity.getOperateNo() + 1);
- contractHoldOrderDao.updateById(holdOrderEntity);
-
- // 发送爆仓消息
- sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), newForcePrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo());
- }
- }
- }
- }
-
- public void sendOrderBombMsg(Long id, int type, BigDecimal forceClosingPrice, String symbol, int operateNo) {
- OrderModel model = null;
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == type) {
- model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_MORE_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo);
- // 开空
- } else {
- model = new OrderModel(id, RabbitPriceTypeEnum.CLOSE_LESS_BOMB.getValue(), forceClosingPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(), symbol, operateNo);
- }
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void calHoldFeeAmountForBondAmount() {
- List<ContractHoldOrderEntity> list = contractHoldOrderDao.selectAllHoldOrder();
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
-
- if (CollUtil.isNotEmpty(list)) {
- for (ContractHoldOrderEntity holdOrderEntity : list) {
- BigDecimal holdAmount = holdOrderEntity.getHoldAmount();
- if (holdAmount == null) {
- holdAmount = BigDecimal.ZERO;
- }
-
- BigDecimal thisTimeHold = holdOrderEntity.getBondAmount().multiply(tradeSettingEntity.getDoingRatio());
- log.info("订单编号:{}, 持仓费:{}", holdOrderEntity.getOrderNo(), thisTimeHold);
-
- MemberEntity memberEntity = memberDao.selectById(holdOrderEntity.getMemberId());
- BigDecimal subBond = holdOrderEntity.getBondAmount().subtract(thisTimeHold);
-
- BigDecimal newForcePrice = CalculateUtil.getForceSetPrice(subBond.subtract(holdOrderEntity.getOpeningFeeAmount()), holdOrderEntity.getOpeningPrice(), holdOrderEntity.getSymbolCnt(), holdOrderEntity.getSymbolSku(), holdOrderEntity.getOpeningType(), memberEntity);
- holdAmount = holdAmount.add(thisTimeHold);
- holdOrderEntity.setBondAmount(subBond);
- holdOrderEntity.setHoldAmount(holdAmount);
- holdOrderEntity.setForceClosingPrice(newForcePrice);
- holdOrderEntity.setOperateNo(holdOrderEntity.getOperateNo() + 1);
- contractHoldOrderDao.updateById(holdOrderEntity);
-
- // 发送爆仓消息
- sendOrderBombMsg(holdOrderEntity.getId(), holdOrderEntity.getOpeningType(), newForcePrice, holdOrderEntity.getSymbol(), holdOrderEntity.getOperateNo());
- }
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractOrderServiceImpl.java
deleted file mode 100644
index 9fdc086..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/ContractOrderServiceImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.contract.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.parameter.dto.SubmitOrderDto;
-import com.xcong.excoin.modules.contract.service.ContractOrderService;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.RedisUtils;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-27
- **/
-@Service
-public class ContractOrderServiceImpl extends ServiceImpl<ContractOrderDao, ContractOrderEntity> implements ContractOrderService {
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java
deleted file mode 100644
index 93b135e..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/OrderWebsocketServiceImpl.java
+++ /dev/null
@@ -1,759 +0,0 @@
-package com.xcong.excoin.modules.contract.service.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.modules.coin.dao.MemberAccountFlowEntityDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountFlowEntity;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.mapper.ContractEntrustOrderEntityMapper;
-import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper;
-import com.xcong.excoin.modules.contract.service.ContractEntrustOrderService;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.contract.service.ContractOrderService;
-import com.xcong.excoin.modules.member.dao.AgentReturnDao;
-import com.xcong.excoin.modules.member.dao.MemberSettingDao;
-import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.member.parameter.vo.NeedMoneyMemberVo;
-import com.xcong.excoin.modules.member.service.MemberService;
-import com.xcong.excoin.modules.member.service.MemberWalletContractService;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import com.xcong.excoin.utils.CacheSettingUtils;
-import com.xcong.excoin.utils.CalculateUtil;
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.*;
-
-/**
- * @author helius
- */
-@Slf4j
-@Service
-public class OrderWebsocketServiceImpl {
-
- @Resource
- ContractHoldOrderService contractHoldOrderService;
-
- @Resource
- ContractOrderService contractOrderService;
-
- @Resource
- ContractEntrustOrderService contractEntrustOrderService;
-
- @Resource
- MemberWalletContractService memberWalletContractService;
-
- @Resource
- CacheSettingUtils cacheSettingUtils;
-
- @Resource
- OrderProducer producer;
-
- @Resource
- MemberService memberService;
-
- @Resource
- private AgentReturnDao agentReturnDao;
-
- @Resource
- private MemberAccountFlowEntityDao memberAccountFlowEntityDao;
- @Resource
- private MemberSettingDao memberSettingDao;
-
-
- public void dealOrderFromMq(List<OrderModel> list, Integer type) {
- if (CollectionUtils.isNotEmpty(list)) {
- String batchno = UUID.randomUUID().toString();
- // 更新订单状态
- // 更新为不可平仓状态
- int count = contractHoldOrderService.updateContractHoldOrderCanNotClosingByIds(list, batchno);
- // 查询
- if (count > 0) {
- // 查询
- List<ContractHoldOrderEntity> coinsCoinsOrders = contractHoldOrderService.selectContractHoldOrderByBatchNo(batchno);
- // 根据状态调用不同的方法
- // 1:买入委托2:开多3:开空4:平多5:平空6:爆仓平多7:爆仓平空8:撤单9:止盈平多10:止盈平空11:止损平多12:止损平空
- // 6在这里是爆仓 包括爆空和暴多
- switch (type) {
- case 6:
- this.dealCoinOut(coinsCoinsOrders, list);
- break;
- case 9:
- this.dealForMoreStopPro(coinsCoinsOrders, list);
- break;
- case 10:
- this.dealForLessStopPro(coinsCoinsOrders, list);
- break;
- case 11:
- this.dealForMoreLoss(coinsCoinsOrders, list);
- break;
- case 12:
- this.dealForLessLoss(coinsCoinsOrders, list);
- break;
- default:
- break;
- }
-
- }
-
-
- }
- }
-
- public void dealForLimitMq(List<OrderModel> list) {
- if (CollectionUtils.isNotEmpty(list)) {
- //查询限价委托的单
- String batchno = UUID.randomUUID().toString();
- List<Long> ids = new ArrayList<>();
- list.forEach(model -> ids.add(model.getOrderId()));
- List<ContractEntrustOrderEntity> contractEntrustOrderEntities = contractEntrustOrderService.selectEntrustOrderListByIds(ids);
-
- if (CollectionUtils.isNotEmpty(contractEntrustOrderEntities)) {
- this.dealLimitBuyOrder(contractEntrustOrderEntities);
- }
-
- }
- }
-
- /**
- * 开多止盈
- */
- @Transactional(rollbackFor = Exception.class)
- public void dealForMoreStopPro(List<ContractHoldOrderEntity> orderList, List<OrderModel> list) {
- if (CollectionUtils.isNotEmpty(orderList)) {
- Map<Long, BigDecimal> modelMap = new HashMap<Long, BigDecimal>();
- for (OrderModel model : list) {
- modelMap.put(model.getOrderId(), new BigDecimal(model.getPrice()));
- }
- for (ContractHoldOrderEntity order : orderList) {
- Long orderId = order.getId();
- System.out.println("开多止盈订单号:" + order.getOrderNo());
- System.out.println("传来的止盈价格:" + modelMap.get(order.getId()));
- if (null != order.getStopProfitPrice()) {
- BigDecimal closePrice = order.getStopProfitPrice();
- BigDecimal queuePrice = modelMap.get(order.getId());
- System.out.println("订单的止盈价格:" + closePrice);
- // 判断 保留七位是为了忽略以为小数 防止不精确导致的不相等
- if (queuePrice.compareTo(closePrice) != 0) {
-
- // 不能止盈
- System.out.println("数据库价格:" + queuePrice.toPlainString() + "--价格不能止盈:" + closePrice);
- //更新数据
- contractHoldOrderService.updateOrderIsCanClosingAndBatchNoById(orderId);
- continue;
- }
- System.out.println("执行操作");
- // 止盈价
- String symbol = order.getSymbol();
- // 本次需要退回的保证金
- BigDecimal prePrice = order.getBondAmount();
- Long memberId = order.getMemberId();
- MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memberId, "USDT");
- if (wallet != null) {
- // 历史订单
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(order);
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setId(null);
-
- // 本次平仓数量
- int currentFlat = order.getSymbolCnt();
- BigDecimal symbolSku = cacheSettingUtils.getSymbolSku(order.getSymbol());
- // 盈亏额度= (当前的币种的平仓价-下单时的建仓价)*购买的手数/规格*倍率
- BigDecimal profitLossPrice = (closePrice
- .subtract(order.getOpeningPrice()))
- .multiply(new BigDecimal(currentFlat))
- .multiply(symbolSku).setScale(8, BigDecimal.ROUND_DOWN);
- MemberEntity memberEntity = memberService.getById(memberId);
- MemberSettingEntity memberSettingEntity = memberSettingDao.selectMemberSettingByMemberId(memberId);
- log.info("划点前:{}", profitLossPrice);
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(memberSettingEntity.getClosingSpread().divide(BigDecimal.valueOf(100), 4, BigDecimal.ROUND_DOWN)));
- log.info("划点后:{}", profitLossPrice);
- if (memberEntity.getIsProfit() == 1) {
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- if (profitLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(tradeSetting.getProfitParam()));
- } else {
-// profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.add(tradeSetting.getProfitParam()));
- }
- }
- //回报率
- BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
- contractOrderEntity.setRewardAmount(profitLossPrice);
- contractOrderEntity.setRewardRatio(returnRate);
- contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
- contractOrderEntity.setClosingPrice(closePrice);
- contractOrderEntity.setClosingType(6);
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_MORE);
- BigDecimal totalReturn = BigDecimal.ZERO;
- contractOrderService.save(contractOrderEntity);
-
- contractHoldOrderService.removeById(order.getId());
- // 将需要退回的减去手续费
- BigDecimal needReturn = prePrice.add(profitLossPrice);
- //总退回金额=保证金+收益-手续费
- totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
- // 总的是收益-平仓手续费
- BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
-
- memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
-
- // 流水记录 TODO 531e
- insertAccountFlow(order, wallet, profitLossPrice, "止盈平仓");
-
- //返佣
- ThreadPoolUtils.calReturnMoney(order.getMemberId(), order.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE);
- }
- }
- }
- }
-
- }
-
- /**
- * 开空止盈
- */
- public void dealForLessStopPro(List<ContractHoldOrderEntity> orderList, List<OrderModel> list) {
- //List<CoinsCoinsOrder> orderList = orderMapper.selectOrderByBatchNo(batchno);
- //System.out.println("开空止盈订单batchno:" + batchno);
- if (CollectionUtils.isNotEmpty(orderList)) {
- Map<Long, BigDecimal> modelMap = new HashMap<Long, BigDecimal>();
- for (OrderModel model : list) {
- modelMap.put(model.getOrderId(), new BigDecimal(model.getPrice()));
- }
- for (ContractHoldOrderEntity order : orderList) {
- System.out.println("开空止盈订单号:" + order.getOrderNo());
- System.out.println("传来的止盈价格:" + modelMap.get(order.getId()).toPlainString());
- BigDecimal closePrice = order.getStopProfitPrice();
- Long orderId = order.getId();
- if (null != closePrice) {
-
- // 止盈价
- System.out.println("订单的止盈价格:" + closePrice);
- System.out.println(closePrice.compareTo(modelMap.get(order.getId())));
- BigDecimal queuePrice = modelMap.get(order.getId()).setScale(7, RoundingMode.HALF_UP);
- if (closePrice.compareTo(queuePrice) != 0) {
- System.out.println("数据库价格:" + queuePrice.toPlainString() + "--价格不能开空止盈:" + closePrice);
- contractHoldOrderService.updateOrderIsCanClosingAndBatchNoById(orderId);
- continue;
- }
- System.out.println("执行操作");
- String symbol = order.getSymbol();
- // 本次需要退回的预付款
- BigDecimal prePrice = order.getBondAmount();
- Long memberId = order.getMemberId();
- MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memberId, "USDT");
- if (wallet != null) {
- // 历史订单
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(order);
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setId(null);
-
- // 本次平仓数量
- int currentFlat = order.getSymbolCnt();
- BigDecimal symbolSku = cacheSettingUtils.getSymbolSku(order.getSymbol());
- // 盈亏额度= (当前的币种的平仓价-下单时的建仓价)*购买的手数/规格*倍率
- BigDecimal profitLossPrice = (order.getOpeningPrice()
- .subtract(closePrice))
- .multiply(new BigDecimal(currentFlat + ""))
- .multiply(symbolSku).setScale(8, BigDecimal.ROUND_DOWN);
- MemberEntity memberEntity = memberService.getById(memberId);
- MemberSettingEntity memberSettingEntity = memberSettingDao.selectMemberSettingByMemberId(memberId);
- log.info("划点前:{}", profitLossPrice);
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(memberSettingEntity.getClosingSpread().divide(BigDecimal.valueOf(100), 4, BigDecimal.ROUND_DOWN)));
- log.info("划点后:{}", profitLossPrice);
- if (memberEntity.getIsProfit() == 1) {
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- if (profitLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(tradeSetting.getProfitParam()));
- } else {
-// profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.add(tradeSetting.getProfitParam()));
- }
- }
- //回报率
- BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
- contractOrderEntity.setRewardAmount(profitLossPrice);
- contractOrderEntity.setRewardRatio(returnRate);
- contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
- contractOrderEntity.setClosingPrice(closePrice);
- contractOrderEntity.setClosingType(7);
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_LESS);
- BigDecimal totalReturn = BigDecimal.ZERO;
- contractOrderService.save(contractOrderEntity);
-
- contractHoldOrderService.removeById(order.getId());
- // 将需要退回的减去手续费
- BigDecimal needReturn = prePrice.add(profitLossPrice);
- //总退回金额=保证金+收益-手续费
- totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
- // 更新钱包
- // 总的是收益-平仓手续费
- BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
-
- memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
-
- insertAccountFlow(order, wallet, profitLossPrice, "止盈平仓");
-
- //返佣
- ThreadPoolUtils.calReturnMoney(order.getMemberId(), order.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE);
- }
- }
- }
- }
-
- }
-
- /**
- * 开多止损
- *
- * @param
- */
- public void dealForMoreLoss(List<ContractHoldOrderEntity> orderList, List<OrderModel> list) {
- //List<CoinsCoinsOrder> orderList = orderMapper.selectOrderByBatchNo(batchno);
- //System.out.println("开多止损批次号batchno:" + batchno);
- if (CollectionUtils.isNotEmpty(orderList)) {
- Map<Long, BigDecimal> modelMap = new HashMap<Long, BigDecimal>();
- for (OrderModel model : list) {
- modelMap.put(model.getOrderId(), new BigDecimal(model.getPrice()));
- }
- for (ContractHoldOrderEntity order : orderList) {
- System.out.println("开多止损订单号:" + order.getOrderNo());
- Long orderId = order.getId();
- System.out.println("传来的止损价格:" + modelMap.get(orderId));
-
- if (null != order.getStopLossPrice()) {
- // 止损价
- BigDecimal closePrice = order.getStopLossPrice();
- System.out.println("订单止损价格:" + closePrice.toPlainString());
- BigDecimal queuePrice = modelMap.get(orderId);
- if (closePrice.compareTo(queuePrice) != 0) {
- System.out.println("数据库价格:" + queuePrice.toPlainString() + "--价格不能开多止损:" + closePrice);
- contractHoldOrderService.updateOrderIsCanClosingAndBatchNoById(orderId);
- continue;
- }
- System.out.println("执行操作");
- String symbol = order.getSymbol();
- Long memberId = order.getMemberId();
- // 本次需要退回的预付款
- BigDecimal prePrice = order.getBondAmount();
- MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memberId, "USDT");
-
- if (wallet != null) {
- // 历史订单
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(order);
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setId(null);
-
- // 本次平仓数量
- int currentFlat = order.getSymbolCnt();
- BigDecimal symbolSku = cacheSettingUtils.getSymbolSku(order.getSymbol());
- // 盈亏额度= (当前的币种的平仓价-下单时的建仓价)*购买的手数/规格*倍率
- BigDecimal profitLossPrice = (closePrice
- .subtract(order.getOpeningPrice()))
- .multiply(new BigDecimal(currentFlat + ""))
- .multiply(symbolSku).setScale(8, BigDecimal.ROUND_DOWN);
- MemberEntity memberEntity = memberService.getById(memberId);
-
- if (memberEntity.getIsProfit() == 1) {
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- if (profitLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(tradeSetting.getProfitParam()));
- } else {
-// profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.add(tradeSetting.getProfitParam()));
- }
- }
- //回报率
- BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
- contractOrderEntity.setRewardAmount(profitLossPrice);
- contractOrderEntity.setRewardRatio(returnRate);
- contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
- contractOrderEntity.setClosingPrice(closePrice);
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_MORE);
- contractOrderEntity.setClosingType(8);
- BigDecimal totalReturn = BigDecimal.ZERO;
- contractOrderService.save(contractOrderEntity);
-
- contractHoldOrderService.removeById(order.getId());
- // 将需要退回的减去手续费
- BigDecimal needReturn = prePrice.add(profitLossPrice);
- //总退回金额=保证金+收益-手续费
- totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
- // 更新钱包
- // 总的是收益-平仓手续费
- BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
-
- memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
-
- insertAccountFlow(order, wallet, profitLossPrice, "开多止损平仓");
-
- //返佣
- ThreadPoolUtils.calReturnMoney(order.getMemberId(), order.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE);
- }
- }
- }
- }
- }
-
- /**
- * 开空止损
- *
- * @param
- */
- public void dealForLessLoss(List<ContractHoldOrderEntity> orderList, List<OrderModel> list) {
- // List<CoinsCoinsOrder> orderList = orderMapper.selectOrderByBatchNo(batchno);
- //System.out.println("开空止损批次号batchno:" + batchno);
- if (CollectionUtils.isNotEmpty(orderList)) {
- Map<Long, BigDecimal> modelMap = new HashMap<Long, BigDecimal>();
- for (OrderModel model : list) {
- modelMap.put(model.getOrderId(), new BigDecimal(model.getPrice()));
- }
- for (ContractHoldOrderEntity order : orderList) {
- Long orderId = order.getId();
- System.out.println("传来的止损价格:" + modelMap.get(orderId).toPlainString());
- System.out.println("开空止损订单号:" + order.getOrderNo());
- if (null != order.getStopLossPrice()) {
- // 止损价
- BigDecimal closePrice = order.getStopLossPrice();
-
- System.out.println("订单止损价格:" + closePrice.toPlainString());
- BigDecimal queuePrice = modelMap.get(orderId);
- if (closePrice.compareTo(queuePrice) != 0) {
- System.out.println("数据库价格:" + queuePrice.toPlainString() + "--价格不能开空止损:" + closePrice);
- contractHoldOrderService.updateOrderIsCanClosingAndBatchNoById(orderId);
- continue;
- }
- System.out.println("执行操作");
- String symbol = order.getSymbol();
- Long memberId = order.getMemberId();
- // 本次需要退回的预付款
- BigDecimal prePrice = order.getBondAmount();
- MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memberId, "USDT");
-
- if (wallet != null) {
- // 历史订单
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(order);
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setId(null);
-
- // 本次平仓数量
- int currentFlat = order.getSymbolCnt();
- BigDecimal symbolSku = cacheSettingUtils.getSymbolSku(order.getSymbol());
- // 盈亏额度= (当前的币种的平仓价-下单时的建仓价)*购买的手数/规格*倍率
- BigDecimal profitLossPrice = (order.getOpeningPrice()
- .subtract(closePrice))
- .multiply(new BigDecimal(currentFlat + ""))
- .multiply(symbolSku).setScale(8, BigDecimal.ROUND_DOWN);
- MemberEntity memberEntity = memberService.getById(memberId);
-
- if (memberEntity.getIsProfit() == 1) {
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- if (profitLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.subtract(tradeSetting.getProfitParam()));
- } else {
-// profitLossPrice = profitLossPrice.multiply(BigDecimal.ONE.add(tradeSetting.getProfitParam()));
- }
- }
- //回报率
- BigDecimal returnRate = profitLossPrice.divide((order.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount())), 8, BigDecimal.ROUND_DOWN);
- contractOrderEntity.setRewardAmount(profitLossPrice);
- contractOrderEntity.setRewardRatio(returnRate);
- contractOrderEntity.setClosingFeeAmount(order.getOpeningFeeAmount());
- contractOrderEntity.setClosingPrice(closePrice);
- contractOrderEntity.setClosingType(9);
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_LESS);
- BigDecimal totalReturn = BigDecimal.ZERO;
- contractOrderService.save(contractOrderEntity);
-
- contractHoldOrderService.removeById(order.getId());
-
- // 将需要退回的减去手续费
- BigDecimal needReturn = prePrice.add(profitLossPrice);
- //总退回金额=保证金+收益-手续费
- totalReturn = needReturn.subtract(contractOrderEntity.getClosingFeeAmount());
- // 更新钱包
- // 总的是收益-平仓手续费
- BigDecimal totalBalance = profitLossPrice.subtract(contractOrderEntity.getClosingFeeAmount());
- memberWalletContractService.increaseWalletContractBalanceById(totalReturn, totalBalance, null, wallet.getId());
-
- insertAccountFlow(order, wallet, profitLossPrice, "开空止损平仓");
-
- //返佣
- ThreadPoolUtils.calReturnMoney(order.getMemberId(), order.getOpeningFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE);
- }
- }
- }
- }
- }
-
- private void insertAccountFlow(ContractHoldOrderEntity order, MemberWalletContractEntity wallet, BigDecimal profitLossPrice, String source) {
- MemberAccountFlowEntity record = new MemberAccountFlowEntity();
- record.setCreateTime(new Date());
- record.setSource(source);
- record.setRemark(source);
- record.setBalance(wallet.getAvailableBalance());
- record.setMemberId(order.getMemberId());
- record.setSymbol(order.getSymbol());
- record.setPrice(profitLossPrice.add(order.getPrePaymentAmount()));
- memberAccountFlowEntityDao.insert(record);
- }
-
-
- /**
- * 限价委托
- *
- * @param
- */
- public void dealLimitBuyOrder(List<ContractEntrustOrderEntity> orderList) {
- //List<CoinsCoinsOrder> orderList = orderMapper.selectOrderByBatchNo(batchno);
- if (CollectionUtils.isNotEmpty(orderList)) {
- ContractHoldOrderEntity contractHoldOrderEntity = null;
- for (ContractEntrustOrderEntity coinsCoinsOrder : orderList) {
- MemberWalletContractEntity wallet = memberWalletContractService.findWalletContractByMemberIdAndSymbol(coinsCoinsOrder.getMemberId(), "USDT");
- if (wallet == null) {
- continue;
- }
-
- // 委托单bean转换为持仓单bean
- contractHoldOrderEntity = ContractEntrustOrderEntityMapper.INSTANCE.entrustOrderToHoldOrder(coinsCoinsOrder);
- contractHoldOrderEntity.setId(null);
- Long memId = coinsCoinsOrder.getMemberId();
- MemberEntity memberEntity = memberService.getById(memId);
- BigDecimal entrustPrice = coinsCoinsOrder.getEntrustPrice();
- int symbolCnt = coinsCoinsOrder.getSymbolCnt();
- int type = coinsCoinsOrder.getEntrustType();
-
- if (type == 1) {
- // 开多
- contractHoldOrderEntity.setOpeningType(ContractHoldOrderEntity.OPENING_TYPE_MORE);
- } else {
- // 开空
- contractHoldOrderEntity.setOpeningType(ContractHoldOrderEntity.OPENING_TYPE_LESS);
- }
-
- //持仓单赋值
- contractHoldOrderEntity.setMemberId(memId);
- contractHoldOrderEntity.setIsCanClosing(ContractHoldOrderEntity.ORDER_CAN_CLOSING_Y);
- contractHoldOrderEntity.setMarkPrice(coinsCoinsOrder.getEntrustPrice());
- contractHoldOrderEntity.setBondAmount(coinsCoinsOrder.getBondAmount());
- // 开仓手续费 建仓价*规格*手数*手续费率
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(coinsCoinsOrder.getSymbol());
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
- BigDecimal openFeePrice = coinsCoinsOrder.getEntrustPrice().multiply(lotNumber)
- .multiply(new BigDecimal(coinsCoinsOrder.getSymbolCnt()))
- .multiply(tradeSettingEntity.getFeeRatio().divide(new BigDecimal(100)))
- .setScale(8, BigDecimal.ROUND_DOWN);
- contractHoldOrderEntity.setOpeningFeeAmount(openFeePrice);
- contractHoldOrderEntity.setVersion(1);
- BigDecimal forceSetPrice = CalculateUtil.getForceSetPrice(coinsCoinsOrder.getBondAmount().subtract(openFeePrice), entrustPrice, symbolCnt, lotNumber, type, memberEntity);
-
- contractHoldOrderEntity.setForceClosingPrice(forceSetPrice);
- contractHoldOrderEntity.setLeverRatio(coinsCoinsOrder.getLeverRatio());
- contractHoldOrderEntity.setOpeningPrice(entrustPrice);
- contractHoldOrderEntity.setTradeType(ContractHoldOrderEntity.TRADE_TYPE_LIMIT);
- contractHoldOrderEntity.setOperateNo(1);
- contractHoldOrderService.save(contractHoldOrderEntity);
-
- // 需要一个历史插入
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(contractHoldOrderEntity);
- contractOrderEntity.setEntrustOpeningPrice(coinsCoinsOrder.getEntrustPrice());
- contractOrderEntity.setEntrustTime(coinsCoinsOrder.getCreateTime());
- contractOrderEntity.setOpeningTime(new Date());
-
- contractOrderEntity.setId(null);
- contractOrderService.save(contractOrderEntity);
- // 发送爆仓的队列
- // 市价
- if (coinsCoinsOrder.getEntrustType() == 1) {
- // 开多
- OrderModel model = new OrderModel(contractHoldOrderEntity.getId(), 6, contractHoldOrderEntity.getForceClosingPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), coinsCoinsOrder.getSymbol(), 1);
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- } else {
- // 开空
- OrderModel model = new OrderModel(contractHoldOrderEntity.getId(), 7, contractHoldOrderEntity.getForceClosingPrice().setScale(8, RoundingMode.HALF_UP).toPlainString(), coinsCoinsOrder.getSymbol(), 1);
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 扣除手续费
- BigDecimal totalBalance = openFeePrice.negate();
- contractEntrustOrderService.removeById(coinsCoinsOrder.getId());
- memberWalletContractService.increaseWalletContractBalanceById(null, totalBalance, coinsCoinsOrder.getBondAmount().negate(), wallet.getId());
-
- //返佣
- ThreadPoolUtils.calReturnMoney(memberEntity.getId(), openFeePrice, contractOrderEntity, AgentReturnEntity.ORDER_TYPE_OPEN);
- }
- }
- }
-
- /**
- * 爆仓
- *
- * @param
- */
- public void dealCoinOut(List<ContractHoldOrderEntity> orderList, List<OrderModel> orderModels) {
- if (CollectionUtils.isNotEmpty(orderList)) {
- Map<Long, Integer> modelMap = new HashMap<Long, Integer>();
- for (OrderModel model : orderModels) {
- modelMap.put(model.getOrderId(), model.getOperateNo());
- }
- for (ContractHoldOrderEntity coinsOrder : orderList) {
- Long orderId = coinsOrder.getId();
- Integer operateNo = coinsOrder.getOperateNo();
- //判断当前订单是否是最新的爆仓价 不相等时直接进入下一个订单
- if (!modelMap.get(orderId).equals(operateNo)) {
- // 将订单更新为可平仓并删除批次号
- contractHoldOrderService.updateOrderIsCanClosingAndBatchNoById(orderId);
- continue;
- }
- boolean isDone = false;
- Long memId = coinsOrder.getMemberId();
- BigDecimal nowPrice = coinsOrder.getForceClosingPrice();
- // 创建订单(加入历史表的订单)
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(coinsOrder);
-
- //查询是否满足爆仓条件
- if (coinsOrder.getOpeningType() == ContractHoldOrderEntity.OPENING_TYPE_MORE) {
- //如果是开多,当前价小于预估强平价即为爆仓
- // 设置平仓类型 // 爆仓平多
- contractOrderEntity.setClosingType(4);
- //更新用户钱包数据
- isDone = true;
- } else {
- //如果是开空,当前价大于预估强平价即为爆仓
- contractOrderEntity.setClosingType(5);
- //更新主表订单状态位为“已平仓”
- isDone = true;
-
- }
- if (isDone) {
- //删除次仓订单
- contractHoldOrderService.removeById(orderId);
- // 订单状态转换
- if (ContractOrderEntity.ORDER_TYPE_OPEN_MORE == contractOrderEntity.getOrderType()) {
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_MORE);
- } else {
- contractOrderEntity.setOrderType(ContractOrderEntity.ORDER_TYPE_CLOSE_LESS);
- }
- //更新主表订单状态位为“已平仓”
- contractOrderEntity.setId(null);
- contractOrderEntity.setClosingPrice(nowPrice);
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setClosingFeeAmount(coinsOrder.getOpeningFeeAmount());
- contractOrderEntity.setRewardAmount(coinsOrder.getBondAmount().subtract(contractOrderEntity.getOpeningFeeAmount()).negate());
- contractOrderService.save(contractOrderEntity);
-
- //更新用户钱包数据
- MemberWalletContractEntity usdt = memberWalletContractService.findWalletContractByMemberIdAndSymbol(memId, "USDT");
-
- // 减去的时候用负数
- BigDecimal totalPrice = coinsOrder.getBondAmount().negate();
- memberWalletContractService.increaseWalletContractBalanceById(null, totalPrice, null, usdt.getId());
- // 流水记录 TODO
- MemberAccountFlowEntity record = new MemberAccountFlowEntity();
- record.setCreateTime(new Date());
- record.setSource("系统自动平仓");
- record.setRemark("系统自动平仓");
- record.setBalance(usdt.getAvailableBalance());
- record.setMemberId(memId);
- record.setSymbol(coinsOrder.getSymbol());
- record.setPrice(coinsOrder.getBondAmount());
- memberAccountFlowEntityDao.insert(record);
- }
- }
- }
- }
-
- public void calYj(Long mid, BigDecimal money, ContractOrderEntity order, int type) {
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
- if (money != null) {
- money = money.multiply(tradeSetting.getFeeSpreadRatio());
- }
- MemberEntity member = memberService.getById(mid);
- String[] referenceIds = member.getRefererIds().split(",");
- List<String> ids = Arrays.asList(referenceIds);
-
- if (MemberEntity.ACCOUNT_TYPE_TEST.equals(member.getAccountType())) {
- return;
- }
-
- // 判断该用户是否为代理商
- NeedMoneyMemberVo needMoneyMember = memberService.selectFriendRelationUserByMemberId(mid);
-
- // 查询该用户下所有需要返佣的代理商
- List<NeedMoneyMemberVo> list = memberService.selectAllNeedMoneyMember(ids);
- TreeMap<Integer, NeedMoneyMemberVo> treeMap = new TreeMap<>(new Comparator<Integer>() {
- @Override
- public int compare(Integer o1, Integer o2) {
- return o2.compareTo(o1);
- }
- });
- // 建立层级关系
- for (int i = 0; i < list.size(); i++) {
- treeMap.put(list.get(i).getLevelId(), list.get(i));
- }
-
- // 该用户为代理商则判断is_self字段,判断是否保留其手续费
- // 该用户为代理商则判断is_self字段,判断是否保留其手续费
- if (needMoneyMember != null && needMoneyMember.getFeeIsSelf() == 1) {
- treeMap.put(needMoneyMember.getLevelId(), needMoneyMember);
- }
-
-
- // 存放uid以及对应uid用户的佣金
- Map<String, Map<String, BigDecimal>> map = new HashMap<>();
- Iterator<Map.Entry<Integer, NeedMoneyMemberVo>> it = treeMap.entrySet().iterator();
- BigDecimal lastRate = BigDecimal.ZERO;
- BigDecimal lastYj = BigDecimal.ZERO;
- while (it.hasNext()) {
- Map.Entry<Integer, NeedMoneyMemberVo> entry = it.next();
- NeedMoneyMemberVo member1 = entry.getValue();
- Map<String, BigDecimal> returnValue = new HashMap<>();
- returnValue.put("ratio", member1.getReturnRatio());
- returnValue.put("lastRate", lastRate);
- // 上下级佣金比率相减后乘以手续费 -- 即用户所得佣金
- lastYj = (member1.getReturnRatio().subtract(lastRate)).multiply(money);
- lastRate = member1.getReturnRatio();
- returnValue.put("returnMoney", lastYj);
- map.put(member1.getInviteId(), returnValue);
- }
-
- // 输出对应佣金是否正确
- Iterator<Map.Entry<String, Map<String, BigDecimal>>> it1 = map.entrySet().iterator();
- List<AgentReturnEntity> agentList = new ArrayList<AgentReturnEntity>();
- while (it1.hasNext()) {
- Map.Entry<String, Map<String, BigDecimal>> entry = it1.next();
- // System.out.println(entry.getKey() + "-----" + entry.getValue());
- MemberEntity agentMember = memberService.selectMemberInfoByInviteId(entry.getKey());
- AgentReturnEntity agent = new AgentReturnEntity();
- agent.setMemberId(mid);
- agent.setOrderId(order.getId());
- agent.setOrderNo(order.getOrderNo());
- agent.setRefererId(agentMember.getId());
- agent.setOrderType(order.getOrderType());
- agent.setReturnSymbol(order.getSymbol());
- agent.setIsReturn(0);
- agent.setReturnAmount(entry.getValue().get("returnMoney"));
- agent.setChildReturnRatio(entry.getValue().get("lastRate"));
- agent.setReturnRatio(entry.getValue().get("ratio"));
- agent.setClosingType(order.getClosingType());
- if (type == 1) {//开仓
- agent.setOpeningFeeAmount(order.getOpeningFeeAmount());
- } else if (type == 2) {//平仓
- agent.setClosingFeeAmount(order.getClosingFeeAmount());
- } else {//持仓费
- agent.setHoldingFeeAmount(order.getHoldAmount());
- }
- agent.setInviteId(entry.getKey());
- agentReturnDao.insert(agent);
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java b/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
deleted file mode 100644
index 1f4e3ed..0000000
--- a/src/main/java/com/xcong/excoin/modules/contract/service/impl/RabbitOrderServiceImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.xcong.excoin.modules.contract.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.enumerates.OrderClosingTypeEnum;
-import com.xcong.excoin.common.system.service.CommonService;
-import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.mapper.ContractHoldOrderEntityMapper;
-import com.xcong.excoin.modules.contract.service.RabbitOrderService;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberSettingDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.utils.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-06-01
- **/
-@Slf4j
-@Service
-public class RabbitOrderServiceImpl implements RabbitOrderService {
-
- @Resource
- private MemberDao memberDao;
-
- @Resource
- private OrderWebsocketServiceImpl orderWebsocketService;
-
- @Resource
- private ContractHoldOrderDao contractHoldOrderDao;
-
- @Resource
- private ContractOrderDao contractOrderDao;
-
- @Resource
- private CommonService commonService;
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Resource
- private CacheSettingUtils cacheSettingUtils;
-
- @Resource
- private RedisUtils redisUtils;
- @Resource
- private MemberSettingDao memberSettingDao;
-
- @Transactional(rollbackFor = Exception.class)
- @Override
- public void cancelHoldOrder(List<Long> ids) {
- if (CollUtil.isNotEmpty(ids)) {
- if (ids.size() == 1) {
- ContractHoldOrderEntity holdOrderEntity = contractHoldOrderDao.selectById(ids.get(0));
- cancelHoldOrderMethod(holdOrderEntity);
- } else {
- List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectBatchIds(ids);
- if (CollUtil.isNotEmpty(holdOrderEntities)) {
- for (ContractHoldOrderEntity holdOrder : holdOrderEntities) {
- cancelHoldOrderMethod(holdOrder);
- }
- }
- }
- }
- }
-
- public void cancelHoldOrderMethod(ContractHoldOrderEntity holdOrderEntity) {
- String symbol = holdOrderEntity.getSymbol();
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol)));
-
- MemberEntity memberEntity = memberDao.selectById(holdOrderEntity.getMemberId());
-
- MemberWalletContractEntity walletContract = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(holdOrderEntity.getMemberId(), CoinTypeEnum.USDT.name());
- if (walletContract != null) {
- // 删除持仓表订单
- contractHoldOrderDao.deleteById(holdOrderEntity.getId());
-
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(symbol);
- // 盈亏
- BigDecimal profitOrLoss = BigDecimal.ZERO;
- Integer orderType = null;
- Integer closingType = null;
-
- MemberSettingEntity memberSettingEntity = memberSettingDao.selectMemberSettingByMemberId(memberEntity.getId());
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- newPrice = newPrice.multiply(BigDecimal.ONE.subtract(memberSettingEntity.getClosingSpread().divide(BigDecimal.valueOf(10000), 4, BigDecimal.ROUND_DOWN)));
- // (最新价-开仓价)*规格*张数
- profitOrLoss = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(lotNumber).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- orderType = ContractOrderEntity.ORDER_TYPE_CLOSE_MORE;
- closingType = OrderClosingTypeEnum.CLOSE_MORE.getValue();
- // 开空
- } else {
- newPrice = newPrice.multiply(BigDecimal.ONE.add(memberSettingEntity.getClosingSpread().divide(BigDecimal.valueOf(10000), 4, BigDecimal.ROUND_DOWN)));
- // (开仓价-最新价)*规格*张数
- profitOrLoss = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(lotNumber).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt()));
- orderType = ContractOrderEntity.ORDER_TYPE_CLOSE_LESS;
- closingType = OrderClosingTypeEnum.CLOSE_LESS.getValue();
- }
-
- if (memberEntity.getIsProfit() == MemberEntity.IS_PROFIT_Y) {
- PlatformTradeSettingEntity tradeSettingEntity = cacheSettingUtils.getTradeSetting();
- if (profitOrLoss.compareTo(BigDecimal.ZERO) > -1) {
- profitOrLoss = profitOrLoss.multiply(BigDecimal.ONE.subtract(tradeSettingEntity.getProfitParam()));
- } else {
- profitOrLoss = profitOrLoss.multiply(BigDecimal.ONE.add(tradeSettingEntity.getProfitParam()));
- }
- }
-
- // 盈亏比例(回报率)
- BigDecimal rewardRatio = profitOrLoss.divide(holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()), 8, BigDecimal.ROUND_DOWN);
-
- ContractOrderEntity contractOrderEntity = ContractHoldOrderEntityMapper.INSTANCE.holdOrderToOrder(holdOrderEntity);
- contractOrderEntity.setId(null);
- contractOrderEntity.setOrderType(orderType);
- contractOrderEntity.setClosingPrice(newPrice);
- contractOrderEntity.setClosingFeeAmount(holdOrderEntity.getOpeningFeeAmount());
- contractOrderEntity.setClosingTime(new Date());
- contractOrderEntity.setClosingType(closingType);
- contractOrderEntity.setRewardAmount(profitOrLoss);
- contractOrderEntity.setRewardRatio(rewardRatio);
- contractOrderDao.insert(contractOrderEntity);
-
- // 计算盈利或亏损后可用金额和总金额应该增加或减少的
- BigDecimal addMoney = holdOrderEntity.getBondAmount().subtract(holdOrderEntity.getOpeningFeeAmount()).add(profitOrLoss);
- memberWalletContractDao.increaseWalletContractBalanceById(addMoney, profitOrLoss.subtract(contractOrderEntity.getOpeningFeeAmount()), null, walletContract.getId());
-
- // 流水
- LogRecordUtils.insertMemberAccountFlow(memberEntity.getId(), addMoney, walletContract.getAvailableBalance().add(addMoney), holdOrderEntity.getSymbol(), "平仓", "平仓");
-
- // 计算佣金
- ThreadPoolUtils.calReturnMoney(memberEntity.getId(), contractOrderEntity.getClosingFeeAmount(), contractOrderEntity, AgentReturnEntity.ORDER_TYPE_CLOSE);
- }
-
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java b/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java
deleted file mode 100644
index ee8cbfb..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/controller/MemberQuickBuySaleController.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package com.xcong.excoin.modules.home.controller;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.alibaba.druid.util.StringUtils;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleCommitDto;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto;
-import com.xcong.excoin.modules.home.service.MemberQuickBuySaleService;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.service.MemberService;
-
-import cn.hutool.crypto.SecureUtil;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-
-@RestController
-@Slf4j
-@RequestMapping(value = "/api/quick")
-@Api(value = "MemberQuickBuySaleController", tags = "USDT快捷买卖类")
-public class MemberQuickBuySaleController {
-
- @Autowired
- MemberQuickBuySaleService memberQuickBuySaleService;
- @Autowired
- MemberService memberService;
-
- @ApiOperation(value = "recharge", notes = "USDT快速充值")
- @RequestMapping(value = "/recharge", method = RequestMethod.POST)
- public Result recharge(@RequestBody @Valid MemberQuickBuySaleDto memberQuickBuySaleDto) {
- log.info("入参----->{}", memberQuickBuySaleDto);
- //获取用户ID
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- log.info("查询到的会员----->{}", member);
- // 验证是否实名认证
- //if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) {
- // return Result.fail("请先实名认证");
- //}
- String tradePasswordWeb = memberQuickBuySaleDto.getTradePassword();
-
- // 验证支付密码
- String tradePassword = member.getTradePassword();
-
- log.info("入参交易密码{},用户设置的交易密码{}", tradePasswordWeb,tradePassword);
- if (StringUtils.isEmpty(tradePassword)) {
- return Result.fail("请先配置交易密码");
- }
- if (StringUtils.isEmpty(tradePasswordWeb)) {
- return Result.fail("请输入交易密码");
- }
- // 验证交易密码
- if (!tradePassword.equals(SecureUtil.md5(tradePasswordWeb))) {
- return Result.fail("请输入正确的交易密码");
- }
- return memberQuickBuySaleService.recharge(member, memberQuickBuySaleDto);
- }
-
-
- @ApiOperation(value = "commitPay", notes = "USDT充值支付确认")
- @RequestMapping(value = "/commitPay", method = RequestMethod.POST)
- public Result commitPay(@RequestBody @Valid MemberQuickBuySaleCommitDto memberQuickBuySaleCommitDto) {
- return memberQuickBuySaleService.commitPay(memberQuickBuySaleCommitDto);
- }
-
- @ApiOperation(value = "selectById", notes = "查询单个买卖记录")
- @GetMapping(value = "/selectById/{id}")
- public Result selectById(@PathVariable(value = "id") Long id) {
- return memberQuickBuySaleService.selectById(id);
- }
-
- @ApiOperation(value = "selectAll", notes = "查询用户所有的买卖记录")
- @GetMapping(value = "/selectAll")
- public Result selectAll(@RequestParam(value = "type") String type) {
- return memberQuickBuySaleService.selectAll(type);
- }
-
- @ApiOperation(value = "cancel", notes = "充值撤销")
- @GetMapping(value = "/cancel")
- public Result cancel(@RequestParam(value = "id") Long id) {
- return memberQuickBuySaleService.cancelRecharge(id);
- }
-
- @ApiOperation(value = "sell", notes = "USDT快速卖出")
- @RequestMapping(value = "/sell", method = RequestMethod.POST)
- public Result sell(@RequestBody @Valid MemberQuickBuySaleDto memberQuickBuySaleDto) {
- // 获取当前登录用户
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberService.getById(memberId);
- if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) {
- return Result.fail("请先实名认证");
- }
- String tradePasswordWeb = memberQuickBuySaleDto.getTradePassword();
- // 验证支付密码
- String tradePassword = member.getTradePassword();
-
- log.info("入参交易密码{},用户设置的交易密码{}", tradePasswordWeb,tradePassword);
- if (StringUtils.isEmpty(tradePassword)) {
- return Result.fail("请先配置交易密码");
- }
- if (StringUtils.isEmpty(tradePasswordWeb)) {
- return Result.fail("请输入交易密码");
- }
- // 验证交易密码
- if (!tradePassword.equals(SecureUtil.md5(tradePasswordWeb))) {
- return Result.fail("请输入正确的交易密码");
- }
- return memberQuickBuySaleService.sell(member,memberQuickBuySaleDto);
- }
-
- @ApiOperation(value = "cancelSell", notes = "提现撤销")
- @GetMapping(value = "/cancelSell")
- public Result cancelSell(@RequestParam(value = "id") Long id) {
- return memberQuickBuySaleService.cancelSell(id);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/dao/MemberQuickBuySaleDao.java b/src/main/java/com/xcong/excoin/modules/home/dao/MemberQuickBuySaleDao.java
deleted file mode 100644
index 9f0f27f..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/dao/MemberQuickBuySaleDao.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.xcong.excoin.modules.home.dao;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
-
-public interface MemberQuickBuySaleDao extends BaseMapper<MemberQuickBuySaleEntity> {
-
- MemberQuickBuySaleEntity selectByIdAndMemberId(@Param("memberId")Long memberId,@Param("id")Long id);
-
- int updateQuickBuySaleTimeOut();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleCommitDto.java b/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleCommitDto.java
deleted file mode 100644
index 3d3a550..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleCommitDto.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.home.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberQuickBuySaleCommitDto", description = "确认快捷买入接收参数")
-public class MemberQuickBuySaleCommitDto {
-
- @NotNull(message = "订单id不能为空")
- @ApiModelProperty(value = "主键",example = "1")
- private Long id;
-
- @NotNull(message = "付款方式不能为空")
- @ApiModelProperty(value = "付款方式 1-支付宝2-微信3-银行卡",example = "1")
- private int paymentType;
-
- @NotNull(message = "收款账号不能为空")
- @ApiModelProperty(value = "收款账号",example = "13000000000")
- private String paymentAccount;
-
- @NotNull(message = "收款人姓名不能为空")
- @ApiModelProperty(value = "收款人姓名",example = "张三")
- private String paymentName;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleDto.java b/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleDto.java
deleted file mode 100644
index 4e48a48..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/dto/MemberQuickBuySaleDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.home.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "会员快捷买入卖出参数接收类", description = "会员快捷买入卖出参数接收类")
-public class MemberQuickBuySaleDto {
-
- @NotNull(message = "金额不能为空")
- @ApiModelProperty(value = "金额(人民币)",example = "700")
- private BigDecimal amountCny;
-
- @NotNull(message = "金额不能为空")
- @ApiModelProperty(value = "金额(USDT)",example = "100")
- private BigDecimal amountUsdt;
-
- @ApiModelProperty(value = "单价",example = "7")
- private BigDecimal unitPrice;
-
- @NotNull(message = "交易密码不能为空")
- @ApiModelProperty(value = "交易密码",example = "123456")
- private String tradePassword;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/entity/MemberQuickBuySaleEntity.java b/src/main/java/com/xcong/excoin/modules/home/entity/MemberQuickBuySaleEntity.java
deleted file mode 100644
index 88ca2bc..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/entity/MemberQuickBuySaleEntity.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.xcong.excoin.modules.home.entity;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("member_quick_buy_sale")
-public class MemberQuickBuySaleEntity extends BaseEntity{
- /**
- * 订单状态 1-新建
- */
- public static final Integer CHARGE_STATUS_CREATE = 1;
-
- /**
- * 订单状态 2-已付款
- */
- public static final Integer CHARGE_STATUS_PAID = 2;
-
- /**
- * 订单状态 3-已审核
- */
- public static final Integer CHARGE_STATUS_CHECKED = 3;
-
- /**
- * 订单状态 4-撤单
- */
- public static final Integer CHARGE_STATUS_CANCEL_USER = 4;
-
- /**
- * 订单状态 5-系统取消
- */
- public static final Integer CHARGE_STATUS_CANCEL_SYSTEM = 5;
-
-
- private static final long serialVersionUID = 1L;
- /**
- * 用户Id
- */
- private Long memberId;
- /**
- * 金额(人民币)
- */
- private BigDecimal amountCny;
- /**
- * 金额(USDT)
- */
- private BigDecimal amountUsdt;
- /**
- * 付款方式 1-支付宝2-微信3-银行卡
- */
- private Integer paymentType;
- /**
- * 收款账号
- */
- private String paymentAccount;
- /**
- * 收款人姓名
- */
- private String paymentName;
- /**
- * 支付码
- */
- private String paymentCode;
- /**
- * 单价
- */
- private BigDecimal unitPrice;
- /**
- * 订单状态 1-新建2-已付款3-已审核4-撤单5-系统取消
- */
- private int orderStatus;
- /**
- * 订单编号
- */
- private String orderNo;
- /**
- * 订单类型 B买入 S卖出
- */
- private String orderType;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java b/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java
deleted file mode 100644
index c79e48e..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/mapper/MemberQuickBuySaleEntityMapper.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.home.mapper;
-
-import java.util.List;
-
-import org.mapstruct.Mapper;
-import org.mapstruct.factory.Mappers;
-
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto;
-import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
-import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleDetailVo;
-
-
-@Mapper
-public abstract class MemberQuickBuySaleEntityMapper {
-
- public static final MemberQuickBuySaleEntityMapper INSTANCE = Mappers.getMapper(MemberQuickBuySaleEntityMapper.class);
-
- public abstract MemberQuickBuySaleDetailVo entityToVo(MemberQuickBuySaleEntity memberQuickBuySaleEntity);
-
- public abstract MemberQuickBuySaleEntity dtoToEntity(MemberQuickBuySaleDto dto);
-
- public abstract List<MemberQuickBuySaleDetailVo> entityListToVoList(List<MemberQuickBuySaleEntity> memberQuickBuySaleEntityList);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java b/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java
deleted file mode 100644
index 3256044..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/service/MemberQuickBuySaleService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.home.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleCommitDto;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto;
-import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-
-public interface MemberQuickBuySaleService extends IService<MemberQuickBuySaleEntity> {
-
- public Result recharge(MemberEntity member,MemberQuickBuySaleDto memberQuickBuySaleDto);
-
- public Result commitPay(MemberQuickBuySaleCommitDto memberQuickBuySaleCommitDto);
-
- public Result selectById(Long id);
-
- public Result selectAll(String type);
-
- public Result cancelRecharge(Long id);
-
- public Result sell(MemberEntity member,MemberQuickBuySaleDto memberQuickBuySaleDto);
-
- public Result cancelSell(Long id);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java b/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java
deleted file mode 100644
index fd6273b..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/service/impl/MemberQuickBuySaleServiceImpl.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package com.xcong.excoin.modules.home.service.impl;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import com.xcong.excoin.utils.dingtalk.DingTalkType;
-import org.springframework.stereotype.Service;
-
-import com.alibaba.druid.util.StringUtils;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.home.dao.MemberQuickBuySaleDao;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleCommitDto;
-import com.xcong.excoin.modules.home.dto.MemberQuickBuySaleDto;
-import com.xcong.excoin.modules.home.entity.MemberQuickBuySaleEntity;
-import com.xcong.excoin.modules.home.mapper.MemberQuickBuySaleEntityMapper;
-import com.xcong.excoin.modules.home.service.MemberQuickBuySaleService;
-import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleDetailVo;
-import com.xcong.excoin.modules.home.vo.MemberQuickBuySaleVo;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberPaymentMethodDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberPaymentMethodEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import com.xcong.excoin.modules.platform.dao.PlatformPaymentMethodDao;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-
-@Service
-public class MemberQuickBuySaleServiceImpl extends ServiceImpl<MemberQuickBuySaleDao, MemberQuickBuySaleEntity> implements MemberQuickBuySaleService {
-
- @Resource
- MemberDao memberDao;
- @Resource
- MemberQuickBuySaleDao memberQuickBuySaleDao;
- @Resource
- MemberWalletCoinDao memberWalletCoinDao;
- @Resource
- MemberPaymentMethodDao memberPaymentMethodDao;
- @Resource
- PlatformPaymentMethodDao platformPaymentMethodDao;
-
- @Override
- public Result recharge(MemberEntity member, MemberQuickBuySaleDto memberQuickBuySaleDto) {
- // 生成订单号
- Long timestamp = System.currentTimeMillis();
- int random = (int) (Math.random() * 10);
- String chargeNo = String.valueOf(timestamp).substring(2) + random;
- // 插入订单表
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = new MemberQuickBuySaleEntity();
- memberQuickBuySaleEntity.setOrderStatus(1);
- memberQuickBuySaleEntity.setMemberId(member.getId());
- memberQuickBuySaleEntity.setAmountUsdt(memberQuickBuySaleDto.getAmountUsdt());
- memberQuickBuySaleEntity.setAmountCny(memberQuickBuySaleDto.getAmountCny());
- memberQuickBuySaleEntity.setUnitPrice(memberQuickBuySaleDto.getUnitPrice());
- memberQuickBuySaleEntity.setCreateTime(new Date());
- memberQuickBuySaleEntity.setOrderNo(chargeNo);
- memberQuickBuySaleEntity.setOrderType("B");
- // 支付码 ID+四位随机数
- int ran = (int) (Math.random() * 10000000);
- memberQuickBuySaleEntity.setPaymentCode(ran + "");
-
- memberQuickBuySaleDao.insert(memberQuickBuySaleEntity);
- MemberQuickBuySaleVo memberQuickBuySaleVo = new MemberQuickBuySaleVo();
- memberQuickBuySaleVo.setId(memberQuickBuySaleEntity.getId());
- // 返回前台付款方式
- return Result.ok("提交成功", memberQuickBuySaleVo);
- }
-
- @Override
- public Result commitPay(MemberQuickBuySaleCommitDto memberQuickBuySaleCommitDto) {
- // 用户提交支付确认 将状态改为付款中
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = new MemberQuickBuySaleEntity();
- memberQuickBuySaleEntity.setId(memberQuickBuySaleCommitDto.getId());
- memberQuickBuySaleEntity.setOrderStatus(2);
- memberQuickBuySaleEntity.setPaymentAccount(memberQuickBuySaleCommitDto.getPaymentAccount());
- memberQuickBuySaleEntity.setPaymentName(memberQuickBuySaleCommitDto.getPaymentName());
-
- memberQuickBuySaleDao.updateById(memberQuickBuySaleEntity);
-
- ThreadPoolUtils.sendDingTalk(1);
- return Result.ok("确认成功");
- }
-
- @Override
- public Result selectById(Long id) {
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = memberQuickBuySaleDao.selectById(id);
- MemberQuickBuySaleDetailVo memberQuickBuySaleDetailVo = MemberQuickBuySaleEntityMapper.INSTANCE.entityToVo(memberQuickBuySaleEntity);
- // 收款信息
- QueryWrapper<PlatformPaymentMethodEntity> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("status", "1");
- List<PlatformPaymentMethodEntity> paymentMethodList = platformPaymentMethodDao.selectList(queryWrapper);
- // 随机一个
- if (CollectionUtils.isEmpty(paymentMethodList)) {
- return Result.fail("收款方式为空");
- }
- memberQuickBuySaleDetailVo.setPlatforPaymentMethodList(paymentMethodList);
- long startTime = memberQuickBuySaleEntity.getCreateTime().getTime();
- long nowTime = new Date().getTime();
- long third = 30 * 60 * 1000;
- memberQuickBuySaleDetailVo.setTimeLeft((third - nowTime + startTime) / 1000);
- return Result.ok(memberQuickBuySaleDetailVo);
- }
-
- @Override
- public Result selectAll(String type) {
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- QueryWrapper<MemberQuickBuySaleEntity> queryWrapper = new QueryWrapper<>();
- queryWrapper.eq("member_id", member.getId());
- if (!StringUtils.isEmpty(type)) {
- queryWrapper.eq("order_type", type);
- }
- queryWrapper.orderByDesc("id");
- List<MemberQuickBuySaleEntity> memberQuickBuySaleEntityList = memberQuickBuySaleDao.selectList(queryWrapper);
- List<MemberQuickBuySaleDetailVo> memberQuickBuySaleDetailVoList = MemberQuickBuySaleEntityMapper.INSTANCE.entityListToVoList(memberQuickBuySaleEntityList);
- return Result.ok(memberQuickBuySaleDetailVoList);
- }
-
- @Override
- public Result sell(MemberEntity member, MemberQuickBuySaleDto memberQuickBuySaleDto) {
- // 判断是否存在足够余额
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum.USDT.toString());
- // 判断是否存在足够余额
- if (walletCoin == null) {
- return Result.fail("您当前可用USDT额度不够");
- }
- BigDecimal extractUsdt = memberQuickBuySaleDto.getAmountUsdt();
- if (extractUsdt == null) {
- return Result.fail("请输入提币量");
- }
- // 判断是否足够
- System.out.println("提币数:" + extractUsdt.doubleValue() + " 可用:" + walletCoin.getAvailableBalance());
- if (extractUsdt.compareTo(walletCoin.getAvailableBalance()) == 1) {
- return Result.fail("您当前可用USDT额度不够");
- }
-
- // 判断是否存在收款方式
- List<MemberPaymentMethodEntity> payMentMethodList = memberPaymentMethodDao.selectByMemberId(member.getId());
- if (CollectionUtils.isEmpty(payMentMethodList)) {
- return Result.fail("请配置收款方式");
- }
- // 冻结可用额度
- int i = memberWalletCoinDao.updateFrozenBalance(member.getId(),
- walletCoin.getId(), extractUsdt);
- if (i <= 0) {
- return Result.fail("可用USDT余额不足");
- }
-
- // 生成订单号
- Long timestamp = System.currentTimeMillis();
- int random = (int) (Math.random() * 10);
- String chargeNo = String.valueOf(timestamp).substring(2) + random;
- // 插入订单表
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = new MemberQuickBuySaleEntity();
- memberQuickBuySaleEntity.setOrderStatus(1);
- memberQuickBuySaleEntity.setMemberId(member.getId());
- memberQuickBuySaleEntity.setAmountUsdt(memberQuickBuySaleDto.getAmountUsdt());
- memberQuickBuySaleEntity.setAmountCny(memberQuickBuySaleDto.getAmountCny());
- memberQuickBuySaleEntity.setOrderNo(chargeNo);
- memberQuickBuySaleEntity.setOrderType("S");
- // 支付码 ID+四位随机数
- int ran = (int) (Math.random() * 10000000);
- memberQuickBuySaleEntity.setPaymentCode(ran + "");
-
- memberQuickBuySaleDao.insert(memberQuickBuySaleEntity);
-
- ThreadPoolUtils.sendDingTalk(2);
- return Result.ok("下单成功");
- }
-
- @Override
- public Result cancelRecharge(Long id) {
- // 获取当前登录用户
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = memberQuickBuySaleDao.selectByIdAndMemberId(member.getId(), id);
- memberQuickBuySaleEntity.setOrderStatus(MemberQuickBuySaleEntity.CHARGE_STATUS_CANCEL_USER);
- memberQuickBuySaleDao.updateById(memberQuickBuySaleEntity);
- return Result.ok("成功");
- }
-
- @Override
- public Result cancelSell(Long id) {
- // 获取当前登录用户
- MemberEntity member = LoginUserUtils.getAppLoginUser();
- MemberQuickBuySaleEntity memberQuickBuySaleEntity = memberQuickBuySaleDao.selectByIdAndMemberId(member.getId(), id);
- if (memberQuickBuySaleEntity != null) {
- memberQuickBuySaleEntity.setOrderStatus(MemberQuickBuySaleEntity.CHARGE_STATUS_CANCEL_USER);
- memberQuickBuySaleDao.updateById(memberQuickBuySaleEntity);
-
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(member.getId(), CoinTypeEnum.USDT.toString());
- // 冻结资金返回可用
- int i = memberWalletCoinDao.subFrozenBalance(member.getId(),
- walletCoin.getId(), memberQuickBuySaleEntity.getAmountUsdt());
- if (i < 0) {
- return Result.fail("撤单失败");
- }
- return Result.ok("成功");
- } else {
- return Result.fail("订单不存在");
- }
-
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleDetailVo.java b/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleDetailVo.java
deleted file mode 100644
index db8e91f..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleDetailVo.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.xcong.excoin.modules.home.vo;
-
-import java.math.BigDecimal;
-import java.util.Date;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-@Data
-@ApiModel(value = "会员快捷买入卖出", description = "会员快捷买入卖出类")
-public class MemberQuickBuySaleDetailVo {
-
- @ApiModelProperty(value = "订单Id")
- private Long id;
- @ApiModelProperty(value = "用户id")
- private Long memberId;
- @ApiModelProperty(value = "金额(人民币)")
- private BigDecimal amountCny;
- @ApiModelProperty(value = "金额(USDT)")
- private BigDecimal amountUsdt;
- @ApiModelProperty(value = "付款方式 1-支付宝2-微信3-银行卡")
- private Integer paymentType;
- @ApiModelProperty(value = "支付码")
- private String paymentCode;
- @ApiModelProperty(value = "单价")
- private BigDecimal unitPrice;
- @ApiModelProperty(value = "订单状态 1-新建2-已付款3-已审核4-撤单5-系统取消")
- private int orderStatus;
- @ApiModelProperty(value = "订单编号")
- private String orderNo;
- @ApiModelProperty(value = "订单类型 B买入 S卖出")
- private String orderType;
- @ApiModelProperty(value = "剩余时间")
- private Long timeLeft;
- @ApiModelProperty(value = "下单时间")
- @JsonFormat(pattern = "MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date createTime;
- @ApiModelProperty(value = "平台收款方式")
- private List<PlatformPaymentMethodEntity> platforPaymentMethodList;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleVo.java b/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleVo.java
deleted file mode 100644
index 6d41454..0000000
--- a/src/main/java/com/xcong/excoin/modules/home/vo/MemberQuickBuySaleVo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.xcong.excoin.modules.home.vo;
-
-import java.util.List;
-
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-@Data
-@ApiModel(value = "会员快捷买入卖出", description = "会员快捷买入卖出类")
-public class MemberQuickBuySaleVo {
-
- @ApiModelProperty(value = "订单Id")
- private Long id;
- @ApiModelProperty(value = "剩余时间")
- private Long timeLeft;
- @ApiModelProperty(value = "平台收款方式")
- private List<PlatformPaymentMethodEntity> platforPaymentMethodList;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java b/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java
deleted file mode 100644
index c2a3f6e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/controller/MemberController.java
+++ /dev/null
@@ -1,365 +0,0 @@
-package com.xcong.excoin.modules.member.controller;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto;
-import com.xcong.excoin.modules.member.parameter.vo.AppVersionListVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberAuthenticationInfoVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberAvivableCoinInfoVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountListVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressListVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberCoinInfoListVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberInfoVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailListVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberPaymethodDetailVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberPersonCenterInfoVo;
-import com.xcong.excoin.modules.member.parameter.vo.MemberSendCodeWayVo;
-import com.xcong.excoin.modules.member.service.MemberService;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * 用户类
- *
- * @author wzy
- * @date 2020-05-18
- **/
-@Slf4j
-@Api(value = "个人中心接口", tags = "个人中心接口")
-@RestController
-@RequestMapping(value = "/api/member")
-public class MemberController {
-
- @Resource
- MemberService memberService;
-
- /**
- * 获取当前版本号
- */
- @ApiOperation(value="APP端获取当前版本号", notes="获取当前版本号")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = AppVersionListVo.class)})
- @GetMapping(value = "/getAppVersionInfo")
- public Result getAppVersionInfo() {
- return memberService.getAppVersionInfo();
- }
-
-
- /**
- * 获取当前版本号
- */
- @ApiOperation(value="PC端获取当前版本号", notes="获取当前版本号")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = AppVersionListVo.class)})
- @GetMapping(value = "/getPcVersionInfo")
- public Result getPcVersionInfo() {
- return memberService.getPcVersionInfo();
- }
-
-
- /**
- * 获取我的信息
- * @return
- */
- @ApiOperation(value="获取我的信息", notes="获取我的信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberInfoVo.class)})
- @GetMapping(value = "/getMemberInfo")
- public Result getMemberInfo() {
- return memberService.getMemberInfo();
- }
-
- /**
- * 忘记密码
- * @return
- */
- @ApiOperation(value=" 忘记密码", notes=" 忘记密码")
- @PostMapping(value="/memberForgetPwd")
- public Result memberForgetPwd(@RequestBody @Valid MemberForgetPwdDto memberForgetPwdDto) {
- return memberService.memberForgetPwd(memberForgetPwdDto);
- }
-
- /**
- * 验证账户是否存在
- * @return
- */
- @ApiOperation(value="验证账户是否存在", notes="验证账户是否存在")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "account", value = "账号", required = true, dataType = "String", paramType="query"),
- @ApiImplicitParam(name = "type", value = "类型 1:手机号 2:邮箱", required = true, dataType = "int", paramType="query")
- })
- @GetMapping(value = "/getMemberAccountInfo")
- public Result getMemberAccountInfo(String account,int type) {
- return memberService.getMemberAccountInfo(account,type);
- }
-
- /**
- * 修改密码
- * @return
- */
- @ApiOperation(value="修改密码", notes="修改密码")
- @PostMapping(value="/memberUpdatePwd")
- public Result memberUpdatePwd(@RequestBody @Valid MemberUpdatePwdDto memberUpdatePwdDto) {
- //System.out.println("修改密码:");
- return memberService.memberUpdatePwd(memberUpdatePwdDto);
- }
-
- /**
- * 修改资金密码时效性
- * @return
- */
- @ApiOperation(value="修改资金密码时效性", notes="修改资金密码时效性")
- @PostMapping(value="/memberUpdateTradersPwdTime")
- public Result memberUpdateTradersPwdTime(@RequestBody @Valid MemberUpdateTradersPwdTimeDto memberUpdateTradersPwdTimeDto) {
- //System.out.println("修改密码:");
- return memberService.memberUpdateTradersPwdTime(memberUpdateTradersPwdTimeDto);
- }
-
- /**
- * 获取实名认证信息
- * @return
- */
- @ApiOperation(value = "获取实名认证信息", notes = "获取实名认证信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAuthenticationInfoVo.class)})
- @GetMapping(value = "/memberAuthenticationInfo")
- public Result memberAuthenticationInfo() {
- return memberService.memberAuthenticationInfo();
- }
-
- /**
- * 实名认证
- * @return
- */
- @ApiOperation(value="实名认证", notes="实名认证")
- @PostMapping(value="/memberAuthentication")
- public Result memberAuthentication(@RequestBody @Valid MemberAuthenticationDto memberAuthenticationDto) {
- return memberService.memberAuthentication(memberAuthenticationDto);
- }
-
- /**
- * 修改资金密码
- * @return
- */
- @ApiOperation(value="修改资金密码", notes="修改资金密码")
- @PostMapping(value="/memberUpdateTradePwd")
- public Result memberUpdateTradePwd(@RequestBody @Valid MemberUpdateTradePwdDto memberUpdateTradePwdDto) {
- return memberService.memberUpdateTradePwd(memberUpdateTradePwdDto);
- }
-
- /**
- * 用户退出登录
- * @return
- */
- @ApiOperation(value="用户退出登录", notes="用户退出登录")
- @GetMapping(value = "/memberLogout")
- public Result memberLogout() {
- return memberService.memberLogout();
- }
-
- /**
- * 设置交易密码
- * @param code
- * @param password
- * @param token
- * @return
- */
- @ApiOperation(value="设置交易密码", notes="设置交易密码")
- @PostMapping(value="/memberTradersPwd")
- public Result memberTradersPwd(@RequestBody @Valid MemberForgetPwdDto memberForgetPwdDto) {
- return memberService.memberTradersPwd(memberForgetPwdDto);
- }
-
- /**
- * 收款方式
- * @return
- */
- @ApiOperation(value="新增收款方式", notes="新增收款方式")
- @PostMapping(value="/memberAddPaymethod")
- public Result memberAddPaymethod(@RequestBody @Valid MemberPaymethodDto memberPaymethodDto) {
- return memberService.memberAddPaymethod(memberPaymethodDto);
- }
-
- /**
- * 收款方式
- * @return
- */
- @ApiOperation(value="删除收款方式", notes="删除收款方式")
- @PostMapping(value="/memberDelPaymethod")
- public Result memberDelPaymethod(@RequestBody @Valid MemberDelPaymethodDto memberDelPaymethodDto) {
- return memberService.memberDelPaymethod(memberDelPaymethodDto);
- }
-
- /**
- * 收款方式
- * @return
- */
- @ApiOperation(value="一个收款方式的详情", notes="一个收款方式的详情")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberPaymethodDetailVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "long", paramType="query")
- })
- @GetMapping(value = "/memberPaymethodDetail")
- public Result memberPaymethodDetail(long id) {
- return memberService.memberPaymethodDetail(id);
- }
-
- /**
- * 收款方式
- * @return
- */
- @ApiOperation(value="收款方式的列表", notes="收款方式的列表")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberPaymethodDetailListVo.class)})
- @GetMapping(value = "/memberPaymethodDetailList")
- public Result memberPaymethodDetailList() {
- return memberService.memberPaymethodDetailList();
- }
-
- /**
- * 绑定手机号
- * @return
- */
- @ApiOperation(value="绑定手机号", notes="绑定手机号")
- @PostMapping(value="/memberBindPhone")
- public Result memberBindPhone(@RequestBody @Valid MemberBindPhoneDto memberBindPhoneDto) {
- return memberService.memberBindPhone(memberBindPhoneDto);
- }
-
- /**
- * 绑定邮箱
- * @return
- */
- @ApiOperation(value="绑定邮箱", notes="绑定邮箱")
- @PostMapping(value="/memberBindEmail")
- public Result memberBindEmail(@RequestBody @Valid MemberBindEmailDto memberBindEmailDto) {
- return memberService.memberBindEmail(memberBindEmailDto);
- }
-
- /**
- * 获取币种地址
- * @return
- */
- @ApiOperation(value = "获取币种地址数量", notes = "获取币种地址数量")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberCoinAddressCountListVo.class)})
- @GetMapping(value = "/memberCoinAddressCount")
- public Result memberCoinAddressCount() {
- return memberService.memberCoinAddressCount();
- }
-
- /**
- * 获取提币地址
- * @return
- */
- @ApiOperation(value = "获取提币地址列表", notes = "获取提币地址列表")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberCoinAddressListVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/memberCoinAddressList")
- public Result memberCoinAddressList(String symbol) {
- return memberService.memberCoinAddressList(symbol);
- }
-
- /**
- * 添加提币地址
- * @return
- */
- @ApiOperation(value = "添加提币地址", notes = "添加提币地址")
- @PostMapping(value = "/memberAddCoinAddress")
- public Result memberAddCoinAddress(@RequestBody @Valid MemberAddCoinAddressDto memberAddCoinAddressDto) {
- return memberService.memberAddCoinAddress(memberAddCoinAddressDto);
- }
-
- /**
- * 删除提币地址
- * @return
- */
- @ApiOperation(value="删除提币地址", notes="删除提币地址")
- @PostMapping(value="/memberDelCoinAddress")
- public Result memberDelCoinAddress(@RequestBody @Valid MemberDelCoinAddressDto memberDelCoinAddressDto) {
- return memberService.memberDelCoinAddress(memberDelCoinAddressDto);
- }
-
- /**
- * 获取发送验证码途径
- * @return
- */
- @ApiOperation(value = "获取发送验证码途径", notes = "获取发送验证码途径")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberSendCodeWayVo.class)})
- @GetMapping(value = "/memberSendCodeWay")
- public Result memberSendCodeWay() {
- return memberService.memberSendCodeWay();
- }
-
- /**
- * 获取个人中心信息
- * @return
- */
- @ApiOperation(value = "获取个人中心信息", notes = "获取个人中心信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberPersonCenterInfoVo.class)})
- @GetMapping(value = "/memberPersonCenterInfo")
- public Result memberPersonCenterInfo() {
- return memberService.memberPersonCenterInfo();
- }
-
- /**
- * 提币币种信息
- * @return
- */
- @ApiOperation(value = "获取提币币种信息", notes = "获取提币币种信息")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberCoinInfoListVo.class)})
- @GetMapping(value = "/memberCoinInfoList")
- public Result memberCoinInfoList() {
- return memberService.memberCoinInfoList();
- }
-
- /**
- * 提币币种可用资金
- * @param token
- * @param coinVo
- * @return
- */
- @ApiOperation(value = "提币币种可用资金", notes = "提币币种可用资金")
- @ApiResponses({@ApiResponse( code = 200, message = "success", response = MemberAvivableCoinInfoVo.class)})
- @ApiImplicitParams({
- @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
- })
- @GetMapping(value = "/memberAvivableCoinInfo")
- public Result memberAvivableCoinInfo(String symbol) {
- return memberService.memberAvivableCoinInfo(symbol);
- }
-
- /**
- * 提币申请
- * @param token
- * @param coinVo
- * @return
- */
- @ApiOperation(value="提交提币申请", notes="提交提币申请")
- @PostMapping(value="/memberSubmitCoinApply")
- public Result memberSubmitCoinApply(@RequestBody @Valid MemberSubmitCoinApplyDto memberSubmitCoinApplyDto) {
- return memberService.memberSubmitCoinApply(memberSubmitCoinApplyDto);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/AgentReturnDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/AgentReturnDao.java
deleted file mode 100644
index d20792d..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/AgentReturnDao.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface AgentReturnDao extends BaseMapper<AgentReturnEntity> {
-
- List<AgentReturnEntity> selectAllNeedMoneyReturn();
-
- int updateAgentReturnStatusByRefererId(@Param("isReturn") int isReturn, @Param("refererId") Long refererId);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/AppVersionDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/AppVersionDao.java
deleted file mode 100644
index d487e27..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/AppVersionDao.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.AppVersionEntity;
-
-public interface AppVersionDao extends BaseMapper<AppVersionEntity> {
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberAuthenticationDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberAuthenticationDao.java
deleted file mode 100644
index 51e3adb..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberAuthenticationDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberAuthenticationEntity;
-
-public interface MemberAuthenticationDao extends BaseMapper<MemberAuthenticationEntity> {
-
- int findMemberbyIdCardNoCount(String idCardNo);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java
deleted file mode 100644
index b9fea92..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinAddressDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
-
-public interface MemberCoinAddressDao extends BaseMapper<MemberCoinAddressEntity> {
-
- MemberCoinAddressEntity selectAddressByMemberIdAndSymbol(Long memberId, String symbol);
-
- MemberCoinAddressEntity selectBlockAddressWithTag(@Param("memberId") Long memberId, @Param("symbol") String symbol, @Param("tag") String tag);
-
- MemberCoinAddressEntity selectBlockAddress(@Param("memberId") Long memberId, @Param("symbol") String symbol);
-
- List<MemberCoinAddressEntity> selectCoinAddressListByMap(@Param("symbol") String symbol, @Param("memberId") Long memberId);
-
- List<MemberCoinAddressEntity> selectAllBlockAddressBySymbolAndTag(@Param("symbol") String symbol, @Param("tag") String tag);
-
- List<MemberCoinAddressEntity> selectAllBlockAddressBySymbol(@Param("symbol") String symbol);
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java
deleted file mode 100644
index c35bdb0..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinChargeDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface MemberCoinChargeDao extends BaseMapper<MemberCoinChargeEntity> {
-
- public MemberCoinChargeEntity selectNewestChargeRecord(@Param("memberId") Long memberId, @Param("symbol") String symbol, @Param("tag") String tag);
-
- List<MemberCoinChargeEntity> selectAllBySymbolAndTag(@Param("symbol") String symbol, @Param("tag") String tag, @Param("status") Integer status);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java
deleted file mode 100644
index 75ce0f4..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberCoinWithdrawDao.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberCoinWithdrawEntity;
-
-public interface MemberCoinWithdrawDao extends BaseMapper<MemberCoinWithdrawEntity> {
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java
deleted file mode 100644
index b7e285a..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberDao.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-import com.xcong.excoin.modules.member.parameter.vo.NeedMoneyMemberVo;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author wzy
- */
-public interface MemberDao extends BaseMapper<MemberEntity> {
-
- public MemberEntity selectMemberInfoByAccount(@Param("account") String account);
-
- public MemberEntity selectMemberInfoByInviteId(@Param("inviteId") String inviteId);
-
- public NeedMoneyMemberVo selectFriendRelationUserByMemberId(@Param("memberId") Long memberId);
-
- public List<NeedMoneyMemberVo> selectAllNeedMoneyMember(@Param("list") List<String> list);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberLevelRateDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberLevelRateDao.java
deleted file mode 100644
index bfea23f..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberLevelRateDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberLevelRateEntity;
-import org.apache.ibatis.annotations.Param;
-
-public interface MemberLevelRateDao extends BaseMapper<MemberLevelRateEntity> {
-
- public MemberLevelRateEntity selectLeverRateByMemberIdAndSymbol(@Param("memberId") Long memberId, @Param("symbol") String symbol);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberPaymentMethodDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberPaymentMethodDao.java
deleted file mode 100644
index 1aaebf2..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberPaymentMethodDao.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberPaymentMethodEntity;
-
-public interface MemberPaymentMethodDao extends BaseMapper<MemberPaymentMethodEntity> {
-
- public List<MemberPaymentMethodEntity> selectByMemberId(Long memberId);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberSettingDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberSettingDao.java
deleted file mode 100644
index 620a813..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberSettingDao.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-08-13
- **/
-public interface MemberSettingDao extends BaseMapper<MemberSettingEntity> {
-
- public MemberSettingEntity selectMemberSettingByMemberId(@Param("memberId") Long memberId);
-
- public int batchInsert(@Param("list") List<MemberSettingEntity> list);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletAgentDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletAgentDao.java
deleted file mode 100644
index 595a570..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletAgentDao.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
-
-public interface MemberWalletAgentDao extends BaseMapper<MemberWalletAgentEntity> {
-
- MemberWalletAgentEntity selectWalletAgentBymIdAndCode(@Param("memberId")Long memberId,@Param("walletCode")String walletCode);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletCoinDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletCoinDao.java
deleted file mode 100644
index 66a50dc..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletCoinDao.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
-
-/**
- * @author wzy
- */
-public interface MemberWalletCoinDao extends BaseMapper<MemberWalletCoinEntity> {
-
- List<MemberWalletCoinEntity> selectMemberWalletCoinsByMemberId(Long memberId);
-
- MemberWalletCoinEntity selectWalletCoinBymIdAndCode(@Param("memberId") Long memberId, @Param("walletCode") String walletCode);
-
- int updateFrozenBalance(@Param("memberId") Long memberId, @Param("id") Long id, @Param("amount") BigDecimal amount);
-
- int subFrozenBalance(@Param("memberId") Long memberId, @Param("id") Long id, @Param("amount") BigDecimal amount);
-
- int updateBlockBalance(@Param("id") Long id, @Param("availableBalance") BigDecimal availableBalance, @Param("earlyBalance") BigDecimal earlyBalance, @Param("blockNumber") Integer blockNumber);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractDao.java
deleted file mode 100644
index e12db7e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractDao.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-
-import java.math.BigDecimal;
-
-public interface MemberWalletContractDao extends BaseMapper<MemberWalletContractEntity> {
-
- MemberWalletContractEntity findWalletContractByMemberIdAndSymbol(@Param("memberId")Long memberId, @Param("symbol")String symbol);
-
- /**
- * 增减合约钱包(负数为减)
- * @param availableBalance
- * @param totalBalance
- * @param frozenBalance
- * @param id
- */
- void increaseWalletContractBalanceById(@Param("availableBalance") BigDecimal availableBalance,@Param("totalBalance") BigDecimal totalBalance,@Param("frozenBalance") BigDecimal frozenBalance,@Param("id") Long id);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractSimulateDao.java b/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractSimulateDao.java
deleted file mode 100644
index ca43023..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/dao/MemberWalletContractSimulateDao.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.xcong.excoin.modules.member.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractSimulateEntity;
-
-/**
- * @author helius
- */
-public interface MemberWalletContractSimulateDao extends BaseMapper<MemberWalletContractSimulateEntity> {
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/AgentReturnEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/AgentReturnEntity.java
deleted file mode 100644
index 4cefe1a..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/AgentReturnEntity.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-31
- **/
-@Data
-@TableName("agent_return")
-public class AgentReturnEntity extends BaseEntity {
-
- /**
- * 订单类型 开仓
- */
- public static final int ORDER_TYPE_OPEN = 1;
-
- /**
- * 订单类型 平仓
- */
- public static final int ORDER_TYPE_CLOSE = 2;
-
- /**
- * 订单类型 持仓
- */
- public static final int ORDER_TYPE_HOLD = 3;
-
- /**
- * 是否已返佣 0-否
- */
- public static final int IS_RETURN_N = 0;
-
- /**
- * 是否已返佣 1-是
- */
- public static final int IS_RETURN_Y = 1;
-
- private Long memberId;
-
- private Long orderId;
-
- private String orderNo;
-
- private int orderType;
-
- private BigDecimal closingFeeAmount;
-
- private BigDecimal holdingFeeAmount;
-
- private BigDecimal openingFeeAmount;
-
- private BigDecimal returnAmount;
-
- private Long refererId;
-
- private String inviteId;
-
- private BigDecimal returnRatio;
-
- private BigDecimal childReturnRatio;
-
- /**
- * 0-否1-是
- */
- private int isReturn;
-
- private String returnSymbol;
-
- private int closingType;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/AppVersionEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/AppVersionEntity.java
deleted file mode 100644
index 2261fdc..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/AppVersionEntity.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import lombok.Data;
-/**
- * 版本表
- *
- **/
-@Data
-@TableName("app_version")
-public class AppVersionEntity implements Serializable {
- /**
- * 账号状态 - 禁用
- */
- public static final Integer type_and = 1;
-
- /**
- * 账号状态 - 启用
- */
- public static final Integer type_app = 2;
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date createtime;
-
- private String version;
- private String content;
- private String address;
- private Integer type;
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberAuthenticationEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberAuthenticationEntity.java
deleted file mode 100644
index 619df68..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberAuthenticationEntity.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-/**
- * 用户实名认证信息实体
- *
- * @author wzy
- * @date 2020-05-18
- **/
-@Data
-@TableName("member_authentication")
-public class MemberAuthenticationEntity extends BaseEntity {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 用户ID
- */
- private Long memberId;
-
- /**
- * 真实姓名
- */
- private String realName;
-
- /**
- * 姓
- */
- private String firstName;
-
- /**
- * 名
- */
- private String secondName;
-
- /**
- * 国家
- */
- private String nation;
-
- /**
- * 身份证号
- */
- private String idcardNo;
-
- /**
- * 证件类型
- */
- private String type;
-
- /**
- * 身份证正面
- */
- private String idcardImageFront;
-
- /**
- * 身份证背面
- */
- private String idcardImageBack;
-
- /**
- * 手持身份证
- */
- private String idcardImageInHand;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinAddressEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinAddressEntity.java
deleted file mode 100644
index 853703c..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinAddressEntity.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-/**
- * 会员币地址
- * @author Administrator
- *
- */
-@Data
-@TableName("member_coin_address")
-public class MemberCoinAddressEntity extends BaseEntity {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * 会员ID
- */
- private Long memberId;
- /**
- * 地址
- */
- private String address;
- /**
- * 私钥
- */
- private String privateKey;
- /**
- * 币种
- */
- private String symbol;
- /**
- * 是否是本平台地址1:是 0:否
- */
- private String isBiyict;
- public static final String IS_BIYICT_YES = "1";
- public static final String IS_BIYICT_NO = "2";
- /**
- *
- */
- private String label;
- /**
- *
- */
- private String tag;
- /**
- * 币种ID
- */
- private Long symbolscoinId;
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinChargeEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinChargeEntity.java
deleted file mode 100644
index 8171578..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinChargeEntity.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-07-02
- **/
-@Data
-@TableName("member_coin_charge")
-public class MemberCoinChargeEntity extends BaseEntity {
-
- private Long memberId;
-
- private String certificate;
-
- private BigDecimal amount;
-
- private BigDecimal lastAmount;
-
- private int status;
-
- private String symbol;
-
- private String address;
-
- private String tag;
-
- private String hash;
-
- private String orderCode;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinWithdrawEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinWithdrawEntity.java
deleted file mode 100644
index cea3765..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberCoinWithdrawEntity.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-/**
- * 会员提币表
- */
-@Data
-@TableName("member_coin_withdraw")
-public class MemberCoinWithdrawEntity extends BaseEntity{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * 会员ID
- */
- private Long memberId;
- /**
- * 地址
- */
- private String address;
- /**
- * 提币数量
- */
- private BigDecimal amount;
- /**
- * 手续费
- */
- private BigDecimal feeAmount;
- /**
- * 币种
- */
- private String symbol;
- /**
- * 状态
- */
- private int status;
- public static final int STATUS_DOING = 1;
- /**
- * 是否内部转账 Y-是N-不是
- */
- private String isInside;
- public static final String ISINSIDE_YES = "Y";
- public static final String ISINSIDE_NO = "N";
-
- private String label;
-
- private String tag;
-
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java
deleted file mode 100644
index aaa7e5e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberEntity.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-import java.math.BigDecimal;
-
-/**
- * 会员信息实体
- *
- * @author wzy
- * @date 2020-05-12
- **/
-@Data
-@TableName("member")
-public class MemberEntity extends BaseEntity {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 账号状态 - 禁用
- */
- public static final Integer ACCOUNT_STATUS_DISABLED = 0;
-
- /**
- * 账号状态 - 启用
- */
- public static final Integer ACCOUNT_STATUS_ENABLE = 1;
-
- /**
- * 账号代理级别
- */
- public static final Integer ACCOUNT_AGENT_LEVEL = 6;
-
- /**
- * 账号类型 手机
- */
- public static final Integer ACCOUNT_TYPE_PHONE = 1;
-
- /**
- * 账号类型 邮箱
- */
- public static final Integer ACCOUNT_TYPE_EMAIL = 2;
-
- /**
- * 正常账号
- */
- public static final Integer ACCOUNT_TYPE_NORMAL = 1;
- /**
- * 测试账号
- */
- public static final Integer ACCOUNT_TYPE_TEST = 2;
-
- /**
- * 实名认证 审核通过
- */
- public static final Integer CERTIFY_STATUS_Y = 2;
- /**
- * 实名认证 审核不通过
- */
- public static final Integer CERTIFY_STATUS_N = 0;
- /**
- * 实名认证 审核中
- */
- public static final Integer CERTIFY_STATUS_ING = 1;
- /**
- * 实名认证 未提交
- */
- public static final Integer CERTIFY_STATUS_UN_SUBMIT = 3;
-
- public static final int IS_PROFIT_Y = 1;
-
- public static final int IS_PROFIT_N = 0;
-
- /**
- * 手机号(包含国际手机号)
- */
- private String phone;
-
- /**
- * 邮箱
- */
- private String email;
-
- /**
- * 登陆密码
- */
- private String password;
-
- /**
- * 交易密码
- */
- private String tradePassword;
-
- /**
- * 交易密码时效性设置
- */
- private Integer tradeAgingSetting;
-
- /**
- * 邀请码
- */
- private String inviteId;
-
- /**
- * 账号状态 0-禁用 1-启用
- */
- private int accountStatus;
-
- /**
- * 上级推荐人id
- */
- private String refererId;
-
- /**
- * 上级推荐人ID链
- */
- private String refererIds;
-
- /**
- * 账号类型 1-正常账号 2-测试账号
- */
- private Integer accountType;
-
- /**
- * 代理级别
- */
- private Integer agentLevel;
-
- /**
- * 实名认证状态 0-审核未通过 1-审核通过 2-等待审核
- */
- private Integer certifyStatus;
-
- /**
- * 身份证号
- */
- private String idcardNo;
-
- /**
- * 是否设置盈亏难度系数 0-否1-是
- */
- private Integer isProfit;
-
- /**
- * 是否设置预估强平价系数 0-否1-是
- */
- private Integer isForce;
-
- /**
- * 滑点
- */
- private BigDecimal spread;
-
- /**
- * 平仓点数
- */
- private BigDecimal closingSpread;
-
- /**
- * 强平系数
- */
- private BigDecimal forceParam;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberLevelRateEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberLevelRateEntity.java
deleted file mode 100644
index ef68aab..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberLevelRateEntity.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-/**
- * 用户杠杆设置表
- *
- * @Author wzy
- * @Date 2020/5/18
- **/
-@Data
-@TableName("member_level_rate")
-public class MemberLevelRateEntity extends BaseEntity {
-
- /**
- * 会员ID
- */
- private Long memberId;
-
- /**
- * 多头杠杆
- */
- private int levelRateUp = 100;
-
- /**
- * 空头杠杆
- */
- private int levelRateDown = 100;
-
- /**
- * 币种
- */
- private String symbol;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberPaymentMethodEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberPaymentMethodEntity.java
deleted file mode 100644
index be0e903..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberPaymentMethodEntity.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-/**
- * 会员收款方式
- */
-@Data
-@TableName("member_payment_method")
-public class MemberPaymentMethodEntity extends BaseEntity{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 用户Id
- */
- private Long memberId;
- /**
- * 姓名
- */
- private String name;
- /**
- * 账号
- */
- private String account;
- /**
- * 收款二维码
- */
- private String paymentQrcode;
- /**
- * 银行
- */
- private String bank;
- /**
- * 支行
- */
- private String subBank;
- /**
- * 类型 1-支付宝2-微信3-银行卡
- */
- private String paymentType;
- public static final Integer PAYMENTTYPE_ALIPAY = 1;
- public static final Integer PAYMENTTYPE_WECHAT = 2;
- public static final Integer PAYMENTTYPE_CARD = 3;
-
- /**
- * 默认收款方式
- */
- private String isDefualt;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java
deleted file mode 100644
index 8b5b5fd..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-
-/**
- * 会员自选币种
- */
-@Data
-@TableName("member_select_symbols")
-public class MemberSelectSymbolsEntity extends BaseEntity{
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * 会员ID
- */
- private long memberId;
- /**
- * 币种
- */
- private String symbol;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberSettingEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberSettingEntity.java
deleted file mode 100644
index 36ea5a7..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberSettingEntity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-08-13
- **/
-@Data
-@TableName("member_setting")
-public class MemberSettingEntity extends BaseEntity {
-
- private Long memberId;
-
- /**
- * 滑点
- */
- private BigDecimal spread;
-
- /**
- * 平仓点数
- */
- private BigDecimal closingSpread;
-
- /**
- * 强平系数
- */
- private BigDecimal forceParam;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletAgentEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletAgentEntity.java
deleted file mode 100644
index bb067cf..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletAgentEntity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 代理用户钱包
- *
- * @author wzy
- * @date 2020-05-18
- **/
-@Data
-@TableName("member_wallet_agent")
-public class MemberWalletAgentEntity extends BaseEntity {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * 用户Id
- */
- private Long memberId;
-
- /**
- * 可用余额
- */
- private BigDecimal availableBalance = AppContants.INIT_MONEY;
-
- /**
- * 总金额
- */
- private BigDecimal totalBalance = AppContants.INIT_MONEY;
-
- /**
- * 冻结金额
- */
- private BigDecimal frozenBalance = AppContants.INIT_MONEY;
-
- /**
- * 借入资产金额
- */
- private BigDecimal borrowedFund = AppContants.INIT_MONEY;
-
- /**
- * 钱包标识
- */
- private String walletCode;
-
- /**
- * 钱包地址
- */
- private String walletAddress;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletCoinEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletCoinEntity.java
deleted file mode 100644
index f2bd58c..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletCoinEntity.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-18
- **/
-@Data
-@TableName("member_wallet_coin")
-public class MemberWalletCoinEntity extends BaseEntity {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 用户Id
- */
- private Long memberId;
-
- /**
- * 可用余额
- */
- private BigDecimal availableBalance;
-
- /**
- * 总金额
- */
- private BigDecimal totalBalance;
-
- /**
- * 冻结金额
- */
- private BigDecimal frozenBalance;
-
- /**
- * 借入资产金额
- */
- private BigDecimal borrowedFund;
-
- /**
- * 钱包标识
- */
- private String walletCode;
-
- /**
- * 钱包地址
- */
- private String walletAddress;
-
- /**
- * 上次余额
- */
- private BigDecimal earlyBalance;
-
- /**
- * 区块编号
- */
- private int blockNumber;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractEntity.java
deleted file mode 100644
index 91cd275..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractEntity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-18
- **/
-@Data
-@TableName("member_wallet_contract")
-public class MemberWalletContractEntity extends BaseEntity {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private Long memberId;
-
- private BigDecimal availableBalance;
-
- private BigDecimal totalBalance;
-
- private BigDecimal frozenBalance;
-
- private BigDecimal borrowedFund;
-
- private String walletCode;
-
- private String walletAddress;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractSimulateEntity.java b/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractSimulateEntity.java
deleted file mode 100644
index 6554e6e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberWalletContractSimulateEntity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.member.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-18
- **/
-@Data
-@TableName("member_wallet_contract_simulate")
-public class MemberWalletContractSimulateEntity extends BaseEntity {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private Long memberId;
-
- private BigDecimal availableBalance;
-
- private BigDecimal totalBalance;
-
- private BigDecimal frozenBalance;
-
- private BigDecimal borrowedFund;
-
- private String walletCode;
-
- private String walletAddress;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAddCoinAddressDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAddCoinAddressDto.java
deleted file mode 100644
index 4bf9314..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAddCoinAddressDto.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAddCoinAddressDto", description = "增加提币地址参数接收类")
-public class MemberAddCoinAddressDto {
-
- @NotNull(message = "币种ID不能为空")
- @ApiModelProperty(value = "币种ID")
- private Long symbolscoinId;
- /**
- * 地址
- */
- @NotNull(message = "地址不能为空")
- @ApiModelProperty(value = "地址")
- private String address;
- /**
- * 是否是本平台地址1:是 0:否
- */
- @NotNull(message = "是否是本平台地址不能为空")
- @ApiModelProperty(value = "是否是本平台地址1:是 0:否")
- private String isBiyict;
- /**
- * 备注
- */
- @ApiModelProperty(value = "备注")
- private String remark;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAuthenticationDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAuthenticationDto.java
deleted file mode 100644
index 60d7bb2..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberAuthenticationDto.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAuthenticationDto", description = "实名认证参数接收类")
-public class MemberAuthenticationDto {
-
- @NotNull(message = "姓不能为空")
- @ApiModelProperty(value = "姓", example = "姓")
- private String firstName;
-
- @NotNull(message = "名不能为空")
- @ApiModelProperty(value = "名", example = "名")
- private String secondName;
-
- @NotNull(message = "真实姓名不能为空")
- @ApiModelProperty(value = "真实姓名", example = "姓名")
- private String realName;
-
- @NotNull(message = "身份证卡号不能为空")
- @ApiModelProperty(value = "身份证卡号", example = "123456789")
- private String idCardNo;
-
- @NotNull(message = "身份证正面不能为空")
- @ApiModelProperty(value = "身份证正面", example = "身份证正面")
- private String idCardFront;
-
- @NotNull(message = "身份证反面不能为空")
- @ApiModelProperty(value = "身份证反面", example = "身份证反面")
- private String idCardReverse;
-
- @NotNull(message = "手持身份证不能为空")
- @ApiModelProperty(value = "手持身份证", example = "手持身份证")
- private String idCardImage;
-
- @NotNull(message = "国家不能为空")
- @ApiModelProperty(value = "国家", example = "国家")
- private String nation;
-
- @NotNull(message = "类型不能为空")
- @ApiModelProperty(value = "类型1:身份证2:护照编号", example = "1")
- private String type;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindEmailDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindEmailDto.java
deleted file mode 100644
index 1a8f2cc..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindEmailDto.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberBindEmailDto", description = "绑定邮箱参数接收类")
-public class MemberBindEmailDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "邮箱不能为空")
- @ApiModelProperty(value = "邮箱", example = "www.13412341234@134.com")
- private String email;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindPhoneDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindPhoneDto.java
deleted file mode 100644
index f7d6afc..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberBindPhoneDto.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberBindPhoneDto", description = "绑定手机号参数接收类")
-public class MemberBindPhoneDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "电话号码不能为空")
- @ApiModelProperty(value = "电话号码", example = "13412341234")
- private String phone;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelCoinAddressDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelCoinAddressDto.java
deleted file mode 100644
index 0277ead..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelCoinAddressDto.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberDelCoinAddressDto", description = "删除提币地址参数接收类")
-public class MemberDelCoinAddressDto {
-
- @NotNull(message = "提币地址ID不能为空")
- @ApiModelProperty(value = "提币地址ID", example = "1")
- private Long id;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelPaymethodDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelPaymethodDto.java
deleted file mode 100644
index 1135c4a..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberDelPaymethodDto.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberDelPaymethodDto", description = "删除收款方式参数接收类")
-public class MemberDelPaymethodDto {
-
- @NotNull(message = "收款方式ID不能为空")
- @ApiModelProperty(value = "收款方式ID", example = "1")
- private Long id;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberForgetPwdDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberForgetPwdDto.java
deleted file mode 100644
index 9ff9a5d..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberForgetPwdDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberForgetPwdDto", description = "忘记密码参数接收类")
-public class MemberForgetPwdDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "新密码不能为空")
- @ApiModelProperty(value = "新密码", example = "qq123456")
- private String password;
-
- @NotNull(message = "验证类型不能为空")
- @ApiModelProperty(value = "验证类型 1 手机号码 2 邮箱", example = "1")
- private int type;
-
- @NotNull(message = "验证账号不能为空")
- @ApiModelProperty(value = "验证账号", example = "13412341234")
- private String account;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberPaymethodDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberPaymethodDto.java
deleted file mode 100644
index fa2a3b2..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberPaymethodDto.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberPaymethodDto", description = "收款方式参数接收类")
-public class MemberPaymethodDto {
- /**
- * 姓名
- */
- @NotNull(message = "姓名不能为空")
- @ApiModelProperty(value = "姓名", example = "姓名")
- private String name;
- /**
- * 账号
- */
- @NotNull(message = "账号不能为空")
- @ApiModelProperty(value = "账号", example = "13412341234")
- private String account;
- /**
- * 收款二维码
- */
- @ApiModelProperty(value = "账号", example = "13412341234")
- private String paymentQrcode;
- /**
- * 银行
- */
- @ApiModelProperty(value = "银行", example = "银行")
- private String bank;
- /**
- * 支行
- */
- @ApiModelProperty(value = "支行", example = "支行")
- private String subBank;
- /**
- * 类型 1-支付宝2-微信3-银行卡
- */
- @NotNull(message = "类型不能为空")
- @ApiModelProperty(value = "类型 1-支付宝2-微信3-银行卡", example = "1")
- private String paymentType;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberSubmitCoinApplyDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberSubmitCoinApplyDto.java
deleted file mode 100644
index 5d4fa7b..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberSubmitCoinApplyDto.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import java.math.BigDecimal;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberSubmitCoinApplyDto", description = "提交提币申请参数接收类")
-public class MemberSubmitCoinApplyDto {
-
- @NotNull(message = "地址不能为空")
- @ApiModelProperty(value = "地址", example = "asfdsdafsdafdsaf1231232sdfsa")
- private String address;
-
- @NotNull(message = "币数量不能为空")
- @ApiModelProperty(value = "币数量", example = "10")
- private BigDecimal coinNumber;
-
- @NotNull(message = "手续费不能为空")
- @ApiModelProperty(value = "手续费", example = "10")
- private BigDecimal feeAmount;
-
- @NotNull(message = "交易密码不能为空")
- @ApiModelProperty(value = "交易密码", example = "123456")
- private String tradePassword;
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "验证方式不能为空")
- @ApiModelProperty(value = "验证方式", example = "13412341234")
- private String account;
-
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "BTC")
- private String symbol;
-
- @ApiModelProperty(value = "姓名", example = "姓名")
- private String lable;
-
- @ApiModelProperty(value = "姓名", example = "姓名")
- private String tag;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTradersPwdDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTradersPwdDto.java
deleted file mode 100644
index 884119f..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberTradersPwdDto.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberTradersPwdDto", description = "设置交易密码参数接收类")
-public class MemberTradersPwdDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "新密码不能为空")
- @ApiModelProperty(value = "新密码", example = "qq123456")
- private String password;
-
- @NotNull(message = "验证类型不能为空")
- @ApiModelProperty(value = "验证类型 1 手机号码 2 邮箱", example = "1")
- private int type;
-
- @ApiModelProperty(value = "电话号码", example = "13412341234")
- private String phone;
-
- @ApiModelProperty(value = "邮箱", example = "www.13412341234@123.com")
- private String email;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdatePwdDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdatePwdDto.java
deleted file mode 100644
index 0e2b96c..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdatePwdDto.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberUpdatePwdDto", description = "修改密码参数接收类")
-public class MemberUpdatePwdDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "新密码不能为空")
- @ApiModelProperty(value = "新密码", example = "qq123456")
- private String password;
-
- @NotNull(message = "验证类型不能为空")
- @ApiModelProperty(value = "验证类型 1 手机号码 2 邮箱", example = "1")
- private int type;
-
- @ApiModelProperty(value = "电话号码", example = "13412341234")
- private String phone;
-
- @ApiModelProperty(value = "邮箱", example = "www.13412341234@123.com")
- private String email;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradePwdDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradePwdDto.java
deleted file mode 100644
index 650b4d7..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradePwdDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberUpdateTradePwdDto", description = "修改资金密码参数接收类")
-public class MemberUpdateTradePwdDto {
-
- @NotNull(message = "验证码不能为空")
- @ApiModelProperty(value = "验证码", example = "123456")
- private String code;
-
- @NotNull(message = "新密码不能为空")
- @ApiModelProperty(value = "新密码", example = "qq123456")
- private String password;
-
- @NotNull(message = "验证类型不能为空")
- @ApiModelProperty(value = "验证类型 1 手机号码 2 邮箱", example = "1")
- private int type;
-
- @NotNull(message = "验证账号不能为空")
- @ApiModelProperty(value = "验证账号", example = "13412341234")
- private String account;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradersPwdTimeDto.java b/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradersPwdTimeDto.java
deleted file mode 100644
index 09da5a6..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/dto/MemberUpdateTradersPwdTimeDto.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.dto;
-
-import javax.validation.constraints.NotNull;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberUpdateTradersPwdTimeDto", description = "修改资金密码时效性接收类")
-public class MemberUpdateTradersPwdTimeDto {
-
- @NotNull(message = "交易密码时效性设置不能为空")
- @ApiModelProperty(value = "交易密码时效性设置1:一直需要输入密码 2不需要输入密码", example = "1")
- private Integer tradeAgingSetting;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionListVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionListVo.java
deleted file mode 100644
index 2d11e03..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "AppVersionListVo", description = "版本信息列表")
-public class AppVersionListVo {
-
- @ApiModelProperty(value = "版本信息")
- private List<AppVersionVo> appVersionVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionVo.java
deleted file mode 100644
index e3da351..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/AppVersionVo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "AppVersionVo", description = "版本号信息")
-public class AppVersionVo {
-
- @ApiModelProperty(value = "版本号")
- private String version;
-
- @ApiModelProperty(value = "下载地址")
- private String address;
-
- @ApiModelProperty(value = "类型:1安卓,2苹果")
- private Integer type;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAuthenticationInfoVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAuthenticationInfoVo.java
deleted file mode 100644
index c680aa3..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAuthenticationInfoVo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAuthenticationInfoVo", description = "实名认证信息")
-public class MemberAuthenticationInfoVo {
-
- @ApiModelProperty(value = "实名认证状态 0-审核未通过 1-审核中 2-审核通过")
- private Integer certifyStatus;
-
- @ApiModelProperty(value = "姓")
- private String firstName;
-
- @ApiModelProperty(value = "名")
- private String secondName;
-
- @ApiModelProperty(value = "身份证卡号")
- private String idCardNo;
-
- @ApiModelProperty(value = "证件类型")
- private String type;
-
- @ApiModelProperty(value = "国家")
- private String nation;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAvivableCoinInfoVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAvivableCoinInfoVo.java
deleted file mode 100644
index 7231563..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberAvivableCoinInfoVo.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberAvivableCoinInfoVo", description = "提币币种可用资金信息")
-public class MemberAvivableCoinInfoVo {
-
- @ApiModelProperty(value = "可用余额")
- private BigDecimal availableBalance;
-
- @ApiModelProperty(value = "手续费")
- private BigDecimal fee;
-
- @ApiModelProperty(value = "USDT链名")
- private String lable;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountListVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountListVo.java
deleted file mode 100644
index 0ef11f8..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountListVo.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinAddressCountListVo", description = "币种地址信息")
-public class MemberCoinAddressCountListVo {
-
-
- @ApiModelProperty(value = "币种地址")
- private List<MemberCoinAddressCountVo> memberCoinAddressCountVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountVo.java
deleted file mode 100644
index 7d52ead..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressCountVo.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinAddressCountVo", description = "币种地址数量信息")
-public class MemberCoinAddressCountVo {
-
- @ApiModelProperty(value = "ID")
- private Long id;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String name;
- /**
- * 地址数量
- */
- @ApiModelProperty(value = "地址数量")
- private Integer count;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressListVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressListVo.java
deleted file mode 100644
index a35d316..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinAddressListVo", description = "币种地址信息")
-public class MemberCoinAddressListVo {
-
- @ApiModelProperty(value = "币种地址")
- private List<MemberCoinAddressVo> memberCoinAddressVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressVo.java
deleted file mode 100644
index 5532f0b..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinAddressVo.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinAddressVo", description = "地址信息")
-public class MemberCoinAddressVo {
-
- @ApiModelProperty(value = "ID")
- private Long id;
- /**
- * 会员ID
- */
- @ApiModelProperty(value = "会员ID")
- private Long memberId;
- /**
- * 地址
- */
- @ApiModelProperty(value = "地址")
- private String address;
- /**
- * 私钥
- */
- @ApiModelProperty(value = "私钥")
- private String privateKey;
- /**
- * 币种
- */
- @ApiModelProperty(value = "币种")
- private String symbol;
- /**
- * 是否是本平台地址1:是 0:否
- */
- @ApiModelProperty(value = "是否是本平台地址1:是 0:否")
- private String isBiyict;
-
- @ApiModelProperty(value = "备注")
- private String label;
-
- @ApiModelProperty(value = "ID")
- private Long symbolscoinId;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoListVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoListVo.java
deleted file mode 100644
index a5ac662..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinInfoListVo", description = "币种信息")
-public class MemberCoinInfoListVo {
-
- @ApiModelProperty(value = "币种名称")
- private List<MemberCoinInfoVo> memberCoinInfoVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoVo.java
deleted file mode 100644
index 36d950e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberCoinInfoVo.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberCoinInfoVo", description = "币种信息")
-public class MemberCoinInfoVo {
-
- @ApiModelProperty(value = "币种名称")
- private String name;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberInfoVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberInfoVo.java
deleted file mode 100644
index 6ab0a86..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberInfoVo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberInfoVo", description = "个人信息")
-public class MemberInfoVo {
-
- /**
- * 手机号(包含国际手机号)
- */
- @ApiModelProperty(value = "手机号(包含国际手机号)")
- private String phone;
-
- /**
- * 邀请码
- */
- @ApiModelProperty(value = "邀请码")
- private String inviteId;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailListVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailListVo.java
deleted file mode 100644
index 19f1b91..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailListVo.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberPaymethodDetailListVo", description = "收款方式列表")
-public class MemberPaymethodDetailListVo {
-
- @ApiModelProperty(value = "收款方式列表")
- private List<MemberPaymethodDetailVo> memberPaymethodDetailVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailVo.java
deleted file mode 100644
index 72161ed..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPaymethodDetailVo.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberPaymethodDetailVo", description = "收款方式信息")
-public class MemberPaymethodDetailVo {
-
- /**
- * Id
- */
- @ApiModelProperty(value = "Id")
- private Long id;
- /**
- * 用户Id
- */
- @ApiModelProperty(value = "用户Id")
- private Long memberId;
- /**
- * 姓名
- */
- @ApiModelProperty(value = "姓名")
- private String name;
- /**
- * 账号
- */
- @ApiModelProperty(value = "账号")
- private String account;
- /**
- * 收款二维码
- */
- @ApiModelProperty(value = "收款二维码")
- private String paymentQrcode;
- /**
- * 银行
- */
- @ApiModelProperty(value = "银行")
- private String bank;
- /**
- * 支行
- */
- @ApiModelProperty(value = "支行")
- private String subBank;
- /**
- * 类型 1-支付宝2-微信3-银行卡
- */
- @ApiModelProperty(value = "类型 1-支付宝2-微信3-银行卡")
- private String paymentType;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPersonCenterInfoVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPersonCenterInfoVo.java
deleted file mode 100644
index 97576fc..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberPersonCenterInfoVo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberPersonCenterInfoVo", description = "个人中心信息")
-public class MemberPersonCenterInfoVo {
-
- @ApiModelProperty(value = "手机号(包含国际手机号)1:有 0没有")
- private Integer phone;
-
- @ApiModelProperty(value = "邮箱1:有 0没有")
- private Integer email;
-
- @ApiModelProperty(value = "交易密码1:有 0没有")
- private Integer tradePassword;
-
- @ApiModelProperty(value = "收款方式1:有 0没有")
- private Integer memberPaymentMethod;
-
- @ApiModelProperty(value = "实名认证0:审核不通过 1:审核中 2: 审核通过 3:未提交")
- private Integer certifyStatus;
-
- @ApiModelProperty(value = "交易密码时效性设置1:一直需要输入密码 2不需要输入密码")
- private Integer tradeAgingSetting;
- /**
- * 一直需要输入密码
- */
- public static final int PWD_NEED_FORVER = 1;
-
- /**
- * 不需要输入密码
- */
- public static final int PWD_NEED_NO = 2;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberSendCodeWayVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberSendCodeWayVo.java
deleted file mode 100644
index 3f01954..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/MemberSendCodeWayVo.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-@Data
-@ApiModel(value = "MemberSendCodeWayVo", description = "发送验证码途径信息")
-public class MemberSendCodeWayVo {
-
- /**
- * 手机号(包含国际手机号)
- */
- @ApiModelProperty(value = "手机号(包含国际手机号)")
- private String phone;
-
- /**
- * 邮箱
- */
- @ApiModelProperty(value = "邮箱")
- private String email;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/NeedMoneyMemberVo.java b/src/main/java/com/xcong/excoin/modules/member/parameter/vo/NeedMoneyMemberVo.java
deleted file mode 100644
index 0e06255..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/parameter/vo/NeedMoneyMemberVo.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.xcong.excoin.modules.member.parameter.vo;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 返佣用户
- */
-@Data
-public class NeedMoneyMemberVo {
- private Long memberId;
- private String inviteId;
- private String referenceId;
- private BigDecimal returnRatio;
- private int levelId;
- private int feeIsSelf;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java b/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java
deleted file mode 100644
index ae6e757..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/service/MemberService.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.xcong.excoin.modules.member.service;
-
-import javax.validation.Valid;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.dto.RegisterDto;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto;
-import com.xcong.excoin.modules.member.parameter.vo.NeedMoneyMemberVo;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author wzy
- */
-public interface MemberService extends IService<MemberEntity> {
-
- public Result register(RegisterDto registerDto);
-
- public Result getMemberInfo();
-
- public Result memberAuthentication(@Valid MemberAuthenticationDto memberAuthenticationDto);
-
- public Result memberForgetPwd(@Valid MemberForgetPwdDto memberForgetPwdDto);
-
- public Result memberUpdatePwd(@Valid MemberUpdatePwdDto memberUpdatePwdDto);
-
- public Result memberUpdateTradePwd(@Valid MemberUpdateTradePwdDto memberUpdateTradePwdDto);
-
- public Result memberLogout();
-
- public Result memberTradersPwd(@Valid MemberForgetPwdDto memberForgetPwdDto);
-
- public Result memberAddPaymethod(@Valid MemberPaymethodDto memberPaymethodDto);
-
- public Result memberDelPaymethod(@Valid MemberDelPaymethodDto memberDelPaymethodDto);
-
- public Result memberPaymethodDetail(long id);
-
- public Result memberPaymethodDetailList();
-
- public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto);
-
- public Result memberBindEmail(@Valid MemberBindEmailDto memberBindEmailDto);
-
- public Result memberCoinAddressCount();
-
- public Result memberCoinAddressList(String symbol);
-
- public Result memberAddCoinAddress(@Valid MemberAddCoinAddressDto memberAddCoinAddressDto);
-
- public Result memberSendCodeWay();
-
- public Result memberDelCoinAddress(@Valid MemberDelCoinAddressDto memberDelCoinAddressDto);
-
- public Result memberAuthenticationInfo();
-
- public Result memberPersonCenterInfo();
-
- public Result memberCoinInfoList();
-
- public Result memberAvivableCoinInfo(String symbol);
-
- public NeedMoneyMemberVo selectFriendRelationUserByMemberId(Long memberId);
-
- public List<NeedMoneyMemberVo> selectAllNeedMoneyMember(List<String> list);
-
- public MemberEntity selectMemberInfoByInviteId(String inviteId);
-
- public Result memberUpdateTradersPwdTime(@Valid MemberUpdateTradersPwdTimeDto memberUpdateTradersPwdTimeDto);
-
- public Result memberSubmitCoinApply(@Valid MemberSubmitCoinApplyDto memberSubmitCoinApplyDto);
-
- public Result getMemberAccountInfo(String account,int type);
-
- public Result getAppVersionInfo();
-
- public Result getPcVersionInfo();
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/member/service/MemberWalletContractService.java b/src/main/java/com/xcong/excoin/modules/member/service/MemberWalletContractService.java
deleted file mode 100644
index 37840b3..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/service/MemberWalletContractService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.xcong.excoin.modules.member.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.math.BigDecimal;
-
-public interface MemberWalletContractService extends IService<MemberWalletContractEntity> {
-
- MemberWalletContractEntity findWalletContractByMemberIdAndSymbol(Long memberId, String symbol);
-
- /**
- * 增减合约钱包(负数为减)
- * @param availableBalance
- * @param totalBalance
- * @param frozenBalance
- * @param id
- */
- void increaseWalletContractBalanceById(BigDecimal availableBalance, BigDecimal totalBalance, BigDecimal frozenBalance, Long id);
-
-}
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
deleted file mode 100644
index ec15f5e..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberServiceImpl.java
+++ /dev/null
@@ -1,1006 +0,0 @@
-package com.xcong.excoin.modules.member.service.impl;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.SecureUtil;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.enumerates.SymbolEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.dto.RegisterDto;
-import com.xcong.excoin.common.system.service.CommonService;
-import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.member.dao.*;
-import com.xcong.excoin.modules.member.entity.*;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAddCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberAuthenticationDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindEmailDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberBindPhoneDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelCoinAddressDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberDelPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberForgetPwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberPaymethodDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberSubmitCoinApplyDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdatePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradePwdDto;
-import com.xcong.excoin.modules.member.parameter.dto.MemberUpdateTradersPwdTimeDto;
-import com.xcong.excoin.modules.member.parameter.vo.*;
-import com.xcong.excoin.modules.member.service.MemberService;
-import com.xcong.excoin.modules.platform.dao.PlatformFeeSettingDao;
-import com.xcong.excoin.modules.platform.dao.PlatformSymbolsCoinDao;
-import com.xcong.excoin.modules.platform.entity.PlatformFeeSettingEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsCoinEntity;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.ShareCodeUtil;
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import lombok.extern.slf4j.Slf4j;
-
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.stereotype.Service;
-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 javax.annotation.Resource;
-import javax.validation.Valid;
-
-/**
- * @author wzy
- * @date 2020-05-18
- **/
-@Slf4j
-@Service
-public class MemberServiceImpl extends ServiceImpl<MemberDao, MemberEntity> implements MemberService {
-
- @Resource
- private MemberDao memberDao;
-
- @Resource
- private MemberWalletAgentDao memberWalletAgentDao;
-
- @Resource
- MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Resource
- private MemberWalletCoinDao memberWalletCoinDao;
-
- @Resource
- private MemberLevelRateDao memberLevelRateDao;
-
- @Resource
- MemberAuthenticationDao memberAuthenticationDao;
-
- @Resource
- RedisUtils redisUtils;
-
- @Resource
- MemberPaymentMethodDao memberPaymentMethodDao;
-
- @Resource
- PlatformSymbolsCoinDao platformSymbolsCoinDao;
-
- @Resource
- PlatformFeeSettingDao platformFeeSettingDao;
-
- @Resource
- MemberCoinAddressDao memberCoinAddressDao;
-
- @Resource
- private CommonService commonservice;
-
- @Resource
- MemberCoinWithdrawDao memberCoinWithdrawDao;
-
- @Resource
- AppVersionDao appVersionDao;
- @Resource
- private MemberSettingDao memberSettingDao;
-
- @Resource
- private MemberWalletContractSimulateDao memberWalletContractSimulateDao;
-
- @Transactional()
- @Override
- public Result register(RegisterDto registerDto) {
- // 查询是否存在该账号用户
- MemberEntity member = memberDao.selectMemberInfoByAccount(registerDto.getAccount());
- if (member != null) {
- return Result.fail("账号已存在");
- }
-
-// boolean isTrue = commonservice.verifyCode(registerDto.getAccount(), registerDto.getCode());
-// if (!isTrue) {
-// return Result.fail(MessageSourceUtils.getString("common_verify_code"));
-// }
-
- member = new MemberEntity();
- member.setPassword(SecureUtil.md5(registerDto.getPassword()));
-
- // 判断账号类型
- if (MemberEntity.ACCOUNT_TYPE_PHONE.equals(registerDto.getType())) {
- member.setPhone(registerDto.getAccount());
- } else if (MemberEntity.ACCOUNT_TYPE_EMAIL.equals(registerDto.getType())) {
- member.setEmail(registerDto.getAccount());
- } else {
- return Result.fail("账号类型错误");
- }
-
- // 判断是否拥有推荐人,若为空则默认系统
-// if (StrUtil.isBlank(registerDto.getRefererId())) {
-// registerDto.setRefererId(AppContants.SYSTEM_REFERER);
-// }
- if (!AppContants.SYSTEM_REFERER.equals(registerDto.getRefererId())) {
- MemberEntity isExist = memberDao.selectMemberInfoByInviteId(registerDto.getRefererId());
- if (isExist == null) {
- return Result.fail("推荐人不存在");
- }
- }
-
- member.setRefererId(registerDto.getRefererId());
- member.setAccountStatus(MemberEntity.ACCOUNT_STATUS_ENABLE);
- member.setAccountType(MemberEntity.ACCOUNT_TYPE_NORMAL);
- member.setAgentLevel(MemberEntity.ACCOUNT_AGENT_LEVEL);
- member.setCertifyStatus(MemberEntity.CERTIFY_STATUS_UN_SUBMIT);
- member.setIsForce(1);
- member.setIsProfit(0);
- memberDao.insert(member);
-
- MemberSettingEntity memberSettingEntity = new MemberSettingEntity();
- memberSettingEntity.setSpread(BigDecimal.ONE);
- memberSettingEntity.setClosingSpread(BigDecimal.valueOf(5));
- memberSettingEntity.setForceParam(BigDecimal.valueOf(0.0055));
- memberSettingEntity.setMemberId(member.getId());
- memberSettingDao.insert(memberSettingEntity);
-
- String inviteId = ShareCodeUtil.toSerialCode(member.getId());
- member.setInviteId(inviteId);
-
- boolean flag = false;
- String parentId = member.getRefererId();
- String ids = "";
- while (!flag) {
- ids += ("," + parentId);
- MemberEntity parentMember = memberDao.selectMemberInfoByInviteId(parentId);
- if (parentMember == null) {
- break;
- }
- parentId = parentMember.getRefererId();
- if (parentMember.getRefererId().equals(parentMember.getInviteId())) {
- flag = true;
- }
- }
- member.setRefererIds(ids);
- memberDao.updateById(member);
-
- //初始化合约钱包
- MemberWalletContractEntity walletContract = new MemberWalletContractEntity();
- walletContract.setMemberId(member.getId());
- walletContract.setAvailableBalance(AppContants.INIT_MONEY);
- walletContract.setFrozenBalance(AppContants.INIT_MONEY);
- walletContract.setTotalBalance(AppContants.INIT_MONEY);
- walletContract.setBorrowedFund(AppContants.INIT_MONEY);
- walletContract.setWalletCode(CoinTypeEnum.USDT.name());
- memberWalletContractDao.insert(walletContract);
-
- MemberWalletContractSimulateEntity walletContractSimulate = new MemberWalletContractSimulateEntity();
- walletContractSimulate.setMemberId(member.getId());
- walletContractSimulate.setAvailableBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY));
- walletContractSimulate.setTotalBalance(new BigDecimal(AppContants.INIT_SIMULATE_MONEY));
- walletContractSimulate.setFrozenBalance(AppContants.INIT_MONEY);
- walletContractSimulate.setBorrowedFund(AppContants.INIT_MONEY);
- walletContractSimulate.setWalletCode(CoinTypeEnum.USDT.name());
- memberWalletContractSimulateDao.insert(walletContractSimulate);
-
-
- // 初始化币币钱包
- for (CoinTypeEnum coinTypeEnum : CoinTypeEnum.values()) {
- MemberWalletCoinEntity walletCoin = new MemberWalletCoinEntity();
- walletCoin.setWalletCode(coinTypeEnum.name());
- walletCoin.setMemberId(member.getId());
- walletCoin.setAvailableBalance(AppContants.INIT_MONEY);
- walletCoin.setFrozenBalance(AppContants.INIT_MONEY);
- walletCoin.setTotalBalance(AppContants.INIT_MONEY);
- walletCoin.setBorrowedFund(AppContants.INIT_MONEY);
- memberWalletCoinDao.insert(walletCoin);
- }
-
- // 初始化代理佣金钱包
- MemberWalletAgentEntity walletAgent = new MemberWalletAgentEntity();
- walletAgent.setMemberId(member.getId());
- walletAgent.setWalletCode(CoinTypeEnum.USDT.name());
- memberWalletAgentDao.insert(walletAgent);
-
- // 初始化杠杆
- for (SymbolEnum symbolEnum : SymbolEnum.values()) {
- MemberLevelRateEntity levelRate = new MemberLevelRateEntity();
- levelRate.setMemberId(member.getId());
- levelRate.setSymbol(symbolEnum.getValue());
- memberLevelRateDao.insert(levelRate);
- }
-
- return Result.ok(MessageSourceUtils.getString("home_service_0009"));
- }
-
- @Override
- public Result getMemberInfo() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity memberEntity = memberDao.selectById(memberId);
- MemberInfoVo memberInfoVo = new MemberInfoVo();
- if (ObjectUtil.isNotEmpty(memberEntity)) {
- String email = memberEntity.getEmail();
- String phone = memberEntity.getPhone();
- if (StrUtil.isNotEmpty(phone)) {
- memberInfoVo.setPhone(phone);
- } else if (StrUtil.isNotEmpty(email)) {
- memberInfoVo.setPhone(email);
- }
-
- memberInfoVo.setInviteId(memberEntity.getInviteId());
- }
- return Result.ok(memberInfoVo);
- }
-
- @Override
- @Transactional
- public Result memberForgetPwd(@Valid MemberForgetPwdDto memberForgetPwdDto) {
-
- int type = memberForgetPwdDto.getType();
- String account = memberForgetPwdDto.getAccount();
- String code = memberForgetPwdDto.getCode();
- String password = memberForgetPwdDto.getPassword();
-
- Map<String, Object> hashMap = new HashMap<>();
- if (type == 1) {
- hashMap.put("phone", account);
- } else {
- hashMap.put("email", account);
- }
- List<MemberEntity> member = memberDao.selectByMap(hashMap);
- if (CollUtil.isEmpty(member)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0047"));
- }
-
- boolean flag = commonservice.verifyCode(account, code);
- if (flag) {
- MemberEntity memberEntity = member.get(0);
- memberEntity.setPassword(SecureUtil.md5(password));
- memberDao.updateById(memberEntity);
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_0045"));
- }
- return Result.ok(MessageSourceUtils.getString("member_service_0048"));
- }
-
- @Override
- @Transactional
- public Result memberUpdatePwd(@Valid MemberUpdatePwdDto memberUpdatePwdDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity memberEntity = memberDao.selectById(memberId);
-
- String code = memberUpdatePwdDto.getCode();
- String password = memberUpdatePwdDto.getPassword();
- String phone = memberUpdatePwdDto.getPhone();
- String email = memberUpdatePwdDto.getEmail();
- int type = memberUpdatePwdDto.getType();
- boolean verificationCode = verificationCode(type, phone, code, email);
- if (verificationCode) {
- memberEntity.setPassword(SecureUtil.md5(password));
- memberDao.updateById(memberEntity);
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_0041"));
- }
- return Result.ok(MessageSourceUtils.getString("member_service_0040"));
- }
-
- /**
- * 验证输入的验证码
- *
- * @param type 验证类型1:电话2:邮箱
- * @param phone
- * @param email
- * @param code 验证码
- * @return
- */
- private boolean verificationCode(Integer type, String phone, String code, String email) {
- boolean verificationCode = false;
- if (type == 1) {
- String smsCode = redisUtils.get("SMS_" + phone) + "";
- if (code.equals(smsCode)) {
- verificationCode = true;
- }
- } else {
- String emailCode = redisUtils.get("EMAIL_" + email) + "";
- if (code.equals(emailCode)) {
- verificationCode = true;
- }
- }
- return verificationCode;
- }
-
- @Override
- @Transactional
- public Result memberAuthentication(@Valid MemberAuthenticationDto memberAuthenticationDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
- if (MemberEntity.CERTIFY_STATUS_ING.equals(member.getCertifyStatus())) {
- return Result.fail(MessageSourceUtils.getString("member_service_4000"));
- }
- if (ObjectUtil.isNotEmpty(member)) {
-
- MemberAuthenticationEntity memberAuthenticationEntity = new MemberAuthenticationEntity();
-
- if (MemberEntity.CERTIFY_STATUS_Y == member.getCertifyStatus()) {
- return Result.fail(MessageSourceUtils.getString("member_service_0055"));
- }
- if (MemberEntity.CERTIFY_STATUS_ING == member.getCertifyStatus()) {
- return Result.fail(MessageSourceUtils.getString("member_service_0056"));
- }
- memberAuthenticationEntity.setMemberId(memberId);
-
- if (StrUtil.isBlank(memberAuthenticationDto.getNation())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0057"));
- }
- memberAuthenticationEntity.setNation(memberAuthenticationDto.getNation());
-
- if (StrUtil.isBlank(memberAuthenticationDto.getFirstName())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0058"));
- }
- memberAuthenticationEntity.setFirstName(memberAuthenticationDto.getFirstName());
-
- if (StrUtil.isBlank(memberAuthenticationDto.getSecondName())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0059"));
- }
- memberAuthenticationEntity.setSecondName(memberAuthenticationDto.getSecondName());
-
- String type = memberAuthenticationDto.getType();
- memberAuthenticationEntity.setType(type);
-
- String idCardNo = memberAuthenticationDto.getIdCardNo();
- if (StrUtil.isBlank(idCardNo)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0060"));
- }
- memberAuthenticationEntity.setIdcardNo(idCardNo);
- //同一个身份证号码不能重复实名认证
- int count = memberAuthenticationDao.findMemberbyIdCardNoCount(idCardNo);
- if (count > 0) {
- return Result.fail(MessageSourceUtils.getString("member_service_0060"));
- }
- if (StrUtil.isBlank(memberAuthenticationDto.getIdCardFront())
- || StrUtil.isBlank(memberAuthenticationDto.getIdCardReverse())
- || StrUtil.isBlank(memberAuthenticationDto.getIdCardImage())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0061"));
- }
- memberAuthenticationEntity.setIdcardImageFront(memberAuthenticationDto.getIdCardFront());
- memberAuthenticationEntity.setIdcardImageBack(memberAuthenticationDto.getIdCardReverse());
- memberAuthenticationEntity.setIdcardImageInHand(memberAuthenticationDto.getIdCardImage());
-
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("member_id", memberId);
- List<MemberAuthenticationEntity> selectByMap = memberAuthenticationDao.selectByMap(columnMap);
- if (CollUtil.isEmpty(selectByMap)) {
- memberAuthenticationDao.insert(memberAuthenticationEntity);
- } else {
- memberAuthenticationEntity.setId(selectByMap.get(0).getId());
- memberAuthenticationDao.updateById(memberAuthenticationEntity);
- }
-
- member.setCertifyStatus(MemberEntity.CERTIFY_STATUS_ING);
- member.setIdcardNo(idCardNo);
- memberDao.updateById(member);
-
- ThreadPoolUtils.sendDingTalk(4);
- return Result.ok(MessageSourceUtils.getString("member_service_0024"));
- }
- return Result.fail(MessageSourceUtils.getString("member_service_0063"));
- }
-
- @Override
- @Transactional
- public Result memberUpdateTradePwd(@Valid MemberUpdateTradePwdDto memberUpdateTradePwdDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity memberEntity = memberDao.selectById(memberId);
-
- String code = memberUpdateTradePwdDto.getCode();
- String password = memberUpdateTradePwdDto.getPassword();
- String account = memberUpdateTradePwdDto.getAccount();
- String phone = memberEntity.getPhone();
- String email = memberEntity.getEmail();
- int type = memberUpdateTradePwdDto.getType();
-
- //验证手机号或者邮箱是否是该账户绑定的手机号或者邮箱
- if (MemberEntity.ACCOUNT_TYPE_PHONE.equals(type) && !phone.equals(account)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0041"));
- }
- if (MemberEntity.ACCOUNT_TYPE_EMAIL.equals(type) && !email.equals(account)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0041"));
- }
-
- boolean flag = commonservice.verifyCode(account, code);
- if (flag) {
- memberEntity.setTradePassword(SecureUtil.md5(password));
- memberDao.updateById(memberEntity);
- LoginUserUtils.resetAppLoginUser(memberEntity);
- return Result.ok(MessageSourceUtils.getString("member_service_0051"));
- }
- return Result.fail(MessageSourceUtils.getString("member_service_0045"));
-
- }
-
- @Override
- @Transactional
- public Result memberLogout() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity memberEntity = memberDao.selectById(memberId);
- if (ObjectUtil.isEmpty(memberEntity)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0003"));
- }
- String token = LoginUserUtils.getAppLoginUserToken();
- redisUtils.del(AppContants.APP_LOGIN_PREFIX + token);
- SecurityContextHolder.clearContext();
- return Result.ok(MessageSourceUtils.getString("member_service_0071"));
- }
-
- @Override
- @Transactional
- public Result memberTradersPwd(@Valid MemberForgetPwdDto memberForgetPwdDto) {
- //获取用户ID
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- String code = memberForgetPwdDto.getCode();
- String password = memberForgetPwdDto.getPassword();
- String account = memberForgetPwdDto.getAccount();
- int type = memberForgetPwdDto.getType();
-
- boolean flag = commonservice.verifyCode(account, code);
- if (flag) {
- memberEntity.setTradePassword(SecureUtil.md5(password));
- memberDao.updateById(memberEntity);
- // 重置内存中的用户信息
- LoginUserUtils.resetAppLoginUser(memberEntity);
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_0015"));
- }
-
- return Result.ok(MessageSourceUtils.getString("member_service_0068"));
- }
-
- @Override
- @Transactional
- public Result memberAddPaymethod(@Valid MemberPaymethodDto memberPaymethodDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
-
- if (!MemberEntity.CERTIFY_STATUS_Y.equals(member.getCertifyStatus())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0077"));
- }
-
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("member_id", memberId);
- List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap);
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (MemberPaymentMethodEntity memberPaymentMethodEntity : selectByMap) {
- if (memberPaymethodDto.getAccount().equals(memberPaymentMethodEntity.getAccount())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0097"));
- }
- }
- }
- String account = memberPaymethodDto.getAccount();
- String bank = memberPaymethodDto.getBank();
- String name = memberPaymethodDto.getName();
- String paymentQrcode = memberPaymethodDto.getPaymentQrcode();
- String paymentType = memberPaymethodDto.getPaymentType();
- String subBank = memberPaymethodDto.getSubBank();
- MemberPaymentMethodEntity memberPaymentMethodEntity = new MemberPaymentMethodEntity();
- memberPaymentMethodEntity.setMemberId(memberId);
- memberPaymentMethodEntity.setAccount(account);
- memberPaymentMethodEntity.setBank(bank);
- memberPaymentMethodEntity.setName(name);
- memberPaymentMethodEntity.setPaymentQrcode(paymentQrcode);
- memberPaymentMethodEntity.setPaymentType(paymentType);
- memberPaymentMethodEntity.setSubBank(subBank);
- memberPaymentMethodDao.insert(memberPaymentMethodEntity);
- return Result.ok(MessageSourceUtils.getString("member_service_0024"));
- }
-
- @Override
- @Transactional
- public Result memberDelPaymethod(@Valid MemberDelPaymethodDto memberDelPaymethodDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- Long id = memberDelPaymethodDto.getId();
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("id", id);
- columnMap.put("member_id", memberId);
- memberPaymentMethodDao.deleteByMap(columnMap);
- return Result.ok("success");
- }
-
- @Override
- public Result memberPaymethodDetail(long id) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberPaymentMethodEntity memberPaymentMethod = memberPaymentMethodDao.selectById(id);
-
- MemberPaymethodDetailVo memberPaymethodDetailVo = new MemberPaymethodDetailVo();
- memberPaymethodDetailVo.setAccount(memberPaymentMethod.getAccount());
- memberPaymethodDetailVo.setBank(memberPaymentMethod.getBank());
- memberPaymethodDetailVo.setMemberId(memberId);
- memberPaymethodDetailVo.setName(memberPaymentMethod.getName());
- memberPaymethodDetailVo.setPaymentQrcode(memberPaymentMethod.getPaymentQrcode());
- memberPaymethodDetailVo.setPaymentType(memberPaymentMethod.getPaymentType());
- memberPaymethodDetailVo.setSubBank(memberPaymentMethod.getSubBank());
-
- return Result.ok(memberPaymethodDetailVo);
- }
-
- @Override
- public Result memberPaymethodDetailList() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("member_id", memberId);
- List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap);
- List<MemberPaymethodDetailVo> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (MemberPaymentMethodEntity memberPaymentMethodEntity : selectByMap) {
- MemberPaymethodDetailVo memberPaymethodDetailVo = new MemberPaymethodDetailVo();
- memberPaymethodDetailVo.setId(memberPaymentMethodEntity.getId());
- memberPaymethodDetailVo.setAccount(memberPaymentMethodEntity.getAccount());
- memberPaymethodDetailVo.setBank(memberPaymentMethodEntity.getBank());
- memberPaymethodDetailVo.setMemberId(memberId);
- memberPaymethodDetailVo.setName(memberPaymentMethodEntity.getName());
- memberPaymethodDetailVo.setPaymentQrcode(memberPaymentMethodEntity.getPaymentQrcode());
- memberPaymethodDetailVo.setPaymentType(memberPaymentMethodEntity.getPaymentType());
- memberPaymethodDetailVo.setSubBank(memberPaymentMethodEntity.getSubBank());
- arrayList.add(memberPaymethodDetailVo);
- }
- }
-
- MemberPaymethodDetailListVo memberPaymethodDetailListVo = new MemberPaymethodDetailListVo();
- memberPaymethodDetailListVo.setMemberPaymethodDetailVo(arrayList);
- return Result.ok(memberPaymethodDetailListVo);
- }
-
- @Override
- @Transactional
- public Result memberBindPhone(@Valid MemberBindPhoneDto memberBindPhoneDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- String phone = memberBindPhoneDto.getPhone();
- String code = memberBindPhoneDto.getCode();
-
- MemberEntity member = memberDao.selectById(memberId);
-
- if (ObjectUtil.isNotEmpty(member)) {
- if (!commonservice.verifyCode(phone, code)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0013"));
- }
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("phone", phone);
- List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap);
- if (CollUtil.isEmpty(selectByMap)) {
- member.setPhone(phone);
- memberDao.updateById(member);
- return Result.ok(MessageSourceUtils.getString("member_service_0014"));
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_1400"));
- }
- }
-
- return Result.fail(MessageSourceUtils.getString("member_service_0015"));
- }
-
- @Override
- @Transactional
- public Result memberBindEmail(@Valid MemberBindEmailDto memberBindEmailDto) {
-
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- String email = memberBindEmailDto.getEmail();
- String code = memberBindEmailDto.getCode();
-
- MemberEntity member = memberDao.selectById(memberId);
- boolean flag = commonservice.verifyCode(email, code);
- if (ObjectUtil.isNotEmpty(member)) {
- if (flag) {
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("email", email);
- List<MemberEntity> selectByMap = memberDao.selectByMap(columnMap);
- if (CollUtil.isEmpty(selectByMap)) {
- member.setEmail(email);
- memberDao.updateById(member);
- return Result.ok(MessageSourceUtils.getString("member_service_0018"));
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_1400"));
- }
- }
- }
- return Result.fail(MessageSourceUtils.getString("member_service_0019"));
- }
-
- @Override
- public Result memberCoinAddressCount() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- List<MemberCoinAddressCountVo> list = platformSymbolsCoinDao.selectCoinAddressCount(memberId);
- MemberCoinAddressCountListVo memberCoinAddressCountListVo = new MemberCoinAddressCountListVo();
- if (CollUtil.isNotEmpty(list)) {
- memberCoinAddressCountListVo.setMemberCoinAddressCountVo(list);
- return Result.ok(memberCoinAddressCountListVo);
- }
- return Result.fail(MessageSourceUtils.getString("member_service_0020"));
- }
-
- @Override
- public Result memberCoinAddressList(String symbol) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- List<MemberCoinAddressEntity> selectByMap = memberCoinAddressDao.selectCoinAddressListByMap(symbol, memberId);
- MemberCoinAddressListVo memberCoinAddressListVo = new MemberCoinAddressListVo();
- List<MemberCoinAddressVo> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (MemberCoinAddressEntity memberCoinAddressEntity : selectByMap) {
- MemberCoinAddressVo memberCoinAddressVo = new MemberCoinAddressVo();
- memberCoinAddressVo.setId(memberCoinAddressEntity.getId());
- memberCoinAddressVo.setAddress(memberCoinAddressEntity.getAddress());
- memberCoinAddressVo.setIsBiyict(memberCoinAddressEntity.getIsBiyict());
- memberCoinAddressVo.setMemberId(memberCoinAddressEntity.getMemberId());
- memberCoinAddressVo.setPrivateKey(memberCoinAddressEntity.getPrivateKey());
- memberCoinAddressVo.setSymbol(memberCoinAddressEntity.getSymbol());
- memberCoinAddressVo.setLabel(memberCoinAddressEntity.getLabel());
- memberCoinAddressVo.setSymbolscoinId(memberCoinAddressEntity.getSymbolscoinId());
- arrayList.add(memberCoinAddressVo);
- }
- }
- memberCoinAddressListVo.setMemberCoinAddressVo(arrayList);
-
- return Result.ok(memberCoinAddressListVo);
- }
-
- @Override
- @Transactional
- public Result memberAddCoinAddress(@Valid MemberAddCoinAddressDto memberAddCoinAddressDto) {
-
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- String address = memberAddCoinAddressDto.getAddress();
- String isBiyict = memberAddCoinAddressDto.getIsBiyict();
- Long symbolscoinId = memberAddCoinAddressDto.getSymbolscoinId();
- String remark = memberAddCoinAddressDto.getRemark();
-
- PlatformSymbolsCoinEntity platformSymbolsCoinEntity = platformSymbolsCoinDao.selectById(symbolscoinId);
-
- MemberCoinAddressEntity memberCoinAddressEntity = new MemberCoinAddressEntity();
- memberCoinAddressEntity.setAddress(address);
- memberCoinAddressEntity.setMemberId(memberId);
- memberCoinAddressEntity.setIsBiyict(MemberCoinAddressEntity.IS_BIYICT_NO);
- memberCoinAddressEntity.setSymbolscoinId(symbolscoinId);
- memberCoinAddressEntity.setLabel(remark);
- memberCoinAddressEntity.setSymbol(platformSymbolsCoinEntity.getName());
-
- memberCoinAddressDao.insert(memberCoinAddressEntity);
-
- return Result.ok(MessageSourceUtils.getString("member_service_0024"));
- }
-
- @Override
- public Result memberSendCodeWay() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
- MemberSendCodeWayVo memberSendCodeWayVo = new MemberSendCodeWayVo();
- if (ObjectUtil.isNotEmpty(member)) {
- memberSendCodeWayVo.setPhone(member.getPhone());
- memberSendCodeWayVo.setEmail(member.getEmail());
- }
- return Result.ok(memberSendCodeWayVo);
- }
-
- @Override
- @Transactional
- public Result memberDelCoinAddress(@Valid MemberDelCoinAddressDto memberDelCoinAddressDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
- if (ObjectUtil.isNotEmpty(member)) {
- Long id = memberDelCoinAddressDto.getId();
- memberCoinAddressDao.deleteById(id);
- }
- return Result.ok("success");
- }
-
- @Override
- public Result memberAuthenticationInfo() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
-
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("member_id", memberId);
- List<MemberAuthenticationEntity> selectByMap = memberAuthenticationDao.selectByMap(columnMap);
-
- MemberAuthenticationInfoVo memberAuthnticationInfoVo = new MemberAuthenticationInfoVo();
- memberAuthnticationInfoVo.setCertifyStatus(member.getCertifyStatus());
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (MemberAuthenticationEntity memberAuthenticationEntity : selectByMap) {
- memberAuthnticationInfoVo.setFirstName(memberAuthenticationEntity.getFirstName());
- memberAuthnticationInfoVo.setSecondName(memberAuthenticationEntity.getSecondName());
- memberAuthnticationInfoVo.setNation(memberAuthenticationEntity.getNation());
- memberAuthnticationInfoVo.setIdCardNo(memberAuthenticationEntity.getIdcardNo());
- memberAuthnticationInfoVo.setType(memberAuthenticationEntity.getType());
- }
- }
- return Result.ok(memberAuthnticationInfoVo);
- }
-
- @Override
- public Result memberPersonCenterInfo() {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
-
- MemberPersonCenterInfoVo memberPersonCenterInfoVo = new MemberPersonCenterInfoVo();
-
- Integer certifyStatus = member.getCertifyStatus();
- memberPersonCenterInfoVo.setCertifyStatus(certifyStatus);
-
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("member_id", memberId);
- List<MemberPaymentMethodEntity> selectByMap = memberPaymentMethodDao.selectByMap(columnMap);
- if (CollUtil.isEmpty(selectByMap)) {
- memberPersonCenterInfoVo.setMemberPaymentMethod(0);
- } else {
- memberPersonCenterInfoVo.setMemberPaymentMethod(1);
- }
-
- if (StrUtil.isNotEmpty(member.getPhone())) {
- memberPersonCenterInfoVo.setPhone(1);
- } else {
- memberPersonCenterInfoVo.setPhone(0);
- }
-
- if (StrUtil.isNotEmpty(member.getEmail())) {
- memberPersonCenterInfoVo.setEmail(1);
- } else {
- memberPersonCenterInfoVo.setEmail(0);
- }
-
- if (StrUtil.isNotEmpty(member.getTradePassword())) {
- memberPersonCenterInfoVo.setTradePassword(1);
- } else {
- memberPersonCenterInfoVo.setTradePassword(0);
- }
-
- Integer tradeAgingSetting = member.getTradeAgingSetting();
- if (tradeAgingSetting != null && tradeAgingSetting == MemberPersonCenterInfoVo.PWD_NEED_FORVER) {
- memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_FORVER);
- } else {
- memberPersonCenterInfoVo.setTradeAgingSetting(MemberPersonCenterInfoVo.PWD_NEED_NO);
- }
-
- return Result.ok(memberPersonCenterInfoVo);
- }
-
- @Override
- public Result memberCoinInfoList() {
-
- MemberCoinInfoListVo memberCoinInfoListVo = new MemberCoinInfoListVo();
- List<PlatformSymbolsCoinEntity> selectByMap = platformSymbolsCoinDao.selectByMap(new HashMap<>());
- List<MemberCoinInfoVo> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (PlatformSymbolsCoinEntity platformSymbolsCoinEntity : selectByMap) {
- MemberCoinInfoVo memberCoinInfoVo = new MemberCoinInfoVo();
- memberCoinInfoVo.setName(platformSymbolsCoinEntity.getName());
- arrayList.add(memberCoinInfoVo);
- }
- }
- memberCoinInfoListVo.setMemberCoinInfoVo(arrayList);
-
- return Result.ok(memberCoinInfoListVo);
- }
-
- @Override
- public Result memberAvivableCoinInfo(String symbol) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
- if (ObjectUtil.isEmpty(walletCoin)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0087"));
- }
-
- List<MemberAvivableCoinInfoVo> arrayList = new ArrayList<>();
-
-
- List<PlatformFeeSettingEntity> feeSettingByTypeAndSymbolLable = platformFeeSettingDao.getFeeSettingsByTypeAndSymbol(2, symbol);
- if (CollUtil.isEmpty(feeSettingByTypeAndSymbolLable)) {
- return Result.fail(MessageSourceUtils.getString("member_service_0087"));
- }
- for (PlatformFeeSettingEntity platformFeeSettingEntity : feeSettingByTypeAndSymbolLable) {
- MemberAvivableCoinInfoVo memberAvivableCoinInfoVo = new MemberAvivableCoinInfoVo();
- memberAvivableCoinInfoVo.setAvailableBalance(walletCoin.getAvailableBalance());
- memberAvivableCoinInfoVo.setFee(platformFeeSettingEntity.getFeePrice());
- memberAvivableCoinInfoVo.setLable(platformFeeSettingEntity.getLable());
- arrayList.add(memberAvivableCoinInfoVo);
- }
-
- return Result.ok(arrayList);
- }
-
- @Override
- public NeedMoneyMemberVo selectFriendRelationUserByMemberId(Long memberId) {
- return memberDao.selectFriendRelationUserByMemberId(memberId);
- }
-
- @Override
- public List<NeedMoneyMemberVo> selectAllNeedMoneyMember(List<String> list) {
- return memberDao.selectAllNeedMoneyMember(list);
- }
-
- @Override
- public MemberEntity selectMemberInfoByInviteId(String inviteId) {
- return memberDao.selectMemberInfoByInviteId(inviteId);
- }
-
- @Override
- @Transactional
- public Result memberUpdateTradersPwdTime(MemberUpdateTradersPwdTimeDto memberUpdateTradersPwdTimeDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
- member.setTradeAgingSetting(memberUpdateTradersPwdTimeDto.getTradeAgingSetting());
- memberDao.updateById(member);
- return Result.ok("success");
- }
-
- @Override
- public Result memberSubmitCoinApply(@Valid MemberSubmitCoinApplyDto memberSubmitCoinApplyDto) {
- //获取用户ID
- Long memberId = LoginUserUtils.getAppLoginUser().getId();
- MemberEntity member = memberDao.selectById(memberId);
- if (member.getCertifyStatus() != MemberEntity.CERTIFY_STATUS_Y) {
- return Result.fail(MessageSourceUtils.getString("member_service_0077"));
- }
- if (StrUtil.isEmpty(member.getTradePassword())) {
- return Result.fail(MessageSourceUtils.getString("member_service_0081"));
- }
- if (member.getTradePassword() == null) {
- return Result.fail(MessageSourceUtils.getString("member_service_0082"));
- }
- if (!member.getTradePassword().equals(SecureUtil.md5(memberSubmitCoinApplyDto.getTradePassword()))) {
- return Result.fail(MessageSourceUtils.getString("member_service_0082"));
- }
-
- boolean flag = commonservice.verifyCode(memberSubmitCoinApplyDto.getAccount(), memberSubmitCoinApplyDto.getCode());
- if (flag) {
- MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, memberSubmitCoinApplyDto.getSymbol());
- BigDecimal availableBalance = walletCoin.getAvailableBalance();
- BigDecimal coinNumber = memberSubmitCoinApplyDto.getCoinNumber();
- if (availableBalance.compareTo(BigDecimal.ZERO) > 0
- && availableBalance.compareTo(coinNumber) >= 0) {
- //新增提币记录
- MemberCoinWithdrawEntity memberCoinWithdrawEntity = new MemberCoinWithdrawEntity();
- memberCoinWithdrawEntity.setAddress(memberSubmitCoinApplyDto.getAddress());
- memberCoinWithdrawEntity.setAmount(coinNumber);
- memberCoinWithdrawEntity.setFeeAmount(memberSubmitCoinApplyDto.getFeeAmount());
- memberCoinWithdrawEntity.setSymbol(memberSubmitCoinApplyDto.getSymbol());
- memberCoinWithdrawEntity.setMemberId(memberId);
- memberCoinWithdrawEntity.setStatus(MemberCoinWithdrawEntity.STATUS_DOING);
-
- Map<String, Object> columnMap = new HashMap<>();
- columnMap.put("symbol", memberSubmitCoinApplyDto.getSymbol());
- columnMap.put("address", memberSubmitCoinApplyDto.getAddress());
- columnMap.put("is_biyict", MemberCoinAddressEntity.IS_BIYICT_YES);
- List<MemberCoinAddressEntity> selectByMap = memberCoinAddressDao.selectByMap(columnMap);
- if (CollUtil.isEmpty(selectByMap)) {
- memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_NO);
- } else {
- memberCoinWithdrawEntity.setIsInside(MemberCoinWithdrawEntity.ISINSIDE_YES);
- }
- memberCoinWithdrawDao.insert(memberCoinWithdrawEntity);
- BigDecimal subtract = walletCoin.getAvailableBalance().subtract(coinNumber);
- walletCoin.setAvailableBalance(subtract);
- BigDecimal add = walletCoin.getFrozenBalance().add(coinNumber);
- walletCoin.setFrozenBalance(add);
- memberWalletCoinDao.updateById(walletCoin);
-
- MemberAccountMoneyChange accountRecord = new MemberAccountMoneyChange();
- accountRecord.setContent("提币");
- accountRecord.setMemberId(memberId);
- accountRecord.setAmount(coinNumber);
- accountRecord.setWithdrawId(memberCoinWithdrawEntity.getId());
- accountRecord.setStatus(MemberAccountMoneyChange.STATUS_WAIT_INTEGER);
- accountRecord.setSymbol(memberSubmitCoinApplyDto.getSymbol());
- accountRecord.setType(MemberAccountMoneyChange.TYPE_WALLET_COIN);
- memberAccountMoneyChangeDao.insert(accountRecord);
-
- ThreadPoolUtils.sendDingTalk(3);
- return Result.ok(MessageSourceUtils.getString("member_service_0086"));
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_0005"));
- }
-
- } else {
- return Result.fail(MessageSourceUtils.getString("member_service_0039"));
- }
- }
-
- @Override
- public Result getMemberAccountInfo(String account, int type) {
-
- Map<String, Object> hashMap = new HashMap<>();
- if (type == 1) {
- hashMap.put("phone", account);
- } else {
- hashMap.put("email", account);
- }
- List<MemberEntity> member = memberDao.selectByMap(hashMap);
- if (CollUtil.isEmpty(member)) {
- return Result.fail(MessageSourceUtils.getString("home_service_0003"));
- }
-
- return Result.ok("");
- }
-
- @Override
- public Result getAppVersionInfo() {
- MemberEntity memberEntity = LoginUserUtils.getAppLoginUser();
-
- Map<String, Object> columnMap = new HashMap<>();
- List<AppVersionEntity> selectByMap = appVersionDao.selectByMap(columnMap);
- List<Object> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (AppVersionEntity appVersionEntity : selectByMap) {
- AppVersionVo appVersionVo = new AppVersionVo();
- if ("37059551".equals(memberEntity.getInviteId())) {
- appVersionVo.setAddress("www.baidu.com");
- appVersionVo.setType(appVersionEntity.getType());
- appVersionVo.setVersion(appVersionEntity.getVersion());
- } else {
- appVersionVo.setAddress(appVersionEntity.getAddress());
- appVersionVo.setType(appVersionEntity.getType());
- appVersionVo.setVersion(appVersionEntity.getVersion());
- }
- arrayList.add(appVersionVo);
- }
- }
- return Result.ok(arrayList);
- }
-
- @Override
- public Result getPcVersionInfo() {
- Map<String, Object> columnMap = new HashMap<>();
- List<AppVersionEntity> selectByMap = appVersionDao.selectByMap(columnMap);
- List<Object> arrayList = new ArrayList<>();
- if (CollUtil.isNotEmpty(selectByMap)) {
- for (AppVersionEntity appVersionEntity : selectByMap) {
- AppVersionVo appVersionVo = new AppVersionVo();
- appVersionVo.setAddress(appVersionEntity.getAddress());
- appVersionVo.setType(appVersionEntity.getType());
- appVersionVo.setVersion(appVersionEntity.getVersion());
- arrayList.add(appVersionVo);
- }
- }
- return Result.ok(arrayList);
- }
-}
-
-
diff --git a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberWalletContractServiceImpl.java b/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberWalletContractServiceImpl.java
deleted file mode 100644
index 9a7abac..0000000
--- a/src/main/java/com/xcong/excoin/modules/member/service/impl/MemberWalletContractServiceImpl.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.xcong.excoin.modules.member.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.member.service.MemberWalletContractService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-
-/**
- * 会员合约钱包
- */
-@Slf4j
-@Service
-public class MemberWalletContractServiceImpl extends ServiceImpl<MemberWalletContractDao, MemberWalletContractEntity> implements MemberWalletContractService {
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Override
- public MemberWalletContractEntity findWalletContractByMemberIdAndSymbol(Long memberId, String symbol){
- return memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberId,symbol);
- }
-
- @Override
- public void increaseWalletContractBalanceById(BigDecimal availableBalance, BigDecimal totalBalance, BigDecimal frozenBalance, Long id) {
- memberWalletContractDao.increaseWalletContractBalanceById(availableBalance,totalBalance,frozenBalance,id);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/controller/PlatformController.java b/src/main/java/com/xcong/excoin/modules/platform/controller/PlatformController.java
deleted file mode 100644
index ccd9d98..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/controller/PlatformController.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package com.xcong.excoin.modules.platform.controller;
-
-import javax.annotation.Resource;
-
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.service.PlatformBannerService;
-import com.xcong.excoin.modules.platform.service.PlatformNoticeService;
-import com.xcong.excoin.modules.platform.service.PlatformCnyUsdtExchangeService;
-import com.xcong.excoin.modules.platform.service.PlatformPaymentMethodService;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-
-@RestController
-@Slf4j
-@RequestMapping(value = "/api/exchange")
-@Api(value = "PlatformController", tags = "平台系统设置类")
-public class PlatformController {
-
- @Resource
- PlatformCnyUsdtExchangeService platformCnyUsdtExchangeService;
- @Resource
- PlatformPaymentMethodService platformPaymentMethodService;
-
- @Resource
- PlatformBannerService platformBannerService;
-
- @Resource
- PlatformNoticeService PlatformNoticeService;
-
-
- @ApiOperation(value = "findUsdtCnyExchange", notes = "Cny|Usdt兑换")
- @GetMapping(value = "/findUsdtCnyExchange")
- public Result findUsdtCnyExchange(@ApiParam(name = "type", value = "类型", type="string", required=true) @RequestParam("type") String type) {
- log.info("type值----->{}", type);
- return platformCnyUsdtExchangeService.findUsdtCnyExchange(type);
- }
-
- @ApiOperation(value = "findAllPaymentMethod", notes = "查询平台收款方式")
- @GetMapping(value = "/findAllPaymentMethod")
- public Result findAllPaymentMethod() {
- return platformPaymentMethodService.findAll();
- }
-
- @ApiOperation(value = "首页轮播图", notes = "首页轮播图")
- @GetMapping(value = "/findPlatformBannerList")
- public Result findPlatformBannerList() {
- return platformBannerService.findAll();
- }
-
- @ApiOperation(value = "首页公告查询", notes = "首页公告查询")
- @GetMapping(value = "/findPlatformNoticeList")
- public Result findPlatformNoticeList() {
- return PlatformNoticeService.findPlatformNoticeList();
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformBannerDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformBannerDao.java
deleted file mode 100644
index 47bfb50..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformBannerDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformBannerEntity;
-
-public interface PlatformBannerDao extends BaseMapper<PlatformBannerEntity> {
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformCnyUsdtExchangeDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformCnyUsdtExchangeDao.java
deleted file mode 100644
index 59171d1..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformCnyUsdtExchangeDao.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-
-import java.math.BigDecimal;
-
-public interface PlatformCnyUsdtExchangeDao extends BaseMapper<PlatformCnyUsdtExchangeEntity> {
-
- PlatformCnyUsdtExchangeEntity getCNYAndUSDTOne();
-
- void updateUsdt(BigDecimal value);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformFeeSettingDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformFeeSettingDao.java
deleted file mode 100644
index 03ea822..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformFeeSettingDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import java.util.List;
-
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformFeeSettingEntity;
-
-public interface PlatformFeeSettingDao extends BaseMapper<PlatformFeeSettingEntity> {
-
- PlatformFeeSettingEntity getFeeSettingByTypeAndSymbolLable(@Param("type")Integer type,@Param("symbol")String symbol,@Param("lable")String lable);
-
- PlatformFeeSettingEntity getFeeSettingByTypeAndSymbol(@Param("type")Integer type,@Param("symbol")String symbol);
-
- List<PlatformFeeSettingEntity> getFeeSettingsByTypeAndSymbol(@Param("type")int i,@Param("symbol")String symbol);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformNoticeDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformNoticeDao.java
deleted file mode 100644
index 5625867..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformNoticeDao.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformNoticeEntity;
-
-public interface PlatformNoticeDao extends BaseMapper<PlatformNoticeEntity> {
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformPaymentMethodDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformPaymentMethodDao.java
deleted file mode 100644
index ecabe6d..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformPaymentMethodDao.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-
-public interface PlatformPaymentMethodDao extends BaseMapper<PlatformPaymentMethodEntity> {
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsCoinDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsCoinDao.java
deleted file mode 100644
index a116b5a..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsCoinDao.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountVo;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsCoinEntity;
-
-public interface PlatformSymbolsCoinDao extends BaseMapper<PlatformSymbolsCoinEntity> {
-
- List<MemberCoinAddressCountVo> selectCoinAddressCount(Long memberId);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsSkuDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsSkuDao.java
deleted file mode 100644
index cf6399b..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/PlatformSymbolsSkuDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.member.parameter.vo.MemberCoinAddressCountVo;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsCoinEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsSkuEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-public interface PlatformSymbolsSkuDao extends BaseMapper<PlatformSymbolsSkuEntity> {
-
- PlatformSymbolsSkuEntity findSymbolSkuByName(@Param("name") String name);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/dao/TradeSettingDao.java b/src/main/java/com/xcong/excoin/modules/platform/dao/TradeSettingDao.java
deleted file mode 100644
index aec081a..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/dao/TradeSettingDao.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.xcong.excoin.modules.platform.dao;
-
-import java.util.List;
-
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsSkuEntity;
-import org.apache.ibatis.annotations.Param;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.platform.entity.PlatformLeverageSettingEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-
-public interface TradeSettingDao extends BaseMapper<PlatformTradeSettingEntity> {
-
- PlatformTradeSettingEntity findTradeSetting();
-
- PlatformSymbolsSkuEntity findSymbolSkubySymbol(@Param("symbol") String symbol);
-
- List<PlatformSymbolsSkuEntity> findAllSymbolSkubySymbol();
-
- List<PlatformLeverageSettingEntity> findLeverageSetting();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformBannerEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformBannerEntity.java
deleted file mode 100644
index 6a511c6..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformBannerEntity.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-
-import lombok.Data;
-@Data
-@TableName("platform_banner")
-public class PlatformBannerEntity extends BaseEntity{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- /**
- * 标题
- */
- private String name;
- /**
- * 图片链接
- */
- private String imageUrl;
- /**
- * 是否可跳转 1-是2-否
- */
- private String isJump;
- /**
- * 跳转外部或内部 1-内2-外
- */
- private int isInside;
- /**
- * 跳转链接
- */
- private String jumpUrl;
- /**
- * 显示端口 1-pc2-手机
- */
- private int showPort;
- /**
- * 联系方式
- */
- private String sort;
- /**
- * 是否置顶 1-是2-否
- */
- private String isTop;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformCnyUsdtExchangeEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformCnyUsdtExchangeEntity.java
deleted file mode 100644
index 4afacaf..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformCnyUsdtExchangeEntity.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-@Data
-@TableName("platform_cny_usdt_exchange")
-public class PlatformCnyUsdtExchangeEntity implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- private Long id;
-
- /**
- * 兑换比例
- */
- private BigDecimal value;
- /**
- * 增减偏量
- */
- private BigDecimal diff;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformFeeSettingEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformFeeSettingEntity.java
deleted file mode 100644
index ecea14f..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformFeeSettingEntity.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-@Data
-@TableName("platform_fee_setting")
-public class PlatformFeeSettingEntity implements Serializable {
-
- private static final long serialVersionUID = 1L;
- /**
- * 主键ID
- */
- private Long id;
- /**
- * 类型 1-充币2-提币3-充值USDT4-提现USDT
- */
- private Integer type;
- /**
- * 最低价
- */
- private BigDecimal minPrice;
- /**
- * 最高价
- */
- private BigDecimal maxPrice;
- /**
- * 手续费价
- */
- private BigDecimal feePrice;
- /**
- *
- */
- private Date createTime;
- /**
- * 人民币价格
- */
- private BigDecimal cnyPrice;
- /**
- * 币种
- */
- private String symbol;
- /**
- * USDT链名
- */
- private String lable;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformLeverageSettingEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformLeverageSettingEntity.java
deleted file mode 100644
index 8d72d42..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformLeverageSettingEntity.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-/**
- * 杠杆设置表
- */
-@Data
-@TableName("platform_leverage_setting")
-public class PlatformLeverageSettingEntity implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
- /**
- * 杠杆值
- */
- private String value;
- /**
- * 杠杆名称
- */
- private String name;
- /**
- * 币种
- */
- private String symbol;
- /**
- * 维持保证金率
- */
- private String prePriceRate;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformNoticeEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformNoticeEntity.java
deleted file mode 100644
index af6308d..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformNoticeEntity.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-
-import java.util.Date;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-
-import lombok.Data;
-
-@Data
-@TableName("platform_notice")
-public class PlatformNoticeEntity{
-
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
- /**
- * 标题
- */
- private String title;
-
- /**
- * 类别
- */
- private Integer categoryid;
-
- private String categoryname;
- private String source;
- private String content;
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
- private Date createTime;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformPaymentMethodEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformPaymentMethodEntity.java
deleted file mode 100644
index e8a2fff..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformPaymentMethodEntity.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-@Data
-@TableName("platform_payment_method")
-public class PlatformPaymentMethodEntity{
-
-
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
-
- /**
- * 姓名
- */
- private String name;
- /**
- * 账号
- */
- private String account;
- /**
- * 收款二维码
- */
- private String paymentQrcode;
- /**
- * 类型【1、支付宝2、微信3、银行卡】
- */
- private int type;
- /**
- * 银行名
- */
- private String bank;
- /**
- * 状态
- */
- private int status;
- /**
- * 联系方式
- */
- private String phone;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsCoinEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsCoinEntity.java
deleted file mode 100644
index d3c893e..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsCoinEntity.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-/**
- * 币种表
- */
-@Data
-@TableName("platform_symbols_coin")
-public class PlatformSymbolsCoinEntity implements Serializable{
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
- /**
- * 币种名称
- */
- private String name;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsSkuEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsSkuEntity.java
deleted file mode 100644
index 17b2e0e..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformSymbolsSkuEntity.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-/**
- * 币种规格表
- * @author helius
- */
-@Data
-@TableName("platform_symbols_sku")
-public class PlatformSymbolsSkuEntity implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
- /**
- * 币种名称
- */
- private String name;
- /**
- * 规格
- */
- private BigDecimal lotnumber;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformTradeSettingEntity.java b/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformTradeSettingEntity.java
deleted file mode 100644
index b0e342e..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/entity/PlatformTradeSettingEntity.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package com.xcong.excoin.modules.platform.entity;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-/**
- * 交易设置表
- * @author Administrator
- *
- */
-@Data
-@TableName("platform_trade_setting")
-public class PlatformTradeSettingEntity implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- @TableId(value = "id",type = IdType.AUTO)
- private Long id;
- /**
- * 点差
- */
- private BigDecimal spread;
- /**
- * 杠杆
- */
- private BigDecimal leverageRatio;
- /**
- * 爆仓
- */
- private BigDecimal outstock;
- /**
- * 手续费率
- */
- private BigDecimal feeRatio;
- /**
- * 币币手续费率
- */
- private BigDecimal coinFeeRatio;
- /**
- * 代理返佣比例
- */
- private BigDecimal agentReturnRatio;
- /**
- * 持仓系数
- */
- private BigDecimal doingRatio;
- /**
- * 预估强平价系数
- */
- private BigDecimal forceParam;
-
- /**
- *盈亏难度系数
- */
- private BigDecimal profitParam;
-
- /**
- * 手续费系数
- */
- private BigDecimal feeSpreadRatio;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformBannerService.java b/src/main/java/com/xcong/excoin/modules/platform/service/PlatformBannerService.java
deleted file mode 100644
index 51d6428..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformBannerService.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.xcong.excoin.modules.platform.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformBannerEntity;
-
-public interface PlatformBannerService extends IService<PlatformBannerEntity> {
-
- public Result findAll();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformCnyUsdtExchangeService.java b/src/main/java/com/xcong/excoin/modules/platform/service/PlatformCnyUsdtExchangeService.java
deleted file mode 100644
index 264f3c3..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformCnyUsdtExchangeService.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.xcong.excoin.modules.platform.service;
-
-import org.springframework.web.bind.annotation.RequestParam;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-
-public interface PlatformCnyUsdtExchangeService extends IService<PlatformCnyUsdtExchangeEntity> {
-
- public Result findUsdtCnyExchange(@RequestParam("type") String type);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformNoticeService.java b/src/main/java/com/xcong/excoin/modules/platform/service/PlatformNoticeService.java
deleted file mode 100644
index ad6f68b..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformNoticeService.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.xcong.excoin.modules.platform.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformNoticeEntity;
-
-public interface PlatformNoticeService extends IService<PlatformNoticeEntity> {
-
- Result findPlatformNoticeList();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformPaymentMethodService.java b/src/main/java/com/xcong/excoin/modules/platform/service/PlatformPaymentMethodService.java
deleted file mode 100644
index 55edcbc..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformPaymentMethodService.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.xcong.excoin.modules.platform.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-
-public interface PlatformPaymentMethodService extends IService<PlatformPaymentMethodEntity> {
-
- public Result findAll();
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformSymbolsSkuService.java b/src/main/java/com/xcong/excoin/modules/platform/service/PlatformSymbolsSkuService.java
deleted file mode 100644
index fe62d33..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/PlatformSymbolsSkuService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.xcong.excoin.modules.platform.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformBannerEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsSkuEntity;
-
-public interface PlatformSymbolsSkuService extends IService<PlatformSymbolsSkuEntity> {
-
- public PlatformSymbolsSkuEntity findSymbolSkuByName(String name);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformBannerServiceImpl.java b/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformBannerServiceImpl.java
deleted file mode 100644
index a6e0c72..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformBannerServiceImpl.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.xcong.excoin.modules.platform.service.impl;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.dao.PlatformBannerDao;
-import com.xcong.excoin.modules.platform.dao.PlatformPaymentMethodDao;
-import com.xcong.excoin.modules.platform.entity.PlatformBannerEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-import com.xcong.excoin.modules.platform.service.PlatformBannerService;
-
-@Service
-public class PlatformBannerServiceImpl extends ServiceImpl<PlatformBannerDao, PlatformBannerEntity> implements PlatformBannerService{
- @Resource
- PlatformBannerDao platformBannerDao;
-
- @Override
- public Result findAll() {
- QueryWrapper<PlatformBannerEntity> queryWrapper = new QueryWrapper<>();
- List<PlatformBannerEntity> paymentMethodList = platformBannerDao.selectList(queryWrapper);
- return Result.ok(paymentMethodList);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformCnyUsdtExchangeServiceImpl.java b/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformCnyUsdtExchangeServiceImpl.java
deleted file mode 100644
index 701ca20..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformCnyUsdtExchangeServiceImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.xcong.excoin.modules.platform.service.impl;
-
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-import com.xcong.excoin.modules.platform.service.PlatformCnyUsdtExchangeService;
-
-@Service
-public class PlatformCnyUsdtExchangeServiceImpl extends ServiceImpl<PlatformCnyUsdtExchangeDao, PlatformCnyUsdtExchangeEntity> implements PlatformCnyUsdtExchangeService{
- @Resource
- PlatformCnyUsdtExchangeDao platformCnyUsdtExchangeDao;
-
- @Override
- public Result findUsdtCnyExchange(String type) {
- // 查询当前兑换价格
- Map<String, Object> map = new HashMap<String, Object>();
- PlatformCnyUsdtExchangeEntity platformCnyUsdtExchangeEntity = platformCnyUsdtExchangeDao.selectById(1);
- BigDecimal cnyUsdt = platformCnyUsdtExchangeEntity.getValue();
- if ("B".equals(type)) {
- // 买的时候提高价格
- map.put("exchange", cnyUsdt.add(platformCnyUsdtExchangeEntity.getDiff()));
- }else {
- // 卖的时候降低
- map.put("exchange", cnyUsdt.subtract(platformCnyUsdtExchangeEntity.getDiff()));
- }
- return Result.ok(map);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformNoticeServiceImpl.java b/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformNoticeServiceImpl.java
deleted file mode 100644
index f4106a1..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformNoticeServiceImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.platform.service.impl;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.dao.PlatformNoticeDao;
-import com.xcong.excoin.modules.platform.entity.PlatformNoticeEntity;
-import com.xcong.excoin.modules.platform.service.PlatformNoticeService;
-
-@Service
-public class PlatformNoticeServiceImpl extends ServiceImpl<PlatformNoticeDao, PlatformNoticeEntity> implements PlatformNoticeService {
-
- @Resource
- PlatformNoticeDao platformNoticeDao;
-
- @Override
- public Result findPlatformNoticeList() {
- QueryWrapper<PlatformNoticeEntity> queryWrapper = new QueryWrapper<>();
- List<PlatformNoticeEntity> paymentMethodList = platformNoticeDao.selectList(queryWrapper);
- return Result.ok(paymentMethodList);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformPaymentMethodServiceImpl.java b/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformPaymentMethodServiceImpl.java
deleted file mode 100644
index b4a011e..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformPaymentMethodServiceImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.platform.service.impl;
-
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Service;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.platform.dao.PlatformPaymentMethodDao;
-import com.xcong.excoin.modules.platform.entity.PlatformPaymentMethodEntity;
-import com.xcong.excoin.modules.platform.service.PlatformPaymentMethodService;
-
-@Service
-public class PlatformPaymentMethodServiceImpl extends ServiceImpl<PlatformPaymentMethodDao, PlatformPaymentMethodEntity> implements PlatformPaymentMethodService{
- @Resource
- PlatformPaymentMethodDao platformPaymentMethodDao;
-
- @Override
- public Result findAll() {
- QueryWrapper<PlatformPaymentMethodEntity> queryWrapper = new QueryWrapper<>();
- List<PlatformPaymentMethodEntity> paymentMethodList = platformPaymentMethodDao.selectList(queryWrapper);
- return Result.ok(paymentMethodList);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformSymbolsSkuServiceImpl.java b/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformSymbolsSkuServiceImpl.java
deleted file mode 100644
index 39c0248..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/service/impl/PlatformSymbolsSkuServiceImpl.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.xcong.excoin.modules.platform.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.modules.platform.dao.PlatformSymbolsSkuDao;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsSkuEntity;
-import com.xcong.excoin.modules.platform.service.PlatformSymbolsSkuService;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * 币种规格服务类
- */
-@Service
-public class PlatformSymbolsSkuServiceImpl extends ServiceImpl<PlatformSymbolsSkuDao, PlatformSymbolsSkuEntity> implements PlatformSymbolsSkuService {
-
- @Resource
- private PlatformSymbolsSkuDao platformSymbolsSkuDao;
-
- @Override
- public PlatformSymbolsSkuEntity findSymbolSkuByName(String name) {
- return platformSymbolsSkuDao.findSymbolSkuByName(name);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/platform/vo/PlatformCnyUsdtExchangeVo.java b/src/main/java/com/xcong/excoin/modules/platform/vo/PlatformCnyUsdtExchangeVo.java
deleted file mode 100644
index 8a06fc6..0000000
--- a/src/main/java/com/xcong/excoin/modules/platform/vo/PlatformCnyUsdtExchangeVo.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.xcong.excoin.modules.platform.vo;
-
-import java.math.BigDecimal;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-@Data
-@ApiModel(value = "会员快捷买入卖出", description = "会员快捷买入卖出类")
-public class PlatformCnyUsdtExchangeVo {
-
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/controller/SymbolsController.java b/src/main/java/com/xcong/excoin/modules/symbols/controller/SymbolsController.java
deleted file mode 100644
index 64fe133..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/controller/SymbolsController.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.xcong.excoin.modules.symbols.controller;
-
-import com.huobi.client.model.Candlestick;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.symbols.parameter.dto.KlineDetailDto;
-import com.xcong.excoin.modules.symbols.parameter.vo.HomeSymbolsVo;
-import com.xcong.excoin.modules.symbols.parameter.vo.KlineDataVo;
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.TypeJudgeUtils;
-import io.swagger.annotations.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-/**
- * @author wzy
- * @date 2020-05-28
- **/
-@Api(value = "K线以及币种相关轮询接口类", tags = "K线以及币种相关轮询接口类")
-@Slf4j
-@RestController
-@RequestMapping(value = "/api/symbols")
-public class SymbolsController {
-
- @Resource
- private SymbolsService symbolsService;
-
- @Resource
- private RedisUtils redisUtils;
-
- @ApiOperation(value = "轮询获取app首页币种交易信息", notes = "轮询获取app首页币种交易信息")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = HomeSymbolsVo.class)
- })
- @GetMapping(value = "/homeSymbols")
- public Result homeSymbols(@ApiParam(name = "type", value = "类型1-币币2-合约3-自选", required = true, example = "1") @RequestParam(value = "type") Integer type) {
- return symbolsService.homeSymbols(type);
- }
-
- @ApiOperation(value = "根据币种查询币种当前各种数据", notes = "根据币种查询币种当前各种数据")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = HomeSymbolsVo.class)
- })
- @GetMapping(value = "/findSymbolData")
- public Result findSymbolData(@ApiParam(name = "symbol", value = "币种", required = true, example = "BTC/USDT") @RequestParam(value = "symbol") String symbol) {
- return symbolsService.findSymbolData(symbol);
- }
-
- @ApiOperation(value = "查询历史K线数据", notes = "查询历史K线数据")
- @ApiResponses({
- @ApiResponse(code = 0, message = "success", response = KlineDataVo.class)
- })
- @PostMapping(value = "/klineDetail")
- public Result klineDetail(@RequestBody @Valid KlineDetailDto klineDetailDto) {
- if (!TypeJudgeUtils.klinePeriod(klineDetailDto.getPeriod())) {
- return Result.fail("非法参数");
- }
- return symbolsService.findKlineDetails(klineDetailDto);
- }
-
- @ApiOperation(value = "查询当日最高最低价")
- @GetMapping(value = "/getDayHighAndLow")
- public Result getDayHighAndLow(@ApiParam(name = "symbol", value = "币种", required = true, example = "BTC/USDT") @RequestParam(value = "symbol") String symbol) {
- Candlestick object = (Candlestick) redisUtils.get(symbol);
- return Result.ok(object);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/dao/PlatformSymbolsContractDao.java b/src/main/java/com/xcong/excoin/modules/symbols/dao/PlatformSymbolsContractDao.java
deleted file mode 100644
index 5887d22..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/dao/PlatformSymbolsContractDao.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.xcong.excoin.modules.symbols.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.xcong.excoin.modules.symbols.entity.PlatformSymbolsContractEntity;
-
-import java.util.List;
-
-/**
- *
- * @author wzy
- */
-public interface PlatformSymbolsContractDao extends BaseMapper<PlatformSymbolsContractEntity> {
-
- List<PlatformSymbolsContractEntity> selectAllContractSymbols();
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/entity/PlatformSymbolsContractEntity.java b/src/main/java/com/xcong/excoin/modules/symbols/entity/PlatformSymbolsContractEntity.java
deleted file mode 100644
index 4322b00..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/entity/PlatformSymbolsContractEntity.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.modules.symbols.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @author wzy
- * @date 2020-05-26
- **/
-@Data
-@TableName("platform_symbols_contract")
-public class PlatformSymbolsContractEntity implements Serializable {
-
- private static final long serialVersionUID = -1L;
-
- private Long id;
-
- private String name;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/parameter/dto/KlineDetailDto.java b/src/main/java/com/xcong/excoin/modules/symbols/parameter/dto/KlineDetailDto.java
deleted file mode 100644
index 32aa355..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/parameter/dto/KlineDetailDto.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.symbols.parameter.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-
-/**
- *
- * @Author wzy
- * @Date 2020/5/28
- **/
-@Data
-@ApiModel(value = "KlineDetailDto", description = "请求K线类")
-public class KlineDetailDto {
-
- @NotNull
- @ApiModelProperty(value = "币种", example = "BTC/USDT")
- private String symbol;
-
- @NotNull
- @ApiModelProperty(value = "k线时长", example = "5min")
- private String period;
-
- @NotNull
- @ApiModelProperty(value = "类型 1-币币2-合约", example = "1")
- private Integer type;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/HomeSymbolsVo.java b/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/HomeSymbolsVo.java
deleted file mode 100644
index c607ae1..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/HomeSymbolsVo.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.xcong.excoin.modules.symbols.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * @author wzy
- * @date 2020-05-28
- **/
-@Data
-@ApiModel(value = "HomeSymbolsVo", description = "首页币种行情返回类")
-public class HomeSymbolsVo {
-
- @ApiModelProperty(value = "币种")
- private String symbol;
-
- @ApiModelProperty("当前价")
- private BigDecimal currentPrice;
-
- @ApiModelProperty("对应人民币转换")
- private BigDecimal cnyPrice;
-
- @ApiModelProperty("成交量")
- private BigDecimal volume;
-
- @ApiModelProperty("涨跌幅")
- private BigDecimal upOrDown;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/KlineDataVo.java b/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/KlineDataVo.java
deleted file mode 100644
index 3484e4d..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/parameter/vo/KlineDataVo.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.xcong.excoin.modules.symbols.parameter.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * k线返回类
- *
- * @author wzy
- * @date 2020-05-29
- **/
-@Data
-@ApiModel(value = "KlineDataVo", description = "k线返回类")
-public class KlineDataVo {
-
- @ApiModelProperty(value = "时间")
- private long time;
-
- @ApiModelProperty(value = "开盘指数价")
- private BigDecimal open;
-
- @ApiModelProperty(value = "收盘指数价")
- private BigDecimal high;
-
- @ApiModelProperty(value = "最低指数价")
- private BigDecimal low;
-
- @ApiModelProperty(value = "最高指数价")
- private BigDecimal close;
-
- @ApiModelProperty(value = "成交量张数")
- private BigDecimal volume;
-
- @ApiModelProperty(value = "成交量")
- private BigDecimal amount;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/service/SymbolsService.java b/src/main/java/com/xcong/excoin/modules/symbols/service/SymbolsService.java
deleted file mode 100644
index be91c71..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/service/SymbolsService.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.xcong.excoin.modules.symbols.service;
-
-
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.symbols.parameter.dto.KlineDetailDto;
-
-/**
- * @author wzy
- * @date 2020-05-26
- **/
-public interface SymbolsService {
-
- public void updateSymbolsKine(String time);
-
- public Result homeSymbols(Integer type);
-
- public Result findSymbolData(String symbol);
-
- public Result findKlineDetails(KlineDetailDto klineDetailDto);
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/symbols/service/impl/SymbolsServiceImpl.java b/src/main/java/com/xcong/excoin/modules/symbols/service/impl/SymbolsServiceImpl.java
deleted file mode 100644
index 95d294a..0000000
--- a/src/main/java/com/xcong/excoin/modules/symbols/service/impl/SymbolsServiceImpl.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package com.xcong.excoin.modules.symbols.service.impl;
-
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONObject;
-import com.huobi.client.model.Candlestick;
-import com.xcong.excoin.common.contants.AppContants;
-import com.xcong.excoin.common.enumerates.SymbolEnum;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.common.system.mapper.CandlestickMapper;
-import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
-import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
-import com.xcong.excoin.modules.symbols.parameter.dto.KlineDetailDto;
-import com.xcong.excoin.modules.symbols.parameter.vo.HomeSymbolsVo;
-import com.xcong.excoin.modules.symbols.parameter.vo.KlineDataVo;
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.RedisUtils;
-import com.xcong.excoin.utils.api.ApiClient;
-import com.xcong.excoin.utils.api.response.Kline;
-import com.xcong.excoin.utils.api.response.KlineResponse;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-26
- **/
-@Slf4j
-@Service
-public class SymbolsServiceImpl implements SymbolsService {
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private PlatformCnyUsdtExchangeDao platformCnyUsdtExchangeDao;
-
- private static final String API_KEY = "3938f004-bfe31905-f7581c1a-6abe0";
- private static final String API_SECRET = "a0f7a154-ghxertfvbf-6ce2d90c-a0bab";
-
-
- private static volatile ApiClient client;
-
- private static ApiClient getClient() {
- if (client == null) {
- synchronized (ApiClient.class) {
- if (client == null) {
- client = new ApiClient(API_KEY, API_SECRET);
- }
- }
- }
- return client;
- }
-
- @Override
- public void updateSymbolsKine(String time) {
- synchronized (this) {
- //更新币币交易K线历史数据
- for (SymbolEnum symbol : SymbolEnum.values()) {
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- String[] symbols = symbol.getValue().toLowerCase().split("/");
- ApiClient client = getClient();
- KlineResponse kline = client.kline(symbols[0] + symbols[1], time, 1000 + "");
- if (kline != null) {
- if ("ok".equalsIgnoreCase(kline.getStatus())) {
- List<Kline> klines = (List<Kline>) kline.data;
- List<Candlestick> list = new ArrayList<Candlestick>();
- Candlestick candlestick = null;
- for (Kline kline1 : klines) {
- candlestick = new Candlestick();
- candlestick.setAmount(BigDecimal.valueOf(kline1.getAmount()));
- candlestick.setClose(BigDecimal.valueOf(kline1.getClose()));
- candlestick.setCount(kline1.getCount());
- candlestick.setHigh(BigDecimal.valueOf(kline1.getHigh()));
- candlestick.setLow(BigDecimal.valueOf(kline1.getLow()));
- candlestick.setVolume(BigDecimal.valueOf(kline1.getVol()));
- candlestick.setTimestamp(kline1.getId() * 1000);
- candlestick.setOpen(BigDecimal.valueOf(kline1.getOpen()));
- list.add(candlestick);
- }
-
- if (klines.size() > 0) {
- redisUtils.set("KINE_" + symbol.getValue() + "_" + time, list);
- }
- }
- }
- }
- }
- }
-
- @Override
- public Result homeSymbols(Integer type) {
- List<HomeSymbolsVo> list = new ArrayList<>();
- // 币币行情
- if (AppContants.HOME_SYMBOLS_COIN == type) {
- for (SymbolEnum symbolEnum : SymbolEnum.values()) {
- list.add(getSymbolReturnData(symbolEnum.getValue()));
- }
- // 合约行情
- } else if (AppContants.HOME_SYMBOLS_CONTRACT == type) {
- for (SymbolEnum symbolEnum : SymbolEnum.values()) {
- list.add(getSymbolReturnData(symbolEnum.getValue()));
- }
- // 自选行情
- } else {
-
- }
-
- return Result.ok(list);
- }
-
- @Override
- public Result findSymbolData(String symbol) {
- HomeSymbolsVo homeSymbolsVo = getSymbolReturnData(symbol);
- return Result.ok(homeSymbolsVo);
- }
-
- public HomeSymbolsVo getSymbolReturnData(String symbol) {
- PlatformCnyUsdtExchangeEntity cnyUsdtExchange = platformCnyUsdtExchangeDao.getCNYAndUSDTOne();
- // 获取当日k线数据
- Candlestick symbolObject = (Candlestick) redisUtils.get(symbol);
- // 获取当前币种最新价
- BigDecimal newestPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(symbol)));
- // 获取当日k线的开盘价
- BigDecimal openPrice = symbolObject.getOpen();
-
- BigDecimal upOrDown = newestPrice.subtract(openPrice).divide(openPrice, 8, BigDecimal.ROUND_HALF_UP);
- HomeSymbolsVo homeSymbolsVo = new HomeSymbolsVo();
-
- homeSymbolsVo.setSymbol(symbol);
- homeSymbolsVo.setCurrentPrice(newestPrice);
- homeSymbolsVo.setUpOrDown(upOrDown);
- homeSymbolsVo.setVolume(symbolObject.getAmount());
- if (cnyUsdtExchange != null) {
- BigDecimal cnyPrice = newestPrice.multiply(cnyUsdtExchange.getValue()).setScale(2, BigDecimal.ROUND_HALF_UP);
- homeSymbolsVo.setCnyPrice(cnyPrice);
- }
-
- return homeSymbolsVo;
- }
-
- @Override
- public Result findKlineDetails(KlineDetailDto klineDetailDto) {
- String key = "KINE_{}_{}";
- // 币币k线数据
- if (AppContants.HOME_SYMBOLS_COIN == klineDetailDto.getType()) {
- key = StrUtil.format(key, klineDetailDto.getSymbol(), klineDetailDto.getPeriod());
- // 合约k线数据
- } else {
- key = StrUtil.format(key, klineDetailDto.getSymbol(), klineDetailDto.getPeriod());
- }
-
- Object data = redisUtils.get(key);
- if (data != null) {
- List list = (List) data;
- int length = 0;
- // 默认获取k线900个柱状(超出会报错)
- int size = 900;
-
- if (list.size() > size) {
- length = size - 1;
- } else {
- length = list.size() - 1;
- }
-
- List<KlineDataVo> result = new ArrayList<>(length);
- for (int i = length; i > 0; i--) {
- Candlestick object = (Candlestick) list.get(i);
- KlineDataVo klineDataVo = CandlestickMapper.INSTANCE.toKlineDataVo(object);
- result.add(klineDataVo);
- }
- return Result.ok(result);
- }
- return Result.fail("获取数据失败");
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java b/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
deleted file mode 100644
index 0be8a3b..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/controller/TestUserController.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.xcong.excoin.modules.test.controller;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.common.annotations.UserAuth;
-import com.xcong.excoin.common.response.Result;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.test.dto.TestUserDto;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-import com.xcong.excoin.modules.test.mapper.TestUserEntityMapper;
-import com.xcong.excoin.modules.test.service.TestUserService;
-import com.xcong.excoin.modules.test.vo.TestUserVo;
-import com.xcong.excoin.utils.MessageSourceUtils;
-import io.swagger.annotations.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import javax.validation.Valid;
-
-/**
- * @author wzy
- * @date 2020-04-24 15:25
- **/
-@RestController
-@RequestMapping(value = "/test")
-@Slf4j
-@Api(value = "这是测试用类", tags = "这是测试用类")
-public class TestUserController {
-
- @Resource
- private TestUserService testUserService;
-
- @ApiOperation(value = "测试用户分页请求", notes = "说明")
- @ApiResponses({@ApiResponse(code = 0, message = "ok", response = TestUserVo.class)})
- @PostMapping(value = "/findUserInPage")
- public Result findUserInPage(@RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
- @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
- @RequestBody @Validated TestUserDto testUserDto, @UserAuth MemberEntity memberEntity) {
- log.info("--->{}",SecurityContextHolder.getContext().getAuthentication());
- log.info("----->{}", memberEntity);
- Page<TestUserEntity> page = new Page<>(pageNum, pageSize);
- IPage<TestUserEntity> list = testUserService.page(page);
-
- IPage<TestUserVo> aa = TestUserEntityMapper.INSTANCE.pageEntityToPageVO(list);
- return Result.ok(MessageSourceUtils.getString("111"), aa);
- }
-
-
- @ApiOperation(value = "添加测试用户", notes = "该接口用于添加测试用户")
- @PostMapping(value = "/add")
- public Result add(@RequestBody @Valid TestUserDto testUserDto) {
- TestUserEntity testUserEntity = TestUserEntityMapper.INSTANCE.dtoToEntity(testUserDto);
- boolean flag = testUserService.save(testUserEntity);
- if (flag) {
- return Result.ok("success");
- }
- return Result.fail("fail");
- }
-
- @ApiOperation(value = "修改测试用户", notes = "该接口用户修改测试用户")
- @PostMapping(value = "/modify")
- public Result modify(@RequestBody @Validated TestUserDto testUserDto) {
- TestUserEntity testUserEntity = TestUserEntityMapper.INSTANCE.dtoToEntity(testUserDto);
- log.info("#-------->{}#", testUserEntity);
- boolean flag = testUserService.updateById(testUserEntity);
- if (flag) {
- return Result.ok("success");
- }
- return Result.fail("fail");
- }
-
-
- @ApiOperation(value = "根据ID删除用户", notes = "根据ID删除用户")
- @GetMapping(value = "/del/{id}")
- public Result del(@PathVariable(value = "id") Long id) {
- boolean flag = testUserService.removeById(id);
- if (flag) {
- return Result.ok("success");
- }
- return Result.fail("fail");
- }
-
- @ApiOperation(value = "根据Id查询用户信息", notes = "根据Id查询用户信息")
- @GetMapping(value = "/findById/{id}")
- public Result findById(@ApiParam(name = "id", value = "用户ID", required = true, example = "1") @PathVariable(value = "id") Long id) {
- TestUserEntity testUserEntity = testUserService.getById(id);
- TestUserVo testUserVo = TestUserEntityMapper.INSTANCE.entityToVo(testUserEntity);
- return Result.ok("success", testUserVo);
- }
-
- @ApiOperation(value = "根据Id查询用户信息", notes = "根据Id查询用户信息")
- @GetMapping(value = "/findByIdAndName/{id}/{name}")
- public Result findByIdAndName(@ApiParam(name = "id", value="用户ID", required = true, example = "1") @PathVariable(value = "id") Long id,
- @ApiParam(name = "name", value="用户姓名", required = true, example = "wzy") @PathVariable(value = "name") String name) {
- log.info("---->{}", id);
- log.info("----<{}", name);
- return Result.ok("success");
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/dao/TestUserDao.java b/src/main/java/com/xcong/excoin/modules/test/dao/TestUserDao.java
deleted file mode 100644
index eba5557..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/dao/TestUserDao.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.xcong.excoin.modules.test.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface TestUserDao extends BaseMapper<TestUserEntity> {
-
- public List<TestUserEntity> selectAll();
-
- IPage<TestUserEntity> selectInPage(Page<TestUserEntity> page);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/dto/TestUserDto.java b/src/main/java/com/xcong/excoin/modules/test/dto/TestUserDto.java
deleted file mode 100644
index fa1d08a..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/dto/TestUserDto.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.xcong.excoin.modules.test.dto;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-/**
- * @author wzy
- * @date 2020-05-08 10:17
- **/
-@Data
-@ApiModel(value = "testUser参数接收类", description = "findUserInPage 参数接收类")
-public class TestUserDto {
-
- @NotNull(message = "id不能为空")
- @ApiModelProperty(value = "这是名字啊", example = "张三")
- private String name;
-
- @Length(min = 6, max = 16, message = "账号长度需为6-16位")
- @ApiModelProperty(value = "账号", example = "admin")
- private String account;
-
- @NotBlank(message = "密码不能为空")
- @ApiModelProperty(value = "这是密码字段啊", example = "123456")
- private String password;
-
- @ApiModelProperty(value = "这是地址ID", example = "123")
- private Long addressId;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/entity/TestUserEntity.java b/src/main/java/com/xcong/excoin/modules/test/entity/TestUserEntity.java
deleted file mode 100644
index 13a3879..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/entity/TestUserEntity.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.xcong.excoin.modules.test.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.xcong.excoin.common.system.base.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * @author wzy
- * @date 2020-04-24 15:00
- **/
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("test_user")
-public class TestUserEntity extends BaseEntity {
-
- private String name;
-
- private String account;
-
- private String password;
-
- @TableField(exist = false)
- private String aaaaa;
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/mapper/TestUserEntityMapper.java b/src/main/java/com/xcong/excoin/modules/test/mapper/TestUserEntityMapper.java
deleted file mode 100644
index f116802..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/mapper/TestUserEntityMapper.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.xcong.excoin.modules.test.mapper;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.xcong.excoin.modules.test.dto.TestUserDto;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-import com.xcong.excoin.modules.test.vo.TestUserVo;
-import com.xcong.excoin.modules.test.vo.TestVo;
-import org.mapstruct.InheritInverseConfiguration;
-import org.mapstruct.Mapper;
-import org.mapstruct.Mapping;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-09 15:26
- **/
-@Mapper
-public abstract class TestUserEntityMapper {
- public static final TestUserEntityMapper INSTANCE = Mappers.getMapper(TestUserEntityMapper.class);
-
- public abstract TestUserEntity dtoToEntity(TestUserDto testUserDto);
-
- @Mapping(source = "name", target = "name")
- @Mapping(source = "password", target = "pwd")
- public abstract TestVo entityToTestVo(TestUserEntity testUserEntity);
-
- @Mapping(source = "name", target = "userName")
- public abstract TestUserVo entityToVo(TestUserEntity testUserEntity);
-
- public abstract List<TestUserVo> entityListToVoList(List<TestUserEntity> testUserEntities);
-
- public abstract Page<TestUserVo> pageEntityToPageVO(IPage<TestUserEntity> list);
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/service/TestUserService.java b/src/main/java/com/xcong/excoin/modules/test/service/TestUserService.java
deleted file mode 100644
index 448ffb3..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/service/TestUserService.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.xcong.excoin.modules.test.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-
-import java.util.List;
-
-/**
- * @author helius
- */
-public interface TestUserService extends IService<TestUserEntity> {
-
- public List<TestUserEntity> findAll();
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/service/impl/TestUserServiceImpl.java b/src/main/java/com/xcong/excoin/modules/test/service/impl/TestUserServiceImpl.java
deleted file mode 100644
index ab2b9f2..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/service/impl/TestUserServiceImpl.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.xcong.excoin.modules.test.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.xcong.excoin.modules.test.dao.TestUserDao;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-import com.xcong.excoin.modules.test.service.TestUserService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-04-24 15:23
- **/
-@Service
-@Slf4j
-public class TestUserServiceImpl extends ServiceImpl<TestUserDao, TestUserEntity> implements TestUserService {
-
- @Resource
- private TestUserDao testUserDao;
-
- @Override
- public List<TestUserEntity> findAll() {
- return testUserDao.selectAll();
- }
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/vo/TestUserVo.java b/src/main/java/com/xcong/excoin/modules/test/vo/TestUserVo.java
deleted file mode 100644
index efd4073..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/vo/TestUserVo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.xcong.excoin.modules.test.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-07 17:24
- **/
-@Data
-@ApiModel(value = "测试", description = "测试用户类")
-public class TestUserVo {
-
- @ApiModelProperty(value = "主键ID")
- private Long id;
-
- @ApiModelProperty(value = "用户姓名")
- private String userName;
-
- @ApiModelProperty(value = "密码")
- private String password;
-
- @ApiModelProperty(value = "12345")
- private List<TestVo> testVo;
-
-}
diff --git a/src/main/java/com/xcong/excoin/modules/test/vo/TestVo.java b/src/main/java/com/xcong/excoin/modules/test/vo/TestVo.java
deleted file mode 100644
index ba344b3..0000000
--- a/src/main/java/com/xcong/excoin/modules/test/vo/TestVo.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.xcong.excoin.modules.test.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @author wzy
- * @date 2020-05-08 10:09
- **/
-@Data
-@ApiModel(value = "12345", description = "2222222")
-public class TestVo {
-
- @ApiModelProperty(value = "名字")
- private String name;
-
- @ApiModelProperty(value = "密码")
- private String pwd;
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java
deleted file mode 100644
index 4138bee..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/BlockCoinUpdateJob.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.xcong.excoin.modules.coin.service.BlockCoinService;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-
-/**
- * 链上币种同步任务
- *
- * @author wzy
- * @date 2020-07-02
- **/
-@Component
-@ConditionalOnProperty(prefix = "app", name = "block-job", havingValue = "true")
-public class BlockCoinUpdateJob {
-
- @Resource
- private BlockCoinService blockCoinService;
-
-
- /**
- * ETH_USDT 同步
- */
- @Scheduled(cron = "0 0/10 * * * ? ")
- public void ethUsdtUpdate() {
- blockCoinService.updateEthUsdt();
- }
-
- /**
- * eth 同步
- */
- @Scheduled(cron = "0 1/20 * * * ? ")
- public void ethUpdate() {
- blockCoinService.updateEth();
- }
-
- /**
- * BTC_USDT 同步
- */
- @Scheduled(cron = "0 2/10 * * * ? ")
- public void btcUsdtUpdate() {
- blockCoinService.updateBtcUsdt();
- }
-
- @Scheduled(cron = "0 3/20 * * * ? ")
- public void btcUpdate() {
- blockCoinService.updateBtc();
- }
-
- @Scheduled(cron = "0 4/20 * * * ? ")
- public void eosUpdate() {
- blockCoinService.updateEos();
- }
-
- @Scheduled(cron = "0 6/20 * * * ? ")
- public void xrpUpdate() {
- blockCoinService.updateXrp();
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/DayLineDataUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/DayLineDataUpdateJob.java
deleted file mode 100644
index 6d6438c..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/DayLineDataUpdateJob.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.huobi.client.SubscriptionClient;
-import com.huobi.client.SubscriptionOptions;
-import com.huobi.client.model.Candlestick;
-import com.huobi.client.model.enums.CandlestickInterval;
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.RedisUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-
-/**
- * 最新价更新
- *
- * @author wzy
- * @date 2020-05-28
- **/
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "day-line", havingValue = "true")
-public class DayLineDataUpdateJob {
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private SymbolsService symbolsService;
-
- @Resource
- private WebsocketPriceService websocketPriceService;
-
- @PostConstruct
- public void initNewestPrice() {
- log.info("#=======价格更新开启=======#");
- SubscriptionOptions subscriptionOptions = new SubscriptionOptions();
- subscriptionOptions.setConnectionDelayOnFailure(5);
- subscriptionOptions.setUri("wss://api.hadax.com/ws");
- SubscriptionClient subscriptionClient = SubscriptionClient.create("", "", subscriptionOptions);
-
- subscriptionClient.subscribeCandlestickEvent("btcusdt,ethusdt,eosusdt,etcusdt,ltcusdt,bchusdt,xrpusdt", CandlestickInterval.DAY1, (candlestickEvent) -> {
- Candlestick data = candlestickEvent.getData();
- redisUtils.set(CoinTypeConvert.convert(candlestickEvent.getSymbol()), data);
- });
-
- }
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/KlineDataUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/KlineDataUpdateJob.java
deleted file mode 100644
index ca41425..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/KlineDataUpdateJob.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-
-/**
- * k线数据更新任务
- *
- * @author wzy
- * @date 2020-05-26
- **/
-@Component
-@ConditionalOnProperty(prefix = "app", name = "kline-update-job", havingValue = "true")
-public class KlineDataUpdateJob {
-
- @Resource
- private SymbolsService symbolsService;
-
-
- private static boolean min1 = true;
- private static boolean min5 = true;
- private static boolean min30 = true;
- private static boolean min60 = true;
- private static boolean hour4 = true;
- private static boolean day1 = true;
- private static boolean week = true;
-
-
- /**
- * 定时更新每一分钟的K线数据
- */
- @Scheduled(cron = "0/1 * * * * ? ")
- public void updateSymbolsKineOneMin() {
- if (min1) {
- min1 = false;
- try {
- symbolsService.updateSymbolsKine("1min");
- } catch (Exception e) {
- // e.printStackTrace();
- } finally {
- min1 = true;
- }
- }
- }
-
- /**
- * 定时更新每十分钟的K线数据
- */
- @Scheduled(cron = "0/10 * * * * ? ")
- public void updateSymbolsKineFiveMin() {
- if (min5) {
- min5 = false;
- try {
- symbolsService.updateSymbolsKine("5min");
- } catch (Exception e) {
- //e.printStackTrace();
- } finally {
- min5 = true;
- }
- }
- }
-
- /**
- * 定时更新每30分钟的K线数据
- */
- @Scheduled(cron = "0/120 * * * * ? ")
- public void updateSymbolsKineMin() {
- if (min30) {
- min30 = false;
- try {
- symbolsService.updateSymbolsKine("30min");
- } catch (Exception e) {
- //e.printStackTrace();
- } finally {
- min30 = true;
- }
- }
- }
-
- /**
- * 定时更新1小时的K线数据
- */
- @Scheduled(cron = "* 0/2 * * * ? ")
- public void updateSymbolsKineOneHour() {
- if (min60) {
- min60 = false;
- try {
- symbolsService.updateSymbolsKine("60min");
- } catch (Exception e) {
- //e.printStackTrace();
- } finally {
- min60 = true;
- }
- }
- }
-
- /**
- * 定时更新4小时的K线数据
- */
- @Scheduled(cron = "* 0/1 * * * ? ")
- public void updateSymbolsKineFourHour() {
- if (hour4) {
- hour4 = false;
- try {
- symbolsService.updateSymbolsKine("4hour");
- } catch (Exception e) {
- //e.printStackTrace();
- } finally {
- hour4 = true;
- }
- }
- }
-
-
- /**
- * 定时更新1天的K线数据
- */
- @Scheduled(cron = "* 0/1 * * * ? ")
- public void updateSymbolsKineOneDay() {
- if (day1) {
- day1 = false;
- try {
- symbolsService.updateSymbolsKine("1day");
- } catch (Exception e) {
- //e.printStackTrace();
- } finally {
- day1 = true;
- }
- }
- }
-
- /**
- * 定时更新1周的K线数据
- */
- @Scheduled(cron = "* 0/1 * * * ? ")
- public void updateSymbolsKineOneWeek() {
- if (week) {
- week = false;
- try {
- symbolsService.updateSymbolsKine("1week");
- } catch (Exception e) {
- // e.printStackTrace();
- } finally {
- week = true;
- }
- }
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java b/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java
deleted file mode 100644
index 9fc7240..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/LoopExecutorJob.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.xcong.excoin.modules.coin.service.OrderCoinService;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.home.dao.MemberQuickBuySaleDao;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-
-/**
- * @author wzy
- * @date 2020-06-08
- **/
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "loop-job", havingValue = "true")
-public class LoopExecutorJob {
-
- @Resource
- private MemberQuickBuySaleDao memberQuickBuySaleDao;
-
- @Resource
- private ContractHoldOrderService contractHoldOrderService;
-
- @Resource
- private OrderCoinService orderCoinService;
-
- /**
- * 更新快捷充值超时状态
- */
- @Scheduled(cron = "0/5 * * * * ? ")
- @Transactional(rollbackFor = Exception.class)
- public void updateChargeUsdt() {
- try {
- memberQuickBuySaleDao.updateQuickBuySaleTimeOut();
- } catch (Exception e) {
- log.error("更新快捷充值超时状态", e);
- }
- }
-
-
- /**
- * 持仓费计算
- */
- @Scheduled(cron = "0 0 0/8 * * ?")
- public void updateDoingPrice() {
- log.info("#持仓费计算#");
- try {
- contractHoldOrderService.calHoldFeeAmountForBondAmount();
- } catch (Exception e) {
- log.error("#持仓费计算错误#", e);
- }
- }
-
- /**
- * 币币委托单成交
- */
- @Scheduled(cron = "0/5 * * * * ? ")
- public void coinEntrustToDeal() {
- try {
- orderCoinService.dealEntrustCoinOrder();
- } catch (Exception e) {
- log.error("#币币委托单成交错误#", e);
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java
deleted file mode 100644
index 0ac98f7..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/NewestPriceUpdateJob.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.huobi.client.SubscriptionClient;
-import com.huobi.client.SubscriptionOptions;
-import com.huobi.client.model.Candlestick;
-import com.huobi.client.model.enums.CandlestickInterval;
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.RedisUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-
-/**
- * 最新价更新
- *
- * @author wzy
- * @date 2020-05-28
- **/
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "newest-price-update-job", havingValue = "true")
-public class NewestPriceUpdateJob {
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private SymbolsService symbolsService;
-
- @Resource
- private WebsocketPriceService websocketPriceService;
-
- @PostConstruct
- public void initNewestPrice() {
- log.info("#=======价格更新开启=======#");
- SubscriptionOptions subscriptionOptions = new SubscriptionOptions();
- subscriptionOptions.setConnectionDelayOnFailure(5);
- subscriptionOptions.setUri("wss://api.hadax.com/ws");
- SubscriptionClient subscriptionClient = SubscriptionClient.create("", "", subscriptionOptions);
- subscriptionClient.subscribeTradeEvent("btcusdt,ethusdt,xrpusdt,ltcusdt,bchusdt,eosusdt,etcusdt", tradeEvent -> {
- String symbol = tradeEvent.getSymbol();
- // 根据symbol判断做什么操作
- symbol = CoinTypeConvert.convert(symbol);
- if (null != symbol) {
- String price = tradeEvent.getTradeList().get(0).getPrice().toPlainString();
- // TODO 测试环境关闭这个插入redis
- redisUtils.set(CoinTypeConvert.convertToKey(symbol), price);
- // 比较
- websocketPriceService.comparePriceAsc(symbol, price);
- websocketPriceService.comparePriceDesc(symbol, price);
- //System.out.println("比较完毕:"+symbol+"-"+price);
-
- }
-
- });
-// subscriptionClient.subscribeCandlestickEvent("btcusdt,ethusdt,eosusdt,etcusdt,ltcusdt,bchusdt,xrpusdt", CandlestickInterval.DAY1, (candlestickEvent) -> {
-// Candlestick data = candlestickEvent.getData();
-// redisUtils.set(CoinTypeConvert.convert(candlestickEvent.getSymbol()), data);
-// });
- }
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/NotionalPoolingJob.java b/src/main/java/com/xcong/excoin/quartz/job/NotionalPoolingJob.java
deleted file mode 100644
index 75f36ad..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/NotionalPoolingJob.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.xcong.excoin.modules.blackchain.service.UsdtEthService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.concurrent.ExecutionException;
-
-/**
- * 归集定时任务
- *
- * @author wzy
- * @date 2020-07-02
- **/
-
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "block-job", havingValue = "true")
-public class NotionalPoolingJob {
-
- @Resource
- private UsdtEthService usdtEthService;
-
- /**
- * usdt 归集
- */
- @Scheduled(cron = "0 5/30 * * * ? ")
- public void poolUsdtEth() {
- try {
- log.info("USDT归集开始");
- usdtEthService.pool();
- log.info("USDT归集结束");
- } catch (ExecutionException | InterruptedException e) {
- log.error("#usdt归集错误#", e);
- }
- }
-
- @Scheduled(cron = "0 2/8 * * * ? ")
- public void usdtEthPoolCheck() {
- log.info("USDTETH归集结果扫描开始");
- usdtEthService.usdtEthPoolCheck();
- }
-
- @Scheduled(cron = "0 2/30 * * * ? ")
- public void poolEth() {
- try {
- usdtEthService.ethPool();
- } catch (ExecutionException | InterruptedException e) {
- log.info("#ETH归集错误#", e);
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/quartz/job/UsdtCnyExchangePriceUpdateJob.java b/src/main/java/com/xcong/excoin/quartz/job/UsdtCnyExchangePriceUpdateJob.java
deleted file mode 100644
index 96dc366..0000000
--- a/src/main/java/com/xcong/excoin/quartz/job/UsdtCnyExchangePriceUpdateJob.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.xcong.excoin.quartz.job;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.modules.platform.dao.PlatformCnyUsdtExchangeDao;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.math.BigDecimal;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * 美元-人民币汇率定时任务
- *
- * @author wzy
- * @date 2020-05-28
- **/
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "other-job", havingValue = "true")
-public class UsdtCnyExchangePriceUpdateJob {
-
- @Resource
- private PlatformCnyUsdtExchangeDao cnyUsdtExchangeDao;
-
- @Scheduled(cron = "0 */5 * * * ? ")
- public void updateUsdtCnyExchange() {
- BufferedReader reader = null;
- String result = null;
- StringBuffer sbf = new StringBuffer();
- // 模拟浏览器
- String userAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36";
- try {
- URL url = new URL("https://otc-api-hk.eiijo.cn/v1/data/config/purchase-price?coinId=2¤cyId=1&matchType=0");
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setRequestMethod("GET");
- connection.setReadTimeout(30000);
- connection.setConnectTimeout(30000);
- connection.setRequestProperty("User-agent", userAgent);
- connection.connect();
- InputStream is = connection.getInputStream();
- reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- String strRead = null;
- while ((strRead = reader.readLine()) != null) {
- sbf.append(strRead);
- sbf.append("\r\n");
- }
- reader.close();
- result = sbf.toString();
-
- JSONObject jsonObject = (JSONObject) JSONObject.parse(result);
- String code = jsonObject.getString("code");
- if ("200".equals(code)) {
- JSONObject jsonData = (JSONObject) jsonObject.get("data");
- cnyUsdtExchangeDao.updateUsdt(BigDecimal.valueOf(jsonData.getDouble("price")));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/rabbit/consumer/WebsocketPriceConsumer.java b/src/main/java/com/xcong/excoin/rabbit/consumer/WebsocketPriceConsumer.java
deleted file mode 100644
index b959b0e..0000000
--- a/src/main/java/com/xcong/excoin/rabbit/consumer/WebsocketPriceConsumer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package com.xcong.excoin.rabbit.consumer;
-
-import com.alibaba.fastjson.JSONArray;
-import com.rabbitmq.client.Channel;
-import com.xcong.excoin.configurations.RabbitMqConfig;
-import com.xcong.excoin.modules.contract.service.RabbitOrderService;
-import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.amqp.core.Message;
-import org.springframework.amqp.rabbit.annotation.RabbitListener;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-
-/**
- * APP和后台打包都开启
- *
- * @author helius
- */
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "rabbit-consumer", havingValue = "true")
-public class WebsocketPriceConsumer {
-
- @Resource
- OrderWebsocketServiceImpl orderWebsocketService;
-
- @Resource
- RabbitOrderService orderService;
-
-
- /**
- * 开多止盈
- *
- * @param message 消息体
- * @param channel 信道
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_MOREPRO)
- public void onMessageMorePro(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了开多止盈 : {}", content);
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealOrderFromMq(list, 9);
- }
- // 1:买入委托2:开多3:开空4:平多5:平空6:爆仓平多7:爆仓平空8:撤单9:止盈平多10:止盈平空11:止损平多12:止损平空
-
- /**
- * 开空止盈
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_LESSPRO)
- public void onMessageLessPro(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了开空止盈 : {}", content);
- // 开始处理
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealOrderFromMq(list, 10);
- }
-
-
- /**
- * 开多止损
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_MORELOSS)
- public void onMessageMoreLoss(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了开多止损 : {}", content);
- // 开始处理
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealOrderFromMq(list, 11);
- }
-
- /**
- * 开空止损
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_LESSLOSS)
- public void onMessageLessLoss(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了开空止损 : {}", content);
- // 开始处理
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealOrderFromMq(list, 12);
- }
-
- /**
- * 限价委托
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_LIMIT)
- public void onMessageLimit(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了限价委托 : {}", content);
- // 开始处理
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealForLimitMq(list);
- }
-
- /**
- * 爆仓消费者
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_COINOUT)
- public void onMessageCoinout(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了爆仓 : {}", content);
- // 开始处理
- List<OrderModel> list = JSONArray.parseArray(content, OrderModel.class);
- // 开始处理
- orderWebsocketService.dealOrderFromMq(list, 6);
- }
-
- /**
- * 平仓
- *
- * @param message
- * @param channel
- */
- @RabbitListener(queues = RabbitMqConfig.QUEUE_CLOSETRADE)
- public void onMessageCloseTrade(Message message, Channel channel) {
- String content = new String(message.getBody());
- log.info("==message-price-consumer==我收到消息了平仓: {}", content);
- // 订单
- List<Long> ids = JSONArray.parseArray(content, Long.class);
- orderService.cancelHoldOrder(ids);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/rabbit/init/OrderProducerInit.java b/src/main/java/com/xcong/excoin/rabbit/init/OrderProducerInit.java
deleted file mode 100644
index 25638d8..0000000
--- a/src/main/java/com/xcong/excoin/rabbit/init/OrderProducerInit.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package com.xcong.excoin.rabbit.init;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.common.enumerates.RabbitPriceTypeEnum;
-import com.xcong.excoin.modules.contract.dao.ContractEntrustOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractEntrustOrderEntity;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.rabbit.pricequeue.OrderModel;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
-import java.util.List;
-
-/**
- * 后台开启 APP不开启
- *
- * @author helius
- */
-@Slf4j
-@Component
-@ConditionalOnProperty(prefix = "app", name = "newest-price-update-job", havingValue = "true")
-public class OrderProducerInit {
-
- @Resource
- private ContractEntrustOrderDao contractEntrustOrderDao;
-
- @Resource
- private ContractHoldOrderDao contractHoldOrderDao;
-
- @Resource
- private OrderProducer producer;
-
- @PostConstruct
- public void initOrder() {
- log.info("=======初始化未完成订单信息=======");
-
- // 查询所有未平仓的单
- List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectAllHoldOrder();
- // 查询所有未完成的委托单
- List<ContractEntrustOrderEntity> entrustOrderEntities = contractEntrustOrderDao.selectAllEntrustOrder();
-
- if (CollectionUtils.isNotEmpty(holdOrderEntities)) {
- for (ContractHoldOrderEntity order : holdOrderEntities) {
- // 开多1,开空 2
- int openingType = order.getOpeningType();
- // 1:买入委托2:开多3:开空4:平多5:平空6:爆仓平多7:爆仓平空
- // 9:止盈平多10:止盈平空11:止损平多12:止损平空
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == openingType) {
- // 开多 发送开多止损 止盈 爆仓
- // 爆仓价
- BigDecimal forceSetPrice = order.getForceClosingPrice();
- if (forceSetPrice != null) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_MORE_BOMB.getValue(), forceSetPrice.toPlainString(),
- order.getSymbol(), order.getOperateNo());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 止损
- BigDecimal stopLossPrice = order.getStopLossPrice();
- if (stopLossPrice != null && stopLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_MORE_STOP_LESS.getValue(),
- stopLossPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 止盈
- BigDecimal stopProfitPrice = order.getStopProfitPrice();
- if (stopProfitPrice != null && stopProfitPrice.compareTo(BigDecimal.ZERO) > 0) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_MORE_STOP_PROFIT.getValue(),
- stopProfitPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
-
- } else {
- // 开空 发送开空止损 止盈 爆仓
- // 爆仓价
- BigDecimal forceSetPrice = order.getForceClosingPrice();
- if (forceSetPrice != null) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_LESS_BOMB.getValue(), forceSetPrice.toPlainString(),
- order.getSymbol(), order.getOperateNo());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 止损
- BigDecimal stopLossPrice = order.getStopLossPrice();
- if (stopLossPrice != null && stopLossPrice.compareTo(BigDecimal.ZERO) > 0) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_LESS_STOP_LESS.getValue(),
- stopLossPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- // 止盈
- BigDecimal stopProfitPrice = order.getStopProfitPrice();
- if (stopProfitPrice != null && stopProfitPrice.compareTo(BigDecimal.ZERO) > 0) {
- OrderModel model = new OrderModel(order.getId(), RabbitPriceTypeEnum.CLOSE_LESS_STOP_PROFIT.getValue(),
- stopProfitPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- }
-
- }
- }
-
- if (CollectionUtils.isNotEmpty(entrustOrderEntities)) {
- for (ContractEntrustOrderEntity order : entrustOrderEntities) {
- // 开多1,开空 2
- int entrustType = order.getEntrustType();
- // 开多
- BigDecimal entrustPrice = order.getEntrustPrice();
- OrderModel model;
- if (ContractEntrustOrderEntity.ENTRUST_TYPE_OPEN_MORE == entrustType) {
- // 开多委托
- model = new OrderModel(order.getId(), RabbitPriceTypeEnum.ENTRUST_OPEN_MORE.getValue(),
- entrustPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
-
- } else {
- model = new OrderModel(order.getId(), RabbitPriceTypeEnum.ENTRUST_OPEN_LESS.getValue(),
- entrustPrice.setScale(8, RoundingMode.HALF_UP).toPlainString(),
- order.getSymbol());
- }
- producer.sendPriceOperate(JSONObject.toJSONString(model));
- }
- }
- }
-}
diff --git a/src/main/java/com/xcong/excoin/utils/CacheSettingUtils.java b/src/main/java/com/xcong/excoin/utils/CacheSettingUtils.java
deleted file mode 100644
index 9145008..0000000
--- a/src/main/java/com/xcong/excoin/utils/CacheSettingUtils.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package com.xcong.excoin.utils;
-
-import cn.hutool.core.bean.BeanUtil;
-import com.xcong.excoin.modules.platform.dao.TradeSettingDao;
-import com.xcong.excoin.modules.platform.entity.PlatformSymbolsSkuEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author wzy
- * @date 2020-05-28
- **/
-@Component
-public class CacheSettingUtils {
-
-
- /**
- * 交易设置缓存Key
- */
- private final static String TRADE_SETTING_KEY = "trade_setting_key";
-
- /**
- * 币种规格缓存key
- */
- private final static String TRADE_SYMBOL_SKU_KEY = "trade_symbol_sku_key";
-
- @Resource
- private TradeSettingDao tradeSettingDao;
-
- @Resource
- private RedisUtils redisUtils;
-
-
- /**
- * 获取币种规格
- *
- * @param symbol
- * @return
- */
- public BigDecimal getSymbolSku(String symbol) {
- Object hget = redisUtils.hget(TRADE_SYMBOL_SKU_KEY, symbol);
- if (hget == null) {
- List<PlatformSymbolsSkuEntity> symbolSkubySymbol = tradeSettingDao.findAllSymbolSkubySymbol();
- Map<String, Object> map = new HashMap<String, Object>();
- if (CollectionUtils.isNotEmpty(symbolSkubySymbol)) {
- for (PlatformSymbolsSkuEntity symbolSku : symbolSkubySymbol) {
- map.put(symbolSku.getName(), symbolSku.getLotnumber());
- }
- // 存入redis
- redisUtils.hmset(TRADE_SYMBOL_SKU_KEY, map);
- }
-
- hget = redisUtils.hget(TRADE_SYMBOL_SKU_KEY, symbol);
- }
-
- return new BigDecimal(hget.toString());
- }
-
- /**
- * 获取交易设置缓存
- *
- * @return
- */
- public PlatformTradeSettingEntity getTradeSetting() {
- Map<Object, Object> hmget = redisUtils.hmget(TRADE_SETTING_KEY);
-
- if (hmget == null || hmget.size() == 0) {
- PlatformTradeSettingEntity tradeSetting = tradeSettingDao.findTradeSetting();
- redisUtils.hmset(TRADE_SETTING_KEY, BeanUtil.beanToMap(tradeSetting));
- return tradeSetting;
- }
- return BeanUtil.mapToBean(hmget, PlatformTradeSettingEntity.class, true);
- }
-
-}
diff --git a/src/main/java/com/xcong/excoin/utils/CalculateUtil.java b/src/main/java/com/xcong/excoin/utils/CalculateUtil.java
deleted file mode 100644
index 0ef6ae6..0000000
--- a/src/main/java/com/xcong/excoin/utils/CalculateUtil.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.xcong.excoin.utils;
-
-
-import com.xcong.excoin.modules.member.dao.MemberSettingDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import lombok.extern.slf4j.Slf4j;
-
-import java.math.BigDecimal;
-
-/**
- * @author helius
- */
-@Slf4j
-public class CalculateUtil {
-
- /**
- * 计算预估强平价
- *
- * @param bondAmount 保证金
- * @param openPrice 开仓价
- * @param symbolSkuNumber 张数
- * @param lotNumber 规格
- * @param type 1:买多2:卖空
- * @return
- */
- public static BigDecimal getForceSetPrice(BigDecimal bondAmount, BigDecimal openPrice, int symbolSkuNumber, BigDecimal lotNumber,
- int type, MemberEntity member) {
- MemberSettingDao memberSettingDao = SpringContextHolder.getBean(MemberSettingDao.class);
- BigDecimal forcePrice = BigDecimal.ZERO;
- BigDecimal money = bondAmount.divide(new BigDecimal(symbolSkuNumber).multiply(lotNumber), 8, BigDecimal.ROUND_DOWN);
- if (member.getIsForce() == 1) {
- MemberSettingEntity memberSetting = memberSettingDao.selectMemberSettingByMemberId(member.getId());
- money = money.multiply(memberSetting.getForceParam().multiply(BigDecimal.valueOf(100)));
- }
- //卖空
- if (type == 2) {
- forcePrice = money.add(openPrice);
- } else {//开多
- forcePrice = openPrice.subtract(money);
- }
- if (forcePrice.compareTo(BigDecimal.ZERO) < 0) {
- forcePrice = BigDecimal.ZERO;
- }
- return forcePrice;
- }
-}
diff --git a/src/main/java/com/xcong/excoin/utils/LogRecordUtils.java b/src/main/java/com/xcong/excoin/utils/LogRecordUtils.java
deleted file mode 100644
index 6bf4189..0000000
--- a/src/main/java/com/xcong/excoin/utils/LogRecordUtils.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.xcong.excoin.utils;
-
-import com.xcong.excoin.modules.coin.dao.MemberAccountFlowEntityDao;
-import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountFlowEntity;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-
-import java.math.BigDecimal;
-
-/**
- * 日志记录工具类
- *
- * @author wzy
- * @date 2020-07-02
- **/
-public class LogRecordUtils {
-
- public static void insertMemberAccountMoneyChange(Long memberId,String content, BigDecimal amount, String symbol, Integer status, Integer type) {
- MemberAccountMoneyChange accountRecord = new MemberAccountMoneyChange();
- accountRecord.setContent(content);
- accountRecord.setMemberId(memberId);
- accountRecord.setAmount(amount);
- accountRecord.setStatus(status);
- accountRecord.setSymbol(symbol);
- accountRecord.setType(type);
- SpringContextHolder.getBean(MemberAccountMoneyChangeDao.class).insert(accountRecord);
- }
-
- public static void insertMemberAccountFlow(Long memberId, BigDecimal price, BigDecimal balance, String symbol, String source, String remark) {
- MemberAccountFlowEntity memberAccountFlowEntity = new MemberAccountFlowEntity();
- memberAccountFlowEntity.setMemberId(memberId);
- memberAccountFlowEntity.setPrice(price);
- memberAccountFlowEntity.setBalance(balance);
- memberAccountFlowEntity.setSymbol(symbol);
- memberAccountFlowEntity.setSource(source);
- memberAccountFlowEntity.setRemark(remark);
- SpringContextHolder.getBean(MemberAccountFlowEntityDao.class).insert(memberAccountFlowEntity);
- }
-}
diff --git a/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java b/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java
deleted file mode 100644
index 10c1e06..0000000
--- a/src/main/java/com/xcong/excoin/utils/ThreadPoolUtils.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.xcong.excoin.utils;
-
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
-import com.xcong.excoin.utils.dingtalk.DingTalkUtils;
-
-import java.math.BigDecimal;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-/**
- * @author wzy
- * @date 2020-06-01
- **/
-public class ThreadPoolUtils {
-
- public static final ExecutorService EXECUTOR = Executors.newFixedThreadPool(20);
-
- /**
- * 计算佣金
- *
- * @param id 用户ID
- * @param price 手续费
- * @param entity 订单实体
- * @param type 订单类型
- */
- public static void calReturnMoney(Long id, BigDecimal price, ContractOrderEntity entity, int type) {
- OrderWebsocketServiceImpl orderWebsocketService = SpringContextHolder.getBean(OrderWebsocketServiceImpl.class);
- EXECUTOR.execute(new Runnable() {
- @Override
- public void run() {
- orderWebsocketService.calYj(id, price, entity, type);
- }
- });
- }
-
- /**
- * 发送钉钉消息
- *
- * @param type 类型
- */
- public static void sendDingTalk(int type) {
- EXECUTOR.execute(new Runnable() {
- @Override
- public void run() {
- DingTalkUtils.sendActionCard(type);
- }
- });
- }
-}
diff --git a/src/test/java/com/xcong/excoin/GuijiTest.java b/src/test/java/com/xcong/excoin/GuijiTest.java
deleted file mode 100644
index 6b99989..0000000
--- a/src/test/java/com/xcong/excoin/GuijiTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.xcong.excoin;
-
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ExecutionException;
-
-import javax.annotation.Resource;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.modules.blackchain.service.EthService;
-import com.xcong.excoin.modules.member.dao.MemberCoinAddressDao;
-import com.xcong.excoin.modules.member.dao.MemberCoinChargeDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
-import com.xcong.excoin.modules.member.entity.MemberCoinAddressEntity;
-import com.xcong.excoin.modules.member.entity.MemberCoinChargeEntity;
-
-import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-@SpringBootTest
-public class GuijiTest {
-
- private static final BigDecimal LIMIT = new BigDecimal("50");
- private static final BigDecimal FEE = new BigDecimal("0.005");
-
- public static String ETH_FEE = "0.005";
-
- public static final String TOTAL_ADDRESS = "0x067b4bE5d7B05560AE539Fc8f10597D854ae056D";
- public static final String TOTAL_PRIVATE = "1fb7288c8c88c37d6f79e9617822bffc8d3635bf2d808c5f6afdee9bb326e49c";
-
- @Resource
- private MemberCoinChargeDao memberCoinChargeDao;
- @Resource
- private MemberCoinAddressDao memberCoinAddressDao;
- @Resource
- private MemberWalletCoinDao memberWalletCoinDao;
-
- public void pool() throws ExecutionException, InterruptedException {
- //List<MemberCoinChargeEntity> list = memberCoinChargeDao.selectAllBySymbolAndTag(CoinTypeEnum.USDT.name(), "ERC20", 1);
- List<MemberCoinChargeEntity> list = new ArrayList<MemberCoinChargeEntity>();
- MemberCoinChargeEntity coin = new MemberCoinChargeEntity();
- coin.setAddress("0xdf24223ab4599a47aa9383c5c9914edd68ae63dc");
- coin.setMemberId(1L);
- coin.setLastAmount(new BigDecimal(51.01000101));
- list.add(coin);
- if (CollUtil.isNotEmpty(list)) {
- EthService ethService = new EthService();
-
- for (MemberCoinChargeEntity coinCharge : list) {
- // 首先根据每个地址查询其是否有ETH 如果没有就充值ETH并设置1 表示初始状态 status=2(待充值)3:表示已提过
- String address = coinCharge.getAddress();
- Long memberId = coinCharge.getMemberId();
- BigDecimal lastAmount = coinCharge.getLastAmount();
- if (lastAmount == null || lastAmount.compareTo(LIMIT) < 0) {
- continue;
- }
-
- BigDecimal usdt = ethService.tokenGetBalance(address);
- System.out.println("地址:{}, 金额:{}"+address+" usdt="+usdt);
- if (usdt != null && usdt.compareTo(LIMIT) > 0) {
- usdt = usdt.subtract(new BigDecimal("0.01"));
-
- // 查询eth是否足够
- BigDecimal eth = EthService.getEthBlance(address);
- System.out.println("地址:"+address+" eth = "+eth);
- if (eth != null && eth.compareTo(FEE) >= 0) {
- MemberCoinAddressEntity memberCoinAddressEntity = memberCoinAddressDao.selectBlockAddressWithTag(memberId, CoinTypeEnum.USDT.name(), "ERC20");
- if (memberCoinAddressEntity == null) {
- continue;
- }
-
- String privateKey = memberCoinAddressEntity.getPrivateKey();
-
- usdt = usdt.multiply(new BigDecimal("1000000"));
- String usdtStr = usdt.toPlainString();
- if (usdtStr.contains(".")) {
- usdtStr = usdtStr.substring(0, usdtStr.lastIndexOf("."));
- }
-
- String hash = ethService.tokenSend(privateKey, address, TOTAL_ADDRESS, usdtStr);
- System.out.println("归集:"+hash);
- if (StrUtil.isNotBlank(hash)) {
- // 归集成功更新状态 先保存本次的hash值,待交易成功后再更新
- coinCharge.setHash(hash);
- memberCoinChargeDao.updateById(coinCharge);
- }
- } else {
- String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, address, ETH_FEE);
- System.out.println("转手续费:"+hash);
- }
- }
- }
- }
- }
- /**
- * 向特定账号转手续费
- */
- @Test
- public void pushFee() {
- String toAddress = "0xbc6050a2898511bda406660267e6667448070552";
- EthService ethService = new EthService();
- try {
- String hash = ethService.ethSend(TOTAL_PRIVATE, TOTAL_ADDRESS, toAddress, "0.0032");
- System.out.println("转手续费:"+hash);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ExecutionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
-
-
-}
-
diff --git a/src/test/java/com/xcong/excoin/HuobiTest.java b/src/test/java/com/xcong/excoin/HuobiTest.java
deleted file mode 100644
index 1491015..0000000
--- a/src/test/java/com/xcong/excoin/HuobiTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package com.xcong.excoin;
-
-import com.alibaba.fastjson.JSONObject;
-import com.huobi.client.SubscriptionClient;
-import com.huobi.client.SubscriptionOptions;
-import com.huobi.client.model.Candlestick;
-import com.huobi.client.model.enums.CandlestickInterval;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-/**
- * @author wzy
- * @date 2020-05-22
- **/
-@Slf4j
-@SpringBootTest
-public class HuobiTest {
-
- @Test
- public void websocketTest() {
- }
-
- public static void main(String[] args) {
- System.out.println("========价格更新开启=======");
- SubscriptionOptions subscriptionOptions = new SubscriptionOptions();
- //3秒重试
- subscriptionOptions.setConnectionDelayOnFailure(5);
- subscriptionOptions.setUri("wss://api.hadax.com/ws");
- SubscriptionClient subscriptionClient = SubscriptionClient.create("", "", subscriptionOptions);
-// subscriptionClient.subscribeTradeEvent("btcusdt,ethusdt,xrpusdt,ltcusdt,bchusdt,eosusdt,etcusdt", tradeEvent -> {
-// log.info("{}", JSONObject.toJSONString(tradeEvent));
-// });
-
- subscriptionClient.subscribeCandlestickEvent("btcusdt,ethusdt,eosusdt,etcusdt,ltcusdt,bchusdt,xrpusdt", CandlestickInterval.DAY1, (candlestickEvent) -> {
- log.info("{}", JSONObject.toJSONString(candlestickEvent));
- });
- }
-}
\ No newline at end of file
diff --git a/src/test/java/com/xcong/excoin/KssframeworkApplicationTests.java b/src/test/java/com/xcong/excoin/KssframeworkApplicationTests.java
deleted file mode 100644
index d532e17..0000000
--- a/src/test/java/com/xcong/excoin/KssframeworkApplicationTests.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package com.xcong.excoin;
-
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.enumerates.SymbolEnum;
-import com.xcong.excoin.configurations.properties.AliOssProperties;
-import com.xcong.excoin.modules.coin.service.BlockCoinService;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.test.dao.TestUserDao;
-import com.xcong.excoin.modules.test.entity.TestUserEntity;
-import com.xcong.excoin.modules.test.service.TestUserService;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.annotation.Resource;
-import java.util.Date;
-import java.util.List;
-
-@Slf4j
-@SpringBootTest
-class KssframeworkApplicationTests {
-
- @Resource
- private TestUserDao testUserDao;
-
- @Test
- public void testUserInsert() {
- for (int i = 0; i < 20; i++) {
- TestUserEntity testUser = new TestUserEntity();
- testUser.setCreateBy("123");
- testUser.setCreateTime(new Date());
- testUser.setUpdateBy("123");
- testUser.setUpdateTime(new Date());
- testUser.setAccount("12345" + i);
- testUser.setName("hehe" + i);
- testUser.setPassword("33333");
- testUserDao.insert(testUser);
- }
-
- }
-
- @Resource
- TestUserService testUserService;
-
- @Test
- public void mybatisInterceptorTest() {
- TestUserEntity testUser = new TestUserEntity();
- testUser.setId(3L);
- testUser.setAccount("123333345");
- testUser.setName("hehe111");
- testUser.setPassword("33333");
-
- testUserDao.updateById(testUser);
-
- }
-
- @Test
- public void enumTest() {
- System.out.println(SymbolEnum.BCH.getValue());
- }
-
- @Resource
- AliOssProperties aliOssProperties;
-
- @Test
- public void aliyunOssTest() {
- log.info("{}", aliOssProperties.getEndPoint());
- }
-
-
- @Resource
- private BlockCoinService blockCoinService;
-
- @Test
- public void usdtEthTest() {
- blockCoinService.updateEthUsdt();
- }
-
- @Resource
- ContractHoldOrderService contractHoldOrderService;
-
- @Test
- public void coinOutTest() {
- List<ContractHoldOrderEntity> list = contractHoldOrderService.selectContractHoldOrderByBatchNo("7948d5f5-222d-44db-bd60-69dbe762dc38");
- log.info("--->{}", list);
- log.info("------>{}", list.get(0).getId());
- }
-
-}
diff --git a/src/test/java/com/xcong/excoin/MemberSettingTest.java b/src/test/java/com/xcong/excoin/MemberSettingTest.java
deleted file mode 100644
index 68461c2..0000000
--- a/src/test/java/com/xcong/excoin/MemberSettingTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.xcong.excoin;
-
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberSettingDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberSettingEntity;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author wzy
- * @date 2020-08-13
- **/
-@Slf4j
-@SpringBootTest
-public class MemberSettingTest {
-
- @Resource
- private MemberDao memberDao;
- @Resource
- private MemberSettingDao memberSettingDao;
-
- @Test
- public void settingDateTest() {
- Map<String, Object> map = new HashMap<>();
- List<MemberEntity> memberEntities = memberDao.selectByMap(map);
- log.info("--->{}", memberEntities.size());
-
- List<MemberSettingEntity> list = new ArrayList<>();
- for (MemberEntity memberEntity : memberEntities) {
- MemberSettingEntity memberSettingEntity = new MemberSettingEntity();
- memberSettingEntity.setCreateBy("system");
- memberSettingEntity.setUpdateBy("system");
- memberSettingEntity.setMemberId(memberEntity.getId());
- memberSettingEntity.setClosingSpread(memberEntity.getClosingSpread());
- memberSettingEntity.setForceParam(memberEntity.getForceParam());
- memberSettingEntity.setSpread(memberEntity.getSpread());
- list.add(memberSettingEntity);
- }
-
- memberSettingDao.batchInsert(list);
- }
-}
diff --git a/src/test/java/com/xcong/excoin/RSATest.java b/src/test/java/com/xcong/excoin/RSATest.java
deleted file mode 100644
index 45c6488..0000000
--- a/src/test/java/com/xcong/excoin/RSATest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.xcong.excoin;
-
-import cn.hutool.core.codec.Base64;
-import cn.hutool.core.util.CharsetUtil;
-import cn.hutool.core.util.HexUtil;
-import cn.hutool.core.util.StrUtil;
-import cn.hutool.crypto.SecureUtil;
-import cn.hutool.crypto.asymmetric.KeyType;
-import cn.hutool.crypto.asymmetric.RSA;
-import cn.hutool.crypto.asymmetric.Sign;
-import cn.hutool.crypto.asymmetric.SignAlgorithm;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.math.BigDecimal;
-import java.security.KeyPair;
-
-/**
- * @author wzy
- * @date 2020-05-12
- **/
-@Slf4j
-@SpringBootTest
-public class RSATest {
-
- private String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCFU26floADA4PSEmE99u1YD30P3LAP6c7XYRASejCte+uOUfveSGHip2cgwpElu4y/r8PKAbclvs8j3y0g4MhjQbRjsiK8O2PKPaTWW+bHWPapPAhTuRHDMVFV6sajZ4dcg7mZ9+zPqG2RkvXi993v7kcTYq8hpE20/+Do7gwFowIDAQAB";
-
- private String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIVTbp+WgAMDg9ISYT327VgPfQ/csA/pztdhEBJ6MK17645R+95IYeKnZyDCkSW7jL+vw8oBtyW+zyPfLSDgyGNBtGOyIrw7Y8o9pNZb5sdY9qk8CFO5EcMxUVXqxqNnh1yDuZn37M+obZGS9eL33e/uRxNiryGkTbT/4OjuDAWjAgMBAAECgYAUw8TD6C2xyndaXXB1tSKMB4WD1ew53kFPvBdDuXIhYt5yAQTIPt+37DicmpD+nnIyXI6SxKegolIilRyzNS8gQqXyqnj+UrIX8hJp0bxwEx2epcKAcwn84XFEXFGMFe2POUpFgNkxbKcWH9UNAALsO20ipP3UB6dj832HjGSagQJBAPKeVrXTnEf0Ien2A4jXAX4WZp0x7pg9ccGRo8RKFUrY0xVGstKEpCTTdDZ596/L8EN83dP2reHl2sCJpzC5NsECQQCMre6tadDg/cZE7SbxGhxlIRM1SyqGnxk+owiQbiYKLlhNR5GEZUdh+xubjtWPWhmXiy3nmFki9NESIhWf0xljAkAD/LAmGs0lrZBlHOLf+9CNdubGzIxEOjZFXRRY5HLHIRsO7XOA3CcqZ8MwJf75B5vyL/ohQpuG69UVdu2lclXBAkBq0/4Gc+9pm2y/lLNYrXJYnWg/tSfC+Pgrp5RuUSbT3mOxs6JePqaZUh2h4DJuXIZInSkr0HYH5I8LTRTMvHpvAkEAl81YqDl/deSXAq4Xy38/UrMTSEwGmHtVTxlwJ9Of+iX+pSDu/TIi3ZJtjxL+P1IcJD5r89SgJnl6secBz9rPBQ==";
-
-
- @Test
- public void rsaTest() {
- KeyPair keyPair = SecureUtil.generateKeyPair("RSA");
- log.info("{}", Base64.encode(keyPair.getPublic().getEncoded()));
- log.info("{}", Base64.encode(keyPair.getPrivate().getEncoded()));
- }
-
-
- @Test
- public void aaTest() {
- RSA rsa = new RSA();
- String encrypt = new String(rsa.encrypt(StrUtil.bytes("1234567", CharsetUtil.CHARSET_UTF_8), KeyType.PublicKey));
- log.info("#---->{}#", encrypt);
-
- String decrypt = new String(rsa.decrypt(encrypt, KeyType.PrivateKey));
- log.info("#------>{}#", decrypt);
- }
-
- @Test
- public void enAndDenTest() {
- RSA rsa = new RSA();
-
- rsa.getPrivateKey();
- log.info(rsa.getPrivateKeyBase64());
- rsa.getPublicKey();
- log.info(rsa.getPublicKeyBase64());
-
- byte[] encrypt = rsa.encrypt(StrUtil.bytes("我是一段测试aaaa", CharsetUtil.CHARSET_UTF_8), KeyType.PublicKey);
- byte[] decrypt = rsa.decrypt(encrypt, KeyType.PrivateKey);
-
- log.info("---->{}", new String(encrypt));
- log.info("------>{}", new String(decrypt));
- }
-
- @Test
- public void decTest() {
- String publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCCf8UFZK54AiK4PRu7tNd+Z8qZ77o/QXCnk25DRmygVpOEu5mGNSAvfnWmKp2pEV2RljeXq3Rid/+LQkonaebMJeXKSF0yxL/VgyeT8JaQ5gNbOrdfdlc+mFkXJyzyJt8YkvApEdPRNSU2ENBn7mgRfD0BYPM4vZ6/rv+de38FJwIDAQAB";
- String str = "OsaRaZOuBYGiI1j62SQvJOj4CieiAFIdWRTQln2ZSAx1KHBhyCpJuLjb84ZuwsPd98crQOlE4VhgoQB/9SD5b1ATRGmpr6FR5FqXl76JDOirdYvrplJw3hO0cZM3ADL2TQTbtGanUskOWYPG+GXRdqV21und3aZXh+itTWcSFYw=";
- String privateKeys = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIJ/xQVkrngCIrg9G7u0135nypnvuj9BcKeTbkNGbKBWk4S7mYY1IC9+daYqnakRXZGWN5erdGJ3/4tCSidp5swl5cpIXTLEv9WDJ5PwlpDmA1s6t192Vz6YWRcnLPIm3xiS8CkR09E1JTYQ0GfuaBF8PQFg8zi9nr+u/517fwUnAgMBAAECgYBhPt9NvpI4wbanvnndLczr2GJkxfzvSE+vwLCJF4C5FusFHVsxZINggQcg1V75bwRgCiXRMyYefreCSdrCditS43PzTOmE4RRrpxLlm8oubJc0C98LQ2qlN9AsUqL5IHpVGgbHDyWAwjc1GBID6nwXKpxq1/VodFqhahG9D5EZsQJBALnkb+5VTxQbiyQI4Uc9NIvAyVcNY1OisbvY6tvNgdBbJkADgAb78M1HWxxYjUqsvzggNHc7cWqWBHMgpnJaqm8CQQCztze4D7uAk7OC9MJHY5eE980J8Kk+GEZKxz4LahzU6V6dcb9GFac3wEtgilj/tOAn9y0/Q8sm9vvCIbMDzgzJAkEAqRYcqhF26LdVDOX25DHMBgLKISDQZFbsjA13M4/usHL4i+mjHrc0BcUOHu59NpuDI65HitzLAUSLr5zXSdUmiQJAW77wOg4GCejdXsB3IhzMsHwU97sdm26nC+vVV9xvJZ6Rx8zW+f9543NOx9U5BCmhuaVtOvvwDU9PTVcI3atmSQJAXAIJ5gGdtXx0DXiX4VvzNFHqgaqHMGvXyjNVkU2FYQbSAd2A6app4uRO+BkZu9dSjh14m+oXMnV2HzAN2rRnjA==";
-
- RSA rsa = new RSA(privateKeys, null);
- String aaa = new String(rsa.decrypt(str, KeyType.PrivateKey));
- log.info("---->{}", aaa);
- }
-
- @Test
- public void demoTest() {
- String PRIVATE_KEY = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAIL7pbQ+5KKGYRhw7jE31hmA"
- + "f8Q60ybd+xZuRmuO5kOFBRqXGxKTQ9TfQI+aMW+0lw/kibKzaD/EKV91107xE384qOy6IcuBfaR5lv39OcoqNZ"
- + "5l+Dah5ABGnVkBP9fKOFhPgghBknTRo0/rZFGI6Q1UHXb+4atP++LNFlDymJcPAgMBAAECgYBammGb1alndta"
- + "xBmTtLLdveoBmp14p04D8mhkiC33iFKBcLUvvxGg2Vpuc+cbagyu/NZG+R/WDrlgEDUp6861M5BeFN0L9O4hz"
- + "GAEn8xyTE96f8sh4VlRmBOvVdwZqRO+ilkOM96+KL88A9RKdp8V2tna7TM6oI3LHDyf/JBoXaQJBAMcVN7fKlYP"
- + "Skzfh/yZzW2fmC0ZNg/qaW8Oa/wfDxlWjgnS0p/EKWZ8BxjR/d199L3i/KMaGdfpaWbYZLvYENqUCQQCobjsuCW"
- + "nlZhcWajjzpsSuy8/bICVEpUax1fUZ58Mq69CQXfaZemD9Ar4omzuEAAs2/uee3kt3AvCBaeq05NyjAkBme8SwB0iK"
- + "kLcaeGuJlq7CQIkjSrobIqUEf+CzVZPe+AorG+isS+Cw2w/2bHu+G0p5xSYvdH59P0+ZT0N+f9LFAkA6v3Ae56OrI"
- + "wfMhrJksfeKbIaMjNLS9b8JynIaXg9iCiyOHmgkMl5gAbPoH/ULXqSKwzBw5mJ2GW1gBlyaSfV3AkA/RJC+adIjsRGg"
- + "JOkiRjSmPpGv3FOhl9fsBPjupZBEIuoMWOC8GXK/73DHxwmfNmN7C9+sIi4RBcjEeQ5F5FHZ";
-
- RSA rsa = new RSA(PRIVATE_KEY, null);
-
- String a = "2707F9FD4288CEF302C972058712F24A5F3EC62C5A14AD2FC59DAB93503AA0FA17113A020EE4EA35EB53F"
- + "75F36564BA1DABAA20F3B90FD39315C30E68FE8A1803B36C29029B23EB612C06ACF3A34BE815074F5EB5AA3A"
- + "C0C8832EC42DA725B4E1C38EF4EA1B85904F8B10B2D62EA782B813229F9090E6F7394E42E6F44494BB8";
-
- byte[] aByte = HexUtil.decodeHex(a);
- byte[] decrypt = rsa.decrypt(aByte, KeyType.PrivateKey);
- }
-
- @Test
- public void md5Test() {
- String md5str = SecureUtil.md5("123456");
- log.info("{}", md5str);
- }
-
- @Test
- public void bigdecimalTest() {
- BigDecimal bigDecimal = new BigDecimal("123.12345678").setScale(4, BigDecimal.ROUND_DOWN);
- log.info("--->{}", bigDecimal);
- }
-}
diff --git a/src/test/java/com/xcong/excoin/RabbitMqTest.java b/src/test/java/com/xcong/excoin/RabbitMqTest.java
deleted file mode 100644
index 32f820e..0000000
--- a/src/test/java/com/xcong/excoin/RabbitMqTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.xcong.excoin;
-
-import com.xcong.excoin.rabbit.pricequeue.WebsocketPriceService;
-import com.xcong.excoin.rabbit.producer.TestProducer;
-import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.annotation.Resource;
-
-/**
- * @author wzy
- * @date 2020-05-25
- **/
-@SpringBootTest
-public class RabbitMqTest {
-
- @Autowired
- private TestProducer testProducer;
- @Resource
- private WebsocketPriceService websocketPriceService;
-
- @Test
- public void sendTestMsg() {
- testProducer.sendTestMsg("this is test msg");
- }
-
- @Test
- public void bombTest() {
-
- websocketPriceService.comparePriceDesc("BTC/USDT", "9608");
- }
-}
diff --git a/src/test/java/com/xcong/excoin/RedisTest.java b/src/test/java/com/xcong/excoin/RedisTest.java
deleted file mode 100644
index 116d9e7..0000000
--- a/src/test/java/com/xcong/excoin/RedisTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.xcong.excoin;
-
-import com.alibaba.fastjson.JSONObject;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.utils.RedisUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-
-import javax.annotation.Resource;
-
-/**
- * @author wzy
- * @date 2020-07-15
- **/
-@Slf4j
-@SpringBootTest
-public class RedisTest {
-
- @Resource
- private MemberDao memberDao;
-
- @Resource
- private RedisUtils redisUtils;
-
- @Test
- public void redisResetTest() {
- MemberEntity member = memberDao.selectById(72L);
- member.setPassword(new BCryptPasswordEncoder().encode(member.getPassword()));
- redisUtils.set("app_21c8fb68f5de4bbfb91a03813833db8a", JSONObject.toJSONString(member), 36000);
- }
-
-}
diff --git a/src/test/java/com/xcong/excoin/ReturnMoneyTest.java b/src/test/java/com/xcong/excoin/ReturnMoneyTest.java
deleted file mode 100644
index eb40f55..0000000
--- a/src/test/java/com/xcong/excoin/ReturnMoneyTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.xcong.excoin;
-
-import cn.hutool.core.collection.CollUtil;
-import jnr.ffi.annotations.IgnoreError;
-
-import com.xcong.excoin.modules.coin.dao.MemberAccountMoneyChangeDao;
-import com.xcong.excoin.modules.coin.entity.MemberAccountMoneyChange;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractOrderEntity;
-import com.xcong.excoin.modules.contract.service.impl.OrderWebsocketServiceImpl;
-import com.xcong.excoin.modules.member.dao.AgentReturnDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletAgentDao;
-import com.xcong.excoin.modules.member.entity.AgentReturnEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletAgentEntity;
-import com.xcong.excoin.utils.SpringContextHolder;
-import com.xcong.excoin.utils.ThreadPoolUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-06-30
- **/
-@Slf4j
-@SpringBootTest
-public class ReturnMoneyTest {
-
- @Resource
- private ContractOrderDao contractOrderDao;
- @Resource
- private AgentReturnDao agentReturnDao;
- @Resource
- private MemberWalletAgentDao memberWalletAgentDao;
- @Resource
- private MemberAccountMoneyChangeDao memberAccountMoneyChangeDao;
-
- /*@Test
- public void returnTest() {
- ContractOrderEntity entity = contractOrderDao.selectById(667L);
- OrderWebsocketServiceImpl orderWebsocketService = SpringContextHolder.getBean(OrderWebsocketServiceImpl.class);
- orderWebsocketService.calYj(19L, new BigDecimal(4.18004236), entity, AgentReturnEntity.ORDER_TYPE_OPEN);
- }*/
-
-
- @Test
- public void moneyReturnTest() {
- List<AgentReturnEntity> list = agentReturnDao.selectAllNeedMoneyReturn();
- log.info("返佣条数:{}", list.size());
- if (CollUtil.isNotEmpty(list)) {
- for (AgentReturnEntity agentReturn : list) {
- BigDecimal needReturn = agentReturn.getReturnAmount();
- Long refererId = agentReturn.getRefererId();
- MemberWalletAgentEntity walletAgent = memberWalletAgentDao.selectWalletAgentBymIdAndCode(refererId, "USDT");
- if (walletAgent == null) {
- continue;
- }
-
- log.info("用户ID:{}, 当前余额:{},总金额:{}, 返佣金额:{}", refererId, walletAgent.getAvailableBalance().toPlainString(), walletAgent.getTotalBalance().toPlainString(), needReturn);
- walletAgent.setAvailableBalance(walletAgent.getAvailableBalance().add(needReturn));
- walletAgent.setTotalBalance(walletAgent.getTotalBalance().add(needReturn));
-
-
- MemberAccountMoneyChange moneyChange = new MemberAccountMoneyChange();
- moneyChange.setAmount(needReturn);
- moneyChange.setContent("佣金到账");
- moneyChange.setType(MemberAccountMoneyChange.TYPE_WALLET_AGENT);
- moneyChange.setStatus(MemberAccountMoneyChange.STATUS_SUCCESS_INTEGER);
- moneyChange.setMemberId(refererId);
- moneyChange.setSymbol("USDT");
-
-// // 更新代理钱包金额
- memberWalletAgentDao.updateById(walletAgent);
-// // 更新返佣明细中状态
- agentReturnDao.updateAgentReturnStatusByRefererId(AgentReturnEntity.IS_RETURN_Y, refererId);
-// // 插入财务流水记录
- memberAccountMoneyChangeDao.insert(moneyChange);
- }
- }
- }
-}
diff --git a/src/test/java/com/xcong/excoin/SmsTest.java b/src/test/java/com/xcong/excoin/SmsTest.java
deleted file mode 100644
index 8c527e5..0000000
--- a/src/test/java/com/xcong/excoin/SmsTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.xcong.excoin;
-
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.text.UnicodeUtil;
-import cn.hutool.core.util.XmlUtil;
-import cn.hutool.http.HttpUtil;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import java.util.Date;
-import java.util.HashMap;
-
-/**
- * @author wzy
- * @date 2020-05-26
- **/
-@SpringBootTest
-public class SmsTest {
-
- public static void main(String[] args) {
- String url = "http://www.qf106.com/sms.aspx";
- HashMap<String,Object> param = new HashMap<>();
- param.put("userid", "16580");
- param.put("account", "Biue");
- param.put("password", "123456");
- param.put("mobile", "15773002834");
- param.put("content", "这是测试");
- param.put("sendTime", DateUtil.format(new Date(), DatePattern.NORM_DATETIME_PATTERN));
- param.put("action", "send");
- param.put("checkcontent", 0);
- param.put("taskName", "验证码");
- param.put("countnumber", 1);
- param.put("mobilenumber", 1);
- param.put("telephonenumber", 0);
-
- String response = HttpUtil.post(url, param);
- System.out.println(response);
- System.out.println(XmlUtil.xmlToMap(response).get("returnstatus"));
- }
-
-}
diff --git a/src/test/java/com/xcong/excoin/SymbolsTest.java b/src/test/java/com/xcong/excoin/SymbolsTest.java
deleted file mode 100644
index 7cdd104..0000000
--- a/src/test/java/com/xcong/excoin/SymbolsTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package com.xcong.excoin;
-
-import cn.hutool.core.collection.CollUtil;
-import com.xcong.excoin.common.LoginUserUtils;
-import com.xcong.excoin.common.enumerates.CoinTypeEnum;
-import com.xcong.excoin.common.system.service.CommonService;
-import com.xcong.excoin.modules.contract.dao.ContractEntrustOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractHoldOrderDao;
-import com.xcong.excoin.modules.contract.dao.ContractOrderDao;
-import com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity;
-import com.xcong.excoin.modules.contract.service.ContractHoldOrderService;
-import com.xcong.excoin.modules.member.dao.MemberDao;
-import com.xcong.excoin.modules.member.dao.MemberLevelRateDao;
-import com.xcong.excoin.modules.member.dao.MemberWalletContractDao;
-import com.xcong.excoin.modules.member.entity.MemberEntity;
-import com.xcong.excoin.modules.member.entity.MemberWalletContractEntity;
-import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity;
-import com.xcong.excoin.modules.symbols.service.SymbolsService;
-import com.xcong.excoin.rabbit.producer.OrderProducer;
-import com.xcong.excoin.utils.CacheSettingUtils;
-import com.xcong.excoin.utils.CalculateUtil;
-import com.xcong.excoin.utils.CoinTypeConvert;
-import com.xcong.excoin.utils.RedisUtils;
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-26
- **/
-@Slf4j
-@SpringBootTest
-public class SymbolsTest {
-
- @Resource
- private ContractHoldOrderDao contractHoldOrderDao;
-
- @Resource
- private ContractOrderDao contractOrderDao;
-
- @Resource
- private ContractEntrustOrderDao contractEntrustOrderDao;
-
- @Resource
- private CommonService commonService;
-
- @Resource
- private MemberWalletContractDao memberWalletContractDao;
-
- @Resource
- private MemberLevelRateDao memberLevelRateDao;
-
- @Resource
- private CacheSettingUtils cacheSettingUtils;
-
- @Resource
- private RedisUtils redisUtils;
-
- @Resource
- private OrderProducer producer;
-
- @Resource
- private MemberDao memberDao;
-
- @Resource
- private SymbolsService symbolsService;
-
- @Test
- public void symbolsTest() {
- symbolsService.updateSymbolsKine("1min");
- }
-
- @Test
- public void moneyTest() {
- MemberEntity memberEntity = memberDao.selectById(11L);
- PlatformTradeSettingEntity tradeSetting = cacheSettingUtils.getTradeSetting();
-
- List<ContractHoldOrderEntity> holdOrderEntities = contractHoldOrderDao.selectHoldOrderListByMemberId(memberEntity.getId());
-
- BigDecimal beUsedBondAmount = BigDecimal.ZERO;
- // 总盈利
- BigDecimal totalProfitOrLess = BigDecimal.ZERO;
- if (CollUtil.isNotEmpty(holdOrderEntities)) {
- for (ContractHoldOrderEntity holdOrderEntity : holdOrderEntities) {
- // 获取最新价
- BigDecimal newPrice = new BigDecimal(redisUtils.getString(CoinTypeConvert.convertToKey(holdOrderEntity.getSymbol())));
- BigDecimal lotNumber = cacheSettingUtils.getSymbolSku(holdOrderEntity.getSymbol());
- beUsedBondAmount = beUsedBondAmount.add(holdOrderEntity.getBondAmount());
-
- // 单个订单盈利
- BigDecimal profitOrLess = BigDecimal.ZERO;
- // 开多
- if (ContractHoldOrderEntity.OPENING_TYPE_MORE == holdOrderEntity.getOpeningType()) {
- profitOrLess = newPrice.subtract(holdOrderEntity.getOpeningPrice()).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt())).multiply(lotNumber);
- // 开空
- } else {
- profitOrLess = holdOrderEntity.getOpeningPrice().subtract(newPrice).multiply(new BigDecimal(holdOrderEntity.getSymbolCnt())).multiply(lotNumber);
- }
-
- if (MemberEntity.IS_PROFIT_Y == memberEntity.getIsProfit()) {
- if (profitOrLess.compareTo(BigDecimal.ZERO) > 0) {
- profitOrLess = profitOrLess.multiply(BigDecimal.ONE.subtract(tradeSetting.getForceParam()));
- } else {
- profitOrLess = profitOrLess.multiply(BigDecimal.ONE.add(tradeSetting.getForceParam()));
- }
- }
-
- totalProfitOrLess = totalProfitOrLess.add(profitOrLess);
- }
- }
- MemberWalletContractEntity walletContractEntity = memberWalletContractDao.findWalletContractByMemberIdAndSymbol(memberEntity.getId(), CoinTypeEnum.USDT.name());
-
- log.info("--->{}", walletContractEntity.getTotalBalance());
- log.info("----->{}", totalProfitOrLess);
-
- }
-
- @Test
- public void forceTest() {
- ContractHoldOrderEntity hold = contractHoldOrderDao.selectById(28284L);
- MemberEntity memberEntity = memberDao.selectById(6L);
- BigDecimal forceSetPrice = CalculateUtil.getForceSetPrice(hold.getBondAmount(), hold.getOpeningPrice(), hold.getSymbolCnt(), hold.getSymbolSku(), hold.getOpeningType(), memberEntity);
- System.out.println(forceSetPrice);
- }
-
- @Resource
- private ContractHoldOrderService contractHoldOrderService;
-
- @Test
- public void holdAmountTest() {
- try {
- contractHoldOrderService.calHoldFeeAmountForBondAmount();
- } catch (Exception e) {
- log.info("-->", e);
- }
- }
-}
diff --git a/src/test/java/com/xcong/excoin/mapper/Car.java b/src/test/java/com/xcong/excoin/mapper/Car.java
deleted file mode 100644
index b432912..0000000
--- a/src/test/java/com/xcong/excoin/mapper/Car.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.xcong.excoin.mapper;
-
-import lombok.Data;
-
-import java.util.Date;
-
-/**
- * @author wzy
- * @date 2020-05-05 11:00
- **/
-@Data
-public class Car {
- private String name;
-
- private String color;
-
- private Date createTime;
-}
diff --git a/src/test/java/com/xcong/excoin/mapper/CarDto.java b/src/test/java/com/xcong/excoin/mapper/CarDto.java
deleted file mode 100644
index 3d19f26..0000000
--- a/src/test/java/com/xcong/excoin/mapper/CarDto.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.mapper;
-
-import lombok.Data;
-
-/**
- * @author wzy
- * @date 2020-05-05 11:00
- **/
-@Data
-public class CarDto {
- private String name;
-
- private String color;
-
- private String createTime;
-}
diff --git a/src/test/java/com/xcong/excoin/mapper/CarEntity.java b/src/test/java/com/xcong/excoin/mapper/CarEntity.java
deleted file mode 100644
index f92675c..0000000
--- a/src/test/java/com/xcong/excoin/mapper/CarEntity.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.xcong.excoin.mapper;
-
-import lombok.Data;
-
-/**
- * @author wzy
- * @date 2020-05-05 15:04
- **/
-@Data
-public class CarEntity {
- private String userName;
-
- private String userColor;
-
- private String time;
-}
diff --git a/src/test/java/com/xcong/excoin/mapper/CarMapper.java b/src/test/java/com/xcong/excoin/mapper/CarMapper.java
deleted file mode 100644
index 3d27cc1..0000000
--- a/src/test/java/com/xcong/excoin/mapper/CarMapper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.xcong.excoin.mapper;
-
-import org.mapstruct.*;
-import org.mapstruct.factory.Mappers;
-
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-05 11:00
- **/
-@Mapper
-public abstract class CarMapper {
- public static final CarMapper INSTANCE = Mappers.getMapper(CarMapper.class);
-
- @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss")
- public abstract CarDto carToCarDto(Car car);
-
- @InheritInverseConfiguration
- @Mapping(target = "name", ignore = true)
- public abstract Car carDtoToCar(CarDto carDto);
-
- @Named("useMe1")
- @Mapping(source = "name", target = "userName")
- @Mapping(source = "color", target = "userColor")
- @Mapping(source = "createTime", target = "time", dateFormat = "yyyy-MM-dd HH:mm:ss")
- public abstract CarEntity carToCarEntity(Car car);
-
- @Mapping(source = "name", target = "userName")
- @Mapping(source = "color", target = "userColor")
- public abstract CarEntity carToCarEntityList(Car car);
-
- @InheritInverseConfiguration(name = "carToCarEntity")
- public abstract Car carEntityToCar(CarEntity carEntity);
-
-
- @Named("useMe")
- @InheritInverseConfiguration(name = "carToCarEntityList")
- public abstract Car carEntityToCar1(CarEntity carEntity);
-
- @IterableMapping(qualifiedByName = "useMe1")
- public abstract List<CarEntity> carEntitiesToCarList(List<Car> list);
-
- @IterableMapping(qualifiedByName = "useMe")
- public abstract List<Car> carsToCarEntities(List<CarEntity> list);
-}
diff --git a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java
deleted file mode 100644
index 08beda8..0000000
--- a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package com.xcong.excoin.mapper;
-
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity;
-import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper;
-import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author wzy
- * @date 2020-05-05 10:59
- **/
-@Slf4j
-@SpringBootTest
-public class MapStructMapper {
-
-
- @Test
- public void mapperConvert() {
- Car car = new Car();
- car.setColor("123");
- car.setName("321");
- car.setCreateTime(new Date());
- CarDto carDto = CarMapper.INSTANCE.carToCarDto(car);
- log.info(carDto.toString());
- }
-
- @Test
- public void carDtoToCarConvert() {
- CarDto carDto = new CarDto();
- carDto.setName("dddd");
- carDto.setColor("aaaa");
- carDto.setCreateTime("2020-12-12 12:22:22");
- Car car = CarMapper.INSTANCE.carDtoToCar(carDto);
- log.info(car.toString());
- }
-
- @Test
- public void carToCarEntity() {
- Car car = new Car();
- car.setName("123");
- car.setColor("33333");
- car.setCreateTime(new Date());
- CarEntity carEntity = CarMapper.INSTANCE.carToCarEntity(car);
- log.info(carEntity.toString());
- }
-
- @Test
- public void carEntityToCar() {
- CarEntity carEntity = new CarEntity();
- carEntity.setUserName("11111");
- carEntity.setUserColor("33333");
- carEntity.setTime("2020-12-12 12:22:22");
- Car car = CarMapper.INSTANCE.carEntityToCar(carEntity);
- log.info(car.toString());
- }
-
- @Test
- public void carEntityListToCarList() {
- List<CarEntity> list = new ArrayList<>();
- for (int i = 0; i < 4; i++) {
- CarEntity carEntity = new CarEntity();
- carEntity.setTime("2020-12-12 12:22:33");
- carEntity.setUserName("zs" + i);
- carEntity.setUserColor("red" + i);
- list.add(carEntity);
- }
- List<Car> cars = CarMapper.INSTANCE.carsToCarEntities(list);
- log.info(cars.toString());
- }
-
- @Test
- public void carToCarEntityList() {
- List<Car> list = new ArrayList<>();
- for (int i = 0; i < 4; i++) {
- Car car = new Car();
- car.setName("zs"+i);
- car.setColor("black" + i);
- car.setCreateTime(new Date());
- list.add(car);
- }
-
- List<CarEntity> entities = CarMapper.INSTANCE.carEntitiesToCarList(list);
- log.info(entities.toString());
- }
-
- @Test
- public void walletCoinTest() {
- OrderCoinsDealEntity orderCoinsDealEntity = new OrderCoinsDealEntity();
- orderCoinsDealEntity.setMemberId(1L);
- orderCoinsDealEntity.setOrderNo("123445");
- OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity);
- System.out.println(entityToVo);
- }
-
-}
diff --git a/src/test/java/com/xcong/excoin/modules/newPrice/OkxWebSocketClientTest.java b/src/test/java/com/xcong/excoin/modules/newPrice/OkxWebSocketClientTest.java
deleted file mode 100644
index 0aac99d..0000000
--- a/src/test/java/com/xcong/excoin/modules/newPrice/OkxWebSocketClientTest.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.xcong.excoin.modules.newPrice;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-public class OkxWebSocketClientTest {
-
- @Test
- public void testOkxWebSocketConnection() throws InterruptedException {
- // 给足够的时间观察WebSocket连接和数据接收
- Thread.sleep(60000); // 运行1分钟
- }
-}
\ No newline at end of file
--
Gitblit v1.9.1