|
|
@@ -101,6 +101,7 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
this.saveOrUpdate(bCurrency);
|
|
|
if (ObjectUtils.isNotNull(bCurrency.getCurExrateList())) {
|
|
|
for (BCurExrate item : bCurrency.getCurExrateList()) {
|
|
|
+ item.setType(bCurrency.getParitiesType());
|
|
|
item.setCode(bCurrency.getCode());
|
|
|
if (item.getId() == null) {
|
|
|
item.setCreateTime(new Date());
|
|
|
@@ -213,23 +214,31 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
BigDecimal CNY;
|
|
|
if ("D".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExrateReceipts()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExrateReceipts()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "实收汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "实收汇率");
|
|
|
} else {
|
|
|
- CNY = amount.multiply(bCurExrate.getExrateReceipts());
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = amount.multiply(bCurExrate.getExrateReceivable());
|
|
|
+ }else{
|
|
|
+ CNY = amount.multiply(bCurExrate.getExrateReceipts());
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("C".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExratePayment()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExratePayment()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "实付汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "实付汇率");
|
|
|
} else {
|
|
|
- CNY = amount.multiply(bCurExrate.getExratePayment());
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = amount.multiply(bCurExrate.getExratePayable());
|
|
|
+ }else{
|
|
|
+ CNY = amount.multiply(bCurExrate.getExratePayment());
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
CNY = amount.multiply(bCurrency.getExrate());
|
|
|
@@ -251,32 +260,40 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
BCurExrate bCurExrateUsd = bCurExrateService.getOne(lambdaQueryWrapperUsd);
|
|
|
if ("D".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrateUsd)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrateUsd.getExrateReceipts()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrateUsd.getExrateReceipts()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "实收汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "实收汇率");
|
|
|
} else {
|
|
|
- USD = CNY.divide(bCurExrateUsd.getExrateReceipts(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ USD = CNY.divide(bCurExrateUsd.getExrateReceivable(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }else{
|
|
|
+ USD = CNY.divide(bCurExrateUsd.getExrateReceipts(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("C".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrateUsd)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrateUsd.getExratePayment()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrateUsd.getExratePayment()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年,币别为" + curCode + "实付汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年," + curCode + "实付汇率");
|
|
|
} else {
|
|
|
- USD = CNY.divide(bCurExrateUsd.getExratePayment(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ USD = CNY.divide(bCurExrateUsd.getExratePayable(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }else{
|
|
|
+ USD = CNY.divide(bCurExrateUsd.getExratePayment(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
USD = CNY.divide(bCurrencyUsd.getExrate(), RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到币别汇率信息");
|
|
|
+ throw new RuntimeException("请维护币别汇率");
|
|
|
}
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到币别汇率信息");
|
|
|
+ throw new RuntimeException("请维护币别汇率");
|
|
|
}
|
|
|
return USD;
|
|
|
}
|
|
|
@@ -322,30 +339,38 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
BCurExrate bCurExrate = bCurExrateService.getOne(lambdaQueryWrapper);
|
|
|
if ("D".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExrateReceipts()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExrateReceipts()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + curCode + "实收汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + curCode + "实收汇率");
|
|
|
} else {
|
|
|
- CNY = amount.multiply(bCurExrate.getExrateReceipts());
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = amount.multiply(bCurExrate.getExrateReceivable());
|
|
|
+ }else{
|
|
|
+ CNY = amount.multiply(bCurExrate.getExrateReceipts());
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("C".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExratePayment()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExratePayment()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + curCode + "实付汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + curCode + "实付汇率");
|
|
|
} else {
|
|
|
- CNY = amount.multiply(bCurExrate.getExratePayment());
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = amount.multiply(bCurExrate.getExratePayable());
|
|
|
+ }else{
|
|
|
+ CNY = amount.multiply(bCurExrate.getExratePayment());
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
CNY = amount.multiply(bCurrency.getExrate());
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到币别汇率信息");
|
|
|
+ throw new RuntimeException("请维护币别汇率");
|
|
|
}
|
|
|
return CNY;
|
|
|
}
|
|
|
@@ -391,30 +416,38 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
BCurExrate bCurExrate = bCurExrateService.getOne(lambdaQueryWrapper);
|
|
|
if ("D".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExrateReceipts()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExrateReceipts()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + curCode + "实收汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + curCode + "实收汇率");
|
|
|
} else {
|
|
|
- CNY = bCurExrate.getExrateReceipts();
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = bCurExrate.getExrateReceivable();
|
|
|
+ }else{
|
|
|
+ CNY = bCurExrate.getExrateReceipts();
|
|
|
+ }
|
|
|
}
|
|
|
} else if ("C".equals(dc)) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,USD汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExratePayment()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExratePayment()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + curCode + "实付汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + curCode + "实付汇率");
|
|
|
} else {
|
|
|
- CNY = bCurExrate.getExratePayment();
|
|
|
+ if ("1".equals(type)) {
|
|
|
+ CNY = bCurExrate.getExratePayable();
|
|
|
+ }else{
|
|
|
+ CNY = bCurExrate.getExratePayment();
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
CNY = bCurrency.getExrate();
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到币别汇率信息");
|
|
|
+ throw new RuntimeException("请维护币别汇率");
|
|
|
}
|
|
|
return CNY;
|
|
|
}
|
|
|
@@ -452,30 +485,30 @@ public class BCurrencyServiceImpl extends ServiceImpl<CurrencyMapper, BCurrency>
|
|
|
BCurExrate bCurExrate = bCurExrateService.getOne(lambdaQueryWrapper);
|
|
|
if ("D".equals(bCurrency.getDc())) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,"+details.getCode()+"汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExrateReceipts()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExrateReceipts()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + bCurrency.getCode() + "实收汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + details.getCode() + "实收汇率");
|
|
|
} else {
|
|
|
details.setExrate(bCurExrate.getExrateReceipts());
|
|
|
}
|
|
|
} else if ("C".equals(bCurrency.getDc())) {
|
|
|
if (ObjectUtils.isNull(bCurExrate)) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月,"+details.getCode()+"汇率");
|
|
|
}
|
|
|
if (ObjectUtils.isNull(bCurExrate.getExratePayment()) &&
|
|
|
new BigDecimal("0.00").compareTo(bCurExrate.getExratePayment()) == 0) {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为" + bCurrency.getCode() + "实付汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + details.getCode() + "实付汇率");
|
|
|
} else {
|
|
|
details.setExrate(bCurExrate.getExratePayment());
|
|
|
}
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到" + year + "年" + month + "月,币别为USD汇率信息");
|
|
|
+ throw new RuntimeException("请维护" + year + "年" + month + "月," + details.getCode() + "汇率");
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
- throw new RuntimeException("未找到币别汇率信息");
|
|
|
+ throw new RuntimeException("请维护币别汇率");
|
|
|
}
|
|
|
}
|
|
|
return bCurrencyList;
|