|
|
@@ -31,6 +31,8 @@ import org.springblade.los.basic.cur.entity.BCurrency;
|
|
|
import org.springblade.los.basic.cur.service.IBCurrencyService;
|
|
|
import org.springblade.los.basic.fees.entity.FeesTemplateItems;
|
|
|
import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
|
|
|
+import org.springblade.los.business.aea.entity.AeaBills;
|
|
|
+import org.springblade.los.business.aea.mapper.AeaBillsMapper;
|
|
|
import org.springblade.los.business.amends.entity.Amends;
|
|
|
import org.springblade.los.business.amends.mapper.AmendsMapper;
|
|
|
import org.springblade.los.business.sea.entity.Bills;
|
|
|
@@ -69,6 +71,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
|
|
|
private final BillsMapper billsMapper;
|
|
|
|
|
|
+ private final AeaBillsMapper aeaBillsMapper;
|
|
|
+
|
|
|
private final AmendsMapper amendsMapper;
|
|
|
|
|
|
private final IBCurrencyService bCurrencyService;
|
|
|
@@ -171,181 +175,268 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
|
|
|
@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
|
|
|
public R<List<FeeCenter>> templateImport(LosBFeesTemplate losBFeesTemplate) {
|
|
|
List<FeeCenter> list = new ArrayList<>();
|
|
|
- Bills bills = billsMapper.selectById(losBFeesTemplate.getBillNoId());
|
|
|
- if (bills == null) {
|
|
|
- throw new RuntimeException("未找到主表信息");
|
|
|
- }
|
|
|
- List<PreContainers> preContainers = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
- .eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PreContainers::getIsDeleted, 0)
|
|
|
- .eq(PreContainers::getPid, bills.getId()));
|
|
|
- if (losBFeesTemplate.getFeesTemplateItemsList().size() > 0) {
|
|
|
- int count = 1;
|
|
|
- for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
|
|
|
- FeeCenter feeCenter = new FeeCenter();
|
|
|
-
|
|
|
- feeCenter.setElementsCnName(items.getElementsCnName());
|
|
|
- feeCenter.setElementsEnName(items.getElementsEnName());
|
|
|
- feeCenter.setElementsId(items.getElementsId());
|
|
|
- feeCenter.setElementsCode(items.getElementsCode());
|
|
|
-
|
|
|
- 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.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(losBFeesTemplate.getDc());
|
|
|
- feeCenter.setPaymode(bills.getMpaymode());
|
|
|
- feeCenter.setSort(count);
|
|
|
- count++;
|
|
|
- feeCenter.setCorpId(items.getCorpId());
|
|
|
- feeCenter.setCorpCnName(items.getCorpCnName());
|
|
|
- feeCenter.setCorpEnName(items.getCorpEnName());
|
|
|
- feeCenter.setFeeId(items.getFeeId());
|
|
|
- feeCenter.setFeeCode(items.getFeeCode());
|
|
|
- feeCenter.setFeeCnName(items.getFeeCnName());
|
|
|
- feeCenter.setFeeEnName(items.getFeeEnName());
|
|
|
- feeCenter.setUnitNo(items.getUnitNo());
|
|
|
- feeCenter.setPrice(items.getPrice());
|
|
|
- feeCenter.setCurCode(items.getCurCode());
|
|
|
- if (ObjectUtils.isNotNull(feeCenter.getCurCode())) {
|
|
|
- BCurrency bCurrency = new BCurrency();
|
|
|
- bCurrency.setDate(bills.getEtd());
|
|
|
- bCurrency.setDc(losBFeesTemplate.getDc());
|
|
|
- List<BCurrency> bCurrencyList = bCurrencyService.getExrate(bCurrency);
|
|
|
- if (bCurrencyList.size() > 0) {
|
|
|
- BCurrency currency = bCurrencyList.stream().filter(e -> e.getCode().equals(feeCenter.getCurCode())).findFirst().orElse(null);
|
|
|
- if (currency != null) {
|
|
|
- feeCenter.setExrate(currency.getExrate());
|
|
|
- } else {
|
|
|
- throw new RuntimeException("未找到汇率信息");
|
|
|
+ if ("HYCK".equals(losBFeesTemplate.getType()) || "HYJK".equals(losBFeesTemplate.getType())){
|
|
|
+ Bills bills = billsMapper.selectById(losBFeesTemplate.getBillNoId());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未找到主表信息");
|
|
|
+ }
|
|
|
+ List<PreContainers> preContainers = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ .eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .eq(PreContainers::getIsDeleted, 0)
|
|
|
+ .eq(PreContainers::getPid, bills.getId()));
|
|
|
+ if (losBFeesTemplate.getFeesTemplateItemsList().size() > 0) {
|
|
|
+ int count = 1;
|
|
|
+ for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
|
|
|
+ FeeCenter feeCenter = new FeeCenter();
|
|
|
+
|
|
|
+ feeCenter.setElementsCnName(items.getElementsCnName());
|
|
|
+ feeCenter.setElementsEnName(items.getElementsEnName());
|
|
|
+ feeCenter.setElementsId(items.getElementsId());
|
|
|
+ feeCenter.setElementsCode(items.getElementsCode());
|
|
|
+
|
|
|
+ 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.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(losBFeesTemplate.getDc());
|
|
|
+ feeCenter.setPaymode(bills.getMpaymode());
|
|
|
+ feeCenter.setSort(count);
|
|
|
+ count++;
|
|
|
+ feeCenter.setCorpId(items.getCorpId());
|
|
|
+ feeCenter.setCorpCnName(items.getCorpCnName());
|
|
|
+ feeCenter.setCorpEnName(items.getCorpEnName());
|
|
|
+ feeCenter.setFeeId(items.getFeeId());
|
|
|
+ feeCenter.setFeeCode(items.getFeeCode());
|
|
|
+ feeCenter.setFeeCnName(items.getFeeCnName());
|
|
|
+ feeCenter.setFeeEnName(items.getFeeEnName());
|
|
|
+ feeCenter.setUnitNo(items.getUnitNo());
|
|
|
+ feeCenter.setPrice(items.getPrice());
|
|
|
+ feeCenter.setCurCode(items.getCurCode());
|
|
|
+ if (ObjectUtils.isNotNull(feeCenter.getCurCode())) {
|
|
|
+ BCurrency bCurrency = new BCurrency();
|
|
|
+ bCurrency.setDate(bills.getEtd());
|
|
|
+ bCurrency.setDc(losBFeesTemplate.getDc());
|
|
|
+ List<BCurrency> bCurrencyList = bCurrencyService.getExrate(bCurrency);
|
|
|
+ if (bCurrencyList.size() > 0) {
|
|
|
+ BCurrency currency = bCurrencyList.stream().filter(e -> e.getCode().equals(feeCenter.getCurCode())).findFirst().orElse(null);
|
|
|
+ if (currency != null) {
|
|
|
+ feeCenter.setExrate(currency.getExrate());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未找到汇率信息");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if ("1".equals(items.getQuantityRule())) {
|
|
|
- if (preContainers.size() == 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if ("20GP".equals(items.getUnitNo())) {
|
|
|
- Integer quantity = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
- if (quantity == 0) {
|
|
|
+ if ("1".equals(items.getQuantityRule())) {
|
|
|
+ if (preContainers.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- } else if ("40GP".equals(items.getUnitNo())) {
|
|
|
- Integer quantity = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
- if (quantity == 0) {
|
|
|
+ if ("20GP".equals(items.getUnitNo())) {
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("40GP".equals(items.getUnitNo())) {
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("40HC".equals(items.getUnitNo())) {
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("45GP".equals(items.getUnitNo())) {
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ } else if ("48GP".equals(items.getUnitNo())) {
|
|
|
+ Integer quantity = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
+ if (quantity == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ }
|
|
|
+ } else if ("2".equals(items.getQuantityRule())) {
|
|
|
+ if ("JOB".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
|
|
|
+ } else {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- } else if ("40HC".equals(items.getUnitNo())) {
|
|
|
- Integer quantity = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
- if (quantity == 0) {
|
|
|
+ } else if ("3".equals(items.getQuantityRule())) {
|
|
|
+ if ("KGS".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(bills.getGrossWeight());
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(bills.getGrossWeight()));
|
|
|
+ } else {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- } else if ("45GP".equals(items.getUnitNo())) {
|
|
|
- Integer quantity = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
- if (quantity == 0) {
|
|
|
+ } else if ("4".equals(items.getQuantityRule())) {
|
|
|
+ if (preContainers.size() == 0) {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- } else if ("48GP".equals(items.getUnitNo())) {
|
|
|
- Integer quantity = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
|
|
|
- if (quantity == 0) {
|
|
|
+ if ("TEU".equals(items.getUnitNo())) {
|
|
|
+ BigDecimal quantity20GPTeu = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantity20GP = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity20GPSum = quantity20GPTeu.multiply(new BigDecimal(quantity20GP + ""));
|
|
|
+
|
|
|
+ BigDecimal quantity40GPTeu = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantity40GP = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity40GPSum = quantity40GPTeu.multiply(new BigDecimal(quantity40GP + ""));
|
|
|
+
|
|
|
+ BigDecimal quantity40HCTeu = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantity40HC = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity40HCSum = quantity40HCTeu.multiply(new BigDecimal(quantity40HC + ""));
|
|
|
+
|
|
|
+ BigDecimal quantity45GPTeu = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantity45GP = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity45GPSum = quantity45GPTeu.multiply(new BigDecimal(quantity45GP + ""));
|
|
|
+
|
|
|
+ BigDecimal quantity48GPTeu = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ Integer quantity48GP = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
+ BigDecimal quantity48GPSum = quantity48GPTeu.multiply(new BigDecimal(quantity48GP + ""));
|
|
|
+
|
|
|
+ BigDecimal quantity = quantity20GPSum.add(quantity40GPSum).add(quantity40HCSum).add(quantity45GPSum).add(quantity48GPSum);
|
|
|
+ if (quantity.compareTo(new BigDecimal("0")) == 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
+ }
|
|
|
+ } else if ("5".equals(items.getQuantityRule())) {
|
|
|
+ if ("CBM".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(bills.getMeasurement());
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(bills.getMeasurement()));
|
|
|
+ } else {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- }
|
|
|
- } else if ("2".equals(items.getQuantityRule())) {
|
|
|
- if ("JOB".equals(items.getUnitNo())) {
|
|
|
+ } else {
|
|
|
feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
|
|
|
- } else {
|
|
|
- continue;
|
|
|
}
|
|
|
- } else if ("3".equals(items.getQuantityRule())) {
|
|
|
- if ("KGS".equals(items.getUnitNo())) {
|
|
|
- feeCenter.setQuantity(bills.getGrossWeight());
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(bills.getGrossWeight()));
|
|
|
- } else {
|
|
|
- continue;
|
|
|
- }
|
|
|
- } else if ("4".equals(items.getQuantityRule())) {
|
|
|
- if (preContainers.size() == 0) {
|
|
|
- continue;
|
|
|
+ list.add(feeCenter);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.saveOrUpdateBatch(list);
|
|
|
+ }else if ("KYCK".equals(losBFeesTemplate.getType()) || "KYJK".equals(losBFeesTemplate.getType())){
|
|
|
+ AeaBills bills = aeaBillsMapper.selectById(losBFeesTemplate.getBillNoId());
|
|
|
+ if (bills == null) {
|
|
|
+ throw new RuntimeException("未找到主表信息");
|
|
|
+ }
|
|
|
+ if (losBFeesTemplate.getFeesTemplateItemsList().size() > 0) {
|
|
|
+ int count = 1;
|
|
|
+ for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
|
|
|
+ FeeCenter feeCenter = new FeeCenter();
|
|
|
+
|
|
|
+ feeCenter.setElementsCnName(items.getElementsCnName());
|
|
|
+ feeCenter.setElementsEnName(items.getElementsEnName());
|
|
|
+ feeCenter.setElementsId(items.getElementsId());
|
|
|
+ feeCenter.setElementsCode(items.getElementsCode());
|
|
|
+
|
|
|
+ feeCenter.setPid(bills.getId());
|
|
|
+ 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.setVoyageNo(bills.getVoyageNo());
|
|
|
+ feeCenter.setMblno(bills.getMblno());
|
|
|
+ feeCenter.setHblno(bills.getHblno());
|
|
|
+ feeCenter.setEtd(bills.getEtd());
|
|
|
+ feeCenter.setEta(bills.getEta());
|
|
|
+ feeCenter.setDc(losBFeesTemplate.getDc());
|
|
|
+ feeCenter.setSort(count);
|
|
|
+ count++;
|
|
|
+ feeCenter.setCorpId(items.getCorpId());
|
|
|
+ feeCenter.setCorpCnName(items.getCorpCnName());
|
|
|
+ feeCenter.setCorpEnName(items.getCorpEnName());
|
|
|
+ feeCenter.setFeeId(items.getFeeId());
|
|
|
+ feeCenter.setFeeCode(items.getFeeCode());
|
|
|
+ feeCenter.setFeeCnName(items.getFeeCnName());
|
|
|
+ feeCenter.setFeeEnName(items.getFeeEnName());
|
|
|
+ feeCenter.setUnitNo(items.getUnitNo());
|
|
|
+ feeCenter.setPrice(items.getPrice());
|
|
|
+ feeCenter.setCurCode(items.getCurCode());
|
|
|
+ if (ObjectUtils.isNotNull(feeCenter.getCurCode())) {
|
|
|
+ BCurrency bCurrency = new BCurrency();
|
|
|
+ bCurrency.setDate(bills.getEtd());
|
|
|
+ bCurrency.setDc(losBFeesTemplate.getDc());
|
|
|
+ List<BCurrency> bCurrencyList = bCurrencyService.getExrate(bCurrency);
|
|
|
+ if (bCurrencyList.size() > 0) {
|
|
|
+ BCurrency currency = bCurrencyList.stream().filter(e -> e.getCode().equals(feeCenter.getCurCode())).findFirst().orElse(null);
|
|
|
+ if (currency != null) {
|
|
|
+ feeCenter.setExrate(currency.getExrate());
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException("未找到汇率信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if ("TEU".equals(items.getUnitNo())) {
|
|
|
- BigDecimal quantity20GPTeu = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- Integer quantity20GP = preContainers.stream().filter(e -> "20GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
- BigDecimal quantity20GPSum = quantity20GPTeu.multiply(new BigDecimal(quantity20GP + ""));
|
|
|
-
|
|
|
- BigDecimal quantity40GPTeu = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- Integer quantity40GP = preContainers.stream().filter(e -> "40GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
- BigDecimal quantity40GPSum = quantity40GPTeu.multiply(new BigDecimal(quantity40GP + ""));
|
|
|
-
|
|
|
- BigDecimal quantity40HCTeu = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- Integer quantity40HC = preContainers.stream().filter(e -> "40HC".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
- BigDecimal quantity40HCSum = quantity40HCTeu.multiply(new BigDecimal(quantity40HC + ""));
|
|
|
-
|
|
|
- BigDecimal quantity45GPTeu = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- Integer quantity45GP = preContainers.stream().filter(e -> "45GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
- BigDecimal quantity45GPSum = quantity45GPTeu.multiply(new BigDecimal(quantity45GP + ""));
|
|
|
-
|
|
|
- BigDecimal quantity48GPTeu = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- Integer quantity48GP = preContainers.stream().filter(e -> "48GP".equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
|
|
|
- BigDecimal quantity48GPSum = quantity48GPTeu.multiply(new BigDecimal(quantity48GP + ""));
|
|
|
-
|
|
|
- BigDecimal quantity = quantity20GPSum.add(quantity40GPSum).add(quantity40HCSum).add(quantity45GPSum).add(quantity48GPSum);
|
|
|
- if (quantity.compareTo(new BigDecimal("0")) == 0) {
|
|
|
+ if ("2".equals(items.getQuantityRule())) {
|
|
|
+ if ("JOB".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ } else if ("3".equals(items.getQuantityRule())) {
|
|
|
+ if ("KGS".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(bills.getGrossWeight());
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(bills.getGrossWeight()));
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }else if ("5".equals(items.getQuantityRule())) {
|
|
|
+ if ("CBM".equals(items.getUnitNo())) {
|
|
|
+ feeCenter.setQuantity(bills.getMeasurement());
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(bills.getMeasurement()));
|
|
|
+ } else {
|
|
|
continue;
|
|
|
}
|
|
|
- feeCenter.setQuantity(new BigDecimal(quantity + ""));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(feeCenter.getQuantity()));
|
|
|
- }
|
|
|
- } else if ("5".equals(items.getQuantityRule())) {
|
|
|
- if ("CBM".equals(items.getUnitNo())) {
|
|
|
- feeCenter.setQuantity(bills.getMeasurement());
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(bills.getMeasurement()));
|
|
|
} else {
|
|
|
- continue;
|
|
|
+ feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
+ feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
|
|
|
}
|
|
|
- } else {
|
|
|
- feeCenter.setQuantity(new BigDecimal("1"));
|
|
|
- feeCenter.setAmount(items.getPrice().multiply(new BigDecimal("1")));
|
|
|
+ list.add(feeCenter);
|
|
|
}
|
|
|
- list.add(feeCenter);
|
|
|
}
|
|
|
+ this.saveOrUpdateBatch(list);
|
|
|
}
|
|
|
- this.saveOrUpdateBatch(list);
|
|
|
+
|
|
|
return R.data(list);
|
|
|
}
|
|
|
|