Преглед изворни кода

1.用箱计划模块相关接口调试及修改
2.海运进口-pod返场接口编写
3.箱池动态-POL空箱出场增加计算POl超期箱使费逻辑
4.RT&FD统计增加承运人字段
5.客户托书-海运出口保存更新数据

纪新园 пре 7 месеци
родитељ
комит
c67a34ef2d

+ 8 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/PutBoxItems.java

@@ -186,6 +186,7 @@ public class PutBoxItems implements Serializable {
 	 * etd
 	 */
 	@ApiModelProperty(value = "etd")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date etd;
 	/**
 	 * pol 堆场
@@ -253,6 +254,7 @@ public class PutBoxItems implements Serializable {
 	 * eta
 	 */
 	@ApiModelProperty(value = "eta")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date eta;
 	/**
 	 * pod空箱还箱日期
@@ -266,31 +268,37 @@ public class PutBoxItems implements Serializable {
 	 * pod场站
 	 */
 	@ApiModelProperty(value = "pod场站")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Long podStationId;
 	/**
 	 * pod场站编码
 	 */
 	@ApiModelProperty(value = "pod场站编码")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String podStationCode;
 	/**
 	 * pod场站中文
 	 */
 	@ApiModelProperty(value = "pod场站中文")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String podStationCname;
 	/**
 	 * pod场站英文
 	 */
 	@ApiModelProperty(value = "pod场站英文")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String podStationEname;
 	/**
 	 * pod 免箱使天数
 	 */
 	@ApiModelProperty(value = "pod 免箱使天数")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Integer podFreeBoxUseDays;
 	/**
 	 * pod箱使天数
 	 */
 	@ApiModelProperty(value = "pod箱使天数")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Integer podBoxUseDays;
 	/**
 	 * 代理名称

+ 6 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/RouteCost.java

@@ -297,21 +297,25 @@ public class RouteCost implements Serializable {
 	 * 舱位数
 	 */
 	@ApiModelProperty(value = "舱位数")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Integer shippingSpaceNumber;
 	/**
 	 * 限重含皮(吨)
 	 */
 	@ApiModelProperty(value = "限重含皮(吨)")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private BigDecimal weightLimit;
 	/**
 	 * 航行天数
 	 */
 	@ApiModelProperty(value = "航行天数")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Integer navigateDay;
 	/**
 	 * 在场站天数
 	 */
 	@ApiModelProperty(value = "在场站天数")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Integer existStationDay;
 	/**
 	 * 班次
@@ -407,12 +411,14 @@ public class RouteCost implements Serializable {
 	 * 付费地点
 	 */
 	@ApiModelProperty(value = "付费地点")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private String paymentLocation;
 
 	/**
 	 * 汇率日期
 	 */
 	@ApiModelProperty(value = "汇率日期")
+	@TableField(updateStrategy = FieldStrategy.IGNORED)
 	private Date exrateDate;
 
 	/**

+ 3 - 3
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/RouteCostProfitController.java

@@ -105,7 +105,7 @@ public class RouteCostProfitController extends BladeController {
 	}
 
 	/**
-	 * 分页 航线利润
+	 * 分页 RT&FD
 	 */
 	@GetMapping("/listRTFDProfit")
 	public R<List<RTFDProfitExcel>> listRTFDProfit(RTFDProfitExcel profitExcel) {
@@ -116,12 +116,12 @@ public class RouteCostProfitController extends BladeController {
 
 
 	/**
-	 * 导出 航线利润
+	 * 导出 RT&FD
 	 */
 	@GetMapping("/exportRTFDProfit")
 	public void exportRTFDProfit(RTFDProfitExcel profitExcel, HttpServletResponse response) {
 		List<RTFDProfitExcel> excelList = routeCostService.RTFDProfitAll(profitExcel);
-		ExcelUtil.export(response, "航线利润", "航线利润", excelList, RTFDProfitExcel.class);
+		ExcelUtil.export(response, "RT&FD", "RT&FD", excelList, RTFDProfitExcel.class);
 	}
 
 

+ 10 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/UseBoxPlanItemController.java

@@ -128,6 +128,16 @@ public class UseBoxPlanItemController extends BladeController {
 		return R.status(useBoxPlanItemService.saveOrUpdate(useBoxPlanItem));
 	}
 
+	/**
+	 * 新增或修改 用箱计划明细表
+	 */
+	@PostMapping("/submitList")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入useBoxPlanItem")
+	public R submitList(@Valid @RequestBody List<UseBoxPlanItem> useBoxPlanItemList) {
+		return useBoxPlanItemService.submitList(useBoxPlanItemList);
+	}
+
 
 	/**
 	 * 删除 用箱计划明细表

+ 3 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/IUseBoxPlanItemService.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.los.box.service;
 
+import org.springblade.core.tool.api.R;
 import org.springblade.los.box.entity.UseBoxPlanItem;
 import org.springblade.los.box.excel.UseBoxPlanItemExcel;
 import org.springblade.los.box.vo.UseBoxPlanItemVO;
@@ -42,4 +43,6 @@ public interface IUseBoxPlanItemService extends IService<UseBoxPlanItem> {
 	IPage<UseBoxPlanItemExcel> selectUseBoxPlanItemPage(IPage<UseBoxPlanItemExcel> page, UseBoxPlanItemExcel useBoxPlanItem);
 
 	List<UseBoxPlanItemExcel> exportUseBoxPlanItem(UseBoxPlanItemExcel useBoxPlanItem);
+
+	R submitList(List<UseBoxPlanItem> useBoxPlanItemList);
 }

+ 601 - 53
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -74,6 +74,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.rmi.RemoteException;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
@@ -1204,6 +1205,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				}
 			}
 		}
+		this.countOverdueFee(tradingBoxList, tradingBoxItems);
 		return R.data("操作成功");
 	}
 
@@ -1613,6 +1615,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			if (fees == null) {
 				throw new RuntimeException("请先维护费用基础信息");
 			}
+			String overdueProportion = sysClient.getParamService("overdue.proportion");
+			if (ObjectUtils.isNull(overdueProportion) || "获取数据失败".equals(overdueProportion)) {
+				throw new RuntimeException("超期箱使费比例");
+			}
 			for (TradingBoxItem item : tradingBoxItemOldList) {
 				//查找OW明细对应主表
 				TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
@@ -1628,8 +1634,14 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				String exrateType = currencyUtils.standardCurrency(bills.getBranchId());
 				//对应海运进出口单据所属公司所有币别
 				List<BCurExrate> curExrateList = currencyUtils.obtainRate(new Date(), "1", bills.getBranchId());
+				Date polPickUpDate;
+				if ("OW-N".equals(tradingBox.getType())){
+					polPickUpDate = item.getPolPickUpDate();
+				}else{
+					polPickUpDate = item.getPolStationEmptyContainerExitDate();
+				}
 				//起运港超期天数
-				if (ObjectUtils.isNotNull(item.getPolPickUpDate()) && ObjectUtils.isNotNull(bills.getEtd())) {
+				if (ObjectUtils.isNotNull(polPickUpDate) && ObjectUtils.isNotNull(bills.getEtd())) {
 					//所属公司具体超期标准
 					StorageFees storageFees = this.getStorageFees(storageFeesList, bills, "1");
 					if (storageFees == null) {
@@ -1642,7 +1654,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						throw new RuntimeException("请先维护基础资料-超期标准");
 					}
 					LocalDateTime ldt1 = bills.getEtd().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-					LocalDateTime ldt2 = item.getPolPickUpDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+					LocalDateTime ldt2 = polPickUpDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
 					long days = ChronoUnit.DAYS.between(ldt2, ldt1);
 					//超期天数
 					int overdueDays = 0;
@@ -1654,36 +1666,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						FeeCenter feeCenter = this.addFeeCenter(tradingBox, item, bills, fees, storageFeesItems, curExrateList, overdueDays, exrateType);
 						if (feeCenter != null) {
 							feeCenterList.add(feeCenter);
-						}
-					}
-				}
-				//目的港超期天数
-				if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate()) &&
-					ObjectUtils.isNotNull(bills.getEta())) {
-					//所属公司具体超期标准
-					StorageFees storageFees = this.getStorageFees(storageFeesList, bills, "2");
-					if (storageFees == null) {
-						throw new RuntimeException("请先维护基础资料-超期标准");
-					}
-					//所属公司具体超期标准明细
-					List<StorageFeesItems> storageFeesItems = storageFeesItemsList.stream().filter(e -> e.getPid().equals(storageFees.getId()))
-						.collect(Collectors.toList());
-					if (storageFeesItems.isEmpty()) {
-						throw new RuntimeException("请先维护基础资料-超期标准");
-					}
-					LocalDateTime ldt1 = item.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-					LocalDateTime ldt2 = bills.getEta().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
-					long days = ChronoUnit.DAYS.between(ldt2, ldt1);
-					//超期天数
-					int overdueDays = 0;
-					if (ObjectUtils.isNull(bills.getPodFreeBoxUseDays()) || 0 == bills.getPodFreeBoxUseDays() ||
-						days > bills.getPodFreeBoxUseDays()) {
-						overdueDays = (int) (days - bills.getPodFreeBoxUseDays());
-					}
-					if (overdueDays != 0) {
-						FeeCenter feeCenter = this.addFeeCenter(tradingBox, item, bills, fees, storageFeesItems, curExrateList, overdueDays, exrateType);
-						if (feeCenter != null) {
-							feeCenterList.add(feeCenter);
+							FeeCenter feeCenterC = new FeeCenter();
+							BeanUtil.copyProperties(feeCenter, feeCenterC);
+							feeCenterC.setDc("C");
+							feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion)).setScale(2, RoundingMode.HALF_UP));
+							feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
+							feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
+							feeCenterList.add(feeCenterC);
 						}
 					}
 				}
@@ -3986,27 +3975,93 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		if (boxNum.isEmpty()) {
 			throw new RuntimeException("所选配箱信息箱号不能为空");
 		}
+		//箱档案数据
+		List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
+			.eq(Archives::getTenantId, AuthUtil.getTenantId())
+			.eq(Archives::getIsDeleted, 0)
+			.in(Archives::getCode, boxNum)
+			.eq(Archives::getStatus, "使用中"));
+		if (archivesList.isEmpty()) {
+			throw new RuntimeException("未查到对应箱档案信息");
+		}
+		if (boxNum.size() > archivesList.size()) {
+			List<String> boxCode = archivesList.stream().map(Archives::getCode).collect(Collectors.toList());
+			throw new RuntimeException("箱号:" + boxNum.stream().filter(e -> !boxCode.contains(e))
+				.collect(Collectors.joining(",")) + "未查到对应箱档案信息");
+		}
+		List<String> containerNumberList = archivesList.stream().map(Archives::getContainerNumber)
+			.distinct().collect(Collectors.toList());
+		List<String> containerNumberOwList = archivesList.stream().map(Archives::getContainerNumberOw)
+			.distinct().collect(Collectors.toList());
+		if (!containerNumberOwList.isEmpty()) {
+			containerNumberList.addAll(containerNumberOwList);
+		}
+		List<PutBox> putBoxList = baseMapper.selectList(new LambdaQueryWrapper<PutBox>()
+			.eq(PutBox::getTenantId, AuthUtil.getTenantId())
+			.eq(PutBox::getIsDeleted, 0)
+			.and(i -> i.in(PutBox::getContainerNumber, containerNumberList).or()
+				.in(PutBox::getSrcContainerNumber, containerNumberList)));
+		if (putBoxList.isEmpty()) {
+			throw new RuntimeException("未查到放箱号单据");
+		}
+		List<Long> putBoxIdList = putBoxList.stream().map(PutBox::getId).collect(Collectors.toList());
+		List<PutBoxItems> putBoxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
+			.eq(PutBoxItems::getIsDeleted, 0)
+			.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
+			.in(PutBoxItems::getPid, putBoxIdList));
+		List<Long> srcIdList = putBoxList.stream().map(PutBox::getSrcId).collect(Collectors.toList());
+		List<TradingBox> tradingBoxList = new ArrayList<>();
+		if (!srcIdList.isEmpty()) {
+			tradingBoxList = tradingBoxMapper.selectList(new LambdaQueryWrapper<TradingBox>()
+				.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
+				.eq(TradingBox::getIsDeleted, 0)
+				.in(TradingBox::getId, srcIdList));
+		}
+		List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
+		if (!tradingBoxList.isEmpty()) {
+			List<Long> tradingBoxIdList = tradingBoxList.stream().map(TradingBox::getId).collect(Collectors.toList());
+			tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
+				.eq(TradingBoxItem::getIsDeleted, 0)
+				.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
+				.in(TradingBoxItem::getPid, tradingBoxIdList));
+		}
+		//目的港生成新放箱号单据
+		List<PutBox> putBoxNewList = new ArrayList<>();
+		//目的港生成新放箱号单据明细数据
+		List<PutBoxItems> putBoxItemsNewList = new ArrayList<>();
+		//原起运港放箱号单据明细数据
+		List<PutBoxItems> putBoxItemsOldList = new ArrayList<>();
+		//原起运港OW单据明细数据
+		List<TradingBoxItem> tradingBoxItemOldList = new ArrayList<>();
+		//自有箱-箱档案数据更新
+		List<Archives> archivesArrayList = new ArrayList<>();
+		//OW(拿)、代理箱-箱档案数据删除
+		List<Long> archivesDateleList = new ArrayList<>();
+		BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+			.select(BusinessType::getId)
+			.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+			.eq(BusinessType::getIsDeleted, 0)
+			.eq(BusinessType::getStatus, 0)
+			.eq(BusinessType::getCode, "FXH"));
+		if (businessType == null) {
+			throw new RuntimeException("未找到可用业务类型");
+		}
 		Bills billsHYJK = billsMapper.selectById(bills.getId());
 		if (billsHYJK == null) {
 			throw new RuntimeException("未查到海运进口单据");
 		}
-		List<Long> idHYCKList = new ArrayList<>();
-		Bills billsHYCK = billsMapper.selectById(billsHYJK.getSrcBusId());
-		if (billsHYCK == null) {
-			throw new RuntimeException("未查到来源海运出口单据");
-		}
-		idHYCKList.add(billsHYCK.getId());
-		List<Bills> billsHYCKListFD = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+		List<Long> idHYJKList = new ArrayList<>();
+		List<Bills> billsHYJKListFD = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
 			.eq(Bills::getTenantId, AuthUtil.getTenantId())
 			.eq(Bills::getIsDeleted, 0)
-			.eq(Bills::getMasterId, billsHYCK.getId()));
-		if (!billsHYCKListFD.isEmpty()) {
-			idHYCKList.addAll(billsHYCKListFD.stream().map(Bills::getId).collect(Collectors.toList()));
+			.eq(Bills::getMasterId, bills.getId()));
+		if (!billsHYJKListFD.isEmpty()) {
+			idHYJKList.addAll(billsHYJKListFD.stream().map(Bills::getId).collect(Collectors.toList()));
 		}
-		List<Containers> containersHYCKList = containersService.list(new LambdaQueryWrapper<Containers>()
+		List<Containers> containersHYJKListFD = containersService.list(new LambdaQueryWrapper<Containers>()
 			.eq(Containers::getTenantId, AuthUtil.getTenantId())
 			.eq(Containers::getIsDeleted, 0)
-			.in(Containers::getPid, idHYCKList)
+			.in(Containers::getPid, idHYJKList)
 			.in(Containers::getCntrNo, boxNum));
 		List<Containers> containersListNew = new ArrayList<>();
 		for (Containers item : containersHYJKList) {
@@ -4018,18 +4073,511 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			item.setUpdateUser(AuthUtil.getUserId());
 			item.setUpdateUserName(AuthUtil.getUserName());
 			containersListNew.add(item);
+			//进口分单配箱信息处理
+			if (!containersHYJKListFD.isEmpty()) {
+				Containers containers = containersHYJKListFD.stream().filter(e -> e.getCntrNo().equals(item.getCntrNo()))
+					.findFirst().orElse(null);
+				if (containers != null) {
+					containers.setPodStationId(bills.getPodStationId());
+					containers.setPodStationCname(bills.getPodStationCname());
+					containers.setPodStationEname(bills.getPodStationEname());
+					containers.setPodStationCode(bills.getPodStationCode());
+					containers.setUpdateTime(new Date());
+					containers.setUpdateUser(AuthUtil.getUserId());
+					containers.setUpdateUserName(AuthUtil.getUserName());
+					containersListNew.add(containers);
+				}
+			}
+			//箱档案信息处理
+			Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getCntrNo())).findFirst().orElse(null);
+			if (archives == null) {
+				throw new RuntimeException("未查到箱号:" + item.getCntrNo() + "箱档案数据");
+			}
+			archives.setUpdateTime(new Date());
+			archives.setUpdateUser(AuthUtil.getUserId());
+			archives.setUpdateUserName(AuthUtil.getUserName());
+			archives.setStatus("待使用");
+			archives.setNewDate(bills.getReturnEmptyTime());
+			archives.setBoxDynamics("空箱进场");
+			archives.setAddressId(bills.getPodId());
+			archives.setAddressCode(bills.getPodCode());
+			archives.setAddressCname(bills.getPodCnName());
+			archives.setAddressEname(bills.getPodEnName());
+			archives.setStationId(bills.getPodStationId());
+			archives.setStationCode(bills.getPodStationCname());
+			archives.setStationCname(bills.getPodStationEname());
+			archives.setStationEname(bills.getPodStationCode());
+			archivesArrayList.add(archives);
+			//原放箱号数据处理
+			PutBox putBox1 = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw()))
+				.findFirst().orElse(null);
+			if (putBox1 != null) {
+				if ("OW(放),自有箱,代理箱".contains(putBox1.getBoxClass())) {
+					//放箱号明细数据处理
+					PutBoxItems putBoxItem;
+					if (!putBoxItemsList.isEmpty()) {
+						putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getCntrNo()))
+							.findFirst().orElse(null);
+						if (putBoxItem != null) {
+							putBoxItem.setPid(putBox1.getId());
+							putBoxItem.setPodStationId(bills.getPodStationId());
+							putBoxItem.setPodStationCode(bills.getPodStationCname());
+							putBoxItem.setPodStationCname(bills.getPodStationEname());
+							putBoxItem.setPodStationEname(bills.getPodStationCode());
+							putBoxItem.setPodEmptyContainerReturnDate(bills.getReturnEmptyTime());
+							putBoxItem.setStatus("待使用");
+							putBoxItem.setBoxDynamics("空箱进场");
+							putBoxItemsOldList.add(putBoxItem);
+						} else {
+							throw new RuntimeException("未查到原放箱号:" + archives.getContainerNumber() + "中箱号为:" + item.getCntrNo() + "数据");
+						}
+					} else {
+						throw new RuntimeException("未查到原放箱号:" + archives.getContainerNumber() + "中箱号为:" + item.getCntrNo() + "数据");
+					}
+					if ("OW(放)".equals(putBox1.getBoxClass())) {
+						if (!tradingBoxList.isEmpty()) {
+							TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBox1.getSrcId()))
+								.findFirst().orElse(null);
+							if (tradingBox != null) {
+								TradingBoxItem tradingBoxItem;
+								if (!tradingBoxItemList.isEmpty()) {
+									tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getCntrNo()))
+										.findFirst().orElse(null);
+									if (tradingBoxItem != null) {
+										tradingBoxItem.setPid(tradingBox.getId());
+										tradingBoxItem.setPodStationId(bills.getPodStationId());
+										tradingBoxItem.setPodStationCode(bills.getPodStationCname());
+										tradingBoxItem.setPodStationCname(bills.getPodStationEname());
+										tradingBoxItem.setPodStationEname(bills.getPodStationCode());
+										tradingBoxItem.setPodEmptyContainerReturnDate(bills.getReturnEmptyTime());
+										tradingBoxItem.setBoxDynamics("空箱进场");
+										tradingBoxItem.setStatus("待使用");
+										tradingBoxItem.setPortId(bills.getPodId());
+										tradingBoxItem.setPortCode(bills.getPodCode());
+										tradingBoxItem.setPortCname(bills.getPodCnName());
+										tradingBoxItem.setPortEname(bills.getPodEnName());
+										tradingBoxItem.setStationId(bills.getPodStationId());
+										tradingBoxItem.setStationCode(bills.getPodStationCname());
+										tradingBoxItem.setStationCname(bills.getPodStationEname());
+										tradingBoxItem.setStationEname(bills.getPodStationCode());
+										tradingBoxItemOldList.add(tradingBoxItem);
+									} else {
+										throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
+									}
+								} else {
+									throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
+								}
+							} else {
+								throw new RuntimeException("未查到原OW单据-放箱号为:" + archives.getContainerNumber());
+							}
+						} else {
+							throw new RuntimeException("未查到原OW单据-放箱号为:" + archives.getContainerNumberOw());
+						}
+					}
+					//pod放箱号处理
+					PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
+						&& e.getPolId().equals(archives.getAddressId()) && e.getPolStationId().equals(archives.getStationId())
+						&& e.getBusType().equals(archives.getContainerNumberType())).findFirst().orElse(null);
+					if (putBox == null) {
+						if (!putBoxNewList.isEmpty()) {
+							PutBox putBox2 = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
+								&& e.getPolId().equals(archives.getAddressId()) && e.getPolStationId().equals(archives.getStationId())).findFirst().orElse(null);
+							if (putBox2 == null) {
+								putBox2 = new PutBox();
+								putBox2.setCreateUser(AuthUtil.getUserId());
+								putBox2.setCreateTime(new Date());
+								putBox2.setCreateUserName(AuthUtil.getUserName());
+								putBox2.setBusType("自有箱");
+								putBox2.setBoxBelongsTo("SOC");
+								putBox2.setBoxEastId(archives.getBoxEastId() + "");
+								putBox2.setBoxEastName(archives.getBoxEastName());
+								String code = "FXH-ZY";
+								BusinessBillNo businessBillNo = new BusinessBillNo();
+								businessBillNo.setBusinessTypeId(businessType.getId());
+								businessBillNo.setCode(code);
+								R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+								if (!clientBillNo.isSuccess()) {
+									throw new RuntimeException("生成订单编号失败");
+								}
+								putBox2.setSysNo((String) clientBillNo.getData());
+								putBox2.setContainerNumber(archives.getContainerNumber());
+								putBox2.setSrcContainerNumber(archives.getContainerNumberOw());
+								putBox2.setSrcType(archives.getContainerNumberTypeOw());
+								BusinessBillNo businessBillNo1 = new BusinessBillNo();
+								businessBillNo1.setBusinessTypeId(businessType.getId());
+								businessBillNo1.setCode("FXH-N");
+								R clientBillNo1 = businessBillNoService.getBillNoLos(businessBillNo1);
+								if (!clientBillNo1.isSuccess()) {
+									throw new RuntimeException("生成订单编号失败");
+								}
+								putBox2.setInternalContainerNumber((String) clientBillNo1.getData());
+								putBox2.setPolId(bills.getPodId());
+								putBox2.setPolCode(bills.getPodCode());
+								putBox2.setPolCname(bills.getPodCnName());
+								putBox2.setPolEname(bills.getPodEnName());
+								putBox2.setPolStationId(bills.getPodStationId());
+								putBox2.setPolStationCode(bills.getPodStationCname());
+								putBox2.setPolStationCname(bills.getPodStationEname());
+								putBox2.setPolStationEname(bills.getPodStationCode());
+								putBox2.setBoxType(archives.getTypeName());
+								putBox2.setBoxClass("自有箱");
+								putBox2.setTotalNum(1);
+								putBox2.setOccupyNum(0);
+								putBox2.setRemainingNum(1);
+								putBox2.setStorageNum(1);
+								putBoxNewList.add(putBox2);
+							} else {
+								putBox2.setTotalNum(putBox1.getTotalNum() + 1);
+								putBox2.setOccupyNum(0);
+								putBox2.setRemainingNum(putBox1.getRemainingNum() + 1);
+								putBox2.setStorageNum(putBox1.getStorageNum() + 1);
+							}
+						} else {
+							putBox = new PutBox();
+							putBox.setCreateUser(AuthUtil.getUserId());
+							putBox.setCreateTime(new Date());
+							putBox.setCreateUserName(AuthUtil.getUserName());
+							putBox.setBusType("自有箱");
+							putBox.setBoxClass("自有箱");
+							String code = "FXH-ZY";
+							BusinessBillNo businessBillNo = new BusinessBillNo();
+							businessBillNo.setBusinessTypeId(businessType.getId());
+							businessBillNo.setCode(code);
+							R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+							if (!clientBillNo.isSuccess()) {
+								throw new RuntimeException("生成订单编号失败");
+							}
+							putBox.setSysNo((String) clientBillNo.getData());
+							putBox.setContainerNumber(archives.getContainerNumber());
+							putBox.setBoxBelongsTo("SOC");
+							putBox.setBoxEastId(archives.getBoxEastId() + "");
+							putBox.setBoxEastName(archives.getBoxEastName());
+							putBox.setSrcContainerNumber(archives.getContainerNumberOw());
+							putBox.setSrcType(archives.getContainerNumberTypeOw());
+							BusinessBillNo businessBillNo1 = new BusinessBillNo();
+							businessBillNo1.setBusinessTypeId(businessType.getId());
+							businessBillNo1.setCode("FXH-N");
+							R clientBillNo1 = businessBillNoService.getBillNoLos(businessBillNo1);
+							if (!clientBillNo1.isSuccess()) {
+								throw new RuntimeException("生成订单编号失败");
+							}
+							putBox.setInternalContainerNumber((String) clientBillNo1.getData());
+							putBox.setPolId(bills.getPodId());
+							putBox.setPolCode(bills.getPodCode());
+							putBox.setPolCname(bills.getPodCnName());
+							putBox.setPolEname(bills.getPodEnName());
+							putBox.setPolStationId(bills.getPodStationId());
+							putBox.setPolStationCode(bills.getPodStationCname());
+							putBox.setPolStationCname(bills.getPodStationEname());
+							putBox.setPolStationEname(bills.getPodStationCode());
+							putBox.setBoxType(archives.getTypeName());
+							putBox.setBoxClass("自有箱");
+							putBox.setTotalNum(1);
+							putBox.setOccupyNum(0);
+							putBox.setRemainingNum(1);
+							putBox.setStorageNum(1);
+							putBoxNewList.add(putBox);
+						}
+					} else {
+						putBox.setTotalNum(putBox.getTotalNum() + 1);
+						putBox.setRemainingNum(putBox.getTotalNum() + 1 - putBox.getOccupyNum());
+						putBox.setStorageNum(putBox.getStorageNum() + 1 - putBox.getOccupyNum());
+						putBoxNewList.add(putBox);
+					}
+				} else if ("OW(拿)".equals(putBox1.getBoxClass())) {
+					//放箱号明细数据处理
+					PutBoxItems putBoxItem;
+					if (!putBoxItemsList.isEmpty()) {
+						putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getCntrNo()))
+							.findFirst().orElse(null);
+						if (putBoxItem != null) {
+							putBoxItem.setPid(putBox1.getId());
+							putBoxItem.setPodStationId(bills.getPodStationId());
+							putBoxItem.setPodStationCode(bills.getPodStationCname());
+							putBoxItem.setPodStationCname(bills.getPodStationEname());
+							putBoxItem.setPodStationEname(bills.getPodStationCode());
+							putBoxItem.setPodEmptyContainerReturnDate(bills.getReturnEmptyTime());
+							putBoxItem.setStatus("待使用");
+							putBoxItem.setBoxDynamics("空箱进场");
+							putBoxItemsOldList.add(putBoxItem);
+						} else {
+							throw new RuntimeException("未查到原放箱号:" + archives.getContainerNumber() + "中箱号为:" + item.getCntrNo() + "数据");
+						}
+					} else {
+						throw new RuntimeException("未查到原放箱号:" + archives.getContainerNumber() + "中箱号为:" + item.getCntrNo() + "数据");
+					}
+					if (!tradingBoxList.isEmpty()) {
+						TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBox1.getSrcId()))
+							.findFirst().orElse(null);
+						if (tradingBox != null) {
+							TradingBoxItem tradingBoxItem;
+							if (!tradingBoxItemList.isEmpty()) {
+								tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getCntrNo()))
+									.findFirst().orElse(null);
+								if (tradingBoxItem != null) {
+									tradingBoxItem.setPid(tradingBox.getId());
+									tradingBoxItem.setPodStationId(bills.getPodStationId());
+									tradingBoxItem.setPodStationCode(bills.getPodStationCname());
+									tradingBoxItem.setPodStationCname(bills.getPodStationEname());
+									tradingBoxItem.setPodStationEname(bills.getPodStationCode());
+									tradingBoxItem.setPodEmptyContainerReturnDate(bills.getReturnEmptyTime());
+									tradingBoxItem.setBoxDynamics("空箱进场");
+									tradingBoxItem.setStatus("待使用");
+									tradingBoxItem.setPortId(bills.getPodId());
+									tradingBoxItem.setPortCode(bills.getPodCode());
+									tradingBoxItem.setPortCname(bills.getPodCnName());
+									tradingBoxItem.setPortEname(bills.getPodEnName());
+									tradingBoxItem.setStationId(bills.getPodStationId());
+									tradingBoxItem.setStationCode(bills.getPodStationCname());
+									tradingBoxItem.setStationCname(bills.getPodStationEname());
+									tradingBoxItem.setStationEname(bills.getPodStationCode());
+									tradingBoxItemOldList.add(tradingBoxItem);
+								} else {
+									throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
+								}
+							} else {
+								throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
+							}
+						} else {
+							throw new RuntimeException("未查到原OW单据-放箱号为:" + archives.getContainerNumber());
+						}
+					} else {
+						throw new RuntimeException("未查到原OW单据-放箱号为:" + archives.getContainerNumberOw());
+					}
+					archivesDateleList.add(archives.getId());
+				} else {
+					throw new RuntimeException("放箱号:" + archives.getContainerNumberOw() + "单据类型错误,请联系管理员");
+				}
+			}
 		}
-		for (Containers item : containersHYCKList) {
-			item.setPodStationId(bills.getPodStationId());
-			item.setPodStationCname(bills.getPodStationCname());
-			item.setPodStationEname(bills.getPodStationEname());
-			item.setPodStationCode(bills.getPodStationCode());
-			item.setUpdateTime(new Date());
-			item.setUpdateUser(AuthUtil.getUserId());
-			item.setUpdateUserName(AuthUtil.getUserName());
-			containersListNew.add(item);
+		if (!containersListNew.isEmpty()) {
+			containersService.updateBatchById(containersListNew);
+		}
+		if (!putBoxItemsOldList.isEmpty()) {
+			putBoxItemsService.updateBatchById(putBoxItemsOldList);
+		}
+		if (!tradingBoxItemOldList.isEmpty()) {
+			tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
+		}
+		if (!archivesArrayList.isEmpty()) {
+			archivesService.updateBatchById(archivesArrayList);
+		}
+		if (!archivesDateleList.isEmpty()) {
+			archivesService.removeByIds(archivesDateleList);
 		}
+		if (!putBoxNewList.isEmpty()) {
+			this.saveOrUpdateBatch(putBoxNewList);
+		}
+		for (Containers item : containersHYJKList) {
+			//箱档案信息处理
+			Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getCntrNo())).findFirst().orElse(null);
+			if (archives == null) {
+				throw new RuntimeException("未查到箱号:" + item.getCntrNo() + "箱档案数据");
+			}
+			//放箱号数据处理
+			PutBox putBox1 = putBoxList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumberOw()))
+				.findFirst().orElse(null);
+			if (putBox1 != null) {
+				if ("OW(放),自有箱,代理箱".contains(putBox1.getBoxClass())) {
+					//POD放箱号数据明细处理
+					PutBox putBox = putBoxNewList.stream().filter(e -> e.getContainerNumber().equals(archives.getContainerNumber())
+							&& e.getPolId().equals(archives.getAddressId()) && e.getPolStationId().equals(archives.getStationId()))
+						.findFirst().orElse(null);
+					if (putBox != null) {
+						//POD放箱号明细数据处理
+						PutBoxItems putBoxItem;
+						if (!putBoxItemsList.isEmpty()) {
+							putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getCntrNo()) &&
+									putBox.getId().equals(e.getPid()))
+								.findFirst().orElse(null);
+							if (putBoxItem != null) {
+								putBoxItem.setMblno(item.getMblno());
+								putBoxItem.setBoxDynamics("空箱进场");
+								putBoxItem.setStatus("待使用");
+								putBoxItem.setPolCyId(bills.getPodId());
+								putBoxItem.setPolCyCode(bills.getPodCode());
+								putBoxItem.setPolCyCname(bills.getPodCnName());
+								putBoxItem.setPolCyEname(bills.getPodEnName());
+								putBoxItem.setEtd(null);
+								putBoxItem.setPolFreeBoxUseDays(0);
+								putBoxItem.setPolPreAppearanceDate(null);
+								putBoxItem.setPolStationEmptyContainerExitDate(null);
+								putBoxItem.setPolReturnDate(null);
+								putBoxItem.setPolOverdueBoxUseDays(0);
+								putBoxItem.setPolPickUpDate(null);
+								putBoxItem.setEta(null);
+								putBoxItem.setPodEmptyContainerReturnDate(null);
+								putBoxItem.setPodStationId(null);
+								putBoxItem.setPodStationCode(null);
+								putBoxItem.setPodStationCname(null);
+								putBoxItem.setPodStationEname(null);
+								putBoxItem.setPodFreeBoxUseDays(null);
+								putBoxItem.setPodBoxUseDays(null);
+							} else {
+								putBoxItem = new PutBoxItems();
+								putBoxItem.setBoxClass(putBox.getBusType());
+								putBoxItem.setBoxBelongsTo("SOC");
+								putBoxItem.setBoxCondition("新");
+								putBoxItem.setBoxStatus("好");
+								putBoxItem.setPid(putBox.getId());
+								putBoxItem.setContainerNumber(archives.getContainerNumber());
+								putBoxItem.setBoxCode(item.getCntrNo());
+								putBoxItem.setBoxType(item.getCntrTypeCode());
+								putBoxItem.setMblno(item.getMblno());
+								putBoxItem.setBoxDynamics("空箱进场");
+								putBoxItem.setStatus("待使用");
+								putBoxItem.setPolCyId(bills.getPodId());
+								putBoxItem.setPolCyCode(bills.getPodCode());
+								putBoxItem.setPolCyCname(bills.getPodCnName());
+								putBoxItem.setPolCyEname(bills.getPodEnName());
+							}
+						} else {
+							putBoxItem = new PutBoxItems();
+							putBoxItem.setBoxClass(putBox.getBusType());
+							putBoxItem.setBoxBelongsTo("SOC");
+							putBoxItem.setBoxCondition("新");
+							putBoxItem.setBoxStatus("好");
+							putBoxItem.setPid(putBox.getId());
+							putBoxItem.setContainerNumber(archives.getContainerNumber());
+							putBoxItem.setBoxCode(item.getCntrNo());
+							putBoxItem.setBoxType(item.getCntrTypeCode());
+							putBoxItem.setMblno(item.getMblno());
+							putBoxItem.setBoxDynamics("空箱进场");
+							putBoxItem.setStatus("待使用");
+							putBoxItem.setPolCyId(bills.getPodId());
+							putBoxItem.setPolCyCode(bills.getPodCode());
+							putBoxItem.setPolCyCname(bills.getPodCnName());
+							putBoxItem.setPolCyEname(bills.getPodEnName());
+						}
+						putBoxItemsNewList.add(putBoxItem);
+					} else {
+						throw new RuntimeException("未查到pod放箱号单据信息");
+					}
+				}
+			}
+		}
+		if (!putBoxItemsNewList.isEmpty()) {
+			putBoxItemsService.saveOrUpdateBatch(putBoxItemsNewList);
+			for (PutBoxItems item : putBoxItemsNewList) {
+				PutBox putBox = putBoxNewList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
+				if (putBox != null) {
+					//记录箱轨迹信息
+					ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
+					archivesTrajectory.setPortId(putBox.getPolId());
+					archivesTrajectory.setPortCode(putBox.getPolCode());
+					archivesTrajectory.setPortCname(putBox.getPolCname());
+					archivesTrajectory.setPortEname(putBox.getPolEname());
+					archivesTrajectory.setStationId(putBox.getPolStationId());
+					archivesTrajectory.setStationCode(putBox.getPolStationCode());
+					archivesTrajectory.setStationCname(putBox.getPolStationCname());
+					archivesTrajectory.setStationEname(putBox.getPolStationEname());
+					archivesTrajectory.setContainerNumber(item.getContainerNumber());
+					archivesTrajectory.setBoxType(item.getBoxType());
+					archivesTrajectory.setBoxCategory(item.getBoxClass());
+					archivesTrajectory.setBoxEastId(item.getBoxEastId());
+					archivesTrajectory.setBoxEastName(item.getBoxEastName());
+					archivesTrajectory.setMblno(item.getMblno());
+					archivesTrajectory.setBoxDynamics("空箱进场");
+					archivesTrajectory.setStatus(item.getBoxDynamics());
+					archivesTrajectory.setBillType(putBox.getBusType());
+					archivesTrajectory.setCode(item.getBoxCode());
+					archivesTrajectory.setNewDate(new Date());
+					archivesTrajectory.setCreateTime(new Date());
+					archivesTrajectory.setCreateUser(AuthUtil.getUserId());
+					archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
+					archivesTrajectory.setTenantId(AuthUtil.getTenantId());
+					archivesTrajectory.setSrcId(putBox.getId());
+					archivesTrajectoryMapper.insert(archivesTrajectory);
+				}
+			}
+		}
+		//计算超期箱使费
+		this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList);
 
 		return null;
 	}
+
+	private void countOverdueFeeV1(Bills billsHYJK, List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
+		List<FeeCenter> feeCenterList = new ArrayList<>();
+		//超期标准
+		List<StorageFees> storageFeesList = storageFeesService.list(new LambdaQueryWrapper<StorageFees>()
+			.eq(StorageFees::getTenantId, AuthUtil.getTenantId())
+			.eq(StorageFees::getIsDeleted, 0)
+			.eq(StorageFees::getBranchId, billsHYJK.getBranchId()));
+		if (storageFeesList.isEmpty()) {
+			throw new RuntimeException("请先维护基础资料-超期标准");
+		}
+		List<Long> idList = storageFeesList.stream().map(StorageFees::getId).collect(Collectors.toList());
+		//超期标准明细
+		List<StorageFeesItems> storageFeesItemsList = storageFeesItemsService.list(new LambdaQueryWrapper<StorageFeesItems>()
+			.eq(StorageFeesItems::getTenantId, AuthUtil.getTenantId())
+			.eq(StorageFeesItems::getIsDeleted, 0)
+			.in(StorageFeesItems::getPid, idList));
+		if (storageFeesItemsList.isEmpty()) {
+			throw new RuntimeException("请先维护基础资料-超期标准");
+		}
+		//超期箱使费
+		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
+			.eq(BFees::getTenantId, AuthUtil.getTenantId())
+			.eq(BFees::getIsDeleted, 0)
+			.eq(BFees::getCode, "CQXSF"));
+		if (fees == null) {
+			throw new RuntimeException("请先维护费用基础信息");
+		}
+		String overdueProportion = sysClient.getParamService("overdue.proportion");
+		if (ObjectUtils.isNull(overdueProportion) || "获取数据失败".equals(overdueProportion)) {
+			throw new RuntimeException("超期箱使费比例");
+		}
+		for (TradingBoxItem item : tradingBoxItemOldList) {
+			//查找OW明细对应主表
+			TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
+			if (tradingBox == null) {
+				throw new RuntimeException("未查到OW单据");
+			}
+			//对应海运进出口单据所属公司本位币
+			String exrateType = currencyUtils.standardCurrency(billsHYJK.getBranchId());
+			//对应海运进出口单据所属公司所有币别
+			List<BCurExrate> curExrateList = currencyUtils.obtainRate(new Date(), "1", billsHYJK.getBranchId());
+			//目的港超期天数
+			if (ObjectUtils.isNotNull(item.getPodEmptyContainerReturnDate()) &&
+				ObjectUtils.isNotNull(billsHYJK.getEta())) {
+				//所属公司具体超期标准
+				StorageFees storageFees = this.getStorageFees(storageFeesList, billsHYJK, "2");
+				if (storageFees == null) {
+					throw new RuntimeException("请先维护基础资料-超期标准");
+				}
+				//所属公司具体超期标准明细
+				List<StorageFeesItems> storageFeesItems = storageFeesItemsList.stream().filter(e -> e.getPid().equals(storageFees.getId()))
+					.collect(Collectors.toList());
+				if (storageFeesItems.isEmpty()) {
+					throw new RuntimeException("请先维护基础资料-超期标准");
+				}
+				LocalDateTime ldt1 = item.getPodEmptyContainerReturnDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+				LocalDateTime ldt2 = billsHYJK.getEta().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
+				long days = ChronoUnit.DAYS.between(ldt2, ldt1);
+				//超期天数
+				int overdueDays = 0;
+				if (ObjectUtils.isNull(billsHYJK.getPodFreeBoxUseDays()) || 0 == billsHYJK.getPodFreeBoxUseDays() ||
+					days > billsHYJK.getPodFreeBoxUseDays()) {
+					overdueDays = (int) (days - billsHYJK.getPodFreeBoxUseDays());
+				}
+				if (overdueDays != 0) {
+					FeeCenter feeCenter = this.addFeeCenter(tradingBox, item, billsHYJK, fees, storageFeesItems, curExrateList, overdueDays, exrateType);
+					if (feeCenter != null) {
+						feeCenterList.add(feeCenter);
+						FeeCenter feeCenterC = new FeeCenter();
+						BeanUtil.copyProperties(feeCenter, feeCenterC);
+						feeCenterC.setDc("C");
+						feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion)).setScale(2, RoundingMode.HALF_UP));
+						feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
+						feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
+						feeCenterList.add(feeCenterC);
+					}
+				}
+			}
+		}
+		if (!feeCenterList.isEmpty()) {
+			feeCenterService.saveBatch(feeCenterList);
+		}
+	}
 }

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/RouteCostServiceImpl.java

@@ -876,16 +876,20 @@ public class RouteCostServiceImpl extends ServiceImpl<RouteCostMapper, RouteCost
 				for (String itemType : boxType) {
 					RTFDProfitExcel excel = new RTFDProfitExcel();
 					excel.setBoxType(itemType);
+					excel.setShippingCompanyCname(itemPol.getShippingCompanyCname());
+					excel.setShippingCompanyCnamePodL(itemPod.getShippingCompanyCname());
 					excel.setPolCname(itemPol.getPodCname());
 					excel.setPodLCname(itemPol.getDestinationCname());
 					excel.setPodCname(itemPod.getDestinationCname());
 					//获取POL-POD&L单据明细中对应箱型利润
 					BigDecimal profitPol = costItemListPol.stream().filter(e -> e.getBoxType().equals(itemType)).map(RouteCostItem::getProfit)
 						.reduce(BigDecimal.ZERO, BigDecimal::add);
+					excel.setProfitPol(profitPol);
 					//获取POD&L-POD单据明细中对应箱型利润
 					BigDecimal profitPod = costItemListPod.stream().filter(e -> e.getBoxType().equals(itemType) &&
 							e.getPid().equals(itemPod.getId())).map(RouteCostItem::getProfit)
 						.reduce(BigDecimal.ZERO, BigDecimal::add);
+					excel.setProfitPodL(profitPod);
 					excel.setProfit(profitPol.add(profitPod));
 					excel.setRemarks(itemPod.getRemarks());
 					list.add(excel);

+ 25 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/UseBoxPlanItemServiceImpl.java

@@ -16,6 +16,8 @@
  */
 package org.springblade.los.box.service.impl;
 
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
 import org.springblade.los.box.entity.UseBoxPlanItem;
 import org.springblade.los.box.excel.UseBoxPlanItemExcel;
 import org.springblade.los.box.vo.UseBoxPlanItemVO;
@@ -24,7 +26,9 @@ import org.springblade.los.box.service.IUseBoxPlanItemService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -46,4 +50,25 @@ public class UseBoxPlanItemServiceImpl extends ServiceImpl<UseBoxPlanItemMapper,
 		return baseMapper.exportUseBoxPlanItem(useBoxPlanItem);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R submitList(List<UseBoxPlanItem> useBoxPlanItemList) {
+		if (useBoxPlanItemList.isEmpty()){
+			throw new RuntimeException("缺少必要参数");
+		}
+		for (UseBoxPlanItem item : useBoxPlanItemList){
+			if (item.getId() == null) {
+				item.setCreateTime(new Date());
+				item.setCreateUser(AuthUtil.getUserId());
+				item.setCreateUserName(AuthUtil.getUserName());
+			} else {
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+			}
+		}
+		this.saveOrUpdateBatch(useBoxPlanItemList);
+		return R.data(useBoxPlanItemList);
+	}
+
 }

+ 17 - 5
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/controller/BookingCabinController.java

@@ -88,9 +88,9 @@ public class BookingCabinController extends BladeController {
 			lambdaQueryWrapper.ge(Bills::getEtd, bills.getEtdList().get(0));
 			lambdaQueryWrapper.le(Bills::getEtd, bills.getEtdList().get(1));
 		}
-		if (ObjectUtils.isNotNull(bills.getEtaList()) && !bills.getEtaList().isEmpty()) {
-			lambdaQueryWrapper.ge(Bills::getEta, bills.getEtaList().get(0));
-			lambdaQueryWrapper.le(Bills::getEta, bills.getEtaList().get(1));
+		if (ObjectUtils.isNotNull(bills.getBookingDateList()) && !bills.getBookingDateList().isEmpty()) {
+			lambdaQueryWrapper.ge(Bills::getBookingDate, bills.getBookingDateList().get(0));
+			lambdaQueryWrapper.le(Bills::getBookingDate, bills.getBookingDateList().get(1));
 		}
 		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
 			lambdaQueryWrapper.eq(Bills::getBranchId, AuthUtil.getDeptId());
@@ -114,7 +114,19 @@ public class BookingCabinController extends BladeController {
 			.eq(ObjectUtils.isNotNull(bills.getSeaType()), Bills::getSeaType, bills.getSeaType())
 			.eq(ObjectUtils.isNotNull(bills.getStatus()), Bills::getStatus, bills.getStatus())
 			.orderByDesc(Bills::getCreateTime);
-		lambdaQueryWrapper.eq(ObjectUtils.isNotNull(bills.getBillStatus()), Bills::getBillStatus, bills.getBillStatus());
+		if (ObjectUtils.isNotNull(bills.getBillStatus())) {
+			if (1 == bills.getBillStatus()) {
+				// todo 录入
+			} else if (2 == bills.getBillStatus()) {
+				// todo 提交
+			} else if (3 == bills.getBillStatus()) {
+				// todo 受理
+			} else if (4 == bills.getBillStatus()) {
+				// todo 待确认
+			} else if (5 == bills.getBillStatus()) {
+				lambdaQueryWrapper.eq(Bills::getIssueStatus, "1");
+			}
+		}
 		IPage<Bills> pages = billsService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}
@@ -151,7 +163,7 @@ public class BookingCabinController extends BladeController {
 	 */
 	@GetMapping("/copyBillsBooking")
 	@RepeatSubmit
-	public R copyBillsBooking( Bills bills) {
+	public R copyBillsBooking(Bills bills) {
 		Bills declare = billsService.copyBillsBooking(bills);
 		return R.data(declare);
 	}

+ 12 - 59
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java

@@ -189,53 +189,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			.eq(Bills::getMblno, bills.getMblno())
 			.eq(Bills::getBusinessType, bills.getBusinessType())
 		);
-		if (ObjectUtils.isNotNull(bills.getVesselCnName())) {
-			BVessels vessels = vesselsMapper.selectOne(new LambdaQueryWrapper<BVessels>()
-				.eq(BVessels::getTenantId, AuthUtil.getTenantId())
-				.eq(BVessels::getIsDeleted, 0)
-				.eq(BVessels::getCnName, bills.getVesselCnName()));
-			if (vessels != null) {
-				bills.setVesselId(vessels.getId());
-				bills.setVesselCnName(vessels.getCnName());
-				bills.setVesselEnName(vessels.getEnName());
-			} else {
-				BVessels bVessels = new BVessels();
-				bVessels.setCnName(bills.getVesselCnName());
-				bVessels.setCode(bills.getVesselEnName());
-				bVessels.setEnName(bills.getVesselEnName());
-				vesselsMapper.insert(bVessels);
-				bills.setVesselId(bVessels.getId());
-				bills.setVesselCnName(bVessels.getCnName());
-				bills.setVesselEnName(bVessels.getEnName());
-			}
-		}
-		if (ObjectUtils.isNotNull(bills.getCorpAttnName())) {
-			BCorpsAttn corpsAttn = corpsAttnMapper.selectOne(new LambdaQueryWrapper<BCorpsAttn>()
-				.eq(BCorpsAttn::getTenantId, AuthUtil.getTenantId())
-				.eq(BCorpsAttn::getIsDeleted, 0)
-				.eq(BCorpsAttn::getCname, bills.getCorpAttnName())
-				.eq(BCorpsAttn::getTel, bills.getCorpAttnTel())
-				.eq(BCorpsAttn::getEmail, bills.getCorpAttnEmail())
-			);
-			if (corpsAttn != null) {
-				bills.setCorpAttnId(corpsAttn.getId());
-				bills.setCorpAttnName(corpsAttn.getCname());
-				bills.setCorpAttnTel(corpsAttn.getTel());
-				bills.setCorpAttnEmail(corpsAttn.getEmail());
-			} else {
-				BCorpsAttn attn = new BCorpsAttn();
-				attn.setCname(bills.getCorpAttnName());
-				attn.setTel(bills.getCorpAttnTel());
-				attn.setEmail(bills.getCorpAttnEmail());
-				attn.setPid(bills.getCorpId());
-				attn.setCode(bills.getCorpAttnName());
-				corpsAttnMapper.insert(attn);
-				bills.setCorpAttnId(attn.getId());
-				bills.setCorpAttnName(attn.getCname());
-				bills.setCorpAttnTel(attn.getTel());
-				bills.setCorpAttnEmail(attn.getEmail());
-			}
-		}
 		if (ObjectUtils.isNotNull(bills.getBillDate())) {
 			LocalDate date = bills.getBillDate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
 			int year = date.getYear();
@@ -314,6 +267,18 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			bills.setUpdateUser(AuthUtil.getUserId());
 			bills.setUpdateTime(new Date());
 			bills.setUpdateUserName(AuthUtil.getUserName());
+			if (ObjectUtils.isNotNull(bills.getMblno()) && ObjectUtils.isNotNull(bills.getTemporaryId())) {
+				Bills bills1 = new Bills();
+				bills1.setMblno(bills.getMblno());
+				bills1.setVesselId(bills.getVesselId());
+				bills1.setVesselCnName(bills.getVesselCnName());
+				bills1.setVesselEnName(bills.getVesselEnName());
+				bills1.setVoyageNo(bills.getVoyageNo());
+				bills1.setReturnDate(bills.getReturnDate());
+				bills1.setReturnEmptyDate(bills.getReturnEmptyDate());
+				bills1.setId(bills.getTemporaryId());
+				this.updateById(bills1);
+			}
 		}
 		Integer V20 = 0;
 		Integer V40 = 0;
@@ -549,18 +514,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		BigDecimal measurement = bills.getMeasurement();
 		//主单应加上分单费用
 		if ("MM".equals(bills.getBillType()) && ObjectUtils.isNotNull(bills.getId())) {
-			if (ObjectUtils.isNotNull(bills.getMblno()) && ObjectUtils.isNotNull(bills.getTemporaryId())) {
-				Bills bills1 = new Bills();
-				bills1.setMblno(bills.getMblno());
-				bills1.setVesselId(bills.getVesselId());
-				bills1.setVesselCnName(bills.getVesselCnName());
-				bills1.setVesselEnName(bills.getVesselEnName());
-				bills1.setVoyageNo(bills.getVoyageNo());
-				bills1.setReturnDate(bills.getReturnDate());
-				bills1.setReturnEmptyDate(bills.getReturnEmptyDate());
-				bills1.setId(bills.getTemporaryId());
-				this.updateById(bills1);
-			}
 			bills.setMasterBillNo(bills.getBillNo());
 			//主单信息同步分单
 			List<Bills> details = this.synchronous(bills);

+ 21 - 1
blade-service/blade-los/src/main/java/org/springblade/los/excel/RTFDProfitExcel.java

@@ -57,6 +57,16 @@ public class RTFDProfitExcel implements Serializable {
 	@ExcelProperty(value = "POL")
 	private String polCname;
 	/**
+	 * POL承运人
+	 */
+	@ExcelProperty(value = "承运人")
+	private String shippingCompanyCname;
+	/**
+	 * POL利润
+	 */
+	@ExcelProperty(value = "利润")
+	private BigDecimal profitPol;
+	/**
 	 * POD&L
 	 */
 	@ExcelIgnore
@@ -67,6 +77,16 @@ public class RTFDProfitExcel implements Serializable {
 	@ExcelProperty(value = "POD&L")
 	private String podLCname;
 	/**
+	 * POD&L承运人
+	 */
+	@ExcelProperty(value = "承运人")
+	private String shippingCompanyCnamePodL;
+	/**
+	 * POD&L利润
+	 */
+	@ExcelProperty(value = "利润")
+	private BigDecimal profitPodL;
+	/**
 	 * POD
 	 */
 	@ExcelIgnore
@@ -80,7 +100,7 @@ public class RTFDProfitExcel implements Serializable {
 	/**
 	 * 利润
 	 */
-	@ExcelProperty(value = "利润")
+	@ExcelProperty(value = "合计利润")
 	private BigDecimal profit;
 
 	/**