From 23c98be26dc3acf72236a5c97b374b00b6e3043f Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Fri, 29 May 2020 16:06:21 +0800 Subject: [PATCH] add oss upload file --- src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-) 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 eed4b40..926e4c6 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 @@ -12,6 +12,7 @@ import javax.annotation.Resource; +import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -23,24 +24,24 @@ 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.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.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.TradeSettingDao; +import com.xcong.excoin.modules.platform.entity.PlatformTradeSettingEntity; import com.xcong.excoin.utils.MessageSourceUtils; import cn.hutool.core.collection.CollUtil; @@ -58,7 +59,7 @@ @Resource MemberSelectSymbolsDao memberSelectSymbolsDao; @Resource - CnyUsdtExchangeDao cnyUsdtExchangeDao; + PlatformCnyUsdtExchangeDao cnyUsdtExchangeDao; @Resource OrderCoinsDao orderCoinsDao; @Resource @@ -116,8 +117,8 @@ BigDecimal closePrice = new BigDecimal("100.0000"); List<MemberSelectSymbolsEntity> memSymbols = memberSelectSymbolsDao.selectSymbolByMemIdAndSymbol(memberId, symbol); - - CnyUsdtExchange cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne(); + + PlatformCnyUsdtExchangeEntity cnyUsdtExchange = cnyUsdtExchangeDao.getCNYAndUSDTOne(); BigDecimal cnyUsdt = cnyUsdtExchange.getValue(); TransactionPageOfWalletCoinVo transactionPageOfWalletCoinVo = new TransactionPageOfWalletCoinVo(); //是否自选 @@ -144,6 +145,9 @@ transactionPageOfWalletCoinVo.setCnyUsdt(cnyUsdt.setScale(4, BigDecimal.ROUND_DOWN)); //换算成人民币的币种价格 transactionPageOfWalletCoinVo.setCurrentPriceCny(cnyUsdt.multiply(closePrice).setScale(4, BigDecimal.ROUND_DOWN)); + + transactionPageOfWalletCoinVo.setSymbol(symbol); + transactionPageOfWalletCoinVo.setType(type); return Result.ok(transactionPageOfWalletCoinVo); } @@ -301,10 +305,18 @@ public Result getEntrustWalletCoinOrder(String symbol, Integer status) { //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); + OrderWalletCoinListVo orderWalletCoinListVo = new OrderWalletCoinListVo(); - OrderCoinsEntity orderCoin = orderCoinsDao.findCoinOrderListByMemberIdAndSysmbol(memberId, symbol, status); - OrderWalletCoinVo entityToVo = OrderWalletCoinMapper.INSTANCE.entityToVo(orderCoin); - return Result.ok(entityToVo); + 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); + arrayList.add(entityToVo); + } + } + orderWalletCoinListVo.setOrderWalletCoinVo(arrayList); + return Result.ok(arrayList); } @Override @@ -397,7 +409,7 @@ List<OrderCoinsDealEntity> selectAllWalletCoinOrder = orderCoinDealDao.selectAllWalletCoinOrder(memberId); if(CollUtil.isNotEmpty(selectAllWalletCoinOrder)) { for(OrderCoinsDealEntity orderCoinsDealEntity: selectAllWalletCoinOrder) { - OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVo(orderCoinsDealEntity); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity); arrayList.add(entityToVo); } } @@ -410,7 +422,7 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); OrderCoinsDealEntity selectWalletCoinOrder = orderCoinDealDao.selectWalletCoinOrder(orderId,memberId); - OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVo(selectWalletCoinOrder); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(selectWalletCoinOrder); return Result.ok(entityToVo); } @@ -428,6 +440,7 @@ }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")); } -- Gitblit v1.9.1