|
|
@@ -988,16 +988,56 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
.eq(Amends::getIsDeleted, 0)
|
|
|
.eq(Amends::getStatus, 3)
|
|
|
.eq(Amends::getOrigId, detail.getId()));
|
|
|
+ BigDecimal amountDr = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountCr = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountProfit;
|
|
|
+ BigDecimal amountDrUsd = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountCrUsd = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountProfitUsd;
|
|
|
+ BigDecimal amountDrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountCrLoc = new BigDecimal("0.00");
|
|
|
+ BigDecimal amountProfitLoc;
|
|
|
if (!amendsList.isEmpty()) {
|
|
|
List<Long> ids = amendsList.stream().map(Amends::getId).distinct().collect(Collectors.toList());
|
|
|
- detail.setFeeCenterAmendList(feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ List<FeeCenter> feeCenterAmendList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .in(FeeCenter::getPid, ids)
|
|
|
- ));
|
|
|
+ .in(FeeCenter::getPid, ids));
|
|
|
+ detail.setFeeCenterAmendList(feeCenterAmendList.isEmpty() ? new ArrayList<>() : feeCenterAmendList);
|
|
|
+ for (FeeCenter item : feeCenterAmendList) {
|
|
|
+ if ("D".equals(item.getDc())) {
|
|
|
+ if ("CNY".equals(item.getCurCode())) {
|
|
|
+ amountDr = amountDr.add(item.getAmount());
|
|
|
+ amountDrLoc = amountDrLoc.add(item.getAmount());
|
|
|
+ } else {
|
|
|
+ amountDrUsd = amountDrUsd.add(item.getAmount());
|
|
|
+ amountDrLoc = amountDrLoc.add(item.getAmount().multiply(item.getExrate()));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ("CNY".equals(item.getCurCode())) {
|
|
|
+ amountCr = amountCr.add(item.getAmount());
|
|
|
+ amountCrLoc = amountCrLoc.add(item.getAmount());
|
|
|
+ } else {
|
|
|
+ amountCrUsd = amountCrUsd.add(item.getAmount());
|
|
|
+ amountCrLoc = amountCrLoc.add(item.getAmount().multiply(item.getExrate()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
detail.setFeeCenterAmendList(new ArrayList<>());
|
|
|
}
|
|
|
+ amountProfit = amountDr.subtract(amountCr);
|
|
|
+ amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
|
|
|
+ amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
|
|
|
+ detail.setAmountDrAmend(amountDr);
|
|
|
+ detail.setAmountCrAmend(amountCr);
|
|
|
+ detail.setAmountProfitAmend(amountProfit);
|
|
|
+ detail.setAmountDrUsdAmend(amountDrUsd);
|
|
|
+ detail.setAmountCrUsdAmend(amountCrUsd);
|
|
|
+ detail.setAmountProfitUsdAmend(amountProfitUsd);
|
|
|
+ detail.setAmountDrLocAmend(amountDrLoc);
|
|
|
+ detail.setAmountCrLocAmend(amountCrLoc);
|
|
|
+ detail.setAmountProfitLocAmend(amountProfitLoc);
|
|
|
return detail;
|
|
|
}
|
|
|
|
|
|
@@ -1895,7 +1935,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
|
|
|
lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
|
|
|
}
|
|
|
List<Bills> billsList = baseMapper.selectList(lambdaQueryWrapper);
|
|
|
- if (billsList.size() == 0) {
|
|
|
+ if (billsList.isEmpty()) {
|
|
|
throw new RuntimeException("未查到单据信息");
|
|
|
}
|
|
|
for (Bills detail : billsList) {
|