| | |
| | | package com.xcong.excoin.modules.platform.service.impl;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | | 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.PlatformCnyUsdtExchangeDao;
|
| | | import com.xcong.excoin.modules.platform.entity.PlatformCnyUsdtExchangeEntity;
|
| | | import com.xcong.excoin.modules.platform.service.PlatformCnyUsdtExchangeService;
|
| | | 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<PlatformCnyUsdtExchangeDao, PlatformCnyUsdtExchangeEntity> implements PlatformCnyUsdtExchangeService{
|
| | | public class PlatformPaymentMethodServiceImpl extends ServiceImpl<PlatformPaymentMethodDao, PlatformPaymentMethodEntity> implements PlatformPaymentMethodService{
|
| | | @Resource
|
| | | PlatformCnyUsdtExchangeDao platformCnyUsdtExchangeDao;
|
| | | PlatformPaymentMethodDao platformPaymentMethodDao;
|
| | |
|
| | | @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);
|
| | | public Result findAll() {
|
| | | QueryWrapper<PlatformPaymentMethodEntity> queryWrapper = new QueryWrapper<>();
|
| | | List<PlatformPaymentMethodEntity> paymentMethodList = platformPaymentMethodDao.selectList(queryWrapper);
|
| | | return Result.ok(paymentMethodList);
|
| | | }
|
| | |
|
| | | }
|