|
|
@@ -220,8 +220,180 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
.eq(BCorps::getIsDeleted, 0)
|
|
|
.in(BCorps::getId, idList));
|
|
|
}
|
|
|
+ List<FeesTemplateSonItems> sonItemsList = feesTemplateSonItemsService.list(new LambdaQueryWrapper<FeesTemplateSonItems>()
|
|
|
+ .eq(FeesTemplateSonItems::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(FeesTemplateSonItems::getIsDeleted, 0)
|
|
|
+ .in(FeesTemplateSonItems::getPpid, losBFeesTemplate.getFeesTemplateItemsList().stream().map(FeesTemplateItems::getId).collect(Collectors.toList()))
|
|
|
+ .eq(ObjectUtils.isNotNull(losBFeesTemplate.getDc()), FeesTemplateSonItems::getDc, losBFeesTemplate.getDc()));
|
|
|
+ if (sonItemsList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到模板明细");
|
|
|
+ }
|
|
|
int count = 1;
|
|
|
- for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
|
|
|
+ for (FeesTemplateSonItems items : sonItemsList) {
|
|
|
+ FeesTemplateItems templateItems = losBFeesTemplate.getFeesTemplateItemsList().stream().filter(e -> e.getId().equals(items.getPpid()))
|
|
|
+ .findFirst().orElse(null);
|
|
|
+ if (templateItems == null) {
|
|
|
+ throw new RuntimeException("模版数据错误,请联系管理员");
|
|
|
+ }
|
|
|
+ FeeCenter feeCenter = new FeeCenter();
|
|
|
+ feeCenter.setPid(bills.getId());
|
|
|
+ feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
|
|
|
+ feeCenter.setBillNo(bills.getBillNo());
|
|
|
+ feeCenter.setBusinessType(bills.getBusinessType());
|
|
|
+ feeCenter.setBillType(bills.getBillType());
|
|
|
+ feeCenter.setBillDate(bills.getBillDate());
|
|
|
+ feeCenter.setBillCorpId(bills.getCorpId());
|
|
|
+ feeCenter.setBillCorpCnName(bills.getCorpCnName());
|
|
|
+ feeCenter.setBillCorpEnName(bills.getCorpEnName());
|
|
|
+ feeCenter.setBillShortName(bills.getCorpCnName());
|
|
|
+ feeCenter.setLineId(bills.getLineId());
|
|
|
+ feeCenter.setLineCnName(bills.getLineCnName());
|
|
|
+ feeCenter.setLineEnName(bills.getLineEnName());
|
|
|
+ feeCenter.setVesselId(bills.getVesselId());
|
|
|
+ feeCenter.setVesselCnName(bills.getVesselCnName());
|
|
|
+ feeCenter.setVesselEnName(bills.getVesselEnName());
|
|
|
+ feeCenter.setVoyageNo(bills.getVoyageNo());
|
|
|
+ feeCenter.setMblno(bills.getMblno());
|
|
|
+ feeCenter.setHblno(bills.getHblno());
|
|
|
+ feeCenter.setEtd(bills.getEtd());
|
|
|
+ feeCenter.setEta(bills.getEta());
|
|
|
+ feeCenter.setPolId(bills.getPolId());
|
|
|
+ feeCenter.setPolCode(bills.getPolCode());
|
|
|
+ feeCenter.setPolCnName(bills.getPolCnName());
|
|
|
+ feeCenter.setPolEnName(bills.getPolEnName());
|
|
|
+ feeCenter.setPodId(bills.getPodId());
|
|
|
+ feeCenter.setPodCode(bills.getPodCode());
|
|
|
+ feeCenter.setPodCnName(bills.getPodCnName());
|
|
|
+ feeCenter.setPodEnName(bills.getPodEnName());
|
|
|
+ feeCenter.setDc(items.getDc());
|
|
|
+ feeCenter.setPaymode(bills.getMpaymode());
|
|
|
+ feeCenter.setSort(count);
|
|
|
+ feeCenter.setCorpType(templateItems.getCorpType());
|
|
|
+ count++;
|
|
|
+ if ("国内直接客户,国外直接客户,国内同行及代理".contains(templateItems.getCorpType())) {
|
|
|
+ feeCenter.setCorpId(bills.getCorpId());
|
|
|
+ feeCenter.setCorpCnName(bills.getShortName());
|
|
|
+ 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());
|
|
|
+ } else if ("船公司".contains(templateItems.getCorpType())) {
|
|
|
+ feeCenter.setCorpId(bills.getCarrierId());
|
|
|
+ feeCenter.setCorpCnName(bills.getCarrierShortName());
|
|
|
+ feeCenter.setCorpEnName(bills.getCarrierEnName());
|
|
|
+ feeCenter.setShortName(bills.getCarrierShortName());
|
|
|
+ } else if ("场站".contains(templateItems.getCorpType())) {
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getCyId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ feeCenter.setCorpId(bills.getCyId());
|
|
|
+ feeCenter.setCorpCnName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
|
|
|
+ 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());
|
|
|
+ } else {
|
|
|
+ BCorps bCorps = null;
|
|
|
+ if (!corpsList.isEmpty()) {
|
|
|
+ bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
+ }
|
|
|
+ feeCenter.setCorpId(items.getCorpId());
|
|
|
+ feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
|
|
|
+ feeCenter.setCorpEnName(items.getCorpEnName());
|
|
|
+ feeCenter.setShortName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
|
|
|
+ }
|
|
|
+ feeCenter.setFeeId(items.getFeeId());
|
|
|
+ feeCenter.setFeeCode(items.getFeeCode());
|
|
|
+ feeCenter.setFeeCnName(items.getFeeCnName());
|
|
|
+ feeCenter.setFeeEnName(items.getFeeEnName());
|
|
|
+ feeCenter.setUnitNo(items.getUnitNo());
|
|
|
+ feeCenter.setPrice(items.getSalesPrice());
|
|
|
+ feeCenter.setCurCode(items.getCurCode());
|
|
|
+ if (exrateType.equals(items.getCurCode())) {
|
|
|
+ feeCenter.setExrate(new BigDecimal("1.00"));
|
|
|
+ } else {
|
|
|
+ feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
|
|
|
+ }
|
|
|
+ if ("按箱型".equals(items.getQuantityRule())) {
|
|
|
+ if (preContainers.isEmpty()) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("集装箱数量为零!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("按票".equals(items.getQuantityRule())) {
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(new BigDecimal("1")));
|
|
|
+ } else if ("按重量".equals(items.getQuantityRule())) {
|
|
|
+ feeCenter.setQuantity(bills.getGrossWeight());
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("按TEU".equals(items.getQuantityRule())) {
|
|
|
+ if (preContainers.isEmpty()) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ BigDecimal quantityTeu = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantityGP = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity = quantityTeu.multiply(new BigDecimal(quantityGP + ""));
|
|
|
+ if (quantity.compareTo(new BigDecimal("0")) == 0) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("集装箱teu或数量为零!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("按箱量".equals(items.getQuantityRule())) {
|
|
|
+ if (preContainers.isEmpty()) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Integer quantityGP = preContainers.stream().map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity = new BigDecimal(quantityGP + "");
|
|
|
+ if (quantity.compareTo(new BigDecimal("0")) == 0) {
|
|
|
+ text.append("费用:").append(items.getFeeCnName()).append("集装箱箱量为零!");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("按尺码".equals(items.getQuantityRule())) {
|
|
|
+ feeCenter.setQuantity(bills.getMeasurement());
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else {
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
+ feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNull(feeCenter.getAmount())) {
|
|
|
+ feeCenter.setAmount(new BigDecimal("0"));
|
|
|
+ }
|
|
|
+ if (exrateType.equals(feeCenter.getCurCode())) {
|
|
|
+ feeCenter.setAmountLoc(feeCenter.getAmount());
|
|
|
+ } else {
|
|
|
+ if (new BigDecimal("0").compareTo(feeCenter.getAmount()) != 0) {
|
|
|
+ feeCenter.setAmountLoc(feeCenter.getAmount().multiply(feeCenter.getExrate()));
|
|
|
+ } else {
|
|
|
+ feeCenter.setAmountLoc(new BigDecimal("0"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(feeCenter);
|
|
|
+ }
|
|
|
+ /*for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
|
|
|
FeeCenter feeCenter = new FeeCenter();
|
|
|
feeCenter.setPid(bills.getId());
|
|
|
feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
|
|
|
@@ -267,7 +439,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
- }else if ("船公司".contains(items.getCorpType())) {
|
|
|
+ } else if ("船公司".contains(items.getCorpType())) {
|
|
|
feeCenter.setCorpId(bills.getCarrierId());
|
|
|
feeCenter.setCorpCnName(bills.getCarrierShortName());
|
|
|
feeCenter.setCorpEnName(bills.getCarrierEnName());
|
|
|
@@ -286,7 +458,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
BCorps bCorps = null;
|
|
|
if (!corpsList.isEmpty()) {
|
|
|
bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
@@ -303,9 +475,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setUnitNo(items.getUnitNo());
|
|
|
feeCenter.setPrice(items.getPrice());
|
|
|
feeCenter.setCurCode(items.getCurCode());
|
|
|
- if (exrateType.equals(items.getCurCode())){
|
|
|
+ if (exrateType.equals(items.getCurCode())) {
|
|
|
feeCenter.setExrate(new BigDecimal("1"));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
|
|
|
}
|
|
|
if ("按箱型".equals(items.getQuantityRule())) {
|
|
|
@@ -353,7 +525,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
}
|
|
|
feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- }else if ("按尺码".equals(items.getQuantityRule())) {
|
|
|
+ } else if ("按尺码".equals(items.getQuantityRule())) {
|
|
|
feeCenter.setQuantity(bills.getMeasurement());
|
|
|
feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
} else {
|
|
|
@@ -373,7 +545,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
}
|
|
|
}
|
|
|
list.add(feeCenter);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
this.saveOrUpdateBatch(list);
|
|
|
if (ObjectUtils.isNotNull(text.toString())) {
|
|
|
@@ -1090,7 +1262,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
|
|
|
feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
|
|
|
feeCenter.setShortName(bills.getForeignAgencyCnName());
|
|
|
- }else if ("船公司".contains(templateItems.getCorpType())) {
|
|
|
+ } else if ("船公司".contains(templateItems.getCorpType())) {
|
|
|
feeCenter.setCorpId(bills.getCarrierId());
|
|
|
feeCenter.setCorpCnName(bills.getCarrierShortName());
|
|
|
feeCenter.setCorpEnName(bills.getCarrierEnName());
|
|
|
@@ -1109,7 +1281,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
feeCenter.setCorpCnName(bills.getShippingAgencyCname());
|
|
|
feeCenter.setCorpEnName(bills.getShippingAgencyEname());
|
|
|
feeCenter.setShortName(bills.getShippingAgencyCname());
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
BCorps bCorps = null;
|
|
|
if (!corpsList.isEmpty()) {
|
|
|
bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
|
|
|
@@ -1136,6 +1308,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
continue;
|
|
|
}
|
|
|
+ if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Integer quantity = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
if (quantity == 0) {
|
|
|
text.append("费用:").append(items.getFeeCnName()).append("集装箱数量为零!");
|
|
|
@@ -1154,6 +1329,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
continue;
|
|
|
}
|
|
|
+ if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
BigDecimal quantityTeu = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
Integer quantityGP = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
BigDecimal quantity = quantityTeu.multiply(new BigDecimal(quantityGP + ""));
|
|
|
@@ -1163,7 +1341,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
}
|
|
|
feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- }else if ("按箱量".equals(items.getQuantityRule())) {
|
|
|
+ } else if ("按箱量".equals(items.getQuantityRule())) {
|
|
|
if (preContainers.isEmpty()) {
|
|
|
text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
|
|
|
continue;
|