|
|
@@ -1215,80 +1215,85 @@ public class BillUtils implements IBillUtils {
|
|
|
if (billsList.isEmpty()) {
|
|
|
throw new RuntimeException("未查到海运出口单据,发送失败!");
|
|
|
}
|
|
|
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ List<RouteCost> costList = routeCostService.list(new LambdaQueryWrapper<RouteCost>()
|
|
|
+ .eq(RouteCost::getPodId, bills.getPolId())
|
|
|
+ .eq(RouteCost::getDestinationId, bills.getPodId())
|
|
|
+ .eq(RouteCost::getShippingCompanyId, bills.getCarrierId())
|
|
|
+ .eq(RouteCost::getBusinessType, bills.getBoxBelongsTo())
|
|
|
+ .apply("DATE_FORMAT(effective_start_date,'%Y-%m-%d') <= '" + formatter.format(bills.getEtd()) + "'")
|
|
|
+ .apply("DATE_FORMAT(effective_end_date,'%Y-%m-%d') >= '" + formatter.format(bills.getEtd()) + "'")
|
|
|
+ );
|
|
|
+ if (costList.isEmpty()) {
|
|
|
+ throw new RuntimeException("系统检测到" + formatter.format(bills.getEtd()) + " " + bills.getCarrierCnName() + " " + bills.getPolEnName() +
|
|
|
+ "->" + bills.getPodEnName() + "没有指导价 请联系成本中心!!!");
|
|
|
+ }
|
|
|
+ List<RouteCostItem> costItemList = routeCostItemService.list(new LambdaQueryWrapper<RouteCostItem>()
|
|
|
+ .eq(RouteCostItem::getIsDeleted, 0)
|
|
|
+ .eq(RouteCostItem::getTenantId, AuthUtil.getTenantId())
|
|
|
+ .in(RouteCostItem::getPid, costList.stream().map(RouteCost::getId).collect(Collectors.toList())));
|
|
|
+ if (costItemList.isEmpty()) {
|
|
|
+ throw new RuntimeException("系统检测到" + formatter.format(bills.getEtd()) + " " + bills.getCarrierCnName() + " " + bills.getPolEnName() +
|
|
|
+ "->" + bills.getPodEnName() + "没有指导价 请联系成本中心!!!");
|
|
|
+ }
|
|
|
+ List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
+ .eq(PreContainers::getIsDeleted, 0)
|
|
|
+ .in(PreContainers::getPid, idList));
|
|
|
+ if (preContainersList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到预配箱型信息,发送失败!");
|
|
|
+ }
|
|
|
+ List<SeaContainerNumberItem> containerNumberItemList = seaContainerNumberItemService.list(new LambdaQueryWrapper<SeaContainerNumberItem>()
|
|
|
+ .eq(SeaContainerNumberItem::getIsDeleted, 0)
|
|
|
+ .in(SeaContainerNumberItem::getPid, idList));
|
|
|
+
|
|
|
+ List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
+ .eq(FeeCenter::getIsDeleted, 0)
|
|
|
+ .eq(FeeCenter::getDc, "D")
|
|
|
+ .eq(FeeCenter::getFeeCode, "HYF")
|
|
|
+ .in(FeeCenter::getPid, idList));
|
|
|
+ if (feeCenterList.isEmpty()) {
|
|
|
+ throw new RuntimeException("未查到应收海运费,发送失败!");
|
|
|
+ }
|
|
|
+ String boxBusinessConnectionTime = sysClient.getParamService("box.business.connection.time");
|
|
|
StringBuilder text = new StringBuilder();
|
|
|
StringBuilder messageBody = new StringBuilder();
|
|
|
- if ("SOC".equals(bills.getBoxBelongsTo()) && "DD,MH".contains(bills.getBillType())) {
|
|
|
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- List<RouteCost> costList = routeCostService.list(new LambdaQueryWrapper<RouteCost>()
|
|
|
- .eq(RouteCost::getPodId, bills.getPolId())
|
|
|
- .eq(RouteCost::getDestinationId, bills.getPodId())
|
|
|
- .eq(RouteCost::getShippingCompanyId, bills.getCarrierId())
|
|
|
- .eq(RouteCost::getBusinessType, bills.getBoxBelongsTo())
|
|
|
- .apply("DATE_FORMAT(effective_start_date,'%Y-%m-%d') <= '" + formatter.format(bills.getEtd()) + "'")
|
|
|
- .apply("DATE_FORMAT(effective_end_date,'%Y-%m-%d') >= '" + formatter.format(bills.getEtd()) + "'")
|
|
|
- );
|
|
|
- if (costList.isEmpty()) {
|
|
|
- throw new RuntimeException("系统检测到" + bills.getEtd() + " " + bills.getCarrierCnName() + " " + bills.getPolEnName() +
|
|
|
- "->" + bills.getPodEnName() + "没有指导价 请联系成本中心!!!");
|
|
|
- }
|
|
|
- List<RouteCostItem> costItemList = routeCostItemService.list(new LambdaQueryWrapper<RouteCostItem>()
|
|
|
- .eq(RouteCostItem::getIsDeleted, 0)
|
|
|
- .eq(RouteCostItem::getTenantId, AuthUtil.getTenantId())
|
|
|
- .in(RouteCostItem::getPid, costList.stream().map(RouteCost::getId).collect(Collectors.toList())));
|
|
|
- if (costItemList.isEmpty()) {
|
|
|
- throw new RuntimeException("系统检测到" + bills.getEtd() + " " + bills.getCarrierCnName() + " " + bills.getPolEnName() +
|
|
|
- "->" + bills.getPodEnName() + "没有指导价 请联系成本中心!!!");
|
|
|
- }
|
|
|
- List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
- .eq(PreContainers::getIsDeleted, 0)
|
|
|
- .in(PreContainers::getPid, idList));
|
|
|
- if (preContainersList.isEmpty()) {
|
|
|
- throw new RuntimeException("未查到预配箱型信息,发送失败!");
|
|
|
- }
|
|
|
- List<SeaContainerNumberItem> containerNumberItemList = seaContainerNumberItemService.list(new LambdaQueryWrapper<SeaContainerNumberItem>()
|
|
|
- .eq(SeaContainerNumberItem::getIsDeleted, 0)
|
|
|
- .in(SeaContainerNumberItem::getPid, idList));
|
|
|
- if (!containerNumberItemList.isEmpty()) {
|
|
|
- if (containerNumberItemList.stream().noneMatch(e -> e.getPid().equals(bills.getId()))) {
|
|
|
- throw new RuntimeException("未选择放箱号,发送失败!");
|
|
|
+ for (Bills item : billsList){
|
|
|
+ if ("SOC".equals(item.getBoxBelongsTo()) && "DD,MH".contains(item.getBillType())) {
|
|
|
+ if (!containerNumberItemList.isEmpty()) {
|
|
|
+ if (containerNumberItemList.stream().noneMatch(e -> e.getPid().equals(item.getId()))) {
|
|
|
+ throw new RuntimeException("未选择放箱号,发送失败!");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
- .eq(FeeCenter::getIsDeleted, 0)
|
|
|
- .eq(FeeCenter::getDc, "D")
|
|
|
- .eq(FeeCenter::getFeeCode, "HYF")
|
|
|
- .in(FeeCenter::getPid, idList));
|
|
|
- if (feeCenterList.isEmpty()) {
|
|
|
- throw new RuntimeException("未查到应收海运费,发送失败!");
|
|
|
- }
|
|
|
- String boxBusinessConnectionTime = sysClient.getParamService("box.business.connection.time");
|
|
|
- Date date = null;
|
|
|
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- if (ObjectUtils.isNotNull(boxBusinessConnectionTime)) {
|
|
|
- try {
|
|
|
- date = dateFormat.parse(boxBusinessConnectionTime);
|
|
|
- } catch (ParseException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
+ Date date = null;
|
|
|
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if (ObjectUtils.isNotNull(boxBusinessConnectionTime)) {
|
|
|
+ try {
|
|
|
+ date = dateFormat.parse(boxBusinessConnectionTime);
|
|
|
+ } catch (ParseException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- boolean status = bills.getEtd().compareTo(date) >= 0;
|
|
|
- if (status) {
|
|
|
- for (PreContainers containers : preContainersList) {
|
|
|
- Bills bills1 = billsList.stream().filter(e -> e.getId().equals(containers.getPid())).findFirst().orElse(null);
|
|
|
- if (bills1 != null) {
|
|
|
- BigDecimal price = feeCenterList.stream().filter(e -> containers.getCntrTypeCode().equals(e.getUnitNo())
|
|
|
- && containers.getPid().equals(e.getPid())).map(FeeCenter::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- List<RouteCostItem> minCostItem = costItemList.stream().filter(e -> containers.getCntrTypeCode().equals(e.getBoxType()))
|
|
|
- .sorted(Comparator.comparing(RouteCostItem::getSalesPrice))
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (price.compareTo(minCostItem.get(0).getSalesPrice()) < 0) {
|
|
|
- text.append("提单号:").append(bills1.getHblno()).append("箱型:").append(containers.getCntrTypeCode()).append("应收海运费:" + price + "小于成本中心海运费:" + minCostItem.get(0).getSalesPrice() + "!");
|
|
|
- messageBody.append("提单号:").append(bills1.getHblno()).append("应收海运费:").append(price).append("小于成本中心海运费:").append(minCostItem.get(0).getSalesPrice()).append("!");
|
|
|
- }
|
|
|
- if (containerNumberItemList.stream().filter(e -> e.getBoxType().equals(containers.getCntrTypeCode())
|
|
|
- && containers.getPid().equals(e.getPid()))
|
|
|
- .mapToInt(SeaContainerNumberItem::getOccupyNum).sum() != containers.getQuantity()) {
|
|
|
- text.append("提单号:").append(bills1.getHblno()).append("箱型:").append(containers.getCntrTypeCode()).append("箱量与所选放箱号数量不等!");
|
|
|
+ boolean status = item.getEtd().compareTo(date) >= 0;
|
|
|
+ if (status) {
|
|
|
+ for (PreContainers containers : preContainersList) {
|
|
|
+ Bills bills1 = billsList.stream().filter(e -> e.getId().equals(containers.getPid())).findFirst().orElse(null);
|
|
|
+ if (bills1 != null) {
|
|
|
+ BigDecimal price = feeCenterList.stream().filter(e -> containers.getCntrTypeCode().equals(e.getUnitNo())
|
|
|
+ && containers.getPid().equals(e.getPid())).map(FeeCenter::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ List<RouteCostItem> minCostItem = costItemList.stream().filter(e -> containers.getCntrTypeCode().equals(e.getBoxType()))
|
|
|
+ .sorted(Comparator.comparing(RouteCostItem::getSalesPrice))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (price.compareTo(minCostItem.get(0).getSalesPrice()) < 0) {
|
|
|
+ text.append("提单号:").append(bills1.getHblno()).append("箱型:").append(containers.getCntrTypeCode())
|
|
|
+ .append("应收海运费:").append(price).append("小于成本中心海运费:").append(minCostItem.get(0).getSalesPrice()).append("!");
|
|
|
+ messageBody.append("提单号:").append(bills1.getHblno()).append("应收海运费:").append(price)
|
|
|
+ .append("小于成本中心海运费:").append(minCostItem.get(0).getSalesPrice()).append("!");
|
|
|
+ }
|
|
|
+ if (containerNumberItemList.stream().filter(e -> e.getBoxType().equals(containers.getCntrTypeCode())
|
|
|
+ && containers.getPid().equals(e.getPid()))
|
|
|
+ .mapToInt(SeaContainerNumberItem::getOccupyNum).sum() != containers.getQuantity()) {
|
|
|
+ text.append("提单号:").append(bills1.getHblno()).append("箱型:").append(containers.getCntrTypeCode()).append("箱量与所选放箱号数量不等!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1300,7 +1305,6 @@ public class BillUtils implements IBillUtils {
|
|
|
String pageStatus = "this.$store.getters.domSaleStatus";
|
|
|
messageBody.append("发送人:").append(AuthUtil.getUserName());
|
|
|
this.sendMessage(bills, url, pageLabel, pageStatus, messageBody.toString(), "2", bills.getOperatorId(), "成本中心");
|
|
|
-// return R.success(text.toString());
|
|
|
throw new RuntimeException(text.toString());
|
|
|
} else {
|
|
|
return R.success("操作成功");
|
|
|
@@ -1470,12 +1474,13 @@ public class BillUtils implements IBillUtils {
|
|
|
List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
|
|
|
.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(PreContainers::getIsDeleted, 0)
|
|
|
- .eq(PreContainers::getPid, billId));
|
|
|
+ .eq(PreContainers::getPid, id));
|
|
|
List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
|
|
|
.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
|
|
|
.eq(FeeCenter::getIsDeleted, 0)
|
|
|
.eq(FeeCenter::getPid, billId)
|
|
|
- .eq(FeeCenter::getDc, dc));
|
|
|
+ .eq(ObjectUtils.isNotNull(dc),FeeCenter::getDc, dc)
|
|
|
+ .orderByDesc(FeeCenter::getDc).orderByAsc(FeeCenter::getSort));
|
|
|
if (!feeCenterList.isEmpty()) {
|
|
|
List<Long> idList = new ArrayList<>();
|
|
|
idList.add(bills.getCorpId());
|
|
|
@@ -1502,12 +1507,9 @@ public class BillUtils implements IBillUtils {
|
|
|
}
|
|
|
for (FeeCenter feeCenter : feeCenterList) {
|
|
|
if (!boxTypeList.isEmpty() && boxTypeList.contains(feeCenter.getUnitNo()) && !preContainersList.isEmpty()) {
|
|
|
- PreContainers preContainers = preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(feeCenter.getUnitNo()))
|
|
|
- .findFirst().orElse(null);
|
|
|
- if (preContainers != null) {
|
|
|
- feeCenter.setQuantity(new BigDecimal(preContainers.getQuantity() + ""));
|
|
|
- }
|
|
|
- } else {
|
|
|
+ preContainersList.stream().filter(e -> e.getCntrTypeCode().equals(feeCenter.getUnitNo()))
|
|
|
+ .findFirst().ifPresent(preContainers -> feeCenter.setQuantity(new BigDecimal(preContainers.getQuantity() + "")));
|
|
|
+ } else {
|
|
|
if ("CNTRQTY".equals(feeCenter.getUnitNo())) {
|
|
|
feeCenter.setQuantity(bills.getQuantity());
|
|
|
} else if ("JOB".equals(feeCenter.getUnitNo()) || "票".equals(feeCenter.getUnitNo())) {
|