| | |
| | | import com.yami.trading.bean.rate.domain.UserRateConfig; |
| | | import com.yami.trading.dao.rate.UserRateConfigMapper; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public ExchangeRate findUserConfig(String partyId) { |
| | | |
| | | Syspara currency = sysparaService.find("rate_default_currency"); |
| | | String currency = sysparaService.find("rate_default_currency").getSvalue(); |
| | | |
| | | String user_default_currency = "USD"; |
| | | |
| | | //如果配置了默认币种类型,返回配置的币种类型,默认是USD |
| | | if(Objects.nonNull(currency)) { |
| | | user_default_currency = currency.getSvalue().toUpperCase(); |
| | | if(!currency.isEmpty()) { |
| | | user_default_currency = currency; |
| | | } |
| | | ExchangeRate exchangeRate = exchangeRateService.findBy(ExchangeRate.IN, user_default_currency); |
| | | |
| | | ExchangeRate exchangeRate ; |
| | | |
| | | if (StringUtils.isNullOrEmpty(partyId)) { |
| | | /*if (StringUtils.isNullOrEmpty(partyId)) { |
| | | exchangeRate = exchangeRateService.findBy(ExchangeRate.IN, user_default_currency); |
| | | } else { |
| | | UserRateConfig userRateConfig = getByPartyId(partyId); |
| | |
| | | } else { |
| | | exchangeRate = exchangeRateService.findBy(ExchangeRate.IN, userRateConfig.getCurrency()); |
| | | } |
| | | } |
| | | }*/ |
| | | return exchangeRate; |
| | | } |
| | | |
| | | /** |
| | | * 查询用户计价方式,欧元和英镑 |
| | | */ |
| | | public List<ExchangeRate> findUserConfigList(String partyId) { |
| | | ExchangeRate exchangeRate1 = exchangeRateService.findBy(ExchangeRate.IN, "EUR"); |
| | | ExchangeRate exchangeRate2 = exchangeRateService.findBy(ExchangeRate.IN, "GBP"); |
| | | if (exchangeRate1 == null && exchangeRate2 == null) { |
| | | return null; |
| | | } |
| | | List<ExchangeRate> exchangeRates = new ArrayList<>(); |
| | | exchangeRates.add(exchangeRate1); |
| | | exchangeRates.add(exchangeRate2); |
| | | |
| | | return exchangeRates; |
| | | } |
| | | |
| | | public UserRateConfig getByPartyId(String partyId) { |
| | | return getOne(Wrappers.<UserRateConfig>query().lambda().eq(UserRateConfig::getPartyId, partyId)); |
| | | } |