Просмотр исходного кода

1.箱管调箱增加明细导入接口调试及问题修改
2.增加代理费配置表及相关接口及调试
3.箱档案增加字段是否调拨箱
4.场站api数据同步判断是否调拨箱管,同步箱档案状态
5.主单提取成本接口新计算逻辑修改

纪新园 5 дней назад
Родитель
Сommit
3ac1c6c5b0
19 измененных файлов с 2033 добавлено и 30 удалено
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/Archives.java
  2. 1 6
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/TransferBoxExcel.java
  3. 61 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java
  4. 48 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/dto/AgencyFeeSettingDTO.java
  5. 262 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/entity/AgencyFeeSetting.java
  6. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/vo/AgencyFeeSettingVO.java
  7. 7 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java
  8. 1 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/RouteCostController.java
  9. 4 4
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxItemController.java
  10. 10 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/service/impl/BoxDynamicsRecordServiceImpl.java
  11. 0 17
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxItemServiceImpl.java
  12. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java
  13. 10 1
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  14. 145 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/controller/AgencyFeeSettingController.java
  15. 44 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/mapper/AgencyFeeSettingMapper.java
  16. 71 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/mapper/AgencyFeeSettingMapper.xml
  17. 45 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/service/IAgencyFeeSettingService.java
  18. 1275 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/service/impl/AgencyFeeSettingServiceImpl.java
  19. 4 1
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java

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

@@ -348,6 +348,12 @@ public class Archives implements Serializable {
 	@ApiModelProperty(value = "放箱号类型OW")
 	private String containerNumberTypeOw;
 
+	/**
+	 * 是否调拨
+	 */
+	@ApiModelProperty(value = "是否调拨")
+	private String whetherTransfer;
+
 
 	/**
 	 * 文件

+ 1 - 6
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/TransferBoxExcel.java

@@ -52,7 +52,7 @@ public class TransferBoxExcel implements Serializable {
 	/**
 	 * 箱种类
 	 */
-	@ExcelProperty(value = "箱种类")
+	@ExcelProperty(value = "箱种类*")
 	private String boxCategory;
 
 	/**
@@ -67,11 +67,6 @@ public class TransferBoxExcel implements Serializable {
 	private String boxCondition;
 
 	/**
-	 * 场站
-	 */
-	@ExcelProperty(value = "场站*")
-	private String stationCname;
-	/**
 	 * 进场日期
 	 */
 	@ExcelProperty(value = "进场日期")

+ 61 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java

@@ -2470,8 +2470,39 @@ public class Bills implements Serializable {
 	 */
 	@TableField(exist = false)
 	private String ventilation;
+	/**
+	 * 入货时间
+	 */
+	@TableField(exist = false)
+	private String goodsTime;
+
+	/**
+	 * 截单时间
+	 */
+	@TableField(exist = false)
+	private String clearanceTime;
 
 	/**
+	 * 截VGM时间
+	 */
+	@TableField(exist = false)
+	private String vgmDeadline;
+	/**
+	 * 到厂时间
+	 */
+	@TableField(exist = false)
+	private String timeOn;
+	/**
+	 * 返回场站时间
+	 */
+	@TableField(exist = false)
+	private String endTime;
+	/**
+	 * 派车时间
+	 */
+	@TableField(exist = false)
+	private String dispatchTime;
+	/**
 	 * 入货时间
 	 */
 	@TableField(exist = false)
@@ -2747,4 +2778,34 @@ public class Bills implements Serializable {
 	@TableField(exist = false)
 	private String address2;
 
+	/**
+	 * 工厂联系人
+	 */
+	@TableField(exist = false)
+	private String factoryName;
+
+	/**
+	 * 工厂联地址
+	 */
+	@TableField(exist = false)
+	private String factoryAddress;
+
+	/**
+	 * 工厂联系人
+	 */
+	@TableField(exist = false)
+	private String factoryContacts;
+
+	/**
+	 * 工厂联系电话
+	 */
+	@TableField(exist = false)
+	private String factoryTel;
+
+	/**
+	 * 运单号
+	 */
+	@TableField(exist = false)
+	private String trackingNumber;
+
 }

+ 48 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/dto/AgencyFeeSettingDTO.java

@@ -0,0 +1,48 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.dto;
+
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+/**
+ * 代理费设置数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class AgencyFeeSettingDTO extends AgencyFeeSetting {
+	private static final long serialVersionUID = 1L;
+
+
+
+	/**
+	 * 箱型
+	 */
+	private String boxType;
+
+	/**
+	 * 单价
+	 */
+	private BigDecimal price;
+
+}

+ 262 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/entity/AgencyFeeSetting.java

@@ -0,0 +1,262 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 代理费设置实体类
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+@Data
+@TableName("los_agency_fee_setting")
+@ApiModel(value = "AgencyFeeSetting对象", description = "代理费设置")
+public class AgencyFeeSetting implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 创建人 Id
+	 */
+	@ApiModelProperty(value = "创建人 Id")
+	private Long createUser;
+	/**
+	 * 创建人
+	 */
+	@ApiModelProperty(value = "创建人")
+	private String createUserName;
+	/**
+	 * 创建时间
+	 */
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	 * 修改人 Id
+	 */
+	@ApiModelProperty(value = "修改人 Id")
+	private Long updateUser;
+	/**
+	 * 修改人
+	 */
+	@ApiModelProperty(value = "修改人")
+	private String updateUserName;
+	/**
+	 * 修改时间
+	 */
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 版本
+	 */
+	@ApiModelProperty(value = "版本")
+	private String version;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 系统号
+	 */
+	@ApiModelProperty(value = "系统号")
+	private String sysNo;
+	/**
+	 * 分公司
+	 */
+	@ApiModelProperty(value = "分公司")
+	private String branchName;
+	/**
+	 * 装货港 id
+	 */
+	@ApiModelProperty(value = "装货港 id")
+	private String polId;
+	/**
+	 * 装货港代码
+	 */
+	@ApiModelProperty(value = "装货港代码")
+	private String polCode;
+	/**
+	 * 装货港英文名称
+	 */
+	@ApiModelProperty(value = "装货港英文名称")
+	private String polCnName;
+	/**
+	 * 装货港英文名称
+	 */
+	@ApiModelProperty(value = "装货港英文名称")
+	private String polEnName;
+	/**
+	 * 卸货港 id
+	 */
+	@ApiModelProperty(value = "卸货港 id")
+	private String podId;
+	/**
+	 * 卸货港代码
+	 */
+	@ApiModelProperty(value = "卸货港代码")
+	private String podCode;
+	/**
+	 * 卸货港中文名称
+	 */
+	@ApiModelProperty(value = "卸货港中文名称")
+	private String podCnName;
+	/**
+	 * 卸货港英文名称
+	 */
+	@ApiModelProperty(value = "卸货港英文名称")
+	private String podEnName;
+	/**
+	 * 基本港DF自营自有箱费率
+	 */
+	@ApiModelProperty(value = "基本港DF自营自有箱费率")
+	private BigDecimal basicDfSelfOperatedOwn;
+	/**
+	 * 基本港DF自营代理箱费率
+	 */
+	@ApiModelProperty(value = "基本港DF自营代理箱费率")
+	private BigDecimal basicDfSelfOperatedAgent;
+	/**
+	 * 基本港DF自营空箱调用费率
+	 */
+	@ApiModelProperty(value = "基本港DF自营空箱调用费率")
+	private BigDecimal basicDfSelfOperatedInvoke;
+	/**
+	 * 基本港DF合营自有箱费率
+	 */
+	@ApiModelProperty(value = "基本港DF合营自有箱费率")
+	private BigDecimal basicDfJointVentureOwn;
+	/**
+	 * 基本港DF合营代理箱费率
+	 */
+	@ApiModelProperty(value = "基本港DF合营代理箱费率")
+	private BigDecimal basicDfJointVentureAgent;
+	/**
+	 * 基本港DF合营空箱调用费率
+	 */
+	@ApiModelProperty(value = "基本港DF合营空箱调用费率")
+	private BigDecimal basicDfJointVentureInvoke;
+	/**
+	 * 基本港OPEN/CSA自有箱费率
+	 */
+	@ApiModelProperty(value = "基本港OPEN/CSA自有箱费率")
+	private BigDecimal basicOpenCsaOwn;
+	/**
+	 * 基本港OPEN/CSA代理箱费率
+	 */
+	@ApiModelProperty(value = "基本港OPEN/CSA代理箱费率")
+	private BigDecimal basicOpenCsaAgent;
+	/**
+	 * 基本港OPEN/CSA空箱调用费率
+	 */
+	@ApiModelProperty(value = "基本港OPEN/CSA空箱调用费率")
+	private BigDecimal basicOpenCsaInvoke;
+	/**
+	 * 非基本港DF自营自有箱费率
+	 */
+	@ApiModelProperty(value = "非基本港DF自营自有箱费率")
+	private BigDecimal notBasicDfSelfOperatedOwn;
+	/**
+	 * 非基本港DF自营代理箱费率
+	 */
+	@ApiModelProperty(value = "非基本港DF自营代理箱费率")
+	private BigDecimal notBasicDfSelfOperatedAgent;
+	/**
+	 * 非基本港DF自营空箱调用费率
+	 */
+	@ApiModelProperty(value = "非基本港DF自营空箱调用费率")
+	private BigDecimal notBasicDfSelfOperatedInvoke;
+	/**
+	 * 非基本港DF合营自有箱费率
+	 */
+	@ApiModelProperty(value = "非基本港DF合营自有箱费率")
+	private BigDecimal notBasicDfJointVentureOwn;
+	/**
+	 * 非基本港DF合营代理箱费率
+	 */
+	@ApiModelProperty(value = "非基本港DF合营代理箱费率")
+	private BigDecimal notBasicDfJointVentureAgent;
+	/**
+	 * 非基本港DF合营空箱调用费率
+	 */
+	@ApiModelProperty(value = "非基本港DF合营空箱调用费率")
+	private BigDecimal notBasicDfJointVentureInvoke;
+	/**
+	 * 非基本港OPEN/CSA自有箱费率
+	 */
+	@ApiModelProperty(value = "非基本港OPEN/CSA自有箱费率")
+	private BigDecimal notBasicOpenCsaOwn;
+	/**
+	 * 非基本港OPEN/CSA代理箱费率
+	 */
+	@ApiModelProperty(value = "非基本港OPEN/CSA代理箱费率")
+	private BigDecimal notBasicOpenCsaAgent;
+	/**
+	 * 非基本港OPEN/CSA空箱调用费率
+	 */
+	@ApiModelProperty(value = "非基本港OPEN/CSA空箱调用费率")
+	private BigDecimal notBasicOpenCsaInvoke;
+	/**
+	 * 有效期启
+	 */
+	@ApiModelProperty(value = "有效期启")
+	private Date validityPeriodStart;
+	/**
+	 * 有效期止
+	 */
+	@ApiModelProperty(value = "有效期止")
+	private Date validityPeriodEnd;
+	/**
+	 * 租户号
+	 */
+	@ApiModelProperty(value = "租户号")
+	private String tenantId;
+
+	/**
+	 * 编码生成code
+	 */
+	@TableField(exist = false)
+	private String billNoFormat;
+
+	/**
+	 * 业务类型表 code
+	 */
+	@TableField(exist = false)
+	private String businessTypeCode;
+
+
+}

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/finance/agency/vo/AgencyFeeSettingVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.vo;
+
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 代理费设置视图实体类
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "AgencyFeeSettingVO对象", description = "代理费设置")
+public class AgencyFeeSettingVO extends AgencyFeeSetting {
+	private static final long serialVersionUID = 1L;
+
+}

+ 7 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java

@@ -1600,6 +1600,13 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				bills.setCommodityDescrs(bills.getCommodityDescr());
 				bills = this.dictionaryConversion(bills);
 				bills = this.assignmentSeaBillsDetail(bills);
+				if (ObjectUtils.isNotNull(bills.getOperatorId())) {
+					R<User> userR = userClient.userInfoById(bills.getOperatorId());
+					if (userR.isSuccess() && ObjectUtils.isNotNull(userR.getData())) {
+						bills.setOperatorTel(userR.getData().getPhone());
+						bills.setOperatorEmail(userR.getData().getEmail());
+					}
+				}
 //				bills.setFM(MagicValues.FM);
 				List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
 					.eq(PreContainers::getTenantId, AuthUtil.getTenantId())

+ 1 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/RouteCostController.java

@@ -95,6 +95,7 @@ public class RouteCostController extends BladeController {
 			.eq(RouteCost::getBusinessType, routeCost.getBusinessType())
 			.eq(ObjectUtils.isNotNull(routeCost.getStatus()), RouteCost::getStatus, routeCost.getStatus())
 			.like(ObjectUtils.isNotNull(routeCost.getBusinessNo()), RouteCost::getBusinessNo, routeCost.getBusinessNo())
+			.like(ObjectUtils.isNotNull(routeCost.getTransportationTerms()), RouteCost::getTransportationTerms, routeCost.getTransportationTerms())
 			.and(ObjectUtils.isNotNull(routeCost.getPodCname()), i -> i.like(RouteCost::getPodCname, routeCost.getPodCname()).or()
 				.like(RouteCost::getPodEname, routeCost.getPodCname()).or().like(RouteCost::getPodCode, routeCost.getPodCname()))
 			.and(ObjectUtils.isNotNull(routeCost.getDestinationCname()), i -> i.like(RouteCost::getDestinationCname, routeCost.getDestinationCname()).or()

+ 4 - 4
blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxItemController.java

@@ -35,10 +35,7 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.los.Util.BoxNumUtils;
 import org.springblade.los.box.entity.TradingBox;
 import org.springblade.los.box.entity.TradingBoxItem;
-import org.springblade.los.box.excel.AgentBoxItemExcel;
-import org.springblade.los.box.excel.BoxFeeItemExcel;
-import org.springblade.los.box.excel.RentalBoxItemExcel;
-import org.springblade.los.box.excel.TradingBoxItemExcel;
+import org.springblade.los.box.excel.*;
 import org.springblade.los.box.service.ITradingBoxItemService;
 import org.springblade.los.box.service.ITradingBoxService;
 import org.springframework.web.bind.annotation.*;
@@ -313,6 +310,9 @@ public class TradingBoxItemController extends BladeController {
 		}else if ("4".equals(type)){
 			List<BoxFeeItemExcel> list = new ArrayList<>();
 			ExcelUtil.export(response, "导入箱明细模板-箱管费用", "箱明细", list, BoxFeeItemExcel.class);
+		}else if ("5".equals(type)){
+			List<TransferBoxExcel> list = new ArrayList<>();
+			ExcelUtil.export(response, "导入箱明细模板-箱管调箱", "箱明细", list, TransferBoxExcel.class);
 		}
 	}
 

+ 10 - 1
blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/service/impl/BoxDynamicsRecordServiceImpl.java

@@ -911,6 +911,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 						archives.setBoxStatus(recordItems.getBoxStatus());
 						archives.setNewDate(recordItems.getApproachExitDate());
 						archives.setBoxDynamics("空箱进场");
+						archives.setWhetherTransfer("0");
 						archives.setAddressId(billsHYJK.getPodId());
 						archives.setAddressCode(billsHYJK.getPodCode());
 						archives.setAddressCname(billsHYJK.getPodCnName());
@@ -1452,6 +1453,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setStatus("待使用");
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("调箱进场");
+							archives.setWhetherTransfer("1");
 							archives.setAddressId(item.getPortId());
 							archives.setAddressCode(item.getPortCode());
 							archives.setAddressCname(item.getPortCname());
@@ -1473,6 +1475,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setBoxStatus(item.getBoxStatus());
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("调箱进场");
+							archives.setWhetherTransfer("1");
 							archives.setBoxBelongsTo("SOC");
 							archives.setContainerNumber(item.getContainerNumber());
 							archives.setContainerNumberType(putBox.getBusType());
@@ -1603,7 +1606,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 										} else if ("OW-F".equals(tradingBox.getType())) {
 											tradingBoxItem.setBoxCategory("OW(放)");
 										}
-										putBoxItem.setBoxClass(putBox.getBusType());
+//										putBoxItem.setBoxClass(putBox.getBusType());
 										tradingBoxItem.setBoxCondition("新");
 										tradingBoxItem.setBoxStatus(item.getBoxStatus());
 										tradingBoxItem.setPid(tradingBox.getId());
@@ -1919,6 +1922,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setStatus("使用中");
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("调箱出场");
+							archives.setWhetherTransfer("1");
 							archives.setAddressId(item.getPortId());
 							archives.setAddressCode(item.getPortCode());
 							archives.setAddressCname(item.getPortCname());
@@ -1939,6 +1943,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setStatus("使用中");
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("调箱出场");
+							archives.setWhetherTransfer("1");
 							archives.setBoxBelongsTo("SOC");
 							archives.setContainerNumber(item.getContainerNumber());
 							archives.setContainerNumberType(putBoxData.getBusType());
@@ -2395,6 +2400,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setStatus("使用中");
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("空箱出场");
+							archives.setWhetherTransfer("0");
 							archives.setAddressId(item.getPortId());
 							archives.setAddressCode(item.getPortCode());
 							archives.setAddressCname(item.getPortCname());
@@ -2415,6 +2421,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							archives.setStatus("使用中");
 							archives.setNewDate(item.getApproachExitDate());
 							archives.setBoxDynamics("空箱出场");
+							archives.setWhetherTransfer("0");
 							archives.setBoxBelongsTo("SOC");
 							archives.setContainerNumber(item.getContainerNumber());
 							archives.setContainerNumberType(putBoxData.getBusType());
@@ -3212,6 +3219,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 						archives.setStatus("待使用");
 						archives.setNewDate(item.getApproachExitDate());
 						archives.setBoxDynamics("空箱提箱进场");
+						archives.setWhetherTransfer("0");
 						archives.setAddressId(item.getPortId());
 						archives.setAddressCode(item.getPortCode());
 						archives.setAddressCname(item.getPortCname());
@@ -3233,6 +3241,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 						archives.setBoxStatus(item.getBoxStatus());
 						archives.setNewDate(item.getApproachExitDate());
 						archives.setBoxDynamics("空箱提箱进场");
+						archives.setWhetherTransfer("0");
 						archives.setBoxBelongsTo("SOC");
 						archives.setContainerNumber(item.getContainerNumber());
 						archives.setContainerNumberType(putBox.getBusType());

+ 0 - 17
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxItemServiceImpl.java

@@ -305,14 +305,9 @@ public class TradingBoxItemServiceImpl extends ServiceImpl<TradingBoxItemMapper,
 				if (ObjectUtils.isNull(item.getBoxCondition())) {
 					throw new RuntimeException("箱况不能为空");
 				}
-				if (ObjectUtils.isNull(item.getStationCname())) {
-					throw new RuntimeException("场站不能为空");
-				}
 			}
 			boxType = excelList.stream().map(TransferBoxExcel::getBoxType).filter(Objects::nonNull)
 				.distinct().collect(Collectors.toList());
-			station = excelList.stream().map(TransferBoxExcel::getStationCname).filter(Objects::nonNull)
-				.distinct().collect(Collectors.joining(","));
 		}
 		List<TradingBoxItem> itemList = baseMapper.selectList(new LambdaQueryWrapper<TradingBoxItem>()
 			.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
@@ -828,18 +823,6 @@ public class TradingBoxItemServiceImpl extends ServiceImpl<TradingBoxItemMapper,
 				if (bCntrTypes == null) {
 					throw new RuntimeException("箱型:" + item.getBoxType() + "不存在,请先维护基础资料");
 				}
-				if (!corpsList.isEmpty()) {
-					if (ObjectUtils.isNotNull(item.getStationCname())) {
-						BCorps stationCname = corpsList.stream().filter(e -> item.getStationCname().equals(e.getCnName())).findFirst().orElse(null);
-						if (stationCname == null) {
-							throw new RuntimeException("场站:" + item.getStationCname() + "不存在,请先维护基础资料");
-						}
-						tradingBoxItem.setStationId(stationCname.getId());
-						tradingBoxItem.setStationCname(stationCname.getCnName());
-						tradingBoxItem.setStationCode(stationCname.getCode());
-						tradingBoxItem.setStationEname(stationCname.getEnName());
-					}
-				}
 				if (ObjectUtils.isNotNull(item.getPolPickUpDate())){
 					tradingBoxItem.setPolPickUpDate(formatter.parse(item.getPolPickUpDate()));
 				}

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

@@ -407,6 +407,9 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 				}
 			}
 			tradingBoxItemService.saveOrUpdateBatch(tradingBox.getTradingBoxItemsList());
+			if("XGFY".equals(tradingBox.getType())){
+				tradingBox.setActualBoxNumber(tradingBox.getTradingBoxItemsList().size());
+			}
 			tradingBox.setCode(String.join(",", codes));
 			tradingBox.setTradingBoxItemsList(tradingBox.getTradingBoxItemsList());
 		}

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

@@ -574,7 +574,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				item.setVesselCnName(bills.getVesselCnName());
 				item.setVoyageNo(bills.getVoyageNo());
 				item.setMblno(bills.getMblno());
-				item.setHblno(bills.getHblno());
+				if (ObjectUtils.isNotNull(item.getSrcItemId())){
+					item.setHblno(null);
+				}else{
+					item.setHblno(bills.getHblno());
+				}
 				item.setEtd(bills.getEtd());
 				item.setEta(bills.getEta());
 				item.setPolId(bills.getPolId());
@@ -3130,6 +3134,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		if (!containersList.isEmpty()) {
 			List<Containers> containersListNew = new ArrayList<>();
 			for (Containers item : containersList) {
+				if ("SOC".equals(billsJk.getBoxBelongsTo())){
+					if (ObjectUtils.isNull(item.getPodStationId()) || item.getPodStationId() == 0) {
+						throw new RuntimeException("请先维护配箱POD堆场信息");
+					}
+				}
 				item.setSrcId(item.getId());
 				item.setId(null);
 				item.setCreateTime(new Date());

+ 145 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/controller/AgencyFeeSettingController.java

@@ -0,0 +1,145 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.common.annotation.RepeatSubmit;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import org.springblade.los.finance.agency.service.IAgencyFeeSettingService;
+import org.springblade.los.finance.agency.vo.AgencyFeeSettingVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 代理费设置 控制器
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/agencyfeesetting")
+@Api(value = "代理费设置", tags = "代理费设置接口")
+public class AgencyFeeSettingController extends BladeController {
+
+	private final IAgencyFeeSettingService agencyFeeSettingService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入agencyFeeSetting")
+	public R<AgencyFeeSetting> detail(AgencyFeeSetting agencyFeeSetting) {
+		AgencyFeeSetting detail = agencyFeeSettingService.getOne(Condition.getQueryWrapper(agencyFeeSetting));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 代理费设置
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入agencyFeeSetting")
+	public R<IPage<AgencyFeeSetting>> list(AgencyFeeSetting agencyFeeSetting, Query query) {
+		LambdaQueryWrapper<AgencyFeeSetting> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(AgencyFeeSetting::getTenantId, AuthUtil.getTenantId())
+			.eq(AgencyFeeSetting::getIsDeleted, 0)
+			.eq(ObjectUtils.isNotNull(agencyFeeSetting.getPodId()), AgencyFeeSetting::getPodId, agencyFeeSetting.getPodId())
+			.eq(ObjectUtils.isNotNull(agencyFeeSetting.getPolId()), AgencyFeeSetting::getPolId, agencyFeeSetting.getPolId())
+			.orderByDesc(AgencyFeeSetting::getCreateTime);
+		IPage<AgencyFeeSetting> pages = agencyFeeSettingService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 代理费设置
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入agencyFeeSetting")
+	public R<IPage<AgencyFeeSettingVO>> page(AgencyFeeSettingVO agencyFeeSetting, Query query) {
+		IPage<AgencyFeeSettingVO> pages = agencyFeeSettingService.selectAgencyFeeSettingPage(Condition.getPage(query), agencyFeeSetting);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 代理费设置
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入agencyFeeSetting")
+	public R save(@Valid @RequestBody AgencyFeeSetting agencyFeeSetting) {
+		return R.status(agencyFeeSettingService.save(agencyFeeSetting));
+	}
+
+	/**
+	 * 修改 代理费设置
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入agencyFeeSetting")
+	public R update(@Valid @RequestBody AgencyFeeSetting agencyFeeSetting) {
+		return R.status(agencyFeeSettingService.updateById(agencyFeeSetting));
+	}
+
+	/**
+	 * 新增或修改 代理费设置
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入agencyFeeSetting")
+	public R submit(@Valid @RequestBody AgencyFeeSetting agencyFeeSetting) {
+		return agencyFeeSettingService.submit(agencyFeeSetting);
+	}
+
+
+	/**
+	 * 删除 代理费设置
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(agencyFeeSettingService.removeByIds(Func.toLongList(ids)));
+	}
+
+	/**
+	 * 海运费成本导入
+	 */
+	@GetMapping("/costImportBatch")
+	@RepeatSubmit
+	public R costImportBatch(@RequestParam("billsIds") String billsIds, @RequestParam("costId") String costId) {
+		return agencyFeeSettingService.costImportBatch(billsIds, costId);
+	}
+
+
+}

+ 44 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/mapper/AgencyFeeSettingMapper.java

@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.mapper;
+
+import org.apache.ibatis.annotations.Param;
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import org.springblade.los.finance.agency.vo.AgencyFeeSettingVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 代理费设置 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+public interface AgencyFeeSettingMapper extends BaseMapper<AgencyFeeSetting> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param agencyFeeSetting
+	 * @return
+	 */
+	List<AgencyFeeSettingVO> selectAgencyFeeSettingPage(IPage page, AgencyFeeSettingVO agencyFeeSetting);
+
+    List<AgencyFeeSetting> selectListByPolId(@Param("polId") String polId,@Param("date")String date,@Param("tenantId")String tenantId);
+}

+ 71 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/mapper/AgencyFeeSettingMapper.xml

@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.springblade.los.finance.agency.mapper.AgencyFeeSettingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="agencyFeeSettingResultMap" type="org.springblade.los.finance.agency.entity.AgencyFeeSetting">
+        <id column="id" property="id"/>
+        <result column="branch_id" property="branchId"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_user_name" property="createUserName"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_user_name" property="updateUserName"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="version" property="version"/>
+        <result column="remarks" property="remarks"/>
+        <result column="sys_no" property="sysNo"/>
+        <result column="branch_name" property="branchName"/>
+        <result column="pol_id" property="polId"/>
+        <result column="pol_code" property="polCode"/>
+        <result column="pol_cn_name" property="polCnName"/>
+        <result column="pol_en_name" property="polEnName"/>
+        <result column="pod_id" property="podId"/>
+        <result column="pod_code" property="podCode"/>
+        <result column="pod_cn_name" property="podCnName"/>
+        <result column="pod_en_name" property="podEnName"/>
+        <result column="basic_df_self_operated_own" property="basicDfSelfOperatedOwn"/>
+        <result column="basic_df_self_operated_agent" property="basicDfSelfOperatedAgent"/>
+        <result column="basic_df_self_operated_invoke" property="basicDfSelfOperatedInvoke"/>
+        <result column="basic_df_joint_venture_own" property="basicDfJointVentureOwn"/>
+        <result column="basic_df_joint_venture_agent" property="basicDfJointVentureAgent"/>
+        <result column="basic_df_joint_venture_invoke" property="basicDfJointVentureInvoke"/>
+        <result column="basic_open_csa_own" property="basicOpenCsaOwn"/>
+        <result column="basic_open_csa_agent" property="basicOpenCsaAgent"/>
+        <result column="basic_open_csa_invoke" property="basicOpenCsaInvoke"/>
+        <result column="not_basic_df_self_operated_own" property="notBasicDfSelfOperatedOwn"/>
+        <result column="not_basic_df_self_operated_agent" property="notBasicDfSelfOperatedAgent"/>
+        <result column="not_basic_df_self_operated_invoke" property="notBasicDfSelfOperatedInvoke"/>
+        <result column="not_basic_df_joint_venture_own" property="notBasicDfJointVentureOwn"/>
+        <result column="not_basic_df_joint_venture_agent" property="notBasicDfJointVentureAgent"/>
+        <result column="not_basic_df_joint_venture_invoke" property="notBasicDfJointVentureInvoke"/>
+        <result column="not_basic_open_csa_own" property="notBasicOpenCsaOwn"/>
+        <result column="not_basic_open_csa_agent" property="notBasicOpenCsaAgent"/>
+        <result column="not_basic_open_csa_invoke" property="notBasicOpenCsaInvoke"/>
+        <result column="validity_period_start" property="validityPeriodStart"/>
+        <result column="validity_period_end" property="validityPeriodEnd"/>
+    </resultMap>
+
+
+    <select id="selectAgencyFeeSettingPage" resultMap="agencyFeeSettingResultMap">
+        select * from los_agency_fee_setting where is_deleted = 0
+    </select>
+    <select id="selectListByPolId" resultType="org.springblade.los.finance.agency.entity.AgencyFeeSetting">
+        SELECT *
+        FROM los_agency_fee_setting
+        WHERE EXISTS (
+        SELECT 1
+        FROM (
+        SELECT TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(#{polId}, ',', numbers.n), ',', -1)) AS value
+        FROM (
+        SELECT 1 AS n UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5
+        ) numbers
+        WHERE numbers.n &gt;= 1 + (LENGTH(#{polId}) - LENGTH(REPLACE(#{polId}, ',', '')))
+        ) input_values
+        WHERE FIND_IN_SET(input_values.value, los_agency_fee_setting.pol_id) > 0
+        ) and DATE_FORMAT(validity_period_start,'%Y-%m-%d') &gt;= #{date} and DATE_FORMAT(validity_period_end,'%Y-%m-%d') &lt;= #{date}
+        and tenant_id = #{tenantId} and is_deleted = 0
+    </select>
+
+</mapper>

+ 45 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/service/IAgencyFeeSettingService.java

@@ -0,0 +1,45 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.service;
+
+import org.springblade.core.tool.api.R;
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import org.springblade.los.finance.agency.vo.AgencyFeeSettingVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 代理费设置 服务类
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+public interface IAgencyFeeSettingService extends IService<AgencyFeeSetting> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param agencyFeeSetting
+	 * @return
+	 */
+	IPage<AgencyFeeSettingVO> selectAgencyFeeSettingPage(IPage<AgencyFeeSettingVO> page, AgencyFeeSettingVO agencyFeeSetting);
+
+    R costImportBatch(String billsIds, String costId);
+
+	R submit(AgencyFeeSetting agencyFeeSetting);
+}

+ 1275 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/agency/service/impl/AgencyFeeSettingServiceImpl.java

@@ -0,0 +1,1275 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.finance.agency.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.Util.CurrencyUtils;
+import org.springblade.los.basic.business.entity.BusinessType;
+import org.springblade.los.basic.business.service.IBusinessTypeService;
+import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.service.IBCorpsService;
+import org.springblade.los.basic.cur.entity.BCurExrate;
+import org.springblade.los.basic.fees.entity.BFees;
+import org.springblade.los.basic.fees.service.IBFeesService;
+import org.springblade.los.billno.entity.BusinessBillNo;
+import org.springblade.los.billno.service.IBusinessBillNoService;
+import org.springblade.los.box.entity.Archives;
+import org.springblade.los.box.entity.RouteCostItem;
+import org.springblade.los.box.service.IArchivesService;
+import org.springblade.los.box.service.IRouteCostItemService;
+import org.springblade.los.box.service.ITradingBoxService;
+import org.springblade.los.business.mktSlot.entity.MktSlotQuotation;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.entity.Containers;
+import org.springblade.los.business.sea.entity.PreContainers;
+import org.springblade.los.business.sea.service.IBillsService;
+import org.springblade.los.business.sea.service.IContainersService;
+import org.springblade.los.business.sea.service.IPreContainersService;
+import org.springblade.los.finance.agency.dto.AgencyFeeSettingDTO;
+import org.springblade.los.finance.agency.entity.AgencyFeeSetting;
+import org.springblade.los.finance.agency.mapper.AgencyFeeSettingMapper;
+import org.springblade.los.finance.agency.service.IAgencyFeeSettingService;
+import org.springblade.los.finance.agency.vo.AgencyFeeSettingVO;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.service.ICostProfitCalculationService;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
+import org.springblade.system.feign.ISysClient;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 代理费设置 服务实现类
+ *
+ * @author BladeX
+ * @since 2026-01-05
+ */
+@Service
+@AllArgsConstructor
+public class AgencyFeeSettingServiceImpl extends ServiceImpl<AgencyFeeSettingMapper, AgencyFeeSetting> implements IAgencyFeeSettingService {
+
+	private final ISysClient sysClient;
+
+	private final IBillsService billsService;
+
+	private final IBCorpsService bCorpsService;
+
+	private final IPreContainersService preContainersService;
+
+	private final IContainersService containersService;
+
+	private final ITradingBoxService tradingBoxService;
+
+	private final IArchivesService archivesService;
+
+	private final IRouteCostItemService routeCostItemService;
+
+	private final IBFeesService bFeesService;
+
+	private final CurrencyUtils currencyUtils;
+
+	private final ICostProfitCalculationService costProfitCalculationService;
+
+	private final IFeeCenterService feeCenterService;
+
+	private final IBusinessBillNoService businessBillNoService;
+
+	private final IBusinessTypeService bBusinessTypeService;
+
+	@Override
+	public IPage<AgencyFeeSettingVO> selectAgencyFeeSettingPage(IPage<AgencyFeeSettingVO> page, AgencyFeeSettingVO agencyFeeSetting) {
+		return page.setRecords(baseMapper.selectAgencyFeeSettingPage(page, agencyFeeSetting));
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R costImportBatch(String billsIds, String costId) {
+		List<RouteCostItem> routeCostItemList = routeCostItemService.list(new LambdaQueryWrapper<RouteCostItem>()
+			.eq(RouteCostItem::getTenantId, AuthUtil.getTenantId())
+			.eq(RouteCostItem::getIsDeleted, 0)
+			.eq(RouteCostItem::getPid, costId));
+		if (routeCostItemList.isEmpty()) {
+			throw new RuntimeException("未查到成本明细");
+		}
+		List<Bills> billsList = billsService.list(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.apply("find_in_set(id,'" + billsIds + "')"));
+		if (billsList.isEmpty()) {
+			throw new RuntimeException("未查到单据信息");
+		}
+		List<Long> idList = billsList.stream().map(Bills::getId).collect(Collectors.toList());
+		List<Bills> billsListFD = billsService.list(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.in(Bills::getMasterId, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
+		if (billsListFD.isEmpty()) {
+			throw new RuntimeException("未查到分单单据信息");
+		}
+		List<Long> fDIdList = billsListFD.stream().map(Bills::getId).collect(Collectors.toList());
+		List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
+			.eq(Containers::getTenantId, AuthUtil.getTenantId())
+			.eq(Containers::getIsDeleted, 0)
+			.in(Containers::getPid, fDIdList));
+		if (containersList.isEmpty()) {
+			throw new RuntimeException("请先维护配箱信息");
+		}
+		List<String> boxCodeList = containersList.stream().map(Containers::getCntrNo).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+		List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
+			.eq(Archives::getIsDeleted, 0)
+			.eq(Archives::getTenantId, AuthUtil.getTenantId())
+			.in(Archives::getCode, boxCodeList));
+		if (archivesList.isEmpty()) {
+			throw new RuntimeException("箱信息未查到");
+		}
+		String polId = billsListFD.stream().map(Bills::getPolId).filter(Objects::nonNull).distinct().map(String::valueOf)
+			.collect(Collectors.joining(","));
+		if (ObjectUtils.isNull(polId)) {
+			throw new RuntimeException("请先维护分单装货港信息");
+		}
+		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+		List<AgencyFeeSetting> agencyFeeSettingList = baseMapper.selectListByPolId(polId, formatter.format(new Date()), AuthUtil.getTenantId());
+		if (agencyFeeSettingList.isEmpty()) {
+			throw new RuntimeException("请先维护分单对应起运港代理费费率设置");
+		}
+		List<FeeCenter> feeCenterListFD = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FeeCenter::getIsDeleted, 0)
+			.in(FeeCenter::getPid, fDIdList));
+		List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
+			.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
+			.eq(PreContainers::getIsDeleted, 0)
+			.in(PreContainers::getPid, idList));
+		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
+			.eq(BFees::getTenantId, AuthUtil.getTenantId())
+			.eq(BFees::getIsDeleted, 0)
+			.eq(BFees::getCode, "HYF"));
+		if (fees == null) {
+			throw new RuntimeException("未查到海运费信息,请先维护基础资料");
+		}
+		BFees feesFjf = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
+			.eq(BFees::getTenantId, AuthUtil.getTenantId())
+			.eq(BFees::getIsDeleted, 0)
+			.eq(BFees::getCode, "FJF"));
+		if (feesFjf == null) {
+			throw new RuntimeException("未查到附加费信息,请先维护基础资料");
+		}
+		String deptName = "";
+		String branchId = AuthUtil.getDeptId();
+		if (ObjectUtils.isNotNull(branchId)) {
+			R<String> res = sysClient.getDeptName(Long.parseLong(branchId));
+			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+				deptName = res.getData();
+			}
+		}
+		BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+			.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+			.eq(BCorps::getIsDeleted, 0)
+			.eq(BCorps::getCode, "ZBYF"));
+		if (bCorps == null) {
+			throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
+		}
+		List<FeeCenter> list = new ArrayList<>();
+		StringBuilder text = new StringBuilder();
+		for (Bills bills : billsList) {
+			if (0 != bills.getStatus()) {
+				throw new RuntimeException("单号:" + bills.getBillNo() + ",已提交审核或审核通过,导入失败");
+			}
+			String texts = "";
+			if (ObjectUtils.isNull(bills.getMblno())) {
+				texts = texts + "提单号、";
+			}
+			if (ObjectUtils.isNull(bills.getVesselId())) {
+				texts = texts + "船名、";
+			}
+			if (ObjectUtils.isNull(bills.getVoyageNo())) {
+				texts = texts + "航次、";
+			}
+			if (ObjectUtils.isNull(bills.getPodId())) {
+				texts = texts + "卸货港、";
+			}
+			if (ObjectUtils.isNull(bills.getCarrierId())) {
+				texts = texts + "船公司、";
+			}
+			if (ObjectUtils.isNotNull(texts)) {
+				throw new RuntimeException("单号:" + bills.getBillNo() + "," + texts + "不能为空");
+			}
+			bills.setWhetherExtractCost("1");
+			billsService.updateById(bills);
+			List<PreContainers> preContainers = new ArrayList<>();
+			if (!preContainersList.isEmpty()) {
+				preContainers = preContainersList.stream().filter(e -> e.getPid().equals(bills.getId())).collect(Collectors.toList());
+			}
+			if (preContainers.isEmpty()) {
+				continue;
+			}
+			Date date;
+			if ("SE".equals(bills.getBusinessType())) {
+				if (ObjectUtils.isNotNull(bills.getActualEtd())) {
+					date = bills.getActualEtd();
+				} else {
+					date = bills.getEtd();
+				}
+			} else {
+				if (ObjectUtils.isNotNull(bills.getActualEta())) {
+					date = bills.getActualEta();
+				} else {
+					date = bills.getEta();
+				}
+			}
+			AgencyFeeSetting agencyFeeSetting = agencyFeeSettingList.stream().filter(e -> e.getPolId().contains(bills.getPolId() + "")
+				&& e.getPodId().contains(bills.getPodId() + "")).findFirst().orElse(null);
+			if (agencyFeeSetting == null) {
+				List<AgencyFeeSetting> agencyFeeSettings = agencyFeeSettingList.stream().filter(e -> e.getPolId().contains(bills.getPolId() + "")).collect(Collectors.toList());
+				if (!agencyFeeSettings.isEmpty()) {
+					agencyFeeSetting = agencyFeeSettings.get(0);
+				}
+			}
+			if (agencyFeeSetting == null) {
+				continue;
+			}
+			String exrateType = currencyUtils.standardCurrency(branchId);
+			List<BCurExrate> curExrateList = currencyUtils.obtainRate(date, "1", branchId);
+			List<FeeCenter> list1 = new ArrayList<>();
+			List<FeeCenter> feeCentersFdC = new ArrayList<>();
+			if (!billsListFD.isEmpty()) {
+				List<Bills> billsFd = billsListFD.stream().filter(e -> e.getMasterId().equals(bills.getId())).collect(Collectors.toList());
+				for (Bills item : billsFd) {
+					//判断主单下所有分单费用是否存在
+					if (feeCenterListFD.isEmpty()) {
+						continue;
+					}
+					//判断当前循环的分单费用是否存在
+					List<FeeCenter> feeCenterFDListSum = feeCenterListFD.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
+					if (feeCenterFDListSum.isEmpty()) {
+						continue;
+					}
+					//判断当前循环的分单费用是否存在应收海运费
+					List<FeeCenter> feeCenterFDListHYF = feeCenterFDListSum.stream().filter(e -> "D".equals(e.getDc()) &&
+						"HYF".equals(e.getFeeCode())).collect(Collectors.toList());
+					if (feeCenterFDListHYF.isEmpty()) {
+						continue;
+					}
+					//获取当前循环的分单配箱信息
+					List<Containers> containers = containersList.stream().filter(e -> e.getPid().equals(item.getId()))
+						.collect(Collectors.toList());
+					if (containers.isEmpty()) {
+						throw new RuntimeException("分单号:" + item.getHblno() + "未配箱");
+					}
+					//获取当前循环的分单箱型信息
+					List<String> boxType = new ArrayList<>();
+					if (!preContainersList.isEmpty()) {
+						boxType = preContainersList.stream().filter(e -> e.getPid().equals(item.getId())).map(PreContainers::getCntrTypeCode)
+							.distinct().collect(Collectors.toList());
+					}
+					//循环组装对应箱型海运费单价
+					List<AgencyFeeSettingDTO> dtoList = new ArrayList<>();
+					for (String type : boxType) {
+						AgencyFeeSettingDTO dto = new AgencyFeeSettingDTO();
+						List<FeeCenter> feeCenters = feeCenterFDListHYF.stream().filter(e -> type.equals(e.getUnitNo())).collect(Collectors.toList());
+						//判断是否一个箱型一条海运费
+						if (feeCenters.size() > 1) {
+							throw new RuntimeException("分单号:" + item.getHblno() + ",箱型:" + type + "应收海运费存在多条");
+						}
+						dto.setBoxType(type);
+						dto.setPrice(feeCenters.get(0).getPrice());
+						dtoList.add(dto);
+					}
+					//判断分单是否是基本港
+					boolean whetherBasePort = false;
+					if (agencyFeeSetting.getPolId().contains(item.getPolId() + "") && agencyFeeSetting.getPodId().contains(item.getPodId() + "")) {
+						whetherBasePort = true;
+					}
+					//分单本次海运费集合
+					List<FeeCenter> thisFeeCenterList = new ArrayList<>();
+					//分单所有费用集合
+					List<FeeCenter> feeCenterSum = new ArrayList<>(feeCenterFDListSum);
+					//计算分单对应箱型箱号海运费单价
+					for (AgencyFeeSettingDTO dto : dtoList) {
+						//分单对应箱型应收海运费
+						List<FeeCenter> feeCenters = feeCenterFDListHYF.stream().filter(e -> dto.getBoxType().equals(e.getUnitNo())).collect(Collectors.toList());
+						FeeCenter feeCenter = feeCenters.get(0);
+						//分单应付总部海运费数据组装
+						FeeCenter feeCenterC = new FeeCenter();
+						feeCenterC.setBranchId(item.getBranchId());
+						feeCenterC.setBranchName(item.getBranchName());
+						feeCenterC.setBookingAgentId(item.getBookingAgentId());
+						feeCenterC.setBookingAgentCnName(item.getBookingAgentCnName());
+						feeCenterC.setBookingAgentEnName(item.getBookingAgentEnName());
+						feeCenterC.setQuantityCntrDescr(item.getQuantityCntrDescr());
+						feeCenterC.setBillBranchId(item.getBranchId());
+						feeCenterC.setBillBranchName(item.getBranchName());
+						feeCenterC.setTeu(item.getTeu());
+						feeCenterC.setPid(item.getId());
+						feeCenterC.setCntrNo(item.getQuantityCntrTypesDescr());
+						feeCenterC.setBillNo(item.getBillNo());
+						feeCenterC.setBusinessType(item.getBusinessType());
+						feeCenterC.setBillType(item.getBillType());
+						feeCenterC.setBillDate(item.getBillDate());
+						feeCenterC.setBillCorpId(item.getCorpId());
+						feeCenterC.setBillCorpCnName(item.getCorpCnName());
+						feeCenterC.setBillCorpEnName(item.getCorpEnName());
+						feeCenterC.setBillShortName(item.getShortName());
+						feeCenterC.setLineId(item.getLineId());
+						feeCenterC.setLineCnName(item.getLineCnName());
+						feeCenterC.setLineEnName(item.getLineEnName());
+						feeCenterC.setVesselId(item.getVesselId());
+						feeCenterC.setVesselCnName(item.getVesselCnName());
+						feeCenterC.setVesselEnName(item.getVesselEnName());
+						feeCenterC.setVoyageNo(item.getVoyageNo());
+						feeCenterC.setMblno(item.getMblno());
+						feeCenterC.setHblno(item.getHblno());
+						feeCenterC.setEtd(item.getEtd());
+						feeCenterC.setEta(item.getEta());
+						feeCenterC.setPolId(item.getPolId());
+						feeCenterC.setPolCode(item.getPolCode());
+						feeCenterC.setPolCnName(item.getPolCnName());
+						feeCenterC.setPolEnName(item.getPolEnName());
+						feeCenterC.setPodId(item.getPodId());
+						feeCenterC.setPodCode(item.getPodCode());
+						feeCenterC.setPodCnName(item.getPodCnName());
+						feeCenterC.setPodEnName(item.getPodEnName());
+						feeCenterC.setPaymode(item.getMpaymode());
+						feeCenterC.setSort(1);
+						feeCenterC.setFeeId(feeCenter.getId());
+						feeCenterC.setFeeCode(feeCenter.getFeeCode());
+						feeCenterC.setFeeCnName(feeCenter.getFeeCnName());
+						feeCenterC.setFeeEnName(feeCenter.getFeeEnName());
+						feeCenterC.setUnitNo(feeCenter.getUnitNo());
+						feeCenterC.setCurCode(feeCenter.getCurCode());
+						feeCenterC.setExrate(feeCenter.getExrate());
+						feeCenterC.setDc("C");
+						feeCenterC.setCorpType("国内直接客户");
+						feeCenterC.setCorpId(bCorps.getId());
+						feeCenterC.setCorpCnName(bCorps.getCnName());
+						feeCenterC.setCorpEnName(bCorps.getEnName());
+						feeCenterC.setShortName(bCorps.getShortName());
+						feeCenterC.setGenerationCorpId(bCorps.getBookingAgentId());
+						feeCenterC.setGenerationCorpCnName(bCorps.getBookingAgentCnName());
+						feeCenterC.setGenerationCorpEnName(bCorps.getBookingAgentEnName());
+						feeCenterC.setQuantity(new BigDecimal("1"));
+						//获取分单箱型对应箱号数据
+						List<String> boxCode = containers.stream().filter(e -> e.getCntrTypeCode().equals(dto.getBoxType()))
+							.map(Containers::getCntrNo).filter(Objects::nonNull).collect(Collectors.toList());
+						//合计计算费率后海运费
+						BigDecimal amountPrice = new BigDecimal("0.00");
+						//应收海运费用单价
+						BigDecimal price = feeCenter.getPrice();
+						for (String cntrNo : boxCode) {
+							//获取箱号对应箱档案数据
+							Archives archives = archivesList.stream().filter(e -> e.getCode().equals(cntrNo)).findFirst().orElse(null);
+							if (archives == null) {
+								throw new RuntimeException("分单号:" + item.getHblno() + ",箱号:" + cntrNo + "在箱档案中未查到");
+							}
+							if (whetherBasePort) {
+								//基本港
+								if ("DF自营".equals(item.getCabinType())) {
+									//自营箱 需判断是否调拨
+									if ("1".equals(archives.getWhetherTransfer())) {
+										//调拨箱
+										if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicDfSelfOperatedInvoke()) == 0) {
+											amountPrice = amountPrice.add(price);
+										} else {
+											BigDecimal rate = agencyFeeSetting.getBasicDfSelfOperatedInvoke().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+												.setScale(2, RoundingMode.HALF_UP);
+											BigDecimal thisPrice = price.subtract(price.multiply(rate));
+											amountPrice = amountPrice.add(thisPrice);
+										}
+									} else {
+										//非调拨箱
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicDfSelfOperatedAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicDfSelfOperatedAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicDfSelfOperatedOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicDfSelfOperatedOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									}
+								} else {
+									//非自营箱 无需判断是否调拨
+									if ("DF合营".equals(item.getCabinType())) {
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicDfJointVentureAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicDfJointVentureAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicDfJointVentureOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicDfJointVentureOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									} else {
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicOpenCsaAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicOpenCsaAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getBasicOpenCsaOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getBasicOpenCsaOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									}
+								}
+							} else {
+								//非基本港
+								if ("DF自营".equals(item.getCabinType())) {
+									//自营箱 需判断是否调拨
+									if ("1".equals(archives.getWhetherTransfer())) {
+										//调拨箱
+										if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicDfSelfOperatedInvoke()) == 0) {
+											amountPrice = amountPrice.add(price);
+										} else {
+											BigDecimal rate = agencyFeeSetting.getNotBasicDfSelfOperatedInvoke().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+												.setScale(2, RoundingMode.HALF_UP);
+											BigDecimal thisPrice = price.subtract(price.multiply(rate));
+											amountPrice = amountPrice.add(thisPrice);
+										}
+									} else {
+										//非调拨箱
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicDfSelfOperatedAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicDfSelfOperatedAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicDfSelfOperatedOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicDfSelfOperatedOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									}
+								} else {
+									//非自营箱 无需判断是否调拨
+									if ("DF合营".equals(item.getCabinType())) {
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicDfJointVentureAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicDfJointVentureAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicDfJointVentureOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicDfJointVentureOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									} else {
+										if ("代理箱".equals(archives.getBoxType())) {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicOpenCsaAgent()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicOpenCsaAgent().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										} else {
+											if (new BigDecimal("0.00").compareTo(agencyFeeSetting.getNotBasicOpenCsaOwn()) == 0) {
+												amountPrice = amountPrice.add(price);
+											} else {
+												BigDecimal rate = agencyFeeSetting.getNotBasicOpenCsaOwn().divide(new BigDecimal("100"), MathContext.DECIMAL32)
+													.setScale(2, RoundingMode.HALF_UP);
+												BigDecimal thisPrice = price.subtract(price.multiply(rate));
+												amountPrice = amountPrice.add(thisPrice);
+											}
+										}
+									}
+								}
+							}
+						}
+						feeCenterC.setPrice(amountPrice);
+						feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
+						feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenterC.getExrate()));
+						feeCenterC.setUnsettledAmount(feeCenterC.getAmount());
+						feeCenterC.setCreateUser(AuthUtil.getUserId());
+						feeCenterC.setCreateUserName(AuthUtil.getUserName());
+						feeCenterC.setCreateTime(new Date());
+						feeCentersFdC.add(feeCenterC);
+						feeCenterSum.add(feeCenterC);
+						thisFeeCenterList.add(feeCenterC);
+					}
+					Bills billsAmount = costProfitCalculationService.costProfitCalculation(feeCenterSum, exrateType);
+					if (billsAmount != null) {
+						item.setAccountStatus(billsAmount.getAccountStatus());
+						item.setAmountDr(billsAmount.getAmountDr());
+						item.setOceanFreightDr(billsAmount.getOceanFreightDr());
+						item.setAmountCr(billsAmount.getAmountCr());
+						item.setOceanFreightCr(billsAmount.getOceanFreightCr());
+						item.setAmountProfit(billsAmount.getAmountProfit());
+						item.setOceanFreightProfit(billsAmount.getOceanFreightProfit());
+						item.setAmountDrUsd(billsAmount.getAmountDrUsd());
+						item.setAmountCrUsd(billsAmount.getAmountCrUsd());
+						item.setAmountProfitUsd(billsAmount.getAmountProfitUsd());
+						item.setAmountDrLoc(billsAmount.getAmountDrLoc());
+						item.setAmountCrLoc(billsAmount.getAmountCrLoc());
+						item.setAmountProfitLoc(billsAmount.getAmountProfitLoc());
+						billsService.updateById(item);
+					}
+					if (!thisFeeCenterList.isEmpty()) {
+						BigDecimal amount = thisFeeCenterList.stream().map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+						FeeCenter feeCenterD = new FeeCenter();
+						feeCenterD.setBookingAgentId(bills.getBookingAgentId());
+						feeCenterD.setBookingAgentCnName(bills.getBookingAgentCnName());
+						feeCenterD.setBookingAgentEnName(bills.getBookingAgentEnName());
+						feeCenterD.setQuantityCntrDescr(bills.getQuantityCntrDescr());
+						feeCenterD.setBillBranchId(bills.getBranchId());
+						feeCenterD.setBillBranchName(bills.getBranchName());
+						feeCenterD.setTeu(bills.getTeu());
+						feeCenterD.setBranchId(bills.getBranchId());
+						feeCenterD.setBranchName(bills.getBranchName());
+						feeCenterD.setPid(bills.getId());
+						feeCenterD.setCntrNo(bills.getQuantityCntrTypesDescr());
+						feeCenterD.setBillNo(bills.getBillNo());
+						feeCenterD.setBusinessType(bills.getBusinessType());
+						feeCenterD.setBillType(bills.getBillType());
+						feeCenterD.setBillDate(bills.getBillDate());
+						feeCenterD.setBillCorpId(bills.getCorpId());
+						feeCenterD.setBillCorpCnName(bills.getCorpCnName());
+						feeCenterD.setBillCorpEnName(bills.getCorpEnName());
+						feeCenterD.setBillShortName(bills.getShortName());
+						feeCenterD.setLineId(bills.getLineId());
+						feeCenterD.setLineCnName(bills.getLineCnName());
+						feeCenterD.setLineEnName(bills.getLineEnName());
+						feeCenterD.setVesselId(bills.getVesselId());
+						feeCenterD.setVesselCnName(bills.getVesselCnName());
+						feeCenterD.setVesselEnName(bills.getVesselEnName());
+						feeCenterD.setVoyageNo(bills.getVoyageNo());
+						feeCenterD.setMblno(bills.getMblno());
+						feeCenterD.setHblno(item.getHblno());
+						feeCenterD.setSrcItemId(item.getId());
+						feeCenterD.setEtd(bills.getEtd());
+						feeCenterD.setEta(bills.getEta());
+						feeCenterD.setPolId(bills.getPolId());
+						feeCenterD.setPolCode(bills.getPolCode());
+						feeCenterD.setPolCnName(bills.getPolCnName());
+						feeCenterD.setPolEnName(bills.getPolEnName());
+						feeCenterD.setPodId(bills.getPodId());
+						feeCenterD.setPodCode(bills.getPodCode());
+						feeCenterD.setPodCnName(bills.getPodCnName());
+						feeCenterD.setPodEnName(bills.getPodEnName());
+						feeCenterD.setPaymode(bills.getMpaymode());
+						feeCenterD.setSort(1);
+						feeCenterD.setFeeId(fees.getId());
+						feeCenterD.setFeeCode(fees.getCode());
+						feeCenterD.setFeeCnName(fees.getCnName());
+						feeCenterD.setFeeEnName(fees.getEnName());
+						feeCenterD.setUnitNo("JOB");
+						feeCenterD.setCurCode(feeCenterSum.get(0).getCurCode());
+						feeCenterD.setExrate(feeCenterSum.get(0).getExrate());
+						feeCenterD.setDc("D");
+						feeCenterD.setCorpType("国内直接客户");
+						BCorps corps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+							.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+							.eq(BCorps::getIsDeleted, 0)
+							.eq(BCorps::getEnName, item.getBranchName()));
+						if (corps == null) {
+							throw new RuntimeException("基础资料未查到往来单位" + bills.getBranchName());
+						}
+						feeCenterD.setCorpId(corps.getId());
+						feeCenterD.setCorpCnName(corps.getCnName());
+						feeCenterD.setCorpEnName(corps.getEnName());
+						feeCenterD.setShortName(corps.getShortName());
+						feeCenterD.setGenerationCorpId(corps.getBookingAgentId());
+						feeCenterD.setGenerationCorpCnName(corps.getBookingAgentCnName());
+						feeCenterD.setGenerationCorpEnName(corps.getBookingAgentEnName());
+						feeCenterD.setQuantity(new BigDecimal("1"));
+						feeCenterD.setPrice(amount);
+						feeCenterD.setAmount(amount);
+						feeCenterD.setAmountLoc(amount.multiply(feeCenterD.getExrate()));
+						feeCenterD.setUnsettledAmount(feeCenterD.getAmount());
+						feeCenterD.setCreateUser(AuthUtil.getUserId());
+						feeCenterD.setCreateUserName(AuthUtil.getUserName());
+						feeCenterD.setCreateTime(new Date());
+						list.add(feeCenterD);
+						list1.add(feeCenterD);
+					}
+				}
+			}
+			if (!feeCentersFdC.isEmpty()) {
+				feeCenterService.saveBatch(feeCentersFdC);
+			}
+			int count = 1;
+			for (RouteCostItem items : routeCostItemList) {
+				if ("DD".equals(bills.getBillType())) {
+					FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "船公司", items,
+						curExrateList, preContainers, exrateType, "1");
+					if (feeCenter != null) {
+						feeCenter.setBranchId(branchId);
+						feeCenter.setBranchName(deptName);
+						list.add(feeCenter);
+						list1.add(feeCenter);
+						count++;
+					}
+					FeeCenter feeCenterD = this.addFeeCenter(bills, "D", count, fees, "国内直接客户", items,
+						curExrateList, preContainers, exrateType, "2");
+					if (feeCenterD != null) {
+						feeCenterD.setBranchId(branchId);
+						feeCenterD.setBranchName(deptName);
+						list.add(feeCenterD);
+						list1.add(feeCenterD);
+						count++;
+					}
+					//二程费用
+					if (ObjectUtils.isNotNull(items.getOceanFreightTwo()) &&
+						new BigDecimal("0.00").compareTo(items.getOceanFreightTwo()) != 0) {
+						FeeCenter feeCenterChengBrothers = this.addFeeCenterChengBrothers(bills, "C", count, fees, "船公司", items,
+							curExrateList, preContainers, exrateType, "1");
+						if (feeCenterChengBrothers != null) {
+							feeCenterChengBrothers.setBranchId(branchId);
+							feeCenterChengBrothers.setBranchName(deptName);
+							list.add(feeCenterChengBrothers);
+							list1.add(feeCenterChengBrothers);
+							count++;
+						}
+						FeeCenter feeCenterDChengBrothers = this.addFeeCenterChengBrothers(bills, "D", count, fees, "国内直接客户", items,
+							curExrateList, preContainers, exrateType, "2");
+						if (feeCenterDChengBrothers != null) {
+							feeCenterDChengBrothers.setBranchId(branchId);
+							feeCenterDChengBrothers.setBranchName(deptName);
+							list.add(feeCenterDChengBrothers);
+							list1.add(feeCenterDChengBrothers);
+							count++;
+						}
+					}
+				} else if ("MM".equals(bills.getBillType())) {
+					FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "船公司", items,
+						curExrateList, preContainers, exrateType, "1");
+					if (feeCenter != null) {
+						feeCenter.setBranchId(branchId);
+						feeCenter.setBranchName(deptName);
+						list.add(feeCenter);
+						list1.add(feeCenter);
+						count++;
+					}
+					if ("COC".equals(bills.getBoxBelongsTo())) {
+						FeeCenter feeCenterD = this.addFeeCenter(bills, "D", count, fees, "国内直接客户", items,
+							curExrateList, preContainers, exrateType, "3");
+						if (feeCenterD != null) {
+							feeCenterD.setBranchId(branchId);
+							feeCenterD.setBranchName(deptName);
+							list.add(feeCenterD);
+							list1.add(feeCenterD);
+							count++;
+						}
+					} else {
+						FeeCenter feeCenter1 = this.addFeeCenter(bills, "C", count, feesFjf, "船公司", items,
+							curExrateList, preContainers, exrateType, "5");
+						if (feeCenter1 != null) {
+							feeCenter1.setBranchId(branchId);
+							feeCenter1.setBranchName(deptName);
+							list.add(feeCenter1);
+							list1.add(feeCenter1);
+							count++;
+						}
+					}
+					//二程费用
+					if (ObjectUtils.isNotNull(items.getOceanFreightTwo()) &&
+						new BigDecimal("0.00").compareTo(items.getOceanFreightTwo()) != 0) {
+						FeeCenter feeCenterChengBrothers = this.addFeeCenterChengBrothers(bills, "C", count, fees, "船公司", items,
+							curExrateList, preContainers, exrateType, "1");
+						if (feeCenterChengBrothers != null) {
+							feeCenterChengBrothers.setBranchId(branchId);
+							feeCenterChengBrothers.setBranchName(deptName);
+							list.add(feeCenterChengBrothers);
+							list1.add(feeCenterChengBrothers);
+							count++;
+						}
+						if ("COC".equals(bills.getBoxBelongsTo())) {
+							FeeCenter feeCenterDChengBrothers = this.addFeeCenterChengBrothers(bills, "D", count, fees, "国内直接客户", items,
+								curExrateList, preContainers, exrateType, "3");
+							if (feeCenterDChengBrothers != null) {
+								feeCenterDChengBrothers.setBranchId(branchId);
+								feeCenterDChengBrothers.setBranchName(deptName);
+								list.add(feeCenterDChengBrothers);
+								list1.add(feeCenterDChengBrothers);
+								count++;
+							}
+						}
+					}
+				} else if ("MH".equals(bills.getBillType())) {
+					throw new RuntimeException("只能提取主单,直单单据成本");
+					/*FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "国内直接客户", items,
+						curExrateList, preContainers, exrateType, "4");
+					if (feeCenter != null) {
+						feeCenter.setBranchId(branchId);
+						feeCenter.setBranchName(deptName);
+						list.add(feeCenter);
+						count++;
+					}*/
+				} else {
+					throw new RuntimeException("单据类型错误,请联系管理员");
+				}
+
+			}
+			if (!list1.isEmpty()) {
+				LambdaQueryWrapper<FeeCenter> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+				lambdaQueryWrapper.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+					.eq(FeeCenter::getIsDeleted, 0)
+					.eq(FeeCenter::getPid, bills.getId());
+				List<FeeCenter> feeCenterOldList = feeCenterService.list(lambdaQueryWrapper);
+				if (!feeCenterOldList.isEmpty()) {
+					list1.addAll(feeCenterOldList);
+				}
+				Bills billsAmount = costProfitCalculationService.costProfitCalculation(list1, exrateType);
+				if (billsAmount != null) {
+					bills.setAccountStatus(billsAmount.getAccountStatus());
+					bills.setAmountDr(billsAmount.getAmountDr());
+					bills.setOceanFreightDr(billsAmount.getOceanFreightDr());
+					bills.setAmountCr(billsAmount.getAmountCr());
+					bills.setOceanFreightCr(billsAmount.getOceanFreightCr());
+					bills.setAmountProfit(billsAmount.getAmountProfit());
+					bills.setOceanFreightProfit(billsAmount.getOceanFreightProfit());
+					bills.setAmountDrUsd(billsAmount.getAmountDrUsd());
+					bills.setAmountCrUsd(billsAmount.getAmountCrUsd());
+					bills.setAmountProfitUsd(billsAmount.getAmountProfitUsd());
+					bills.setAmountDrLoc(billsAmount.getAmountDrLoc());
+					bills.setAmountCrLoc(billsAmount.getAmountCrLoc());
+					bills.setAmountProfitLoc(billsAmount.getAmountProfitLoc());
+					billsService.updateById(bills);
+				}
+//				this.updateBills(list1, bills, exrateType);
+			}
+		}
+		if (!list.isEmpty()) {
+			feeCenterService.saveOrUpdateBatch(list);
+		} else {
+			throw new RuntimeException("导入失败,箱型不符");
+		}
+		if (ObjectUtils.isNotNull(text.toString())) {
+			return R.data(list, text + "未导入!!!");
+		} else {
+			return R.data(list);
+		}
+	}
+
+	@Override
+	public R submit(AgencyFeeSetting agencyFeeSetting) {
+		String deptName = "";
+		String branchId = AuthUtil.getDeptId();
+		//获取部门ids对应中文名
+		if (ObjectUtils.isNotNull(branchId)) {
+			R<String> res = sysClient.getDeptName(Long.parseLong(branchId));
+			if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+				deptName = res.getData();
+			}
+		}
+		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+		List<AgencyFeeSetting> agencyFeeSettingList = baseMapper.selectListByPolId(agencyFeeSetting.getPolId(),
+			formatter.format(agencyFeeSetting.getValidityPeriodStart()), AuthUtil.getTenantId());
+		if (agencyFeeSetting.getId() == null) {
+			if (!agencyFeeSettingList.isEmpty()) {
+				throw new RuntimeException("港口存在重复添加");
+			}
+			BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+				.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+				.eq(BusinessType::getIsDeleted, 0)
+				.eq(BusinessType::getStatus, 0)
+				.eq(BusinessType::getCode, agencyFeeSetting.getBusinessTypeCode()));
+			if (businessType == null) {
+				throw new RuntimeException("未找到可用业务类型");
+			}
+			BusinessBillNo businessBillNo = new BusinessBillNo();
+			businessBillNo.setBusinessTypeId(businessType.getId());
+			businessBillNo.setCode(agencyFeeSetting.getBillNoFormat());
+			businessBillNo.setBranchId(branchId);
+			businessBillNo.setDate(new Date());
+			R<String> clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
+			if (!clientBillNo.isSuccess()) {
+				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+				return R.fail(500, "生成订单编号失败");
+			}
+			agencyFeeSetting.setSysNo(clientBillNo.getData());
+			agencyFeeSetting.setCreateTime(new Date());
+			agencyFeeSetting.setCreateUser(AuthUtil.getUserId());
+			agencyFeeSetting.setCreateUserName(AuthUtil.getUserName());
+			agencyFeeSetting.setBranchId(branchId);
+			agencyFeeSetting.setBranchName(deptName);
+		} else {
+			if (!agencyFeeSettingList.isEmpty() && agencyFeeSettingList.stream().filter(e -> !e.getId().equals(agencyFeeSetting.getId())).count() > 1) {
+				throw new RuntimeException("港口存在重复添加");
+			}
+			agencyFeeSetting.setUpdateTime(new Date());
+			agencyFeeSetting.setUpdateUser(AuthUtil.getUserId());
+			agencyFeeSetting.setUpdateUserName(AuthUtil.getUserName());
+		}
+		this.saveOrUpdate(agencyFeeSetting);
+		return R.data(agencyFeeSetting);
+	}
+
+	private FeeCenter addFeeCenterQuotation(Bills bills, String dc, int count, BFees fees, String corpType,
+											PreContainers items, List<BCurExrate> curExrateList,
+											MktSlotQuotation mktSlotQuotations, String exrateType, String type) {
+		FeeCenter feeCenter = new FeeCenter();
+		feeCenter.setCreateUser(AuthUtil.getUserId());
+		feeCenter.setCreateUserName(AuthUtil.getUserName());
+		feeCenter.setCreateTime(new Date());
+		feeCenter.setBranchId(bills.getBranchId());
+		feeCenter.setBranchName(bills.getBranchName());
+		feeCenter.setBillBranchId(bills.getBranchId());
+		feeCenter.setBillBranchName(bills.getBranchName());
+		feeCenter.setBookingAgentId(bills.getBookingAgentId());
+		feeCenter.setBookingAgentCnName(bills.getBookingAgentCnName());
+		feeCenter.setBookingAgentEnName(bills.getBookingAgentEnName());
+		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(dc);
+		feeCenter.setPaymode(bills.getMpaymode());
+		feeCenter.setSort(count);
+		feeCenter.setFeeId(fees.getId());
+		feeCenter.setCorpType(corpType);
+		feeCenter.setFeeCode(fees.getCode());
+		feeCenter.setFeeCnName(fees.getCnName());
+		feeCenter.setFeeEnName(fees.getEnName());
+		feeCenter.setUnitNo(fees.getUnitNo());
+		feeCenter.setCurCode(mktSlotQuotations.getCurCode());
+		feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
+		feeCenter.setQuantity(new BigDecimal(items.getQuantity() + ""));
+		if ("1".equals(type)) {
+			feeCenter.setCorpId(bills.getCorpId());
+			feeCenter.setCorpCnName(bills.getCorpCnName());
+			feeCenter.setCorpEnName(bills.getCorpEnName());
+			feeCenter.setShortName(bills.getShortName());
+			if ("20GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp20());
+			} else if ("40GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp40());
+			} else if ("40HC".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getHc40());
+			} else {
+				return null;
+			}
+		} else if ("2".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getCode, "ZBYF"));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			if ("20GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp20Cost());
+			} else if ("40GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp40Cost());
+			} else if ("40HC".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getHc40Cost());
+			} else {
+				return null;
+			}
+		} else if ("3".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			if ("20GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp20Cost());
+			} else if ("40GP".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getGp40Cost());
+			} else if ("40HC".equals(items.getCntrTypeCode())) {
+				feeCenter.setPrice(mktSlotQuotations.getHc40Cost());
+			} else {
+				return null;
+			}
+		}
+		BCorps corps = bCorpsService.getById(feeCenter.getCorpId());
+		if (corps != null) {
+			feeCenter.setGenerationCorpId(corps.getBookingAgentId());
+			feeCenter.setGenerationCorpCnName(corps.getBookingAgentCnName());
+			feeCenter.setGenerationCorpEnName(corps.getBookingAgentEnName());
+		}
+		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"));
+			}
+		}
+		feeCenter.setUnsettledAmount(feeCenter.getAmount());
+		if (new BigDecimal("0").compareTo(feeCenter.getAmount()) == 0) {
+			return null;
+		} else {
+			return feeCenter;
+		}
+	}
+
+	private FeeCenter addFeeCenter(Bills bills, String dc, int count, BFees fees, String corpType, RouteCostItem
+		items,
+								   List<BCurExrate> curExrateList, List<PreContainers> preContainers,
+								   String exrateType, String type) {
+		FeeCenter feeCenter = new FeeCenter();
+		feeCenter.setCreateUser(AuthUtil.getUserId());
+		feeCenter.setCreateUserName(AuthUtil.getUserName());
+		feeCenter.setCreateTime(new Date());
+		feeCenter.setBranchId(bills.getBranchId());
+		feeCenter.setBranchName(bills.getBranchName());
+		feeCenter.setBookingAgentId(bills.getBookingAgentId());
+		feeCenter.setBookingAgentCnName(bills.getBookingAgentCnName());
+		feeCenter.setBookingAgentEnName(bills.getBookingAgentEnName());
+		feeCenter.setQuantityCntrDescr(bills.getQuantityCntrDescr());
+		feeCenter.setBillBranchId(bills.getBranchId());
+		feeCenter.setBillBranchName(bills.getBranchName());
+		feeCenter.setTeu(bills.getTeu());
+		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(dc);
+		feeCenter.setPaymode(bills.getMpaymode());
+		feeCenter.setSort(count);
+		feeCenter.setFeeId(fees.getId());
+		feeCenter.setCorpType(corpType);
+		feeCenter.setFeeCode(fees.getCode());
+		feeCenter.setFeeCnName(fees.getCnName());
+		feeCenter.setFeeEnName(fees.getEnName());
+		feeCenter.setUnitNo(items.getBoxType());
+		feeCenter.setCurCode(items.getCurCode());
+		feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
+		Integer quantity = preContainers.stream().filter(e -> items.getBoxType().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
+		if (quantity == 0) {
+			return null;
+		}
+		feeCenter.setQuantity(new BigDecimal(quantity + ""));
+		if ("1".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getOceanFreight());
+		} else if ("2".equals(type)) {
+			feeCenter.setCorpId(bills.getCorpId());
+			feeCenter.setCorpCnName(bills.getCorpCnName());
+			feeCenter.setCorpEnName(bills.getCorpEnName());
+			feeCenter.setShortName(bills.getShortName());
+			feeCenter.setPrice(items.getSalesPrice());
+		} else if ("3".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getEnName, bills.getBranchName()));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到往来单位" + bills.getBranchName());
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPrice());
+		} else if ("4".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getCode, "ZBYF"));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPrice());
+		} else if ("5".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getAdditionalFee());
+		}
+		BCorps corps = bCorpsService.getById(feeCenter.getCorpId());
+		if (corps != null) {
+			feeCenter.setGenerationCorpId(corps.getBookingAgentId());
+			feeCenter.setGenerationCorpCnName(corps.getBookingAgentCnName());
+			feeCenter.setGenerationCorpEnName(corps.getBookingAgentEnName());
+		}
+		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"));
+			}
+		}
+		feeCenter.setUnsettledAmount(feeCenter.getAmount());
+		if (new BigDecimal("0.00").compareTo(feeCenter.getAmount()) == 0) {
+			return null;
+		} else {
+			return feeCenter;
+		}
+	}
+
+	private FeeCenter addFeeCenterChengBrothers(Bills bills, String dc, int count, BFees fees, String corpType, RouteCostItem
+		items,
+												List<BCurExrate> curExrateList, List<PreContainers> preContainers,
+												String exrateType, String type) {
+		FeeCenter feeCenter = new FeeCenter();
+		feeCenter.setCreateUser(AuthUtil.getUserId());
+		feeCenter.setCreateUserName(AuthUtil.getUserName());
+		feeCenter.setCreateTime(new Date());
+		feeCenter.setBranchId(bills.getBranchId());
+		feeCenter.setBranchName(bills.getBranchName());
+		feeCenter.setBookingAgentId(bills.getBookingAgentId());
+		feeCenter.setBookingAgentCnName(bills.getBookingAgentCnName());
+		feeCenter.setBookingAgentEnName(bills.getBookingAgentEnName());
+		feeCenter.setQuantityCntrDescr(bills.getQuantityCntrDescr());
+		feeCenter.setBillBranchId(bills.getBranchId());
+		feeCenter.setBillBranchName(bills.getBranchName());
+		feeCenter.setTeu(bills.getTeu());
+		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(dc);
+		feeCenter.setPaymode(bills.getMpaymode());
+		feeCenter.setSort(count);
+		feeCenter.setFeeId(fees.getId());
+		feeCenter.setCorpType(corpType);
+		feeCenter.setFeeCode(fees.getCode());
+		feeCenter.setFeeCnName(fees.getCnName());
+		feeCenter.setFeeEnName(fees.getEnName());
+		feeCenter.setUnitNo(items.getBoxType());
+		feeCenter.setCurCode(items.getCurCode());
+		feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
+		Integer quantity = preContainers.stream().filter(e -> items.getBoxType().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
+		if (quantity == 0) {
+			return null;
+		}
+		feeCenter.setQuantity(new BigDecimal(quantity + ""));
+		if ("1".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getOceanFreightTwo());
+		} else if ("2".equals(type)) {
+			feeCenter.setCorpId(bills.getCorpId());
+			feeCenter.setCorpCnName(bills.getCorpCnName());
+			feeCenter.setCorpEnName(bills.getCorpEnName());
+			feeCenter.setShortName(bills.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
+		} else if ("3".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getEnName, bills.getBranchName()));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到往来单位" + bills.getBranchName());
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
+		} else if ("4".equals(type)) {
+			BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+				.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+				.eq(BCorps::getIsDeleted, 0)
+				.eq(BCorps::getCode, "ZBYF"));
+			if (bCorps == null) {
+				throw new RuntimeException("基础资料未查到编码为‘ZBYF’往来单位");
+			}
+			feeCenter.setCorpId(bCorps.getId());
+			feeCenter.setCorpCnName(bCorps.getCnName());
+			feeCenter.setCorpEnName(bCorps.getEnName());
+			feeCenter.setShortName(bCorps.getShortName());
+			feeCenter.setPrice(items.getSalesPriceTwo());
+		} else if ("5".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierCnName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getAdditionalFee());
+		}
+		BCorps corps = bCorpsService.getById(feeCenter.getCorpId());
+		if (corps != null) {
+			feeCenter.setGenerationCorpId(corps.getBookingAgentId());
+			feeCenter.setGenerationCorpCnName(corps.getBookingAgentCnName());
+			feeCenter.setGenerationCorpEnName(corps.getBookingAgentEnName());
+		}
+		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"));
+			}
+		}
+		feeCenter.setUnsettledAmount(feeCenter.getAmount());
+		if (new BigDecimal("0.00").compareTo(feeCenter.getAmount()) == 0) {
+			return null;
+		} else {
+			return feeCenter;
+		}
+	}
+
+}

+ 4 - 1
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java

@@ -794,6 +794,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setBillBranchId(deptId);
 					feeCenter.setBillBranchName(deptName);
 				}
+				if ("D".equals(feeCenter.getDc()) && ObjectUtils.isNotNull(feeCenter.getSrcItemId())) {
+					feeCenter.setHblno(null);
+				}
 				feeCenter.setSrcType(bills.getSrcType());
 				feeCenter.setSrcId(bills.getSrcId());
 				feeCenter.setSrcCnName(bills.getSrcCnName());
@@ -1058,7 +1061,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					corpIds = feeCenterList.stream().map(FeeCenter::getCorpId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
 				}
 			}
-		}else if ("XGFY".equals(type)){
+		} else if ("XGFY".equals(type)) {
 			TradingBox bills = tradingBoxMapper.selectById(billId);
 			if (bills != null) {
 				List<FeeCenter> feeCenterList = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()