|
|
@@ -569,19 +569,45 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
}
|
|
|
if (!list.isEmpty()) {
|
|
|
this.saveOrUpdateBatch(list);
|
|
|
+ //应付
|
|
|
+ int statusC = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
|
|
|
+ statusC = 1;
|
|
|
+ }
|
|
|
+ //应收
|
|
|
+ int statusD = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
|
|
|
+ statusD = 1;
|
|
|
+ }
|
|
|
+ if (1 == statusD && 0 == statusC) {
|
|
|
+ bills.setAccountStatus(1);
|
|
|
+ } else if (0 == statusD && 1 == statusC) {
|
|
|
+ bills.setAccountStatus(2);
|
|
|
+ }
|
|
|
BigDecimal amountDr;
|
|
|
BigDecimal amountCr;
|
|
|
BigDecimal amountProfit;
|
|
|
BigDecimal amountDrUsd;
|
|
|
BigDecimal amountCrUsd;
|
|
|
BigDecimal amountProfitUsd;
|
|
|
- BigDecimal amountDrLoc = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountDrLoc;
|
|
|
+ BigDecimal amountCrLoc;
|
|
|
BigDecimal amountProfitLoc;
|
|
|
- amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if ("D".equals(list.get(0).getDc())) {
|
|
|
+ amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCr = bills.getAmountCr();
|
|
|
+ amountCrUsd = bills.getAmountCrUsd();
|
|
|
+ amountCrLoc = bills.getAmountCrLoc();
|
|
|
+ } else {
|
|
|
+ amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDr = bills.getAmountDr();
|
|
|
+ amountDrUsd = bills.getAmountDrUsd();
|
|
|
+ amountDrLoc = bills.getAmountDrLoc();
|
|
|
+ }
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
@@ -692,102 +718,23 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
|
if (status) {
|
|
|
- //主单应加上分单费用
|
|
|
- /*if ("MM".equals(bills.getBillType())) {
|
|
|
- List<Bills> details = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
- .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Bills::getIsDeleted, 0)
|
|
|
- .eq(Bills::getMasterId, bills.getId()));
|
|
|
- if (!details.isEmpty()) {
|
|
|
- amountDr = amountDr.add(details.stream().map(Bills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCr = amountCr.add(details.stream().map(Bills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountDrUsd = amountDrUsd.add(details.stream().map(Bills::getAmountDrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCrUsd = amountCrUsd.add(details.stream().map(Bills::getAmountCrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountDrLoc = amountDrLoc.add(details.stream().map(Bills::getAmountDrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCrLoc = amountCrLoc.add(details.stream().map(Bills::getAmountCrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- }
|
|
|
- } else if ("MH".equals(bills.getBillType())) {
|
|
|
- Bills details = billsMapper.selectById(bills.getMasterId());
|
|
|
- //重新计算主单合计
|
|
|
- if (details != null) {
|
|
|
- BigDecimal amountDrM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountProfitM;
|
|
|
- BigDecimal amountDrUsdM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrUsdM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountProfitUsdM;
|
|
|
- BigDecimal amountDrLocM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrLocM = new BigDecimal("0.00");
|
|
|
- BigDecimal amountProfitLocM;
|
|
|
- BigDecimal quantityM = new BigDecimal("0.00");
|
|
|
- BigDecimal grossWeightM = new BigDecimal("0.00");
|
|
|
- BigDecimal measurementM = new BigDecimal("0.00");
|
|
|
- List<FeeCenter> feeCenters = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .eq(FeeCenter::getPid, details.getId()));
|
|
|
- for (FeeCenter item : feeCenters) {
|
|
|
- if ("C".equals(item.getDc())) {
|
|
|
- if (exrateType.equals(item.getCurCode())) {
|
|
|
- amountCrM = amountCrM.add(item.getAmount());
|
|
|
- amountCrLocM = amountCrLocM.add(item.getAmount());
|
|
|
- } else {
|
|
|
- amountCrUsdM = amountCrUsdM.add(item.getAmount());
|
|
|
- amountCrLocM = amountCrLocM.add(item.getAmount().multiply(item.getExrate()));
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (exrateType.equals(item.getCurCode())) {
|
|
|
- amountDrM = amountDrM.add(item.getAmount());
|
|
|
- amountDrLocM = amountDrLocM.add(item.getAmount());
|
|
|
- } else {
|
|
|
- amountDrUsdM = amountDrUsdM.add(item.getAmount());
|
|
|
- amountDrLocM = amountDrLocM.add(item.getAmount().multiply(item.getExrate()));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- List<Bills> billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
|
|
|
- .eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(Bills::getIsDeleted, 0)
|
|
|
- .eq(Bills::getMasterId, details.getId()));
|
|
|
- Bills finalBills = bills;
|
|
|
- List<Bills> billsLists = billsList.stream().filter(e -> !e.getId().equals(finalBills.getId())).collect(Collectors.toList());
|
|
|
- if (!billsLists.isEmpty()) {
|
|
|
- amountDrM = amountDrM.add(billsLists.stream().map(Bills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCrM = amountCrM.add(billsLists.stream().map(Bills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountDrUsdM = amountDrUsdM.add(billsLists.stream().map(Bills::getAmountDrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCrUsdM = amountCrUsdM.add(billsLists.stream().map(Bills::getAmountCrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountDrLocM = amountDrLocM.add(billsLists.stream().map(Bills::getAmountDrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- amountCrLocM = amountCrLocM.add(billsLists.stream().map(Bills::getAmountCrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- quantityM = quantityM.add(billsLists.stream().map(Bills::getQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- grossWeightM = grossWeightM.add(billsLists.stream().map(Bills::getGrossWeight).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- measurementM = measurementM.add(billsLists.stream().map(Bills::getMeasurement).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- }
|
|
|
- amountDrM = amountDrM.add(amountDr);
|
|
|
- amountCrM = amountCrM.add(amountCr);
|
|
|
- amountDrUsdM = amountDrUsdM.add(amountDrUsd);
|
|
|
- amountCrUsdM = amountCrUsdM.add(amountCrUsd);
|
|
|
- amountDrLocM = amountDrLocM.add(amountDrLoc);
|
|
|
- amountCrLocM = amountCrLocM.add(amountCrLoc);
|
|
|
- //利润 = 收 - 付
|
|
|
- amountProfitM = amountDrM.subtract(amountCrM);
|
|
|
- amountProfitUsdM = amountDrUsdM.subtract(amountCrUsdM);
|
|
|
- amountProfitLocM = amountDrLocM.subtract(amountCrLocM);
|
|
|
- details.setAmountDr(amountDrM);
|
|
|
- details.setAmountCr(amountCrM);
|
|
|
- details.setAmountProfit(amountProfitM);
|
|
|
- details.setAmountDrUsd(amountDrUsdM);
|
|
|
- details.setAmountCrUsd(amountCrUsdM);
|
|
|
- details.setAmountProfitUsd(amountProfitUsdM);
|
|
|
- details.setAmountDrLoc(amountDrLocM);
|
|
|
- details.setAmountCrLoc(amountCrLocM);
|
|
|
- details.setAmountProfitLoc(amountProfitLocM);
|
|
|
- details.setQuantity(quantityM);
|
|
|
- details.setGrossWeight(grossWeightM);
|
|
|
- details.setMeasurement(measurementM);
|
|
|
- billsMapper.updateById(details);
|
|
|
- }
|
|
|
- }*/
|
|
|
+ //应付
|
|
|
+ int statusC = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
|
|
|
+ statusC = 1;
|
|
|
+ }
|
|
|
+ //应收
|
|
|
+ int statusD = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
|
|
|
+ statusD = 1;
|
|
|
+ }
|
|
|
+ if (1 == statusD && 0 == statusC) {
|
|
|
+ bills.setAccountStatus(1);
|
|
|
+ } else if (0 == statusD && 1 == statusC) {
|
|
|
+ bills.setAccountStatus(2);
|
|
|
+ } else {
|
|
|
+ bills.setAccountStatus(3);
|
|
|
+ }
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
@@ -1432,19 +1379,46 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
list1.add(feeCenter);
|
|
|
}
|
|
|
if (!list1.isEmpty()) {
|
|
|
+
|
|
|
+ //应付
|
|
|
+ int statusC = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
|
|
|
+ statusC = 1;
|
|
|
+ }
|
|
|
+ //应收
|
|
|
+ int statusD = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
|
|
|
+ statusD = 1;
|
|
|
+ }
|
|
|
+ if (1 == statusD && 0 == statusC) {
|
|
|
+ bills.setAccountStatus(1);
|
|
|
+ } else if (0 == statusD && 1 == statusC) {
|
|
|
+ bills.setAccountStatus(2);
|
|
|
+ }
|
|
|
BigDecimal amountDr;
|
|
|
BigDecimal amountCr;
|
|
|
BigDecimal amountProfit;
|
|
|
BigDecimal amountDrUsd;
|
|
|
BigDecimal amountCrUsd;
|
|
|
BigDecimal amountProfitUsd;
|
|
|
- BigDecimal amountDrLoc = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountDrLoc;
|
|
|
+ BigDecimal amountCrLoc;
|
|
|
BigDecimal amountProfitLoc;
|
|
|
- amountDr = list1.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountDrUsd = list1.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCr = list1.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCrUsd = list1.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if ("D".equals(list.get(0).getDc())) {
|
|
|
+ amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCr = bills.getAmountCr();
|
|
|
+ amountCrUsd = bills.getAmountCrUsd();
|
|
|
+ amountCrLoc = bills.getAmountCrLoc();
|
|
|
+ } else {
|
|
|
+ amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDr = bills.getAmountDr();
|
|
|
+ amountDrUsd = bills.getAmountDrUsd();
|
|
|
+ amountDrLoc = bills.getAmountDrLoc();
|
|
|
+ }
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
@@ -1622,19 +1596,45 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
|
|
|
}
|
|
|
if (!list1.isEmpty()) {
|
|
|
+ //应付
|
|
|
+ int statusC = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
|
|
|
+ statusC = 1;
|
|
|
+ }
|
|
|
+ //应收
|
|
|
+ int statusD = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
|
|
|
+ statusD = 1;
|
|
|
+ }
|
|
|
+ if (1 == statusD && 0 == statusC) {
|
|
|
+ bills.setAccountStatus(1);
|
|
|
+ } else if (0 == statusD && 1 == statusC) {
|
|
|
+ bills.setAccountStatus(2);
|
|
|
+ }
|
|
|
BigDecimal amountDr;
|
|
|
BigDecimal amountCr;
|
|
|
BigDecimal amountProfit;
|
|
|
BigDecimal amountDrUsd;
|
|
|
BigDecimal amountCrUsd;
|
|
|
BigDecimal amountProfitUsd;
|
|
|
- BigDecimal amountDrLoc = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountDrLoc;
|
|
|
+ BigDecimal amountCrLoc;
|
|
|
BigDecimal amountProfitLoc;
|
|
|
- amountDr = list1.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountDrUsd = list1.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCr = list1.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCrUsd = list1.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if ("D".equals(list.get(0).getDc())) {
|
|
|
+ amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCr = bills.getAmountCr();
|
|
|
+ amountCrUsd = bills.getAmountCrUsd();
|
|
|
+ amountCrLoc = bills.getAmountCrLoc();
|
|
|
+ } else {
|
|
|
+ amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDr = bills.getAmountDr();
|
|
|
+ amountDrUsd = bills.getAmountDrUsd();
|
|
|
+ amountDrLoc = bills.getAmountDrLoc();
|
|
|
+ }
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
@@ -1794,19 +1794,45 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
}
|
|
|
}
|
|
|
if (!list1.isEmpty()) {
|
|
|
+ //应付
|
|
|
+ int statusC = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
|
|
|
+ statusC = 1;
|
|
|
+ }
|
|
|
+ //应收
|
|
|
+ int statusD = 0;
|
|
|
+ if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
|
|
|
+ statusD = 1;
|
|
|
+ }
|
|
|
+ if (1 == statusD && 0 == statusC) {
|
|
|
+ bills.setAccountStatus(1);
|
|
|
+ } else if (0 == statusD && 1 == statusC) {
|
|
|
+ bills.setAccountStatus(2);
|
|
|
+ }
|
|
|
BigDecimal amountDr;
|
|
|
BigDecimal amountCr;
|
|
|
BigDecimal amountProfit;
|
|
|
BigDecimal amountDrUsd;
|
|
|
BigDecimal amountCrUsd;
|
|
|
BigDecimal amountProfitUsd;
|
|
|
- BigDecimal amountDrLoc = new BigDecimal("0.00");
|
|
|
- BigDecimal amountCrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountDrLoc;
|
|
|
+ BigDecimal amountCrLoc;
|
|
|
BigDecimal amountProfitLoc;
|
|
|
- amountDr = list1.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountDrUsd = list1.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCr = list1.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- amountCrUsd = list1.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ if ("D".equals(list.get(0).getDc())) {
|
|
|
+ amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCr = bills.getAmountCr();
|
|
|
+ amountCrUsd = bills.getAmountCrUsd();
|
|
|
+ amountCrLoc = bills.getAmountCrLoc();
|
|
|
+ } else {
|
|
|
+ amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ amountDr = bills.getAmountDr();
|
|
|
+ amountDrUsd = bills.getAmountDrUsd();
|
|
|
+ amountDrLoc = bills.getAmountDrLoc();
|
|
|
+ }
|
|
|
//利润 = 收 - 付
|
|
|
amountProfit = amountDr.subtract(amountCr);
|
|
|
amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|