|
|
@@ -212,15 +212,24 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
financeProfitList = financeProfitMapper.financeProfitList(financeProfit, page);
|
|
|
}
|
|
|
List<FinanceProfit> financeProfitDataList = new ArrayList<>();
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
if (!financeProfitList.isEmpty()) {
|
|
|
+ List<Long> idList = financeProfitList.stream().map(FinanceProfitDtoList::getId).distinct().collect(Collectors.toList());
|
|
|
String mblNo = financeProfitList.stream().map(FinanceProfitDtoList::getMblNo).distinct().collect(Collectors.joining(","));
|
|
|
financeProfitDataList = financeProfitMapper.selectList(new LambdaQueryWrapper<FinanceProfit>()
|
|
|
.apply("find_in_set(mblno,'" + mblNo + "')")
|
|
|
.apply("find_in_set(business_type,'SE,SI,AE,AI')")
|
|
|
);
|
|
|
+ if (!financeProfitDataList.isEmpty()) {
|
|
|
+ idList.addAll(financeProfitDataList.stream().map(FinanceProfit::getId).distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, idList));
|
|
|
}
|
|
|
for (FinanceProfitDtoList item : financeProfitList) {
|
|
|
- if (("SEA".equals(item.getBusinessType()) || "SIA".equals(item.getBusinessType())
|
|
|
+ if (("SEA".equals(item.getBusinessType()) || "SIA".equals(item.getBusinessType())
|
|
|
|| "AEA".equals(item.getBusinessType()) || "AIA".equals(item.getBusinessType()))
|
|
|
&& !financeProfitDataList.isEmpty()) {
|
|
|
FinanceProfit profit = financeProfitDataList.stream().filter(e -> e.getMblno().equals(item.getMblNo())).findFirst().orElse(null);
|
|
|
@@ -230,16 +239,186 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
item.setLineCnName(profit.getLineCnName());
|
|
|
}
|
|
|
}
|
|
|
- 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));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ assignment(feeCenters, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return R.data(page.setRecords(financeProfitList));
|
|
|
}
|
|
|
|
|
|
+ private FinanceProfitDtoList assignment(List<FeeCenter> feeCenters, FinanceProfitDtoList item) {
|
|
|
+ //应收人民币
|
|
|
+ BigDecimal amountDr = feeCenters.stream().filter(e -> "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDr(amountDr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收人民币
|
|
|
+ BigDecimal realAmountDr = feeCenters.stream().filter(e -> "CNY".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDr(realAmountDr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收人民币
|
|
|
+ item.setNotReceivedDr(amountDr.subtract(realAmountDr));
|
|
|
+ //应收美元
|
|
|
+ BigDecimal amountDrUsd = feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrUsd(amountDrUsd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收美元
|
|
|
+ BigDecimal realAmountDrUsd =feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrUsd(realAmountDrUsd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收美元
|
|
|
+ item.setNotReceivedDrUsd(amountDrUsd.subtract(realAmountDrUsd));
|
|
|
+ //应收HKD
|
|
|
+ BigDecimal amountDrHkd = feeCenters.stream().filter(e -> "HKD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrHkd(amountDrHkd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收HKD
|
|
|
+ BigDecimal realAmountDrHkd = feeCenters.stream().filter(e -> "HKD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrHkd(realAmountDrHkd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收HKD
|
|
|
+ item.setNotReceivedDrHkd(amountDrHkd.subtract(amountDrHkd));
|
|
|
+ //应收VND
|
|
|
+ BigDecimal amountDrVnd = feeCenters.stream().filter(e -> "VND".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrVnd(amountDrVnd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收VND
|
|
|
+ BigDecimal realAmountDrVnd = feeCenters.stream().filter(e -> "VND".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrVnd(realAmountDrVnd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收VND
|
|
|
+ item.setNotReceivedDrVnd(amountDrVnd.subtract(realAmountDrVnd));
|
|
|
+ //应收SGD
|
|
|
+ BigDecimal amountDrSgd = feeCenters.stream().filter(e -> "SGD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrSgd(amountDrSgd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收SGD
|
|
|
+ BigDecimal realAmountDrSgd = feeCenters.stream().filter(e -> "SGD".equals(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrSgd(realAmountDrSgd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收SGD
|
|
|
+ item.setNotReceivedDrSgd(amountDrSgd.subtract(realAmountDrSgd));
|
|
|
+ //应收其他
|
|
|
+ BigDecimal amountDrOther = feeCenters.stream().filter(e -> !"CNY,USD".contains(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrOther(amountDrOther.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实收其他
|
|
|
+ BigDecimal realAmountDrOther = feeCenters.stream().filter(e -> !"CNY,USD".contains(e.getCurCode()) && "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrOther(realAmountDrOther.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收其他
|
|
|
+ item.setNotReceivedDrOther(amountDrOther.subtract(realAmountDrOther));
|
|
|
+ //合计应收
|
|
|
+ BigDecimal amountDrLoc = feeCenters.stream().filter(e -> "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountDrLoc(amountDrLoc.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实际合计应收
|
|
|
+ BigDecimal realAmountDrLoc = feeCenters.stream().filter(e -> "D".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountDrLoc(realAmountDrLoc.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未收合计
|
|
|
+ item.setNotReceivedLoc(amountDrLoc.subtract(realAmountDrLoc));
|
|
|
+ //应付人民币
|
|
|
+ BigDecimal amountCr = feeCenters.stream().filter(e -> "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCr(amountCr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付人民币
|
|
|
+ BigDecimal realAmountCr = feeCenters.stream().filter(e -> "CNY".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCr(realAmountCr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付人民币
|
|
|
+ item.setNotReceivedCr(amountCr.subtract(realAmountCr));
|
|
|
+ //应付美元
|
|
|
+ BigDecimal amountCrUsd = feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrUsd(amountCrUsd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付美元
|
|
|
+ BigDecimal realAmountCrUsd = feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrUsd(realAmountCrUsd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付美元
|
|
|
+ item.setNotReceivedCrUsd(amountCrUsd.subtract(realAmountCrUsd));
|
|
|
+ //应付HKD
|
|
|
+ BigDecimal amountCrHkd = feeCenters.stream().filter(e -> "HKD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrHkd(amountCrHkd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付HKD
|
|
|
+ BigDecimal realAmountCrHkd = feeCenters.stream().filter(e -> "HKD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrHkd(realAmountCrHkd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付HKD
|
|
|
+ item.setNotReceivedCrHkd(amountCrHkd.subtract(realAmountCrHkd));
|
|
|
+ //应付VND
|
|
|
+ BigDecimal amountCrVnd = feeCenters.stream().filter(e -> "VND".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrVnd(amountCrVnd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付VND
|
|
|
+ BigDecimal realAmountCrVnd = feeCenters.stream().filter(e -> "VND".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrVnd(realAmountCrVnd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付VND
|
|
|
+ item.setNotReceivedCrVnd(amountCrVnd.subtract(realAmountCrVnd));
|
|
|
+ //应付SGD
|
|
|
+ BigDecimal amountCrSgd =feeCenters.stream().filter(e -> "SGD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrSgd(amountCrSgd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付SGD
|
|
|
+ BigDecimal realAmountCrSgd = feeCenters.stream().filter(e -> "SGD".equals(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrSgd(realAmountCrSgd.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付SGD
|
|
|
+ item.setNotReceivedCrSgd(amountCrSgd.subtract(realAmountCrSgd));
|
|
|
+ //应付其他
|
|
|
+ BigDecimal amountCrOther = feeCenters.stream().filter(e -> !"CNY,USD".contains(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrOther(amountCrOther.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实付其他
|
|
|
+ BigDecimal realAmountCrOther = feeCenters.stream().filter(e -> !"CNY,USD".contains(e.getCurCode()) && "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrOther(realAmountCrOther.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付其他
|
|
|
+ item.setNotReceivedCrOther(amountCrOther.subtract(realAmountCrOther));
|
|
|
+ //合计应付
|
|
|
+ BigDecimal amountCrLoc = feeCenters.stream().filter(e -> "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setAmountCrLoc(amountCrLoc.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //实际合计应付
|
|
|
+ BigDecimal realAmountCrLoc = feeCenters.stream().filter(e -> "C".equals(e.getDc()))
|
|
|
+ .map(FeeCenter::getStlTtlAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setRealAmountCrLoc(realAmountCrLoc.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //未付合计
|
|
|
+ item.setNotReceivedCrLoc(amountCrLoc.subtract(realAmountCrLoc));
|
|
|
+ //合计利润
|
|
|
+ item.setAmountProfitLoc(amountDrLoc.subtract(amountCrLoc));
|
|
|
+ //实际单票利润
|
|
|
+ item.setRealAmountProfitLoc(realAmountDrLoc.subtract(realAmountCrLoc));
|
|
|
+ //人民币利润
|
|
|
+ item.setAmountProfit(amountDr.subtract(amountCr));
|
|
|
+ //美元利润
|
|
|
+ item.setAmountProfitUsd(amountDrUsd.subtract(amountCrUsd));
|
|
|
+ //HKD利润
|
|
|
+ item.setAmountProfitHkd(amountDrHkd.subtract(amountCrHkd));
|
|
|
+ //VND利润
|
|
|
+ item.setAmountProfitVnd(amountDrVnd.subtract(amountCrVnd));
|
|
|
+ //SGD利润
|
|
|
+ item.setAmountProfitSgd(amountDrSgd.subtract(amountCrSgd));
|
|
|
+ //其他利润
|
|
|
+ item.setAmountProfitOther(amountDrOther.subtract(amountDrOther));
|
|
|
+ //应收海运费
|
|
|
+ BigDecimal oceanFreightDr = feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "D".equals(e.getDc())
|
|
|
+ && "HYF".equals(e.getFeeCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setOceanFreightDr(oceanFreightDr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //应付海运费
|
|
|
+ BigDecimal oceanFreightCr = feeCenters.stream().filter(e -> "USD".equals(e.getCurCode()) && "C".equals(e.getDc())
|
|
|
+ && "HYF".equals(e.getFeeCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ item.setOceanFreightCr(oceanFreightCr.setScale(2, RoundingMode.HALF_UP));
|
|
|
+ //海运费利润
|
|
|
+ item.setOceanFreightProfit(oceanFreightDr.subtract(oceanFreightCr));
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R<Map<String, Object>> businessSum(String dateStart, String dateEnd) {
|
|
|
long HYJK;
|
|
|
@@ -545,7 +724,13 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
feeSummaryQ.setBranchId(AuthUtil.getDeptId());
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return R.data(page.setRecords(finAccBillsMapper.feeSummaryList(page, feeSummaryQ)));
|
|
|
+ List<FeeSummaryRD> feeSummaryRDList = finAccBillsMapper.feeSummaryList(page, feeSummaryQ);
|
|
|
+ for (FeeSummaryRD item : feeSummaryRDList) {
|
|
|
+ item.setAmountOther(item.getAmountHKD().add(item.getAmountSGD()).add(item.getAmountVND()));
|
|
|
+ item.setAmountOtherAlready(item.getAmountHKDAlready().add(item.getAmountSGDAlready()).add(item.getAmountVNDAlready()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ }
|
|
|
+ return R.data(page.setRecords(feeSummaryRDList));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -555,7 +740,13 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
feeSummaryQ.setBranchId(AuthUtil.getDeptId());
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return finAccBillsMapper.feeSummaryExportList(feeSummaryQ);
|
|
|
+ List<FeeSummaryRD> feeSummaryRDList = finAccBillsMapper.feeSummaryExportList(feeSummaryQ);
|
|
|
+ for (FeeSummaryRD item : feeSummaryRDList) {
|
|
|
+ item.setAmountOther(item.getAmountHKD().add(item.getAmountSGD()).add(item.getAmountVND()));
|
|
|
+ item.setAmountOtherAlready(item.getAmountHKDAlready().add(item.getAmountSGDAlready()).add(item.getAmountVNDAlready()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ }
|
|
|
+ return feeSummaryRDList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -565,7 +756,15 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
feeSummaryQ.setBranchId(AuthUtil.getDeptId());
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return R.data(page.setRecords(finAccBillsMapper.feeSummaryDetailList(page, feeSummaryQ)));
|
|
|
+ List<FeeSummaryDetailRD> feeSummaryDetailList = finAccBillsMapper.feeSummaryDetailList(page, feeSummaryQ);
|
|
|
+ for (FeeSummaryDetailRD item : feeSummaryDetailList) {
|
|
|
+ item.setAmountOther(item.getAmountHKD().add(item.getAmountSGD()).add(item.getAmountVND()));
|
|
|
+ item.setAmountOtherAlready(item.getAmountHKDAlready().add(item.getAmountSGDAlready()).add(item.getAmountVNDAlready()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ item.setAmountnvoicingOther(item.getAmountnvoicingHKD().add(item.getAmountnvoicingSGD()).add(item.getAmountnvoicingVND()));
|
|
|
+ item.setAmountnvoicingOtherNot(item.getAmountnvoicingHKDNot().add(item.getAmountnvoicingSGDNot()).add(item.getAmountnvoicingVNDNot()));
|
|
|
+ }
|
|
|
+ return R.data(page.setRecords(feeSummaryDetailList));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -575,7 +774,15 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
feeSummaryQ.setBranchId(AuthUtil.getDeptId());
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return finAccBillsMapper.feeSummaryDetailExportList(feeSummaryQ);
|
|
|
+ List<FeeSummaryDetailRD> feeSummaryDetailList = finAccBillsMapper.feeSummaryDetailExportList(feeSummaryQ);
|
|
|
+ for (FeeSummaryDetailRD item : feeSummaryDetailList) {
|
|
|
+ item.setAmountOther(item.getAmountHKD().add(item.getAmountSGD()).add(item.getAmountVND()));
|
|
|
+ item.setAmountOtherAlready(item.getAmountHKDAlready().add(item.getAmountSGDAlready()).add(item.getAmountVNDAlready()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ item.setAmountnvoicingOther(item.getAmountnvoicingHKD().add(item.getAmountnvoicingSGD()).add(item.getAmountnvoicingVND()));
|
|
|
+ item.setAmountnvoicingOtherNot(item.getAmountnvoicingHKDNot().add(item.getAmountnvoicingSGDNot()).add(item.getAmountnvoicingVNDNot()));
|
|
|
+ }
|
|
|
+ return feeSummaryDetailList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -590,7 +797,13 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return R.data(page.setRecords(finAccBillsMapper.feeSummaryDetailNotList(page, feeSummaryQ)));
|
|
|
+ List<FeeSummaryDetailNotRD> feeSummaryDetailExportNotList = finAccBillsMapper.feeSummaryDetailNotList(page, feeSummaryQ);
|
|
|
+ for (FeeSummaryDetailNotRD item : feeSummaryDetailExportNotList) {
|
|
|
+ item.setAmountnvoicingOther(item.getAmountnvoicingHKD().add(item.getAmountnvoicingSGD()).add(item.getAmountnvoicingVND()));
|
|
|
+ item.setAmountnvoicingOtherNot(item.getAmountnvoicingHKDNot().add(item.getAmountnvoicingSGDNot()).add(item.getAmountnvoicingVNDNot()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ }
|
|
|
+ return R.data(page.setRecords(feeSummaryDetailExportNotList));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -605,7 +818,13 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
}
|
|
|
feeSummaryQ.setBillType("MH,DD");
|
|
|
}
|
|
|
- return finAccBillsMapper.feeSummaryDetailExportNotList(feeSummaryQ);
|
|
|
+ List<FeeSummaryDetailNotRD> feeSummaryDetailExportNotList = finAccBillsMapper.feeSummaryDetailExportNotList(feeSummaryQ);
|
|
|
+ for (FeeSummaryDetailNotRD item : feeSummaryDetailExportNotList) {
|
|
|
+ item.setAmountnvoicingOther(item.getAmountnvoicingHKD().add(item.getAmountnvoicingSGD()).add(item.getAmountnvoicingVND()));
|
|
|
+ item.setAmountnvoicingOtherNot(item.getAmountnvoicingHKDNot().add(item.getAmountnvoicingSGDNot()).add(item.getAmountnvoicingVNDNot()));
|
|
|
+ item.setAmountOtherNot(item.getAmountHKDNot().add(item.getAmountSGDNot()).add(item.getAmountVNDNot()));
|
|
|
+ }
|
|
|
+ return feeSummaryDetailExportNotList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -767,30 +986,43 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
item.setRealAmountProfitLoc(item.getRealAmountDrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
}
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
+ if (!financeProfitList.isEmpty()) {
|
|
|
+ List<Long> idList = financeProfitList.stream().map(FinanceProfitDtoList::getId).distinct().collect(Collectors.toList());
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, idList));
|
|
|
+ }
|
|
|
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));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ assignment(feeCenters, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
Map<String, BigDecimal> map = new HashMap<>();
|
|
|
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("amountDrOther", financeProfitList.stream().map(FinanceProfitDtoList::getAmountDrOther).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountDrOther", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountDrOther).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("amountCrOther", financeProfitList.stream().map(FinanceProfitDtoList::getAmountCrOther).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ map.put("realAmountCrOther", financeProfitList.stream().map(FinanceProfitDtoList::getRealAmountCrOther).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("amountProfitOther", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfitOther).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
map.put("amountProfitUsd", financeProfitList.stream().map(FinanceProfitDtoList::getAmountProfitUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
map.put("oceanFreightDr", financeProfitList.stream().map(FinanceProfitDtoList::getOceanFreightDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
map.put("oceanFreightCr", financeProfitList.stream().map(FinanceProfitDtoList::getOceanFreightCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
@@ -937,12 +1169,21 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
financeProfitList = financeProfitMapper.financeProfitListSum(financeProfit);
|
|
|
}
|
|
|
List<FinanceProfit> financeProfitDataList = new ArrayList<>();
|
|
|
+ List<FeeCenter> feeCenterList = new ArrayList<>();
|
|
|
if (!financeProfitList.isEmpty()) {
|
|
|
String mblNo = financeProfitList.stream().map(FinanceProfitDtoList::getMblNo).distinct().collect(Collectors.joining(","));
|
|
|
financeProfitDataList = financeProfitMapper.selectList(new LambdaQueryWrapper<FinanceProfit>()
|
|
|
.apply("find_in_set(mblno,'" + mblNo + "')")
|
|
|
.apply("find_in_set(business_type,'SE,SI,AE,AI')")
|
|
|
);
|
|
|
+ List<Long> idList = financeProfitList.stream().map(FinanceProfitDtoList::getId).distinct().collect(Collectors.toList());
|
|
|
+ if (!financeProfitDataList.isEmpty()) {
|
|
|
+ idList.addAll(financeProfitDataList.stream().map(FinanceProfit::getId).distinct().collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ feeCenterList = feeCenterMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .in(FeeCenter::getPid, idList));
|
|
|
}
|
|
|
for (FinanceProfitDtoList item : financeProfitList) {
|
|
|
if (("SEA".equals(item.getBusinessType()) || "SIA".equals(item.getBusinessType())
|
|
|
@@ -955,27 +1196,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
item.setLineCnName(profit.getLineCnName());
|
|
|
}
|
|
|
}
|
|
|
- //利润
|
|
|
- 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.setAmountProfitHkd(item.getAmountDrHkd().subtract(item.getAmountCrHkd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountProfitVnd(item.getAmountDrVnd().subtract(item.getAmountCrVnd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setAmountProfitSgd(item.getAmountDrSgd().subtract(item.getAmountCrSgd()).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.setNotReceivedDrHkd(item.getAmountDrHkd().subtract(item.getRealAmountDrHkd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedDrVnd(item.getAmountDrVnd().subtract(item.getRealAmountDrVnd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedDrSgd(item.getAmountDrSgd().subtract(item.getRealAmountDrSgd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedLoc(item.getAmountDrLoc().subtract(item.getRealAmountDrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- //未付
|
|
|
- item.setNotReceivedCr(item.getAmountCr().subtract(item.getRealAmountCr()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedCrUsd(item.getAmountCrUsd().subtract(item.getRealAmountCrUsd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedCrHkd(item.getAmountCrHkd().subtract(item.getRealAmountCrHkd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedCrVnd(item.getAmountCrVnd().subtract(item.getRealAmountCrVnd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedCrSgd(item.getAmountCrSgd().subtract(item.getRealAmountCrSgd()).setScale(2, RoundingMode.HALF_UP));
|
|
|
- item.setNotReceivedCrLoc(item.getAmountCrLoc().subtract(item.getRealAmountCrLoc()).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ if (!feeCenterList.isEmpty()) {
|
|
|
+ List<FeeCenter> feeCenters = feeCenterList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
|
|
|
+ if (!feeCenters.isEmpty()) {
|
|
|
+ assignment(feeCenters, item);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return financeProfitList;
|
|
|
}
|