xiaoyong931011
2020-07-10 015a80a03a520b872cdeee363a7d27291906e48f
src/main/java/com/xcong/excoin/modules/coin/service/impl/OrderCoinServiceImpl.java
@@ -19,7 +19,6 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -38,15 +37,11 @@
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.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.contract.entity.ContractOrderEntity;
import com.xcong.excoin.modules.contract.mapper.ContractOrderEntityMapper;
import com.xcong.excoin.modules.contract.parameter.vo.OrderListVo;
import com.xcong.excoin.modules.member.dao.MemberWalletCoinDao;
import com.xcong.excoin.modules.member.entity.MemberSelectSymbolsEntity;
import com.xcong.excoin.modules.member.entity.MemberWalletCoinEntity;
@@ -327,6 +322,14 @@
        List<OrderCoinsEntity> findCoinOrderListByMemberIdAndSysmbol = orderCoinsDao.findCoinOrderListByMemberIdAndSysmbol(memberId, symbol, status);
        if (CollUtil.isNotEmpty(findCoinOrderListByMemberIdAndSysmbol)) {
            for (OrderCoinsEntity orderCoinsEntity : findCoinOrderListByMemberIdAndSysmbol) {
               orderCoinsEntity.setFeeAmount(orderCoinsEntity.getFeeAmount().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setMarkPrice(orderCoinsEntity.getMarkPrice().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setEntrustCnt(orderCoinsEntity.getEntrustCnt().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setEntrustPrice(orderCoinsEntity.getEntrustPrice().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setDealCnt(orderCoinsEntity.getDealCnt().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setDealPrice(orderCoinsEntity.getDealPrice().setScale(4, BigDecimal.ROUND_DOWN));
               orderCoinsEntity.setDealAmount(orderCoinsEntity.getDealAmount().setScale(4, BigDecimal.ROUND_DOWN));
                OrderWalletCoinVo entityToVo = OrderWalletCoinMapper.INSTANCE.entityToVo(orderCoinsEntity);
                arrayList.add(entityToVo);
            }
@@ -425,6 +428,26 @@
        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);
    }
@@ -435,6 +458,22 @@
        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);
    }