From 0fd40a68387076a4a37014d2c3997687ab9a754f Mon Sep 17 00:00:00 2001
From: gao <gaoleox@163>
Date: Wed, 27 May 2020 11:53:42 +0800
Subject: [PATCH] Merge branch 'master' of https://chonggaoxiao:xcg523511090712@gitee.com/chonggaoxiao/new_excoin.git
---
src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinsDao.java | 15
src/main/resources/mapper/member/MemberAccountFlowEntityDao.xml | 5
src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountFlowEntityDao.java | 8
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindCollectDto.java | 20
src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml | 22 +
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CancelEntrustWalletCoinOrderDto.java | 19
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java | 65 ++
src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java | 50 ++
src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java | 14
src/main/resources/mapper/platform/TradeSettingDao.xml | 11
src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java | 17
src/test/java/com/xcong/excoin/mapper/MapStructMapper.java | 191 ++++----
src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java | 14
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealVo.java | 76 +++
src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java | 11
src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java | 16
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java | 23 +
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberWalletAgentInfoVo.java | 2
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 386 ++++++++++++++++
lib/huobi-client-1.0.8-SNAPSHOT.jar | 0
src/main/java/com/xcong/excoin/modules/coin/service/impl/CoinServiceImpl.java | 3
src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java | 16
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberAccountMoneyChangeInfoVo.java | 7
src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java | 10
src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java | 8
src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml | 19
src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java | 13
/dev/null | 8
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/TransactionPageOfWalletCoinVo.java | 50 ++
src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java | 101 ++++
src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountFlowEntity.java | 60 ++
src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealListVo.java | 16
32 files changed, 1,119 insertions(+), 157 deletions(-)
diff --git a/lib/huobi-client-1.0.8-SNAPSHOT.jar b/lib/huobi-client-1.0.8-SNAPSHOT.jar
new file mode 100644
index 0000000..6422e71
--- /dev/null
+++ b/lib/huobi-client-1.0.8-SNAPSHOT.jar
Binary files differ
diff --git a/src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java b/src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java
index 3a286be..e4d58dc 100644
--- a/src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java
+++ b/src/main/java/com/xcong/excoin/common/enumerates/MemberWalletCoinEnum.java
@@ -21,7 +21,16 @@
WALLETCOINCODE("USDT", "USDT"),
SUBMITSALESWALLETCOINORDER_SERVICERATE("ServiceRate","0.002"),
- SUBMITSALESWALLETCOINORDER_TYPE("type","1"),
+
+ //SUBMITSALESWALLETCOINORDER_TYPE_S("买入","1"),
+ //SUBMITSALESWALLETCOINORDER_TYPE_B("卖出","2"),
+ //SUBMITSALESWALLETCOINORDER_TRADETYPE_S("市价","1"),
+ //SUBMITSALESWALLETCOINORDER_TRADETYPE_X("限价","2"),
+
+ //SUBMITSALESWALLETCOINORDER_ORDERSTATUS_ONE("委托中","1"),
+ //SUBMITSALESWALLETCOINORDER_ORDERSTATUS_TWO("撤单","2"),
+ //SUBMITSALESWALLETCOINORDER_ORDERSTATUS_THREE("已成交","3"),
+
ENTERTRANSACTIONPAGEOFWALLETCOIN_ISCOLLECT_NO("isCollect","0"),
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
index 51f7399..b505e06 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/controller/CoinController.java
@@ -23,9 +23,6 @@
import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceFromAgentDto;
import com.xcong.excoin.modules.coin.service.CoinService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@@ -54,8 +51,11 @@
*/
@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(@ApiParam(name="symbol",value="币种",required=true)String symbol) {
+ public Result getWalletCoinBySymbol(String symbol) {
return coinService.getWalletCoinBySymbol(symbol);
}
@@ -86,8 +86,11 @@
* @return
*/
@ApiOperation(value="查询币币账户里面的可用资产余额", notes="查询币币账户里面的可用资产余额")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query")
+ })
@GetMapping(value="/findWalletCoinBySymbol")
- public Result findWalletCoinBysymbol(@ApiParam(name="symbol",value="币种",required=true)String symbol) {
+ public Result findWalletCoinBysymbol(String symbol) {
return coinService.findWalletCoinBySymbol(symbol);
}
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
index b5b0b20..06a0cc7 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/controller/OrderCoinController.java
@@ -12,13 +12,23 @@
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.FindCollectDto;
import com.xcong.excoin.modules.coin.parameter.dto.SubmitSalesWalletCoinOrderDto;
-import com.xcong.excoin.modules.coin.parameter.dto.TransferOfBalanceDto;
+import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo;
+import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealListVo;
+import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
+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 io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@@ -35,16 +45,18 @@
* @return
*/
@ApiOperation(value = "进入交易页面", notes = "进入交易页面")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = TransactionPageOfWalletCoinVo.class)})
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "symbol", value = "币种", required = true, dataType = "String", paramType="query"),
+ @ApiImplicitParam(name = "type", value = "买入卖出类型1:买入,2:卖出", required = true, dataType = "String", paramType="query")
+ })
@GetMapping(value = "/enterTransactionPageOfWalletCoin")
- public Result enterTransactionPageOfWalletCoin( @ApiParam(name="symbol",value="币种",required=true)String symbol,
- @ApiParam(name="type",value="买入卖出类型",required=true)String type) {
+ public Result enterTransactionPageOfWalletCoin(String symbol,String type) {
return orderCoinService.enterTransactionPageOfWalletCoin(symbol,type);
}
/**
* 提交买卖订单
- * @param buySymbolTradeVo
- * @param token
* @return
*/
@ApiOperation(value = "提交买卖订单", notes = "提交买卖订单")
@@ -57,5 +69,82 @@
BigDecimal amount = submitSalesWalletCoinOrderDto.getAmount();
return orderCoinService.submitSalesWalletCoinOrder(symbol,type,tradeType,price,amount);
}
-
+
+ /**
+ * 获取委托单数据
+ * @return
+ */
+ @ApiOperation(value = "获取委托单数据", notes = "获取委托单数据")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinVo.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 orderNo = cancelEntrustWalletCoinOrderDto.getOrderNo();
+ return orderCoinService.cancelEntrustWalletCoinOrder(orderNo);
+ }
+
+ /**
+ * 获取币币交易历史订单信息
+ * @return
+ */
+ @ApiOperation(value = "获取币币交易历史订单信息", notes = "获取币币交易历史订单信息")
+ @ApiResponses({@ApiResponse( code = 200, message = "success", response = OrderWalletCoinDealListVo.class)})
+ @GetMapping(value = "/findAllWalletCoinOrder")
+ public Result findAllWalletCoinOrder() {
+ return orderCoinService.findAllWalletCoinOrder();
+ }
+
+ /**
+ * 获取一条币币交易历史订单信息
+ * @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);
+ }
+
}
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
new file mode 100644
index 0000000..64af089
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/dao/MemberAccountFlowEntityDao.java
@@ -0,0 +1,8 @@
+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/OrderCoinDao.java b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDao.java
deleted file mode 100644
index c33249f..0000000
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDao.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.OrderCoinsEntity;
-
-public interface OrderCoinDao extends BaseMapper<OrderCoinsEntity>{
-
-}
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
index 0155075..1d3f4d8 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinDealDao.java
@@ -1,8 +1,16 @@
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.OrderCoinsDealEntity;
public interface OrderCoinDealDao extends BaseMapper<OrderCoinsDealEntity>{
-
+
+ List<OrderCoinsDealEntity> selectAllWalletCoinOrder(@Param("memberId")Long memberId);
+
+ OrderCoinsDealEntity selectWalletCoinOrder(@Param("memberId")Long memberId,@Param("orderId")Long orderId);
+
}
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
new file mode 100644
index 0000000..122ad8f
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/dao/OrderCoinsDao.java
@@ -0,0 +1,15 @@
+package com.xcong.excoin.modules.coin.dao;
+
+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);
+
+ OrderCoinsEntity findCoinOrderListByMemberIdAndSysmbol(@Param("memberId")Long memberId,@Param("symbol")String symbol,@Param("status")int status);
+
+ OrderCoinsEntity findWalletCoinOrderByOrderNo(@Param("orderNo")String orderNo);
+}
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
new file mode 100644
index 0000000..396540b
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/entity/MemberAccountFlowEntity.java
@@ -0,0 +1,60 @@
+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/OrderCoinsDealEntity.java b/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java
index 02b24ad..bc8d440 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsDealEntity.java
@@ -1,5 +1,7 @@
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;
@@ -15,5 +17,53 @@
*
*/
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;
+ /**
+ * 币种
+ */
+ 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
index a99e77e..54cadd8 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/entity/OrderCoinsEntity.java
@@ -1,7 +1,6 @@
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;
@@ -30,7 +29,10 @@
/**
* 订单类型 1、买入2、卖出
*/
- private int orderType;
+ private Integer orderType;
+ public static final Integer ORDERTYPE_BUY = 1;
+ public static final Integer ORDERTYPE_SELL = 2;
+
/**
* 币种
*/
@@ -54,7 +56,7 @@
/**
* 成交价
*/
- private Double dealPrice;
+ private BigDecimal dealPrice;
/**
* 成交金额
*/
@@ -63,13 +65,20 @@
* 状态 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 String feeAmount;
+ private BigDecimal feeAmount;
}
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
new file mode 100644
index 0000000..5844ba7
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinDealMapper.java
@@ -0,0 +1,16 @@
+package com.xcong.excoin.modules.coin.mapper;
+
+import org.mapstruct.Mapper;
+import org.mapstruct.factory.Mappers;
+
+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);
+
+}
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
new file mode 100644
index 0000000..742896f
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/mapper/OrderWalletCoinMapper.java
@@ -0,0 +1,16 @@
+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
new file mode 100644
index 0000000..e7c5bbc
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/CancelEntrustWalletCoinOrderDto.java
@@ -0,0 +1,19 @@
+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 = "CancelEntrustWalletCoinOrderDto", description = "撤销委托订单")
+public class CancelEntrustWalletCoinOrderDto {
+
+ @NotNull(message = "订单编号不能为空")
+ @ApiModelProperty(value = "订单编号", example = "100")
+ private String orderNo;
+
+}
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
new file mode 100644
index 0000000..5367b10
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/FindCollectDto.java
@@ -0,0 +1,20 @@
+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/SubmitSalesWalletCoinOrderDto.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/dto/SubmitSalesWalletCoinOrderDto.java
index 2042a66..72d4b67 100644
--- 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
@@ -7,18 +7,20 @@
import lombok.Data;
@Data
-@ApiModel(value = "SubmitSalesWalletCoinOrderDto", description = "提交买卖订单接收类")
+@ApiModel(value = "SubmitSalesWalletCoinOrderDto", description = "提交买卖订单参数接收类")
public class SubmitSalesWalletCoinOrderDto {
-
+
+
+ @NotNull(message = "币种不能为空")
@ApiModelProperty(value = "币种", example = "BTC")
private String symbol;
- @NotNull(message = "币种不能为空")
- @ApiModelProperty(value = "币种", example = "USDT")
+ @NotNull(message = "交易类型不能为空")
+ @ApiModelProperty(value = "买入卖出类型买入:1,卖出:2", example = "1")
private Integer type;
- @NotNull(message = "账户类型不能为空")
- @ApiModelProperty(value = "账户类型", example = "1")
+ @NotNull(message = "交易方式不能为空")
+ @ApiModelProperty(value = "市价:1,限价:2", example = "1")
private Integer tradeType;
@NotNull(message = "数量不能为空")
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
index 67e7b67..a60edeb 100644
--- 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
@@ -1,6 +1,9 @@
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;
@@ -35,5 +38,9 @@
*/
@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/MemberSelectSymbolsVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java
new file mode 100644
index 0000000..d5cc0e2
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/MemberSelectSymbolsVo.java
@@ -0,0 +1,23 @@
+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
index 3101ab6..5961d16 100644
--- 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
@@ -7,7 +7,7 @@
import lombok.Data;
@Data
-@ApiModel(value = "代理账户信息返回", description = "代理账户信息返回")
+@ApiModel(value = "MemberWalletAgentInfoVo", description = "代理账户信息返回")
public class MemberWalletAgentInfoVo {
/**
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
new file mode 100644
index 0000000..da1059f
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealListVo.java
@@ -0,0 +1,16 @@
+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
new file mode 100644
index 0000000..649f2a5
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinDealVo.java
@@ -0,0 +1,76 @@
+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;
+ /**
+ * 手续费
+ */
+ @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/OrderWalletCoinVo.java b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java
new file mode 100644
index 0000000..f1e9dfb
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/OrderWalletCoinVo.java
@@ -0,0 +1,65 @@
+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 {
+ /**
+ * 订单编号
+ */
+ @ApiModelProperty(value = "订单编号")
+ private String orderNo;
+ /**
+ * 币种
+ */
+ @ApiModelProperty(value = "币种")
+ private String symbol;
+ /**
+ * 市场价
+ */
+ @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
new file mode 100644
index 0000000..e011aeb
--- /dev/null
+++ b/src/main/java/com/xcong/excoin/modules/coin/parameter/vo/TransactionPageOfWalletCoinVo.java
@@ -0,0 +1,50 @@
+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 = "OrderWalletCoinDealVo", 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 BigDecimal feeRatio;
+ /**
+ * 用户可用金额
+ */
+ @ApiModelProperty(value = "用户可用金额")
+ private BigDecimal availableBalance;
+ /**
+ * 当前价
+ */
+ @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/OrderCoinService.java b/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java
index 0d8b8dd..3ae3f16 100644
--- a/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java
+++ b/src/main/java/com/xcong/excoin/modules/coin/service/OrderCoinService.java
@@ -7,10 +7,24 @@
import com.xcong.excoin.modules.coin.entity.OrderCoinsEntity;
public interface OrderCoinService extends IService<OrderCoinsEntity>{
+
+ public String generateSimpleSerialno(String userId);
Result enterTransactionPageOfWalletCoin(String symbol, String type);
Result submitSalesWalletCoinOrder(String symbol, Integer type, Integer tradeType, BigDecimal price,
BigDecimal amount);
+ public Result getEntrustWalletCoinOrder(String symbol, Integer status);
+
+ public Result cancelEntrustWalletCoinOrder(String orderNo);
+
+ public Result findAllWalletCoinOrder();
+
+ public Result findWalletCoinOrder(Long orderId);
+
+ public Result findCollect(String symbol, Integer type);
+
+ public Result checkIsCollect(String symbol);
+
}
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
index a5615d3..89e583b 100644
--- 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
@@ -349,6 +349,7 @@
memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus());
memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol());
memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType());
+ memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime());
arrayList.add(memberAccountMoneyChangeInfoVo);
}
}
@@ -371,6 +372,7 @@
memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus());
memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol());
memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType());
+ memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime());
arrayList.add(memberAccountMoneyChangeInfoVo);
}
}
@@ -395,6 +397,7 @@
memberAccountMoneyChangeInfoVo.setStatus(memberAccountMoneyChange.getStatus());
memberAccountMoneyChangeInfoVo.setSymbol(memberAccountMoneyChange.getSymbol());
memberAccountMoneyChangeInfoVo.setType(memberAccountMoneyChange.getType());
+ memberAccountMoneyChangeInfoVo.setUpdateTime(memberAccountMoneyChange.getUpdateTime());
arrayList.add(memberAccountMoneyChangeInfoVo);
}
}
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
index 0c60ebc..bcee12b 100644
--- 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
@@ -1,7 +1,11 @@
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;
@@ -15,13 +19,24 @@
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.OrderCoinDao;
+import com.xcong.excoin.modules.coin.dao.OrderCoinDealDao;
+import com.xcong.excoin.modules.coin.dao.OrderCoinsDao;
import com.xcong.excoin.modules.coin.dao.platform.CnyUsdtExchangeDao;
import com.xcong.excoin.modules.coin.dao.platform.TradeSettingDao;
import com.xcong.excoin.modules.coin.entity.CnyUsdtExchange;
+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.entity.PlatformTradeSettingEntity;
+import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper;
+import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinMapper;
+import com.xcong.excoin.modules.coin.parameter.vo.MemberSelectSymbolsVo;
+import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealListVo;
+import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo;
+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;
@@ -30,10 +45,11 @@
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<OrderCoinDao, OrderCoinsEntity> implements OrderCoinService{
+public class OrderCoinServiceImpl extends ServiceImpl<OrderCoinsDao, OrderCoinsEntity> implements OrderCoinService{
@Resource
TradeSettingDao platformTradeSettingDao;
@@ -43,6 +59,37 @@
MemberSelectSymbolsDao memberSelectSymbolsDao;
@Resource
CnyUsdtExchangeDao cnyUsdtExchangeDao;
+ @Resource
+ OrderCoinsDao orderCoinsDao;
+ @Resource
+ OrderCoinDealDao orderCoinDealDao;
+ @Resource
+ MemberAccountFlowEntityDao memberAccountFlowEntityDao;
+
+ @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, String type) {
@@ -55,7 +102,7 @@
MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, symbol);
PlatformTradeSettingEntity tradeSetting = platformTradeSettingDao.findTradeSetting();
- if (tradeSetting == null) {
+ if (ObjectUtil.isEmpty(tradeSetting)) {
return Result.fail(MessageSourceUtils.getString("order_service_0003"));
}
//获取USDT的币币账户信息
@@ -72,38 +119,335 @@
CnyUsdtExchange cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne();
BigDecimal cnyUsdt = cnyUsdtExchange.getValue();
-
- Map<String, Object> map = new HashMap<String, Object>();
+ TransactionPageOfWalletCoinVo transactionPageOfWalletCoinVo = new TransactionPageOfWalletCoinVo();
+ //是否自选
if(CollUtil.isEmpty(memSymbols)) {
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_ISCOLLECT_NO.getName(),
- MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_ISCOLLECT_NO.getValue());//是否已经自选该币种
+ transactionPageOfWalletCoinVo.setIsCollect(TransactionPageOfWalletCoinVo.ISCOLLECT_NO);
}else {
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_ISCOLLECT_YES.getName(),
- MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_ISCOLLECT_YES.getValue());//是否已经自选该币种
+ transactionPageOfWalletCoinVo.setIsCollect(TransactionPageOfWalletCoinVo.ISCOLLECT_YES);
}
if (ObjectUtil.isEmpty(walletCoin))
return Result.fail(MessageSourceUtils.getString("order_service_0003"));
-
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_SPREAD.getValue(), tradeSetting.getSpread());// 点差
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_CLOSINGRATIO.getValue(), tradeSetting.getFeeRatio());// 手续费用率
+ // 点差
+ transactionPageOfWalletCoinVo.setSpread(tradeSetting.getSpread().setScale(4, BigDecimal.ROUND_DOWN));
+ // 手续费用率
+ transactionPageOfWalletCoinVo.setFeeRatio(tradeSetting.getFeeRatio().setScale(4, BigDecimal.ROUND_DOWN));
+ // 用户可用金额
if(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_BUY.getValue().equals(type)) {//买入
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_MEMBERMONEY.getValue(), walletCoinUsdt.getAvailableBalance());// 用户可用金额
+ transactionPageOfWalletCoinVo.setAvailableBalance(walletCoinUsdt.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
}else {
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_MEMBERMONEY.getValue(), walletCoin.getAvailableBalance());// 用户可用金额
+ transactionPageOfWalletCoinVo.setAvailableBalance(walletCoin.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
}
-
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_CURRENTPRICE.getValue(), closePrice);//当前价
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_CNYUSDT.getValue(), cnyUsdt);//比例
- map.put(MemberWalletCoinEnum.ENTERTRANSACTIONPAGEOFWALLETCOIN_CURRENTPRICECNY.getValue(), cnyUsdt.multiply(closePrice));//换算成人民币的币种价格
- return Result.ok(map);
-}
+ //当前价
+ 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));
+ 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();
+
+ /**
+ * todo
+ */
+ //查询当前价
+ //BigDecimal nowPrice = new BigDecimal(redisUtil.getString(CoinTypeConConvert.convertToKey(symbol+"/USDT")));
+
+ BigDecimal nowPrice = new BigDecimal("10.0000");
+ // 获取交易管理的杠杠倍率,手续费率等信息,由平台进行设置
+ 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(new BigDecimal(MemberWalletCoinEnum.SUBMITSALESWALLETCOINORDER_SERVICERATE.getValue()));
+ //总费用 = 成交价*数量+手续费
+ BigDecimal totalPayPrice = price.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) {
+ 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)) {
+ // 如果是限价交易直接插入主表数据
+ order.setMemberId(memberId);
+ order.setOrderNo(generateSimpleSerialno(memberId.toString()));
+ order.setOrderType(type);
+ order.setSymbol(symbol);
+ order.setMarkPrice(nowPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setEntrustCnt(amount.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setEntrustPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealCnt(amount.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealAmount(totalPayPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_DODING);
+ order.setTradeType(tradeType);
+ order.setFeeAmount(closingPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ 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.setScale(4, BigDecimal.ROUND_DOWN));
+ walletCoinUsdt.setFrozenBalance(frozenBalance.setScale(4, BigDecimal.ROUND_DOWN));
+ memberWalletCoinDao.updateById(walletCoinUsdt);
+ }else {
+ //如果是卖出,币种减少,USDT增加
+ BigDecimal availableBalance = walletCoin.getAvailableBalance().subtract(amount);
+ BigDecimal frozenBalance = walletCoin.getFrozenBalance().add(amount);
+ walletCoin.setAvailableBalance(availableBalance.setScale(4, BigDecimal.ROUND_DOWN));
+ walletCoin.setFrozenBalance(frozenBalance.setScale(4, BigDecimal.ROUND_DOWN));
+ memberWalletCoinDao.updateById(walletCoin);
+ }
+ } else {
+ //如果是市价交易,主表和附表都需要插入数据
+ order.setMemberId(memberId);
+ order.setOrderNo(generateSimpleSerialno(memberId.toString()));
+ order.setOrderType(type);
+ order.setSymbol(symbol);
+ order.setMarkPrice(nowPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setEntrustCnt(amount.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setEntrustPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealCnt(amount.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setDealAmount(totalPayPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ order.setOrderStatus(OrderCoinsEntity.ORDERSTATUS_DONE);
+ order.setTradeType(tradeType);
+ order.setFeeAmount(closingPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ 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.setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setEntrustPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setDealPrice(price.setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setDealAmount(totalPayPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setFeeAmount(closingPrice.setScale(4, BigDecimal.ROUND_DOWN));
+ orderCoinDealDao.insert(detail);
+
+ if(OrderCoinsEntity.ORDERTYPE_BUY.equals(type)) {
+ //如果是买入,所对应的币种增加,USDT账户减少金额
+ // 更新用户的可用金额
+ walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(amount).setScale(4, BigDecimal.ROUND_DOWN));
+ memberWalletCoinDao.updateById(walletCoin);
+
+ walletCoinUsdt.setAvailableBalance(walletCoinUsdt.getAvailableBalance().subtract(totalPayPrice).setScale(4, BigDecimal.ROUND_DOWN));
+ memberWalletCoinDao.updateById(walletCoinUsdt);
+ }else {
+ //如果是卖出,币种减少,USDT增加
+ walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().subtract(amount).setScale(4, BigDecimal.ROUND_DOWN));
+ memberWalletCoinDao.updateById(walletCoin);
+
+ walletCoinUsdt.setAvailableBalance(walletCoinUsdt.getAvailableBalance().add(totalPayPrice).setScale(4, BigDecimal.ROUND_DOWN));
+ 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.setScale(4, BigDecimal.ROUND_DOWN));
+ } else {
+ record.setPrice(totalPayPrice.negate().setScale(4, BigDecimal.ROUND_DOWN));
+ record.setSource(MemberAccountFlowEntity.SOURCE_SALE+symbol);
+ record.setRemark(MemberAccountFlowEntity.REMARK_SALE+symbol+":"+amount.setScale(4, BigDecimal.ROUND_DOWN));
+ }
+ record.setSymbol(symbol);
+ record.setBalance(walletCoinUsdt.getAvailableBalance().setScale(4, BigDecimal.ROUND_DOWN));
+
+ 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();
+
+ OrderCoinsEntity orderCoin = orderCoinsDao.findCoinOrderListByMemberIdAndSysmbol(memberId, symbol, status);
+ OrderWalletCoinVo entityToVo = OrderWalletCoinMapper.INSTANCE.entityToVo(orderCoin);
+ return Result.ok(entityToVo);
+ }
+
+ @Override
+ @Transactional
+ public Result cancelEntrustWalletCoinOrder(String orderNo) {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ OrderCoinsEntity orderCoinsEntity = orderCoinsDao.findWalletCoinOrderByOrderNo(orderNo);
+ 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();
+
+ if(orderCoinsEntity.getOrderType() == OrderCoinsEntity.TRADETYPE_FIXEDPRICE) {
+ //如果是限价买入,撤单将USDT账户冻结金额返回
+ String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
+ MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
+
+ if (ObjectUtil.isNotEmpty(walletCoin)) {
+ //手续费 = 开仓价*数量*手续费率
+ //返还金额=开仓价*未成交数量+手续费
+ BigDecimal returnBalance = orderCoinsEntity.getEntrustPrice().add(orderCoinsEntity.getFeeAmount());
+
+ walletCoin.setAvailableBalance(walletCoin.getAvailableBalance().add(returnBalance).setScale(4, BigDecimal.ROUND_DOWN));
+ walletCoin.setFrozenBalance(walletCoin.getFrozenBalance().subtract(returnBalance).setScale(4, BigDecimal.ROUND_DOWN));
+ 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().setScale(4, BigDecimal.ROUND_DOWN));
+ record.setMemberId(memberId);
+ record.setSymbol(symbol);
+ record.setPrice(returnBalance);
+ memberAccountFlowEntityDao.insert(record);
+ return Result.ok(MessageSourceUtils.getString("order_service_0013"));
+ }
+ }else {
+ //如果是限价卖出,撤单将对应的钱包冻结金额返回
+ String walletCode = MemberWalletCoinEnum.WALLETCOINCODE.getValue();
+ MemberWalletCoinEntity walletCoin = memberWalletCoinDao.selectWalletCoinBymIdAndCode(memberId, walletCode);
+ if (ObjectUtil.isNotEmpty(walletCoin)) {
+ //返还金额=开仓价*未成交数量
+ BigDecimal returnBalance = walletCoin.getAvailableBalance().add(walletCoin.getFrozenBalance());
+ walletCoin.setAvailableBalance(returnBalance.setScale(4, BigDecimal.ROUND_DOWN));
+ walletCoin.setFrozenBalance(BigDecimal.ZERO);
+ 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().setScale(4, BigDecimal.ROUND_DOWN));
+ record.setMemberId(memberId);
+ record.setSymbol(symbol);
+ record.setPrice(walletCoin.getFrozenBalance().setScale(4, BigDecimal.ROUND_DOWN));
+ memberAccountFlowEntityDao.insert(record);
+ return Result.ok(MessageSourceUtils.getString("order_service_0013"));
+ }
+ }
+
+ 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.setSymbolCnt(orderCoinsEntity.getEntrustCnt());
+ detail.setEntrustPrice(orderCoinsEntity.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setDealPrice(orderCoinsEntity.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setDealAmount(orderCoinsEntity.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN));
+ detail.setFeeAmount(orderCoinsEntity.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN));
+ orderCoinDealDao.insert(detail);
+ }
+ return Result.fail(MessageSourceUtils.getString("order_service_0043"));
+ }
+
+ @Override
+ public Result findAllWalletCoinOrder() {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+
+ OrderWalletCoinDealListVo orderWalletCoinDealListVo = new OrderWalletCoinDealListVo();
+ List<OrderWalletCoinDealVo> arrayList = new ArrayList<OrderWalletCoinDealVo>();
+
+ List<OrderCoinsDealEntity> selectAllWalletCoinOrder = orderCoinDealDao.selectAllWalletCoinOrder(memberId);
+ if(CollUtil.isNotEmpty(selectAllWalletCoinOrder)) {
+ for(OrderCoinsDealEntity orderCoinsDealEntity: selectAllWalletCoinOrder) {
+ OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity);
+ arrayList.add(entityToVo);
+ }
+ }
+ orderWalletCoinDealListVo.setOrderWalletCoinDealVo(arrayList);
+ return Result.ok(orderWalletCoinDealListVo);
+ }
+
+ @Override
+ public Result findWalletCoinOrder(Long orderId) {
+ //获取用户ID
+ Long memberId = LoginUserUtils.getAppLoginUser().getId();
+ OrderCoinsDealEntity selectWalletCoinOrder = orderCoinDealDao.selectWalletCoinOrder(orderId,memberId);
+ OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(selectWalletCoinOrder);
+ 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);
+ }
+
}
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
index 82c98db..8b5b5fd 100644
--- a/src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java
+++ b/src/main/java/com/xcong/excoin/modules/member/entity/MemberSelectSymbolsEntity.java
@@ -1,7 +1,5 @@
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;
@@ -11,7 +9,7 @@
* 会员自选币种
*/
@Data
-@TableName
+@TableName("member_select_symbols")
public class MemberSelectSymbolsEntity extends BaseEntity{
/**
*
@@ -20,10 +18,10 @@
/**
* 会员ID
*/
- private BigDecimal memberId;
+ private long memberId;
/**
* 币种
*/
- private BigDecimal symbol;
+ private String symbol;
}
diff --git a/src/main/resources/mapper/member/MemberAccountFlowEntityDao.xml b/src/main/resources/mapper/member/MemberAccountFlowEntityDao.xml
new file mode 100644
index 0000000..2918668
--- /dev/null
+++ b/src/main/resources/mapper/member/MemberAccountFlowEntityDao.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xcong.excoin.modules.coin.dao.MemberAccountFlowEntityDao">
+
+</mapper>
\ No newline at end of file
diff --git a/src/main/resources/mapper/platform/TradeSettingDao.xml b/src/main/resources/mapper/platform/TradeSettingDao.xml
index 4d4461d..e0e56ba 100644
--- a/src/main/resources/mapper/platform/TradeSettingDao.xml
+++ b/src/main/resources/mapper/platform/TradeSettingDao.xml
@@ -3,16 +3,7 @@
<mapper namespace="com.xcong.excoin.modules.coin.dao.platform.TradeSettingDao">
<select id="findTradeSetting" resultType="com.xcong.excoin.modules.coin.entity.PlatformTradeSettingEntity">
- SELECT
- id id,
- spread spread,
- leverageratio leverageRatio,
- outstock outStock,
- closingratio closingRatio,
- agent_return agent_return,
- doing_rate doingRate
- FROM
- platform_trade_setting
+ SELECT * FROM platform_trade_setting
</select>
<select id="findSymbolSkubySymbol" resultType="com.xcong.excoin.modules.coin.entity.PlatformSymbolsSku">
diff --git a/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml
new file mode 100644
index 0000000..14705e8
--- /dev/null
+++ b/src/main/resources/mapper/walletCoinOrder/OrderCoinDealDao.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.xcong.excoin.modules.coin.dao.OrderCoinDealDao">
+
+ <select id="selectAllWalletCoinOrder" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity">
+ select * from coins_order_deal
+ <where>
+ <if test="memberId != null and memberId != ''">
+ and member_id = #{memberId}
+ </if>
+ </where>
+ order by id desc
+ </select>
+
+ <select id="selectWalletCoinOrder" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity">
+ select * from coins_order_deal where order_id= #{orderId} and member_id = #{memberId}
+ </select>
+
+</mapper>
diff --git a/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml b/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml
new file mode 100644
index 0000000..dfe3656
--- /dev/null
+++ b/src/main/resources/mapper/walletCoinOrder/OrderCoinsDao.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.xcong.excoin.modules.coin.dao.OrderCoinsDao">
+
+ <select id="getOrderCountByToday" resultType="long">
+ <![CDATA[ SELECT COUNT(*) from coins_order WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= DATE_FORMAT(#{now}, '%Y-%m-%d')
+ and DATE_FORMAT(create_time, '%Y-%m-%d') < DATE_FORMAT(#{tomorrow}, '%Y-%m-%d') ]]>
+ </select>
+
+ <select id="findCoinOrderListByMemberIdAndSysmbol" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
+ SELECT * FROM coins_order a where a.member_id= #{memberId} and a.order_status = #{status}
+ <if test="symbol != null and symbol !=''">
+ and a.symbol = #{symbol}
+ </if>
+ </select>
+
+ <select id="findWalletCoinOrderByOrderNo" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
+
+ SELECT * FROM coins_order a where a.order_no= #{orderNo}
+ </select>
+
+</mapper>
diff --git a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java
index 97436ae..08beda8 100644
--- a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java
+++ b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java
@@ -1,89 +1,102 @@
-package com.xcong.excoin.mapper;
-
-import lombok.extern.slf4j.Slf4j;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-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());
- }
-
-}
+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);
+ }
+
+}
--
Gitblit v1.9.1