|
|
@@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.common.enums.CommonEnum;
|
|
|
-import org.springblade.common.utils.NumToWords;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.BeanUtil;
|
|
|
@@ -79,7 +78,6 @@ import org.springblade.system.user.feign.IUserClient;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.BigInteger;
|
|
|
@@ -3585,7 +3583,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
bills.setAmountProfitLoc(bills.getAmountProfit().add(bills.getAmountProfitUsd().multiply(bills.getRate())));
|
|
|
BigDecimal dAll = bills.getAmountDr().add(bills.getAmountDrUsd().multiply(bills.getRate()));
|
|
|
bills.setGrossMargin(bills.getAmountProfitLoc().compareTo(BigDecimal.ZERO) == 0 || dAll.compareTo(BigDecimal.ZERO) == 0 ?
|
|
|
- BigDecimal.ZERO: bills.getAmountProfitLoc().divide(dAll, 4, RoundingMode.HALF_UP));
|
|
|
+ BigDecimal.ZERO : bills.getAmountProfitLoc().divide(dAll, 4, RoundingMode.HALF_UP));
|
|
|
BigDecimal sumProfitUSD = sumUSDDr.subtract(sumUSDCr).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal sumProfitCNY = sumCNYDr.subtract(sumCNYCr).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
BigDecimal sumProfitLoc = sumLocDr.subtract(sumLocCr).setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
@@ -3675,7 +3673,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
}
|
|
|
}
|
|
|
map.put(MagicValues.DATA, list);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
map.put(MagicValues.DATA, null);
|
|
|
}
|
|
|
} else {
|
|
|
@@ -6030,26 +6028,26 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
feeCenterReports1.setDc(fee.getDc());
|
|
|
feeCenterReports1.setBillCorpCnName(fee.getBillCorpCnName());
|
|
|
List<FeeCenterReports> feeCenterD = feeCenterReportsD.stream().filter(e -> e.getFeeCnName().equals(fee.getFeeCnName())
|
|
|
- && fee.getBillCorpCnName().equals(e.getBillCorpCnName())).collect(Collectors.toList());
|
|
|
+ && fee.getBillCorpCnName().equals(e.getBillCorpCnName())).collect(Collectors.toList());
|
|
|
if (!feeCenterD.isEmpty()) {
|
|
|
- feeCenterReports1.setAmountD(feeCenterD.stream().map(FeeCenterReports::getAmountD).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
- feeCenterReports1.setAmountLocD(feeCenterD.stream().map(FeeCenterReports::getAmountLocD).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
- feeCenterReports1.setAmountUsdD(feeCenterD.stream().map(FeeCenterReports::getAmountUsdD).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountD(feeCenterD.stream().map(FeeCenterReports::getAmountD).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountLocD(feeCenterD.stream().map(FeeCenterReports::getAmountLocD).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountUsdD(feeCenterD.stream().map(FeeCenterReports::getAmountUsdD).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
amountDr = amountDr.add(feeCenterReports1.getAmountD());
|
|
|
amountDrUsd = amountDrUsd.add(feeCenterReports1.getAmountUsdD());
|
|
|
}
|
|
|
List<FeeCenterReports> feeCenterC = feeCenterReportsC.stream().filter(e -> e.getFeeCnName().equals(fee.getFeeCnName())
|
|
|
- && !"1".equals(e.getMark())).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
|
|
|
- Comparator.comparing(f -> f.getFeeCnName() + f.getBillCorpCnName()))), ArrayList::new));
|
|
|
- if (!feeCenterC.isEmpty()){
|
|
|
- for (FeeCenterReports itemC : feeCenterC){
|
|
|
+ && !"1".equals(e.getMark())).collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
|
|
|
+ Comparator.comparing(f -> f.getFeeCnName() + f.getBillCorpCnName()))), ArrayList::new));
|
|
|
+ if (!feeCenterC.isEmpty()) {
|
|
|
+ for (FeeCenterReports itemC : feeCenterC) {
|
|
|
itemC.setMark("1");
|
|
|
countC++;
|
|
|
}
|
|
|
feeCenterReports1.setCorpCnName(feeCenterC.get(0).getCorpCnName());
|
|
|
- feeCenterReports1.setAmountC(feeCenterC.stream().map(FeeCenterReports::getAmountC).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
- feeCenterReports1.setAmountLocC(feeCenterC.stream().map(FeeCenterReports::getAmountLocC).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
- feeCenterReports1.setAmountUsdC(feeCenterC.stream().map(FeeCenterReports::getAmountUsdC).filter(Objects::nonNull).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountC(feeCenterC.stream().map(FeeCenterReports::getAmountC).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountLocC(feeCenterC.stream().map(FeeCenterReports::getAmountLocC).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+ feeCenterReports1.setAmountUsdC(feeCenterC.stream().map(FeeCenterReports::getAmountUsdC).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
}
|
|
|
/*if (feeCenterC != null) {
|
|
|
feeCenterC.setMark("1");
|
|
|
@@ -6061,7 +6059,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
}*/
|
|
|
feeCenterReports.add(feeCenterReports1);
|
|
|
}
|
|
|
- if (!feeCenterReportsNewC.isEmpty()){
|
|
|
+ if (!feeCenterReportsNewC.isEmpty()) {
|
|
|
feeCenterReports.addAll(feeCenterReportsNewC);
|
|
|
}
|
|
|
// 如果存在未对应的应付,添加应付费用
|
|
|
@@ -6090,40 +6088,52 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
|
|
|
BigDecimal amountDrCny = ibCurrencyService.converterCny(MagicValues.USD, amountDrUsd, MagicValues.D, "1");
|
|
|
BigDecimal amountCrCny = ibCurrencyService.converterCny(MagicValues.USD, amountCrUsd, MagicValues.C, "1");
|
|
|
item.setAmountProfitLoc(amountDr.subtract(amountCr).add(amountDrCny.subtract(amountCrCny)));
|
|
|
- List<FeeCenterReports> feeCenterReportsArrayList = feeCenterReportsList1.stream()
|
|
|
+ List<FeeCenterReports> feeCenterReportsArrayListC = feeCenterReportsList1.stream()
|
|
|
+ .filter(e -> "C".equals(e.getDc()))
|
|
|
+ .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
|
|
|
+ Comparator.comparing(f -> f.getFeeCnName() + f.getCorpCnName()))), ArrayList::new));
|
|
|
+ List<FeeCenterReports> feeCenterReportsArrayListD = feeCenterReportsList1.stream()
|
|
|
+ .filter(e -> "D".equals(e.getDc()))
|
|
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
|
|
|
- Comparator.comparing(f -> f.getFeeCnName() + f.getBillCorpCnName() + f.getDc()))), ArrayList::new));
|
|
|
- for (FeeCenterReports fee : feeCenterReportsArrayList) {
|
|
|
- FeeCenterReports feeReports = fee;
|
|
|
+ Comparator.comparing(f -> f.getFeeCnName() + f.getBillCorpCnName()))), ArrayList::new));
|
|
|
+ for (FeeCenterReports fee : feeCenterReportsArrayListD) {
|
|
|
FeeCenterReports feeCenterReports1 = new FeeCenterReports();
|
|
|
feeCenterReports1.setFeeCnName(fee.getFeeCnName());
|
|
|
feeCenterReports1.setHblno(fee.getHblno());
|
|
|
feeCenterReports1.setPid(fee.getPid());
|
|
|
feeCenterReports1.setReportType(fee.getReportType());
|
|
|
feeCenterReports1.setDc(fee.getDc());
|
|
|
- if (feeReports != null) {
|
|
|
- if("D".equals(feeReports.getDc())){
|
|
|
- if ((ObjectUtils.isNotNull(feeReports.getAmountD()) && feeReports.getAmountD().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
- || (ObjectUtils.isNotNull(feeReports.getAmountUsdD()) && feeReports.getAmountUsdD().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
- ) {
|
|
|
- feeCenterReports1.setBillCorpCnName(feeReports.getBillCorpCnName());
|
|
|
- feeCenterReports1.setAmountD(feeReports.getAmountD());
|
|
|
- feeCenterReports1.setAmountLocD(feeReports.getAmountLocD());
|
|
|
- feeCenterReports1.setAmountUsdD(feeReports.getAmountUsdD());
|
|
|
- amountDr = amountDr.add(ObjectUtils.isNotNull(feeReports.getAmountD()) ? feeReports.getAmountD() : new BigDecimal("0.00"));
|
|
|
- amountDrUsd = amountDrUsd.add(ObjectUtils.isNotNull(feeReports.getAmountUsdD()) ? feeReports.getAmountUsdD() : new BigDecimal("0.00"));
|
|
|
- }
|
|
|
- }else{
|
|
|
- if ((ObjectUtils.isNotNull(feeReports.getAmountC()) && feeReports.getAmountC().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
- || (ObjectUtils.isNotNull(feeReports.getAmountUsdC()) && feeReports.getAmountUsdC().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
- ) {
|
|
|
- feeCenterReports1.setCorpCnName(feeReports.getCorpCnName());
|
|
|
- feeCenterReports1.setAmountC(feeReports.getAmountC());
|
|
|
- feeCenterReports1.setAmountLocC(feeReports.getAmountLocC());
|
|
|
- feeCenterReports1.setAmountUsdC(feeReports.getAmountUsdC());
|
|
|
- amountCr = amountCr.add(ObjectUtils.isNotNull(feeReports.getAmountC()) ? feeReports.getAmountC() : new BigDecimal("0.00"));
|
|
|
- amountCrUsd = amountCrUsd.add(ObjectUtils.isNotNull(feeReports.getAmountUsdC()) ? feeReports.getAmountUsdC() : new BigDecimal("0.00"));
|
|
|
- }
|
|
|
+ if (fee != null) {
|
|
|
+ if ((ObjectUtils.isNotNull(fee.getAmountD()) && fee.getAmountD().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
+ || (ObjectUtils.isNotNull(fee.getAmountUsdD()) && fee.getAmountUsdD().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
+ ) {
|
|
|
+ feeCenterReports1.setBillCorpCnName(fee.getBillCorpCnName());
|
|
|
+ feeCenterReports1.setAmountD(fee.getAmountD());
|
|
|
+ feeCenterReports1.setAmountLocD(fee.getAmountLocD());
|
|
|
+ feeCenterReports1.setAmountUsdD(fee.getAmountUsdD());
|
|
|
+ amountDr = amountDr.add(ObjectUtils.isNotNull(fee.getAmountD()) ? fee.getAmountD() : new BigDecimal("0.00"));
|
|
|
+ amountDrUsd = amountDrUsd.add(ObjectUtils.isNotNull(fee.getAmountUsdD()) ? fee.getAmountUsdD() : new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ feeCenterReports.add(feeCenterReports1);
|
|
|
+ }
|
|
|
+ for (FeeCenterReports fee : feeCenterReportsArrayListC) {
|
|
|
+ FeeCenterReports feeCenterReports1 = new FeeCenterReports();
|
|
|
+ feeCenterReports1.setFeeCnName(fee.getFeeCnName());
|
|
|
+ feeCenterReports1.setHblno(fee.getHblno());
|
|
|
+ feeCenterReports1.setPid(fee.getPid());
|
|
|
+ feeCenterReports1.setReportType(fee.getReportType());
|
|
|
+ feeCenterReports1.setDc(fee.getDc());
|
|
|
+ if (fee != null) {
|
|
|
+ if ((ObjectUtils.isNotNull(fee.getAmountC()) && fee.getAmountC().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
+ || (ObjectUtils.isNotNull(fee.getAmountUsdC()) && fee.getAmountUsdC().compareTo(new BigDecimal("0.00")) != 0)
|
|
|
+ ) {
|
|
|
+ feeCenterReports1.setCorpCnName(fee.getCorpCnName());
|
|
|
+ feeCenterReports1.setAmountC(fee.getAmountC());
|
|
|
+ feeCenterReports1.setAmountLocC(fee.getAmountLocC());
|
|
|
+ feeCenterReports1.setAmountUsdC(fee.getAmountUsdC());
|
|
|
+ amountCr = amountCr.add(ObjectUtils.isNotNull(fee.getAmountC()) ? fee.getAmountC() : new BigDecimal("0.00"));
|
|
|
+ amountCrUsd = amountCrUsd.add(ObjectUtils.isNotNull(fee.getAmountUsdC()) ? fee.getAmountUsdC() : new BigDecimal("0.00"));
|
|
|
}
|
|
|
}
|
|
|
feeCenterReports.add(feeCenterReports1);
|