|
|
@@ -11,7 +11,6 @@ import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
import org.springblade.los.Util.IDeptUtils;
|
|
|
-import org.springblade.los.basic.cur.entity.BCurrency;
|
|
|
import org.springblade.los.basic.cur.service.IBCurrencyService;
|
|
|
import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
import org.springblade.los.business.aea.mapper.AeaBillsMapper;
|
|
|
@@ -99,6 +98,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
public R<IPage<FinanceProfitDtoList>> financeProfit(FinanceProfitDtoList financeProfit, IPage<FinanceProfitDtoList> page) {
|
|
|
financeProfit.setTenantId(AuthUtil.getTenantId());
|
|
|
financeProfit.setBranchId(deptUtils.getDeptPid() + "");
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamineDate()) && "0".equals(financeProfit.getExamineDate())) {
|
|
|
+ financeProfit.setExamineDate(null);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamine()) && "0".equals(financeProfit.getExamine())) {
|
|
|
+ financeProfit.setExamine(null);
|
|
|
+ }
|
|
|
String jurisdiction = sysClient.getParamService("data.jurisdiction");
|
|
|
if ("1".equals(jurisdiction)) {
|
|
|
if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")
|
|
|
@@ -124,9 +129,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
financeProfit.setSelecType("0");
|
|
|
}
|
|
|
}
|
|
|
- List<FinanceProfitDtoList> financeProfitList = new ArrayList<>();
|
|
|
- BigDecimal exrateC = bCurrencyService.getCnyExrate(null, "USD", "C", "2");
|
|
|
- BigDecimal exrateD = bCurrencyService.getCnyExrate(null, "USD", "D", "2");
|
|
|
+ List<FinanceProfitDtoList> financeProfitList;
|
|
|
//是否合并amend费用 true 合并 false 不合并
|
|
|
if ("1".equals(financeProfit.getMergeAmendFee())) {
|
|
|
financeProfitList = financeProfitMapper.financeProfit(financeProfit, page);
|
|
|
@@ -166,6 +169,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
if (!amendsList.isEmpty() && !feeCenterList.isEmpty()) {
|
|
|
//获取当前业务类型所有amend
|
|
|
List<Amends> amends = amendsList.stream().filter(e -> e.getMblno().equals(item.getMblNo())).collect(Collectors.toList());
|
|
|
+ item.setWhetherExist(amends.size());
|
|
|
for (Amends i : amends) {
|
|
|
//人民币应收金额
|
|
|
BigDecimal feeCentersCD = feeCenterList.stream()
|
|
|
@@ -199,20 +203,36 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal feeCentersUCReal = feeCenterList.stream()
|
|
|
.filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
.map(FeeCenter::getStlTtlAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersUDLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实收合计金额
|
|
|
+ BigDecimal feeCentersUDRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应付合计金额
|
|
|
+ BigDecimal feeCentersUCLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实付合计金额
|
|
|
+ BigDecimal feeCentersUCRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
item.setRealAmountCr(item.getRealAmountCr().add(feeCentersCCReal));
|
|
|
item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
item.setRealAmountCrUsd(item.getRealAmountCrUsd().add(feeCentersUCReal));
|
|
|
- item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUC.multiply(exrateC).add(feeCentersCC).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCReal.multiply(exrateC).add(feeCentersCCReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUCLoc));
|
|
|
+ item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCRealLoc));
|
|
|
item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
item.setRealAmountDr(item.getRealAmountDr().add(feeCentersCDReal));
|
|
|
item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
item.setRealAmountDrUsd(item.getRealAmountDrUsd().add(feeCentersUDReal));
|
|
|
- item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUD.multiply(exrateD).add(feeCentersCD).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDReal.multiply(exrateD).add(feeCentersCDReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setAmountProfitLoc(item.getAmountProfitLoc().add(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountProfitLoc(item.getRealAmountProfitLoc().add(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUDLoc));
|
|
|
+ item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDRealLoc));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -239,11 +259,8 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
item.setLineCnName(profit.getLineCnName());
|
|
|
}
|
|
|
}
|
|
|
- item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setNotReceivedDr(item.getAmountDr().subtract(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setNotReceivedDrUsd(item.getAmountDrUsd().subtract(item.getRealAmountDrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
@@ -978,6 +995,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
public R financeProfitSum(FinanceProfitDtoList financeProfit) {
|
|
|
financeProfit.setTenantId(AuthUtil.getTenantId());
|
|
|
financeProfit.setBranchId(deptUtils.getDeptPid() + "");
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamineDate()) && "0".equals(financeProfit.getExamineDate())) {
|
|
|
+ financeProfit.setExamineDate(null);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamine()) && "0".equals(financeProfit.getExamine())) {
|
|
|
+ financeProfit.setExamine(null);
|
|
|
+ }
|
|
|
String jurisdiction = sysClient.getParamService("data.jurisdiction");
|
|
|
if ("1".equals(jurisdiction)) {
|
|
|
if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")
|
|
|
@@ -1003,9 +1026,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
financeProfit.setSelecType("0");
|
|
|
}
|
|
|
}
|
|
|
- List<FinanceProfitDtoList> financeProfitList = new ArrayList<>();
|
|
|
- BigDecimal exrateC = bCurrencyService.getCnyExrate(null, "USD", "C", "2");
|
|
|
- BigDecimal exrateD = bCurrencyService.getCnyExrate(null, "USD", "D", "2");
|
|
|
+ List<FinanceProfitDtoList> financeProfitList;
|
|
|
//是否合并amend费用 true 合并 false 不合并
|
|
|
if ("1".equals(financeProfit.getMergeAmendFee())) {
|
|
|
financeProfitList = financeProfitMapper.financeProfitSum(financeProfit);
|
|
|
@@ -1078,21 +1099,39 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal feeCentersUCReal = feeCenterList.stream()
|
|
|
.filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
.map(FeeCenter::getStlTtlAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersUDLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实收合计金额
|
|
|
+ BigDecimal feeCentersUDRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应付合计金额
|
|
|
+ BigDecimal feeCentersUCLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实付合计金额
|
|
|
+ BigDecimal feeCentersUCRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
item.setRealAmountCr(item.getRealAmountCr().add(feeCentersCCReal));
|
|
|
item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
item.setRealAmountCrUsd(item.getRealAmountCrUsd().add(feeCentersUCReal));
|
|
|
- item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUC.multiply(exrateC).add(feeCentersCC).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCReal.multiply(exrateC).add(feeCentersCCReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUCLoc));
|
|
|
+ item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCRealLoc));
|
|
|
item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
item.setRealAmountDr(item.getRealAmountDr().add(feeCentersCDReal));
|
|
|
item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
item.setRealAmountDrUsd(item.getRealAmountDrUsd().add(feeCentersUDReal));
|
|
|
- item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUD.multiply(exrateD).add(feeCentersCD).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDReal.multiply(exrateD).add(feeCentersCDReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setAmountProfitLoc(item.getAmountProfitLoc().add(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountProfitLoc(item.getRealAmountProfitLoc().add(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUDLoc));
|
|
|
+ item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDRealLoc));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1100,32 +1139,35 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
financeProfit.setBillType(financeProfit.getBillType() + ",SEA,SIA,AEA,AIA");
|
|
|
}
|
|
|
financeProfitList = financeProfitMapper.financeProfitSum(financeProfit);
|
|
|
- }
|
|
|
- for (FinanceProfitDtoList item : financeProfitList) {
|
|
|
- if (null != item) {
|
|
|
- item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ for (FinanceProfitDtoList item : financeProfitList) {
|
|
|
item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
+ for (FinanceProfitDtoList item : financeProfitList) {
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setNotReceivedDr(item.getAmountDr().subtract(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setNotReceivedDrUsd(item.getAmountDrUsd().subtract(item.getRealAmountDrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setNotReceivedLoc(item.getAmountDrLoc().subtract(item.getRealAmountDrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ }
|
|
|
Map<String, BigDecimal> map = new HashMap<>();
|
|
|
- map.put("amountDrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDrUsd).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountDrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDrUsd).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountDr", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDr).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountDr", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDr).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountDrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDrLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountDrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDrLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountCrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCrUsd).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountCrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCrUsd).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountCr", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCr).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountCr", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCr).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountCrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCrLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountCrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCrLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("amountProfitLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfitLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- map.put("realAmountProfitLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountProfitLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountDrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountDrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountDr", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountDr", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountDrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountDrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountCrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountCrUsd", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountCr", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountCr", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountCrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountCrLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountProfitLoc", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfitLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountProfitLoc", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountProfitLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountProfit", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("amountProfitUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfitUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
return R.data(map);
|
|
|
}
|
|
|
|
|
|
@@ -1133,6 +1175,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
public List<FinanceProfitDtoList> financeProfitExport(FinanceProfitDtoList financeProfit) {
|
|
|
financeProfit.setTenantId(AuthUtil.getTenantId());
|
|
|
financeProfit.setBranchId(deptUtils.getDeptPid() + "");
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamineDate()) && "0".equals(financeProfit.getExamineDate())) {
|
|
|
+ financeProfit.setExamineDate(null);
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(financeProfit.getExamine()) && "0".equals(financeProfit.getExamine())) {
|
|
|
+ financeProfit.setExamine(null);
|
|
|
+ }
|
|
|
String jurisdiction = sysClient.getParamService("data.jurisdiction");
|
|
|
if ("1".equals(jurisdiction)) {
|
|
|
if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")
|
|
|
@@ -1159,8 +1207,6 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
}
|
|
|
List<FinanceProfitDtoList> financeProfitList = new ArrayList<>();
|
|
|
- BigDecimal exrateC = bCurrencyService.getCnyExrate(null, "USD", "C", "2");
|
|
|
- BigDecimal exrateD = bCurrencyService.getCnyExrate(null, "USD", "D", "2");
|
|
|
//是否合并amend费用 true 合并 false 不合并
|
|
|
if (ObjectUtils.isNotNull(financeProfit.getMergeAmendFee())) {
|
|
|
financeProfitList = financeProfitMapper.financeProfitSum(financeProfit);
|
|
|
@@ -1233,21 +1279,39 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal feeCentersUCReal = feeCenterList.stream()
|
|
|
.filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
.map(FeeCenter::getStlTtlAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersUDLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实收合计金额
|
|
|
+ BigDecimal feeCentersUDRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "D".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应付合计金额
|
|
|
+ BigDecimal feeCentersUCLoc = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //实付合计金额
|
|
|
+ BigDecimal feeCentersUCRealLoc = feeCenterList.stream().filter(e -> i.getId().equals(e.getPid()) && "C".equals(e.getDc()))
|
|
|
+ .reduce(BigDecimal.ZERO, (x, y) -> x.add(y.getStlTtlAmount().multiply(y.getExrate())), BigDecimal::add)
|
|
|
+ .setScale(2, RoundingMode.HALF_UP);
|
|
|
item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
item.setRealAmountCr(item.getRealAmountCr().add(feeCentersCCReal));
|
|
|
item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
item.setRealAmountCrUsd(item.getRealAmountCrUsd().add(feeCentersUCReal));
|
|
|
- item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUC.multiply(exrateC).add(feeCentersCC).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCReal.multiply(exrateC).add(feeCentersCCReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersUCLoc));
|
|
|
+ item.setRealAmountCrLoc(item.getRealAmountCrLoc().add(feeCentersUCRealLoc));
|
|
|
item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
item.setRealAmountDr(item.getRealAmountDr().add(feeCentersCDReal));
|
|
|
item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
item.setRealAmountDrUsd(item.getRealAmountDrUsd().add(feeCentersUDReal));
|
|
|
- item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUD.multiply(exrateD).add(feeCentersCD).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDReal.multiply(exrateD).add(feeCentersCDReal).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setAmountProfitLoc(item.getAmountProfitLoc().add(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
- item.setRealAmountProfitLoc(item.getRealAmountProfitLoc().add(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP)));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersUDLoc));
|
|
|
+ item.setRealAmountDrLoc(item.getRealAmountDrLoc().add(feeCentersUDRealLoc));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
+ } else {
|
|
|
+ item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
@@ -1271,11 +1335,8 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
item.setLineCnName(profit.getLineCnName());
|
|
|
}
|
|
|
}
|
|
|
- item.setAmountCrLoc(item.getAmountCrUsd().multiply(exrateC).add(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountCrLoc(item.getRealAmountCrUsd().multiply(exrateC).add(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountDrLoc(item.getAmountDrUsd().multiply(exrateC).add(item.getAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setRealAmountDrLoc(item.getRealAmountDrUsd().multiply(exrateC).add(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setNotReceivedDr(item.getAmountDr().subtract(item.getRealAmountDr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
item.setNotReceivedDrUsd(item.getAmountDrUsd().subtract(item.getRealAmountDrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
@@ -1316,40 +1377,64 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
List<BoxNumberProfit> boxNumberProfitList = boxNumberProfitMapper.selectBoxNumberProfitPage(page, boxNumberProfit);
|
|
|
List<BoxNumberProfitExcel> boxNumberProfitExcelList = new ArrayList<>();
|
|
|
if (!boxNumberProfitList.isEmpty()) {
|
|
|
- List<Long> ids = boxNumberProfitList.stream().map(BoxNumberProfit::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, ids));
|
|
|
- BCurrency bCurrencyD = new BCurrency();
|
|
|
- bCurrencyD.setDc("D");
|
|
|
- bCurrencyD.setType("1");
|
|
|
- List<BCurrency> currencyListD = bCurrencyService.getExrate(bCurrencyD);
|
|
|
- BCurrency bCurrencyC = new BCurrency();
|
|
|
- bCurrencyC.setDc("C");
|
|
|
- bCurrencyC.setType("1");
|
|
|
- List<BCurrency> currencyListC = bCurrencyService.getExrate(bCurrencyC);
|
|
|
- for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
- if ("ASE".equals(item.getBusinessType()) || "ASI".equals(item.getBusinessType())) {
|
|
|
- BigDecimal amountDr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDr);
|
|
|
- BigDecimal amountCr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCr(amountCr);
|
|
|
- BigDecimal amountDrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDrUsd);
|
|
|
- BigDecimal amountCrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCrUsd(amountCrUsd);
|
|
|
- currencyListD.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyD -> item.setAmountDrLoc(amountDr.add(amountDrUsd.multiply(currencyD.getExrate()))));
|
|
|
- currencyListC.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyC -> item.setAmountCrLoc(amountCr.add(amountCrUsd.multiply(currencyC.getExrate()))));
|
|
|
- item.setAmountProfit(amountDr.subtract(amountCr));
|
|
|
- item.setAmountProfitUsd(amountDrUsd.subtract(amountCrUsd));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ if ("1".equals(boxNumberProfit.getMergeAmendFee())) {
|
|
|
+ String mblno = boxNumberProfitList.stream().map(BoxNumberProfit::getMblno).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
|
|
|
+ LambdaQueryWrapper<Amends> lambdaQueryWrapper = new LambdaQueryWrapper<Amends>()
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(mblno,'" + mblno + "')");
|
|
|
+ List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ List<Long> pids = amendsList.stream().map(Amends::getId).collect(Collectors.toList());
|
|
|
+ if (!pids.isEmpty()) {
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, pids));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
+ if (!amendsList.isEmpty() && !feeCenterList.isEmpty()) {
|
|
|
+ //获取当前业务类型所有amend
|
|
|
+ List<Amends> amends = amendsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).collect(Collectors.toList());
|
|
|
+ item.setWhetherExist(amends.size());
|
|
|
+ for (Amends i : amends) {
|
|
|
+ //人民币应收金额
|
|
|
+ BigDecimal feeCentersCD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //人民币应付金额
|
|
|
+ BigDecimal feeCentersCC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应收金额
|
|
|
+ BigDecimal feeCentersUD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应付金额
|
|
|
+ BigDecimal feeCentersUC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
+ item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersLocC));
|
|
|
+ item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
+ item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersLocD));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boxNumberProfitExcelList = BeanUtil.copy(boxNumberProfitList, BoxNumberProfitExcel.class);
|
|
|
@@ -1387,43 +1472,67 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
}
|
|
|
List<BoxNumberProfit> boxNumberProfitList = boxNumberProfitMapper.selectBoxNumberProfitList(boxNumberProfit);
|
|
|
- List<BoxNumberProfitExcel> boxNumberProfitExcelList = new ArrayList<>();
|
|
|
+ List<BoxNumberProfitExcel> boxNumberProfitExcelList;
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
if (!boxNumberProfitList.isEmpty()) {
|
|
|
- List<Long> ids = boxNumberProfitList.stream().map(BoxNumberProfit::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, ids));
|
|
|
- BCurrency bCurrencyD = new BCurrency();
|
|
|
- bCurrencyD.setDc("D");
|
|
|
- bCurrencyD.setType("1");
|
|
|
- List<BCurrency> currencyListD = bCurrencyService.getExrate(bCurrencyD);
|
|
|
- BCurrency bCurrencyC = new BCurrency();
|
|
|
- bCurrencyC.setDc("C");
|
|
|
- bCurrencyC.setType("1");
|
|
|
- List<BCurrency> currencyListC = bCurrencyService.getExrate(bCurrencyC);
|
|
|
- for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
- if ("ASE".equals(item.getBusinessType()) || "ASI".equals(item.getBusinessType())) {
|
|
|
- BigDecimal amountDr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDr);
|
|
|
- BigDecimal amountCr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCr(amountCr);
|
|
|
- BigDecimal amountDrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDrUsd);
|
|
|
- BigDecimal amountCrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCrUsd(amountCrUsd);
|
|
|
- currencyListD.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyD -> item.setAmountDrLoc(amountDr.add(amountDrUsd.multiply(currencyD.getExrate()))));
|
|
|
- currencyListC.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyC -> item.setAmountCrLoc(amountCr.add(amountCrUsd.multiply(currencyC.getExrate()))));
|
|
|
- item.setAmountProfit(amountDr.subtract(amountCr));
|
|
|
- item.setAmountProfitUsd(amountDrUsd.subtract(amountCrUsd));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ if ("1".equals(boxNumberProfit.getMergeAmendFee())) {
|
|
|
+ String mblno = boxNumberProfitList.stream().map(BoxNumberProfit::getMblno).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
|
|
|
+ LambdaQueryWrapper<Amends> lambdaQueryWrapper = new LambdaQueryWrapper<Amends>()
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(mblno,'" + mblno + "')");
|
|
|
+ List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ List<Long> pids = amendsList.stream().map(Amends::getId).collect(Collectors.toList());
|
|
|
+ if (!pids.isEmpty()) {
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, pids));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
+ if (!amendsList.isEmpty() && !feeCenterList.isEmpty()) {
|
|
|
+ //获取当前业务类型所有amend
|
|
|
+ List<Amends> amends = amendsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).collect(Collectors.toList());
|
|
|
+ item.setWhetherExist(amends.size());
|
|
|
+ for (Amends i : amends) {
|
|
|
+ //人民币应收金额
|
|
|
+ BigDecimal feeCentersCD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //人民币应付金额
|
|
|
+ BigDecimal feeCentersCC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应收金额
|
|
|
+ BigDecimal feeCentersUD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应付金额
|
|
|
+ BigDecimal feeCentersUC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
+ item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersLocC));
|
|
|
+ item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
+ item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersLocD));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boxNumberProfitExcelList = BeanUtil.copy(boxNumberProfitList, BoxNumberProfitExcel.class);
|
|
|
@@ -1502,40 +1611,64 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
List<BoxNumberProfit> boxNumberProfitList = boxNumberProfitMapper.selectBoxNumberProfitList(boxNumberProfit);
|
|
|
List<BoxNumberProfitExcel> boxNumberProfitExcelList = new ArrayList<>();
|
|
|
if (!boxNumberProfitList.isEmpty()) {
|
|
|
- List<Long> ids = boxNumberProfitList.stream().map(BoxNumberProfit::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, ids));
|
|
|
- BCurrency bCurrencyD = new BCurrency();
|
|
|
- bCurrencyD.setDc("D");
|
|
|
- bCurrencyD.setType("1");
|
|
|
- List<BCurrency> currencyListD = bCurrencyService.getExrate(bCurrencyD);
|
|
|
- BCurrency bCurrencyC = new BCurrency();
|
|
|
- bCurrencyC.setDc("C");
|
|
|
- bCurrencyC.setType("1");
|
|
|
- List<BCurrency> currencyListC = bCurrencyService.getExrate(bCurrencyC);
|
|
|
- for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
- if ("ASE".equals(item.getBusinessType()) || "ASI".equals(item.getBusinessType())) {
|
|
|
- BigDecimal amountDr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDr);
|
|
|
- BigDecimal amountCr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCr(amountCr);
|
|
|
- BigDecimal amountDrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDrUsd);
|
|
|
- BigDecimal amountCrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCrUsd(amountCrUsd);
|
|
|
- currencyListD.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyD -> item.setAmountDrLoc(amountDr.add(amountDrUsd.multiply(currencyD.getExrate()))));
|
|
|
- currencyListC.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyC -> item.setAmountCrLoc(amountCr.add(amountCrUsd.multiply(currencyC.getExrate()))));
|
|
|
- item.setAmountProfit(amountDr.subtract(amountCr));
|
|
|
- item.setAmountProfitUsd(amountDrUsd.subtract(amountCrUsd));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ if ("1".equals(boxNumberProfit.getMergeAmendFee())) {
|
|
|
+ String mblno = boxNumberProfitList.stream().map(BoxNumberProfit::getMblno).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
|
|
|
+ LambdaQueryWrapper<Amends> lambdaQueryWrapper = new LambdaQueryWrapper<Amends>()
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(mblno,'" + mblno + "')");
|
|
|
+ List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ List<Long> pids = amendsList.stream().map(Amends::getId).collect(Collectors.toList());
|
|
|
+ if (!pids.isEmpty()) {
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, pids));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
+ if (!amendsList.isEmpty() && !feeCenterList.isEmpty()) {
|
|
|
+ //获取当前业务类型所有amend
|
|
|
+ List<Amends> amends = amendsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).collect(Collectors.toList());
|
|
|
+ item.setWhetherExist(amends.size());
|
|
|
+ for (Amends i : amends) {
|
|
|
+ //人民币应收金额
|
|
|
+ BigDecimal feeCentersCD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //人民币应付金额
|
|
|
+ BigDecimal feeCentersCC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应收金额
|
|
|
+ BigDecimal feeCentersUD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应付金额
|
|
|
+ BigDecimal feeCentersUC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
+ item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersLocC));
|
|
|
+ item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
+ item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersLocD));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
boxNumberProfitExcelList = BeanUtil.copy(boxNumberProfitList, BoxNumberProfitExcel.class);
|
|
|
@@ -1550,40 +1683,64 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
List<BoxNumberProfit> boxNumberProfitList = boxNumberProfitMapper.selectBoxNumberProfitList(boxNumberProfit);
|
|
|
List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
if (!boxNumberProfitList.isEmpty()) {
|
|
|
- List<Long> ids = boxNumberProfitList.stream().map(BoxNumberProfit::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
- List<FeeCenter> feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .in(FeeCenter::getPid, ids));
|
|
|
- BCurrency bCurrencyD = new BCurrency();
|
|
|
- bCurrencyD.setDc("D");
|
|
|
- bCurrencyD.setType("1");
|
|
|
- List<BCurrency> currencyListD = bCurrencyService.getExrate(bCurrencyD);
|
|
|
- BCurrency bCurrencyC = new BCurrency();
|
|
|
- bCurrencyC.setDc("C");
|
|
|
- bCurrencyC.setType("1");
|
|
|
- List<BCurrency> currencyListC = bCurrencyService.getExrate(bCurrencyC);
|
|
|
- for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
- if ("ASE".equals(item.getBusinessType()) || "ASI".equals(item.getBusinessType())) {
|
|
|
- BigDecimal amountDr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDr);
|
|
|
- BigDecimal amountCr = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "CNY".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCr(amountCr);
|
|
|
- BigDecimal amountDrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "D".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountDr(amountDrUsd);
|
|
|
- BigDecimal amountCrUsd = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId()) && "C".equals(e.getDc())
|
|
|
- && "USD".equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- item.setAmountCrUsd(amountCrUsd);
|
|
|
- currencyListD.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyD -> item.setAmountDrLoc(amountDr.add(amountDrUsd.multiply(currencyD.getExrate()))));
|
|
|
- currencyListC.stream().filter(e -> "USD".equals(e.getCode())).findFirst()
|
|
|
- .ifPresent(currencyC -> item.setAmountCrLoc(amountCr.add(amountCrUsd.multiply(currencyC.getExrate()))));
|
|
|
- item.setAmountProfit(amountDr.subtract(amountCr));
|
|
|
- item.setAmountProfitUsd(amountDrUsd.subtract(amountCrUsd));
|
|
|
- item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ if ("1".equals(boxNumberProfit.getMergeAmendFee())) {
|
|
|
+ String mblno = boxNumberProfitList.stream().map(BoxNumberProfit::getMblno).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
|
|
|
+ LambdaQueryWrapper<Amends> lambdaQueryWrapper = new LambdaQueryWrapper<Amends>()
|
|
|
+ .eq(Amends::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(Amends::getIsDeleted, 0)
|
|
|
+ .apply("find_in_set(mblno,'" + mblno + "')");
|
|
|
+ List<Amends> amendsList = amendsMapper.selectList(lambdaQueryWrapper);
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ if (!amendsList.isEmpty()) {
|
|
|
+ List<Long> pids = amendsList.stream().map(Amends::getId).collect(Collectors.toList());
|
|
|
+ if (!pids.isEmpty()) {
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, pids));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (BoxNumberProfit item : boxNumberProfitList) {
|
|
|
+ if (!amendsList.isEmpty() && !feeCenterList.isEmpty()) {
|
|
|
+ //获取当前业务类型所有amend
|
|
|
+ List<Amends> amends = amendsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).collect(Collectors.toList());
|
|
|
+ item.setWhetherExist(amends.size());
|
|
|
+ for (Amends i : amends) {
|
|
|
+ //人民币应收金额
|
|
|
+ BigDecimal feeCentersCD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //人民币应付金额
|
|
|
+ BigDecimal feeCentersCC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应收金额
|
|
|
+ BigDecimal feeCentersUD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //美金应付金额
|
|
|
+ BigDecimal feeCentersUC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocD = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ //应收合计金额
|
|
|
+ BigDecimal feeCentersLocC = feeCenterList.stream()
|
|
|
+ .filter(e -> i.getId().equals(e.getPid()) && "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmountLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add).setScale(2, RoundingMode.HALF_UP);
|
|
|
+ item.setAmountCr(item.getAmountCr().add(feeCentersCC));
|
|
|
+ item.setAmountCrUsd(item.getAmountCrUsd().add(feeCentersUC));
|
|
|
+ item.setAmountCrLoc(item.getAmountCrLoc().add(feeCentersLocC));
|
|
|
+ item.setAmountDr(item.getAmountDr().add(feeCentersCD));
|
|
|
+ item.setAmountDrUsd(item.getAmountDrUsd().add(feeCentersUD));
|
|
|
+ item.setAmountDrLoc(item.getAmountDrLoc().add(feeCentersLocD));
|
|
|
+ item.setAmountProfit(item.getAmountDr().subtract(item.getAmountCr()));
|
|
|
+ item.setAmountProfitUsd(item.getAmountDrUsd().subtract(item.getAmountCrUsd()));
|
|
|
+ item.setAmountProfitLoc(item.getAmountDrLoc().subtract(item.getAmountCrLoc()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ("1".equals(boxNumberProfit.getType())) {
|
|
|
@@ -2001,7 +2158,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
lambdaQueryWrapper.eq(Bills::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(Bills::getIsDeleted, 0)
|
|
|
.eq(Bills::getBranchId, AuthUtil.getDeptId())
|
|
|
- .apply("DATE_FORMAT(eta,'%Y-%m-%d') > '" + sdf.format(date1) + "' and DATE_FORMAT(eta,'%Y-%m-%d') <= '" + sdf.format(date)+"'");
|
|
|
+ .apply("DATE_FORMAT(eta,'%Y-%m-%d') > '" + sdf.format(date1) + "' and DATE_FORMAT(eta,'%Y-%m-%d') <= '" + sdf.format(date) + "'");
|
|
|
map.put("arrivalReminder", billsMapper.selectCount(lambdaQueryWrapper));
|
|
|
return R.data(map);
|
|
|
}
|
|
|
@@ -2027,7 +2184,7 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
.and(ObjectUtils.isNotNull(bills.getCorpCnName()), i -> i.like(Bills::getCorpCnName, bills.getCorpCnName()).or()
|
|
|
.like(Bills::getCorpEnName, bills.getCorpCnName()))
|
|
|
.like(ObjectUtils.isNotNull(bills.getBillNo()), Bills::getBillNo, bills.getBillNo())
|
|
|
- .apply("DATE_FORMAT(eta,'%Y-%m-%d') > '" + sdf.format(date1) + "' and DATE_FORMAT(eta,'%Y-%m-%d') <= '" + sdf.format(date)+"'");
|
|
|
+ .apply("DATE_FORMAT(eta,'%Y-%m-%d') > '" + sdf.format(date1) + "' and DATE_FORMAT(eta,'%Y-%m-%d') <= '" + sdf.format(date) + "'");
|
|
|
IPage<Bills> billsIPage = billsMapper.selectPage(Condition.getPage(query), lambdaQueryWrapper);
|
|
|
return R.data(billsIPage);
|
|
|
}
|