From 015a80a03a520b872cdeee363a7d27291906e48f Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 10 Jul 2020 12:35:55 +0800 Subject: [PATCH] 20200710 代码提交 --- src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java | 47 ++++++++++++++++++++++++++++++++++------------- 1 files changed, 34 insertions(+), 13 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 84c82d9..b396d14 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 @@ -427,17 +427,27 @@ orderCoinsDealEntity.setMemberId(memberId); orderCoinsDealEntity.setSymbol(findAllWalletCoinOrderDto.getSymbol()); IPage<OrderCoinsDealEntity> list = orderCoinDealDao.findAllWalletCoinOrderInPage(page, orderCoinsDealEntity); - List<OrderCoinsDealEntity> records = list.getRecords(); + Page<OrderWalletCoinDealVo> pageEntityToPageVo = OrderWalletCoinDealMapper.INSTANCE.pageEntityToPageVo(list); + List<OrderWalletCoinDealVo> records = pageEntityToPageVo.getRecords(); if(CollUtil.isNotEmpty(records)) { - for(OrderCoinsDealEntity OrderCoinsDealEntity : records) { - orderCoinsDealEntity.setSymbolCnt(orderCoinsDealEntity.getSymbolCnt()); - OrderCoinsDealEntity.setEntrustPrice(orderCoinsDealEntity.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN)); - orderCoinsDealEntity.setDealPrice(orderCoinsDealEntity.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN)); - orderCoinsDealEntity.setDealAmount(orderCoinsDealEntity.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN)); - orderCoinsDealEntity.setFeeAmount(orderCoinsDealEntity.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN)); + 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)); } } - Page<OrderWalletCoinDealVo> pageEntityToPageVo = OrderWalletCoinDealMapper.INSTANCE.pageEntityToPageVo(list); + return Result.ok(pageEntityToPageVo); } @@ -447,12 +457,23 @@ //获取用户ID Long memberId = LoginUserUtils.getAppLoginUser().getId(); OrderCoinsDealEntity selectWalletCoinOrder = orderCoinDealDao.selectWalletCoinOrder(orderId, memberId); - selectWalletCoinOrder.setSymbolCnt(selectWalletCoinOrder.getSymbolCnt()); - selectWalletCoinOrder.setEntrustPrice(selectWalletCoinOrder.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN)); - selectWalletCoinOrder.setDealPrice(selectWalletCoinOrder.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN)); - selectWalletCoinOrder.setDealAmount(selectWalletCoinOrder.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN)); - selectWalletCoinOrder.setFeeAmount(selectWalletCoinOrder.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN)); 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); } -- Gitblit v1.9.1