Commit 8cfc9ee6 authored by 332784038@qq.com's avatar 332784038@qq.com Committed by wux

新汇率业务冲突修复

parent 58592794
package cn.iocoder.yudao.module.ecw.convert.currencyRate;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.currencyRate.CurrencyRateDO;
import cn.iocoder.yudao.module.ecw.vo.currencyRate.CurrencyRateCreateReqVO;
import cn.iocoder.yudao.module.ecw.vo.currencyRate.CurrencyRateUpdateReqVO;
......@@ -7,11 +8,14 @@ import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface CurrencyRateConvert {
CurrencyRateConvert INSTANCE = Mappers.getMapper(CurrencyRateConvert.class);
CurrencyRateDO from(CurrencyRateCreateReqVO req);
List<ExchangeRateRespDTO> convertList2(List<CurrencyRateDO> currencyRateDOList);
void update(@MappingTarget CurrencyRateDO saved, CurrencyRateUpdateReqVO req);
}
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.ecw.convert.currency.CurrencyConvert;
import cn.iocoder.yudao.module.ecw.convert.currencyRate.CurrencyRateConvert;
import cn.iocoder.yudao.module.ecw.dal.dataobject.currency.CurrencyDO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.currencyRate.CurrencyRateDO;
import cn.iocoder.yudao.module.ecw.service.currency.CurrencyService;
......@@ -111,7 +112,7 @@ public class CurrecyApiImpl implements CurrencyApi {
@Override
public List<ExchangeRateRespDTO> getAllCurrencyRate() {
List<ExchangeRateDO> exchangeRateDOS = exchangeRateService.selectList();
return ExchangeRateConvert.INSTANCE.convertList2(exchangeRateDOS);
List<CurrencyRateDO> currencyRateDOS = currencyRateService.queryAll();
return CurrencyRateConvert.INSTANCE.convertList2(currencyRateDOS);
}
}
......@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.ecw.vo.currencyRate.CurrencyRateUpdateReqVO;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.List;
import java.util.Optional;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
......@@ -139,6 +140,14 @@ public interface CurrencyRateService {
*/
PageResult<CurrencyRateDO> query(CurrencyRateQueryParamVO param);
/**
* 查询全部汇率数据
*
* @return 结果
*/
List<CurrencyRateDO> queryAll();
/**
* 更新汇率信息。
*
......
......@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import java.util.Set;
......@@ -87,6 +88,11 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
return mapper.selectPage(param);
}
@Override
public List<CurrencyRateDO> queryAll() {
return mapper.selectList();
}
@Override
public void update(long id, CurrencyRateUpdateReqVO req) {
rate(req.getSourceAmount(), req.getTargetAmount()); // check rate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment