|
|
@@ -210,6 +210,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
idList.add(bills.getBookingAgentId());
|
|
|
idList.add(bills.getMconsigneeId());
|
|
|
idList.add(bills.getMnotifyId());
|
|
|
+ idList.add(bills.getForeignAgencyId());
|
|
|
+ idList.add(bills.getShippingAgencyId());
|
|
|
idList.addAll(losBFeesTemplate.getFeesTemplateItemsList().stream().map(FeesTemplateItems::getCorpId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
List<BCorps> corpsList = new ArrayList<>();
|
|
|
if (!idList.isEmpty()) {
|
|
|
@@ -294,10 +296,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpEnName(bills.getCorpEnName());
|
|
|
feeCenter.setShortName(bills.getShortName());
|
|
|
} else if ("国外同行及代理".contains(templateItems.getCorpType())) {
|
|
|
- feeCenter.setCorpId(bills.getForeignAgencyId());
|
|
|
- feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
- feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
- feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ if (bCorps == null){
|
|
|
+ feeCenter.setCorpId(bills.getForeignAgencyId());
|
|
|
+ feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
+ feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
+ feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
+ }else{
|
|
|
+ feeCenter.setCorpId(bCorps.getId());
|
|
|
+ feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ }
|
|
|
} else if ("船公司".contains(templateItems.getCorpType())) {
|
|
|
feeCenter.setCorpId(bills.getCarrierId());
|
|
|
feeCenter.setCorpCnName(bills.getCarrierShortName());
|
|
|
@@ -313,10 +326,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpEnName(bills.getCyEnName());
|
|
|
feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
|
|
|
} else if ("船代".contains(templateItems.getCorpType())) {
|
|
|
- feeCenter.setCorpId(bills.getShippingAgencyId());
|
|
|
- feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
- feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
- feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ if (bCorps == null){
|
|
|
+ feeCenter.setCorpId(bills.getShippingAgencyId());
|
|
|
+ feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
+ feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
+ feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
+ }else{
|
|
|
+ feeCenter.setCorpId(bCorps.getId());
|
|
|
+ feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ }
|
|
|
} else {
|
|
|
BCorps bCorps = null;
|
|
|
if (!corpsList.isEmpty()) {
|
|
|
@@ -1028,6 +1052,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
idList.addAll(billsList.stream().map(Bills::getBookingAgentId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
idList.addAll(billsList.stream().map(Bills::getMconsigneeId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
idList.addAll(billsList.stream().map(Bills::getMnotifyId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
+ idList.addAll(billsList.stream().map(Bills::getForeignAgencyId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
+ idList.addAll(billsList.stream().map(Bills::getShippingAgencyId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
idList.addAll(sonItemsList.stream().map(FeesTemplateSonItems::getCorpId).filter(Objects::nonNull).collect(Collectors.toList()));
|
|
|
List<BCorps> corpsList = new ArrayList<>();
|
|
|
if (!idList.isEmpty()) {
|
|
|
@@ -1154,10 +1180,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpEnName(bills.getCorpEnName());
|
|
|
feeCenter.setShortName(bills.getShortName());
|
|
|
} else if ("国外同行及代理".contains(templateItems.getCorpType())) {
|
|
|
- feeCenter.setCorpId(bills.getForeignAgencyId());
|
|
|
- feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
- feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
- feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ if (bCorps == null){
|
|
|
+ feeCenter.setCorpId(bills.getForeignAgencyId());
|
|
|
+ feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
+ feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
+ feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
+ }else{
|
|
|
+ feeCenter.setCorpId(bCorps.getId());
|
|
|
+ feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ }
|
|
|
} else if ("船公司".contains(templateItems.getCorpType())) {
|
|
|
feeCenter.setCorpId(bills.getCarrierId());
|
|
|
feeCenter.setCorpCnName(bills.getCarrierShortName());
|
|
|
@@ -1173,10 +1210,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpEnName(bills.getCyEnName());
|
|
|
feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
|
|
|
} else if ("船代".contains(templateItems.getCorpType())) {
|
|
|
- feeCenter.setCorpId(bills.getShippingAgencyId());
|
|
|
- feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
- feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
- feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ if (bCorps == null){
|
|
|
+ feeCenter.setCorpId(bills.getShippingAgencyId());
|
|
|
+ feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
+ feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
+ feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
+ }else{
|
|
|
+ feeCenter.setCorpId(bCorps.getId());
|
|
|
+ feeCenter.setCorpCnName(bCorps.getCnName());
|
|
|
+ feeCenter.setCorpEnName(bCorps.getEnName());
|
|
|
+ feeCenter.setShortName(bCorps.getShortName());
|
|
|
+ }
|
|
|
} else {
|
|
|
BCorps bCorps = null;
|
|
|
if (!corpsList.isEmpty()) {
|
|
|
@@ -1492,21 +1540,21 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenterC.setShortName(bCorps.getShortName());
|
|
|
feeCenterC.setQuantity(feeCenter.getQuantity());
|
|
|
if ("按收入".equals(agencyFeeCountWay)) {
|
|
|
- feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(agencyFee))
|
|
|
- .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ feeCenterC.setPrice(feeCenter.getPrice().subtract(feeCenter.getPrice().multiply(new BigDecimal(agencyFee))
|
|
|
+ .divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP)));
|
|
|
} else {
|
|
|
- feeCenterC.setPrice(feeCenterC.getPrice().subtract(new BigDecimal(agencyFee).multiply(feeCenterC.getQuantity()))
|
|
|
+ feeCenterC.setPrice(feeCenter.getPrice().subtract(new BigDecimal(agencyFee).multiply(feeCenterC.getQuantity()))
|
|
|
.setScale(2, RoundingMode.HALF_UP));
|
|
|
}
|
|
|
feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
|
|
|
- feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
|
|
|
+ feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenterC.getExrate()));
|
|
|
feeCentersFdC.add(feeCenterC);
|
|
|
feeCenterSum.add(feeCenterC);
|
|
|
}
|
|
|
}
|
|
|
if (!feeCenterSum.isEmpty()) {
|
|
|
this.updateBills(feeCenterSum, item, exrateType);
|
|
|
- BigDecimal amount = feeCenterSum.stream().map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal amount = feeCenterSum.stream().map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
FeeCenter feeCenterD = new FeeCenter();
|
|
|
feeCenterD.setBranchId(bills.getBranchId());
|
|
|
feeCenterD.setBranchName(bills.getBranchName());
|
|
|
@@ -1545,9 +1593,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenterD.setFeeCode(fees.getCode());
|
|
|
feeCenterD.setFeeCnName(fees.getCnName());
|
|
|
feeCenterD.setFeeEnName(fees.getEnName());
|
|
|
- feeCenterD.setUnitNo(fees.getUnitNo());
|
|
|
- feeCenterD.setCurCode(exrateType);
|
|
|
- feeCenterD.setExrate(new BigDecimal("1"));
|
|
|
+ feeCenterD.setUnitNo("JOB");
|
|
|
+ feeCenterD.setCurCode(feeCenterSum.get(0).getCurCode());
|
|
|
+ feeCenterD.setExrate(feeCenterSum.get(0).getExrate());
|
|
|
feeCenterD.setDc("D");
|
|
|
feeCenterD.setCorpType("国内直接客户");
|
|
|
BCorps corps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
|
|
|
@@ -1564,7 +1612,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenterD.setQuantity(new BigDecimal("1"));
|
|
|
feeCenterD.setPrice(amount);
|
|
|
feeCenterD.setAmount(amount);
|
|
|
- feeCenterD.setAmountLoc(amount);
|
|
|
+ feeCenterD.setAmountLoc(amount.multiply(feeCenterD.getExrate()));
|
|
|
list.add(feeCenterD);
|
|
|
list1.add(feeCenterD);
|
|
|
}
|
|
|
@@ -1672,6 +1720,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
bills.setAccountStatus(1);
|
|
|
} else if (0 == statusD && 1 == statusC) {
|
|
|
bills.setAccountStatus(2);
|
|
|
+ }else{
|
|
|
+ bills.setAccountStatus(3);
|
|
|
}
|
|
|
BigDecimal amountDr;
|
|
|
BigDecimal amountCr;
|
|
|
@@ -2104,7 +2154,11 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setAmountLoc(new BigDecimal("0"));
|
|
|
}
|
|
|
}
|
|
|
- return feeCenter;
|
|
|
+ if (new BigDecimal("0.00").compareTo(feeCenter.getAmount()) == 0){
|
|
|
+ return null;
|
|
|
+ }else{
|
|
|
+ return feeCenter;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|