Browse Source

1.邮箱地址管理模块接口
2.邮箱签名
3.托书生成海运单据生成费用逻辑修改
4.海运出口主单提取成本接口逻辑修改
5.海运进出口保存更新托书数据问题修改
6.海运进出口增加海运费收,付,利润字段
7.所有海运费相关保存接口增加计算利润逻辑

纪新园 7 months ago
parent
commit
74fee4d0ff
16 changed files with 935 additions and 335 deletions
  1. 5 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/RouteCostItem.java
  2. 16 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java
  3. 34 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/dto/EmailAddressDTO.java
  4. 115 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/entity/EmailAddress.java
  5. 36 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/vo/EmailAddressVO.java
  6. 5 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java
  7. 46 2
      blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsServiceImpl.java
  8. 47 33
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  9. 5 12
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/ContainersServiceImpl.java
  10. 190 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/controller/EmailAddressController.java
  11. 42 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/EmailAddressMapper.java
  12. 26 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/EmailAddressMapper.xml
  13. 41 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/service/IEmailAddressService.java
  14. 41 0
      blade-service/blade-los/src/main/java/org/springblade/los/email/service/impl/EmailAddressServiceImpl.java
  15. 8 16
      blade-service/blade-los/src/main/java/org/springblade/los/excel/BoxAndLeadSealNoExcel.java
  16. 278 272
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java

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

@@ -214,6 +214,11 @@ public class RouteCostItem implements Serializable {
 	 */
 	@ApiModelProperty(value = "是否禁用")
 	private String disable;
+	/**
+	 * 附加费
+	 */
+	@ApiModelProperty(value = "附加费")
+	private BigDecimal additionalFee;
 
 
 }

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

@@ -1597,6 +1597,22 @@ public class Bills implements Serializable {
 	private String temporaryNo;
 
 	/**
+	 * 应收海运费
+	 */
+	@ApiModelProperty(value = "应收海运费")
+	private BigDecimal oceanFreightDr;
+	/**
+	 * 应付海运费
+	 */
+	@ApiModelProperty(value = "应付海运费")
+	private BigDecimal oceanFreightCr;
+	/**
+	 * 海运费利润
+	 */
+	@ApiModelProperty(value = "海运费利润")
+	private BigDecimal oceanFreightProfit;
+
+	/**
 	 * 到港日期
 	 */
 	@TableField(exist = false)

+ 34 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/dto/EmailAddressDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      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.email.dto;
+
+import org.springblade.los.email.entity.EmailAddress;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 邮箱地址管理数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class EmailAddressDTO extends EmailAddress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 115 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/entity/EmailAddress.java

@@ -0,0 +1,115 @@
+/*
+ *      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.email.entity;
+
+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.time.LocalDateTime;
+import java.util.Date;
+
+/**
+ * 邮箱地址管理实体类
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+@Data
+@TableName("los_email_address")
+@ApiModel(value = "EmailAddress对象", description = "邮箱地址管理")
+public class EmailAddress implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	private Long id;
+	/**
+	 * 创建人 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 status;
+	/**
+	 * 是否已删除(0 否 1是)
+	 */
+	@ApiModelProperty(value = "是否已删除(0 否 1是)")
+	private Integer isDeleted;
+	/**
+	 * 备注
+	 */
+	@ApiModelProperty(value = "备注")
+	private String remarks;
+	/**
+	 * 收件人
+	 */
+	@ApiModelProperty(value = "收件人")
+	private String recipientUrl;
+	/**
+	 * 收件人姓名
+	 */
+	@ApiModelProperty(value = "收件人姓名")
+	private String recipientName;
+	/**
+	 * 租户
+	 */
+	@ApiModelProperty(value = "租户")
+	private String tenantId;
+
+	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 分公司
+	 */
+	@ApiModelProperty(value = "分公司")
+	private String branchName;
+
+
+}

+ 36 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/email/vo/EmailAddressVO.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.email.vo;
+
+import org.springblade.los.email.entity.EmailAddress;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 邮箱地址管理视图实体类
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "EmailAddressVO对象", description = "邮箱地址管理")
+public class EmailAddressVO extends EmailAddress {
+	private static final long serialVersionUID = 1L;
+
+}

+ 5 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/entity/User.java

@@ -151,4 +151,9 @@ public class User extends TenantEntity {
 	 * 邮箱授权码
 	 */
 	private String emailAuthorization;
+
+	/**
+	 * 邮箱签名
+	 */
+	private String emailSignature;
 }

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

@@ -29,6 +29,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.FileUtil;
+import org.springblade.core.tool.utils.Func;
 import org.springblade.los.Util.BigDecimalUtils;
 import org.springblade.los.Util.CurrencyUtils;
 import org.springblade.los.Util.MagicValues;
@@ -47,6 +48,8 @@ import org.springblade.los.business.sea.dto.ContainersReports;
 import org.springblade.los.business.sea.entity.*;
 import org.springblade.los.business.sea.service.*;
 import org.springblade.los.business.sea.vo.GenerateMailVo;
+import org.springblade.los.email.entity.EmailAddress;
+import org.springblade.los.email.service.IEmailAddressService;
 import org.springblade.los.finance.agreement.entity.AgreementPrice;
 import org.springblade.los.finance.agreement.entity.AgreementPriceItems;
 import org.springblade.los.finance.agreement.service.IAgreementPriceItemsService;
@@ -132,6 +135,8 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 
 	private final CurrencyUtils currencyUtils;
 
+	private final IEmailAddressService emailAddressService;
+
 	@Override
 	public IPage<ReportsVO> selectReportsPage(IPage<ReportsVO> page, ReportsVO reports) {
 		return page.setRecords(baseMapper.selectReportsPage(page, reports));
@@ -1296,7 +1301,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				bills.setCntryString(text.toString());
 				/*bills.setCommodityDescr(bills.getCommodityDescr()+"SHIPPER'S LOAD,COUNT & SEAL"+bills.getQuantityCntrDescr()+"CONTAINER S.T.C"
 					+bills.getHpaymode()+bills.getServiceTerms()+bills.getCapitalLetters());*/
-				bills.setMarks(bills.getMarks() + "<br/>" +bills.getCntryString());
+				bills.setMarks(bills.getMarks() + "<br/>" + bills.getCntryString());
 				bills.setCntrSealNo(cntrSealNo.toString());
 				bills.setContainersReportsList(containersReportsList);
 				bills.setDept(dept);
@@ -1353,7 +1358,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					+bills.getHpaymode()+bills.getServiceTerms()+bills.getCapitalLetters()
 */
 
-				bills.setMarks(bills.getMarks() +"<br/>" + bills.getCntryString());
+				bills.setMarks(bills.getMarks() + "<br/>" + bills.getCntryString());
 				bills.setCntrSealNo(cntrSealNo.toString());
 				bills.setDept(dept);
 				map.put(MagicValues.DATA, bills);
@@ -3655,6 +3660,45 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 		fileList.add(filePath);
 		mailDto.setMailFilePath(fileList);
 		SendMailUtil.sendHtmlFileMail(mailDto);
+		//保存发送地址
+		List<EmailAddress> addressList = new ArrayList<>();
+		String address = "";
+		if (ObjectUtils.isNotNull(generateMailVo.getSendTo())) {
+			address = generateMailVo.getSendTo().replaceAll(";", ",");
+		}
+		if (ObjectUtils.isNotNull(generateMailVo.getSendCc())) {
+			address = address + "," + generateMailVo.getSendCc().replaceAll(";", ",");
+		}
+		List<EmailAddress> emailAddressList = emailAddressService.list(new LambdaQueryWrapper<EmailAddress>()
+			.eq(EmailAddress::getTenantId, AuthUtil.getTenantId())
+			.eq(EmailAddress::getIsDeleted, 0)
+			.eq(EmailAddress::getCreateUser, AuthUtil.getUserId())
+			.apply("find_in_set(recipient_url,'" + address + "')"));
+
+		List<String> sendTo = Func.toStrList(address).stream().distinct().collect(Collectors.toList());
+		for (String item : sendTo) {
+			EmailAddress emailAddress = new EmailAddress();
+			emailAddress.setCreateTime(new Date());
+			emailAddress.setCreateUser(AuthUtil.getUserId());
+			emailAddress.setCreateUserName(AuthUtil.getUserName());
+			emailAddress.setRecipientUrl(item);
+			emailAddress.setBranchId(AuthUtil.getDeptId());
+			emailAddress.setCreateUserName(AuthUtil.getDeptId());
+			if (item.contains("@")) {
+				emailAddress.setRecipientName(item.substring(0, item.indexOf("@")));
+			} else {
+				emailAddress.setRecipientName("");
+			}
+			if (!emailAddressList.isEmpty()) {
+                emailAddressList.stream().filter(e -> !e.getRecipientUrl().equals(item))
+                        .findFirst().ifPresent(emailAddresDetail -> addressList.add(emailAddress));
+            } else {
+				addressList.add(emailAddress);
+			}
+		}
+		if (!addressList.isEmpty()){
+			emailAddressService.saveBatch(addressList);
+		}
 		return R.data("发送成功");
 	}
 

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

@@ -286,33 +286,34 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			bills.setUpdateUserName(AuthUtil.getUserName());
 			if (ObjectUtils.isNotNull(bills.getTemporaryId())) {
 				Bills bills1 = baseMapper.selectById(bills.getTemporaryId());
-				if ("MM".equals(bills.getBillType())) {
-					if (ObjectUtils.isNotNull(bills.getMblno())) {
-						bills1.setMblno(bills.getMblno());
-						bills1.setHblno(bills.getHblno());
-						bills1.setVesselId(bills.getVesselId());
-						bills1.setVesselCnName(bills.getVesselCnName());
-						bills1.setVesselEnName(bills.getVesselEnName());
-						bills1.setVoyageNo(bills.getVoyageNo());
-						bills1.setCyReturnTime(bills.getCyReturnTime());
-						bills1.setCyTrailerTime(bills.getCyTrailerTime());
-						this.updateById(bills1);
-					}
-				} else if ("MH".equals(bills.getBillType())) {
-					if (ObjectUtils.isNotNull(bills.getHblno())) {
-						bills1.setMblno(bills.getMblno());
-						bills1.setHblno(bills.getHblno());
-						bills1.setVesselId(bills.getVesselId());
-						bills1.setVesselCnName(bills.getVesselCnName());
-						bills1.setVesselEnName(bills.getVesselEnName());
-						bills1.setVoyageNo(bills.getVoyageNo());
-						bills1.setCyReturnTime(bills.getCyReturnTime());
-						bills1.setCyTrailerTime(bills.getCyTrailerTime());
-						this.updateById(bills1);
+				if (bills1 != null){
+					if ("MM".equals(bills.getBillType())) {
+						if (ObjectUtils.isNotNull(bills.getMblno())) {
+							bills1.setMblno(bills.getMblno());
+							bills1.setHblno(bills.getHblno());
+							bills1.setVesselId(bills.getVesselId());
+							bills1.setVesselCnName(bills.getVesselCnName());
+							bills1.setVesselEnName(bills.getVesselEnName());
+							bills1.setVoyageNo(bills.getVoyageNo());
+							bills1.setCyReturnTime(bills.getCyReturnTime());
+							bills1.setCyTrailerTime(bills.getCyTrailerTime());
+							this.updateById(bills1);
+						}
+					} else if ("MH".equals(bills.getBillType())) {
+						if (ObjectUtils.isNotNull(bills.getHblno())) {
+							bills1.setMblno(bills.getMblno());
+							bills1.setHblno(bills.getHblno());
+							bills1.setVesselId(bills.getVesselId());
+							bills1.setVesselCnName(bills.getVesselCnName());
+							bills1.setVesselEnName(bills.getVesselEnName());
+							bills1.setVoyageNo(bills.getVoyageNo());
+							bills1.setCyReturnTime(bills.getCyReturnTime());
+							bills1.setCyTrailerTime(bills.getCyTrailerTime());
+							this.updateById(bills1);
+						}
 					}
 				}
 			}
-
 		}
 		Integer V20 = 0;
 		Integer V40 = 0;
@@ -402,6 +403,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		BigDecimal amountDrLoc = new BigDecimal("0.00");
 		BigDecimal amountCrLoc = new BigDecimal("0.00");
 		BigDecimal amountProfitLoc;
+		BigDecimal oceanFreightDr = new BigDecimal("0.00");
+		BigDecimal oceanFreightCr = new BigDecimal("0.00");
+		BigDecimal oceanFreightProfit;
 		List<FeeCenter> feeCenterListAll = new ArrayList<>();
 		//应付
 		int statusC = 0;
@@ -455,6 +459,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				}
 				feeCenterListAll.add(item);
 			}
+			oceanFreightCr = bills.getFeeCenterListC().stream().filter(e -> "C".equals(e.getDc()) &&
+				"HYF".equals(e.getFeeCode())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
 		//应收
 		int statusD = 0;
@@ -508,6 +514,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				}
 				feeCenterListAll.add(item);
 			}
+			oceanFreightDr = bills.getFeeCenterListD().stream().filter(e -> "D".equals(e.getDc()) &&
+				"HYF".equals(e.getFeeCode())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
 		}
 		if (!feeCenterListAll.isEmpty()) {
 			feeCenterService.submitListOptimization(feeCenterListAll);
@@ -672,6 +680,10 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		amountProfit = amountDr.subtract(amountCr);
 		amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
 		amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
+		oceanFreightProfit = oceanFreightDr.subtract(oceanFreightCr);
+		bills.setOceanFreightDr(oceanFreightDr);
+		bills.setOceanFreightCr(oceanFreightCr);
+		bills.setOceanFreightProfit(oceanFreightProfit);
 		bills.setAmountDr(amountDr);
 		bills.setAmountCr(amountCr);
 		bills.setAmountProfit(amountProfit);
@@ -4375,7 +4387,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		copyBills.setCfsQuantity(new BigDecimal("0.00"));
 		copyBills.setCfsGrossWeight(new BigDecimal("0.00"));
 		copyBills.setCfsMeasurement(new BigDecimal("0.00"));
-		copyBills.setBoxBelongsTo("SOC");
+//		copyBills.setBoxBelongsTo("SOC");
 		this.save(copyBills);
 		if (seaBillsDetail != null) {
 			seaBillsDetail.setId(null);
@@ -4430,13 +4442,15 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 						feeCenter.setBranchName(deptName);
 						feeCenters.add(feeCenter);
 					}
-					FeeCenter feeCenterD = this.addFeeCenterQuotation(copyBills, "C", count, feesD, item,
-						curExrateList, exrateType, "2");
-					if (feeCenterD != null) {
-						feeCenterD.setUnitNo(item.getCntrTypeCode());
-						feeCenterD.setBranchId(branchId);
-						feeCenterD.setBranchName(deptName);
-						feeCenters.add(feeCenterD);
+					if (!"SOC".equals(copyBills.getBoxBelongsTo())){
+						FeeCenter feeCenterD = this.addFeeCenterQuotation(copyBills, "C", count, feesD, item,
+							curExrateList, exrateType, "2");
+						if (feeCenterD != null) {
+							feeCenterD.setUnitNo(item.getCntrTypeCode());
+							feeCenterD.setBranchId(branchId);
+							feeCenterD.setBranchName(deptName);
+							feeCenters.add(feeCenterD);
+						}
 					}
 					count++;
 				}
@@ -4980,7 +4994,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		feeCenter.setBillCorpId(bills.getCorpId());
 		feeCenter.setBillCorpCnName(bills.getCorpCnName());
 		feeCenter.setBillCorpEnName(bills.getCorpEnName());
-		feeCenter.setBillShortName(bills.getCorpCnName());
+		feeCenter.setBillShortName(bills.getShortName());
 		feeCenter.setLineId(bills.getLineId());
 		feeCenter.setLineCnName(bills.getLineCnName());
 		feeCenter.setLineEnName(bills.getLineEnName());

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

@@ -413,7 +413,7 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 		for (BoxAndLeadSealNoExcel item : excelList) {
 			if (bills != null) {
 				if ("MH".equals(bills.getBillType())) {
-					if (!item.getHblno().equals(bills.getHblno())) {
+					if (!bills.getHblno().equals(item.getHblno())) {
 						throw new RuntimeException("导入提单号与单据提单号不一致");
 					}
 				}
@@ -455,25 +455,18 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 			count = list.size();
 		}
 		List<Containers> containersList = new ArrayList<>();
-		String regex = "^[a-zA-Z0-9]+$";
-		Pattern pattern = Pattern.compile(regex);
 		for (int i = 0; i < count; i++) {
 			BoxAndLeadSealNoExcel item = excelList.get(i);
-			/*if (pattern.matcher(item.getCntrNo()).matches()) {
-				throw new RuntimeException("箱号" + item.getCntrNo() + "存在特殊字符,请修改");
-			}
-			if (pattern.matcher(item.getSealNo()).matches()) {
-				throw new RuntimeException("铅封号" + item.getSealNo() + "存在特殊字符,请修改");
-			}*/
 			Containers containers = list.get(i);
+			containers.setCntrTypeCode(item.getCntrTypeCode());
 			containers.setCntrNo(item.getCntrNo().toUpperCase());
 			containers.setSealNo(item.getSealNo());
 			containers.setMeasurement(item.getMeasurement());
 			containers.setQuantity(item.getQuantity());
 			containers.setGrossWeight(item.getGrossWeight());
-			containers.setNetWeight(item.getNetWeight());
-			containers.setMarks(item.getMarks());
-			containers.setRemarks(item.getRemarks());
+			containers.setVgmWeight(item.getGrossWeight());
+			containers.setHblno(item.getHblno());
+			containers.setTare(item.getTare());
 			containersList.add(containers);
 		}
 		if (!containersList.isEmpty()) {

+ 190 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/controller/EmailAddressController.java

@@ -0,0 +1,190 @@
+/*
+ *      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.email.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.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.email.entity.EmailAddress;
+import org.springblade.los.email.service.IEmailAddressService;
+import org.springblade.los.email.vo.EmailAddressVO;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 邮箱地址管理 控制器
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/emailaddress")
+@Api(value = "邮箱地址管理", tags = "邮箱地址管理接口")
+public class EmailAddressController extends BladeController {
+
+	private final IEmailAddressService emailAddressService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入emailAddress")
+	public R<EmailAddress> detail(EmailAddress emailAddress) {
+		EmailAddress detail = emailAddressService.getOne(Condition.getQueryWrapper(emailAddress));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页 邮箱地址管理
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入emailAddress")
+	public R<IPage<EmailAddress>> list(EmailAddress emailAddress, Query query) {
+		LambdaQueryWrapper<EmailAddress> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(EmailAddress::getTenantId, AuthUtil.getTenantId())
+			.eq(EmailAddress::getIsDeleted, 0)
+			.and(ObjectUtils.isNotNull(emailAddress.getRecipientUrl()), i -> i.like(EmailAddress::getRecipientUrl, emailAddress.getRecipientUrl())
+				.or().like(EmailAddress::getRecipientName, emailAddress.getRecipientUrl()));
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(EmailAddress::getBranchId, AuthUtil.getDeptId());
+			lambdaQueryWrapper.eq(EmailAddress::getCreateUser, AuthUtil.getUserId());
+		} else {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(emailAddress.getBranchId()), EmailAddress::getBranchId, emailAddress.getBranchId());
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(emailAddress.getCreateUser()), EmailAddress::getCreateUser, emailAddress.getCreateUser());
+		}
+		lambdaQueryWrapper.orderByDesc(EmailAddress::getCreateTime);
+		IPage<EmailAddress> pages = emailAddressService.page(Condition.getPage(query), lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 分页 邮箱地址管理
+	 */
+	@GetMapping("/listAll")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入emailAddress")
+	public R<List<EmailAddress>> listAll(EmailAddress emailAddress) {
+		LambdaQueryWrapper<EmailAddress> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(EmailAddress::getTenantId, AuthUtil.getTenantId())
+			.eq(EmailAddress::getIsDeleted, 0)
+			.and(ObjectUtils.isNotNull(emailAddress.getRecipientUrl()), i -> i.like(EmailAddress::getRecipientUrl, emailAddress.getRecipientUrl())
+				.or().like(EmailAddress::getRecipientName, emailAddress.getRecipientUrl()));
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.eq(EmailAddress::getBranchId, AuthUtil.getDeptId());
+			lambdaQueryWrapper.eq(EmailAddress::getCreateUser, AuthUtil.getUserId());
+		} else {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(emailAddress.getBranchId()), EmailAddress::getBranchId, emailAddress.getBranchId());
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(emailAddress.getCreateUser()), EmailAddress::getCreateUser, emailAddress.getCreateUser());
+		}
+		lambdaQueryWrapper.orderByDesc(EmailAddress::getCreateTime);
+		List<EmailAddress> pages = emailAddressService.list(lambdaQueryWrapper);
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页 邮箱地址管理
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入emailAddress")
+	public R<IPage<EmailAddressVO>> page(EmailAddressVO emailAddress, Query query) {
+		IPage<EmailAddressVO> pages = emailAddressService.selectEmailAddressPage(Condition.getPage(query), emailAddress);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增 邮箱地址管理
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入emailAddress")
+	public R save(@Valid @RequestBody EmailAddress emailAddress) {
+		return R.status(emailAddressService.save(emailAddress));
+	}
+
+	/**
+	 * 修改 邮箱地址管理
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入emailAddress")
+	public R update(@Valid @RequestBody EmailAddress emailAddress) {
+		return R.status(emailAddressService.updateById(emailAddress));
+	}
+
+	/**
+	 * 新增或修改 邮箱地址管理
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入emailAddress")
+	public R submit(@Valid @RequestBody EmailAddress emailAddress) {
+		List<EmailAddress> emailAddressList = emailAddressService.list(new LambdaQueryWrapper<EmailAddress>()
+			.eq(EmailAddress::getTenantId, AuthUtil.getTenantId())
+			.eq(EmailAddress::getIsDeleted, 0)
+			.eq(EmailAddress::getRecipientUrl, emailAddress.getRecipientUrl())
+			.eq(EmailAddress::getCreateUser, AuthUtil.getUserId()));
+		if (emailAddress.getId() == null) {
+			if (!emailAddressList.isEmpty()) {
+				throw new RuntimeException("收件人地址重复");
+			}
+			emailAddress.setCreateTime(new Date());
+			emailAddress.setCreateUser(AuthUtil.getUserId());
+			emailAddress.setCreateUserName(AuthUtil.getUserName());
+			emailAddress.setBranchId(AuthUtil.getDeptId());
+			emailAddress.setCreateUserName(AuthUtil.getDeptId());
+		} else {
+			if (!emailAddressList.isEmpty() && emailAddressList.stream().anyMatch(e -> !e.getId().equals(emailAddress.getId()))) {
+				throw new RuntimeException("收件人地址重复");
+			}
+			emailAddress.setUpdateTime(new Date());
+			emailAddress.setUpdateUser(AuthUtil.getUserId());
+			emailAddress.setUpdateUserName(AuthUtil.getUserName());
+		}
+		return R.status(emailAddressService.saveOrUpdate(emailAddress));
+	}
+
+
+	/**
+	 * 删除 邮箱地址管理
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(emailAddressService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 42 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/EmailAddressMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      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.email.mapper;
+
+import org.springblade.los.email.entity.EmailAddress;
+import org.springblade.los.email.vo.EmailAddressVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ * 邮箱地址管理 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+public interface EmailAddressMapper extends BaseMapper<EmailAddress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param emailAddress
+	 * @return
+	 */
+	List<EmailAddressVO> selectEmailAddressPage(IPage page, EmailAddressVO emailAddress);
+
+}

+ 26 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/mapper/EmailAddressMapper.xml

@@ -0,0 +1,26 @@
+<?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.email.mapper.EmailAddressMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="emailAddressResultMap" type="org.springblade.los.email.entity.EmailAddress">
+        <id column="id" property="id"/>
+        <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="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="remarks" property="remarks"/>
+        <result column="recipient_url" property="recipientUrl"/>
+        <result column="recipient_name" property="recipientName"/>
+    </resultMap>
+
+
+    <select id="selectEmailAddressPage" resultMap="emailAddressResultMap">
+        select * from los_email_address where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/service/IEmailAddressService.java

@@ -0,0 +1,41 @@
+/*
+ *      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.email.service;
+
+import org.springblade.los.email.entity.EmailAddress;
+import org.springblade.los.email.vo.EmailAddressVO;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 邮箱地址管理 服务类
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+public interface IEmailAddressService extends IService<EmailAddress> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param emailAddress
+	 * @return
+	 */
+	IPage<EmailAddressVO> selectEmailAddressPage(IPage<EmailAddressVO> page, EmailAddressVO emailAddress);
+
+}

+ 41 - 0
blade-service/blade-los/src/main/java/org/springblade/los/email/service/impl/EmailAddressServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      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.email.service.impl;
+
+import org.springblade.los.email.entity.EmailAddress;
+import org.springblade.los.email.vo.EmailAddressVO;
+import org.springblade.los.email.mapper.EmailAddressMapper;
+import org.springblade.los.email.service.IEmailAddressService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 邮箱地址管理 服务实现类
+ *
+ * @author BladeX
+ * @since 2025-07-21
+ */
+@Service
+public class EmailAddressServiceImpl extends ServiceImpl<EmailAddressMapper, EmailAddress> implements IEmailAddressService {
+
+	@Override
+	public IPage<EmailAddressVO> selectEmailAddressPage(IPage<EmailAddressVO> page, EmailAddressVO emailAddress) {
+		return page.setRecords(baseMapper.selectEmailAddressPage(page, emailAddress));
+	}
+
+}

+ 8 - 16
blade-service/blade-los/src/main/java/org/springblade/los/excel/BoxAndLeadSealNoExcel.java

@@ -20,6 +20,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
 import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.baomidou.mybatisplus.annotation.FieldStrategy;
+import com.baomidou.mybatisplus.annotation.TableField;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
@@ -72,26 +74,15 @@ public class BoxAndLeadSealNoExcel implements Serializable {
 	@ExcelProperty(value = "体积 (CBM)")
 	private BigDecimal measurement;
 	/**
-	 * 净重 (KGM)
+	 * 箱皮重
 	 */
-	@ExcelProperty(value = "净重 (KGM)")
-	private BigDecimal netWeight;
+	@ExcelProperty(value = "箱皮重")
+	private BigDecimal tare;
 	/**
-	 * 唛头
-	 */
-	@ApiModelProperty(value = "MARKS")
-	private String marks;
-	/**
-	 * 备注
-	 */
-	@ExcelProperty(value = "备注")
-	private String remarks;
-	/**
-	 * VGM 称重方法,SM1, SM2
+	 * VGM
 	 */
 	@ExcelProperty(value = "VGM")
-	private String vgmMethod;
-
+	private String vgmWeight;
 	/**
 	 * 提单号
 	 */
@@ -99,4 +90,5 @@ public class BoxAndLeadSealNoExcel implements Serializable {
 	private String hblno;
 
 
+
 }

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

@@ -569,59 +569,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		}
 		if (!list.isEmpty()) {
 			this.saveOrUpdateBatch(list);
-			//应付
-			int statusC = 0;
-			if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
-				statusC = 1;
-			}
-			//应收
-			int statusD = 0;
-			if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
-				statusD = 1;
-			}
-			if (1 == statusD && 0 == statusC) {
-				bills.setAccountStatus(1);
-			} else if (0 == statusD && 1 == statusC) {
-				bills.setAccountStatus(2);
-			}
-			BigDecimal amountDr;
-			BigDecimal amountCr;
-			BigDecimal amountProfit;
-			BigDecimal amountDrUsd;
-			BigDecimal amountCrUsd;
-			BigDecimal amountProfitUsd;
-			BigDecimal amountDrLoc;
-			BigDecimal amountCrLoc;
-			BigDecimal amountProfitLoc;
-			if ("D".equals(list.get(0).getDc())) {
-				amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountCr = bills.getAmountCr();
-				amountCrUsd = bills.getAmountCrUsd();
-				amountCrLoc = bills.getAmountCrLoc();
-			} else {
-				amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-				amountDr = bills.getAmountDr();
-				amountDrUsd = bills.getAmountDrUsd();
-				amountDrLoc = bills.getAmountDrLoc();
-			}
-			//利润 = 收 - 付
-			amountProfit = amountDr.subtract(amountCr);
-			amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
-			amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
-			bills.setAmountDr(amountDr);
-			bills.setAmountCr(amountCr);
-			bills.setAmountProfit(amountProfit);
-			bills.setAmountDrUsd(amountDrUsd);
-			bills.setAmountCrUsd(amountCrUsd);
-			bills.setAmountProfitUsd(amountProfitUsd);
-			bills.setAmountDrLoc(amountDrLoc);
-			bills.setAmountCrLoc(amountCrLoc);
-			bills.setAmountProfitLoc(amountProfitLoc);
-			billsMapper.updateById(bills);
+			this.updateBills(list, bills, exrateType);
 		} else {
 			throw new RuntimeException("导入失败,未查到可用模版信息");
 		}
@@ -702,54 +650,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				feeCenterList.add(feeCenter);
 			}
 			this.saveOrUpdateBatch(feeCenterList);
-
-			BigDecimal amountDr;
-			BigDecimal amountCr;
-			BigDecimal amountProfit;
-			BigDecimal amountDrUsd;
-			BigDecimal amountCrUsd;
-			BigDecimal amountProfitUsd;
-			BigDecimal amountDrLoc = new BigDecimal("0.00");
-			BigDecimal amountCrLoc = new BigDecimal("0.00");
-			BigDecimal amountProfitLoc;
-			amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-			amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-			amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-			amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-
-			if (status) {
-				//应付
-				int statusC = 0;
-				if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
-					statusC = 1;
-				}
-				//应收
-				int statusD = 0;
-				if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
-					statusD = 1;
-				}
-				if (1 == statusD && 0 == statusC) {
-					bills.setAccountStatus(1);
-				} else if (0 == statusD && 1 == statusC) {
-					bills.setAccountStatus(2);
-				} else {
-					bills.setAccountStatus(3);
-				}
-				//利润 = 收 - 付
-				amountProfit = amountDr.subtract(amountCr);
-				amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
-				amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
-				bills.setAmountDr(amountDr);
-				bills.setAmountCr(amountCr);
-				bills.setAmountProfit(amountProfit);
-				bills.setAmountDrUsd(amountDrUsd);
-				bills.setAmountCrUsd(amountCrUsd);
-				bills.setAmountProfitUsd(amountProfitUsd);
-				bills.setAmountDrLoc(amountDrLoc);
-				bills.setAmountCrLoc(amountCrLoc);
-				bills.setAmountProfitLoc(amountProfitLoc);
-				billsMapper.updateById(bills);
-			}
+			this.updateBills(feeCenterList, bills, exrateType);
 		} else {
 			R.fail("请选择明细");
 		}
@@ -1379,60 +1280,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				list1.add(feeCenter);
 			}
 			if (!list1.isEmpty()) {
-
-				//应付
-				int statusC = 0;
-				if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
-					statusC = 1;
-				}
-				//应收
-				int statusD = 0;
-				if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
-					statusD = 1;
-				}
-				if (1 == statusD && 0 == statusC) {
-					bills.setAccountStatus(1);
-				} else if (0 == statusD && 1 == statusC) {
-					bills.setAccountStatus(2);
-				}
-				BigDecimal amountDr;
-				BigDecimal amountCr;
-				BigDecimal amountProfit;
-				BigDecimal amountDrUsd;
-				BigDecimal amountCrUsd;
-				BigDecimal amountProfitUsd;
-				BigDecimal amountDrLoc;
-				BigDecimal amountCrLoc;
-				BigDecimal amountProfitLoc;
-				if ("D".equals(list.get(0).getDc())) {
-					amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCr = bills.getAmountCr();
-					amountCrUsd = bills.getAmountCrUsd();
-					amountCrLoc = bills.getAmountCrLoc();
-				} else {
-					amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDr = bills.getAmountDr();
-					amountDrUsd = bills.getAmountDrUsd();
-					amountDrLoc = bills.getAmountDrLoc();
-				}
-				//利润 = 收 - 付
-				amountProfit = amountDr.subtract(amountCr);
-				amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
-				amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
-				bills.setAmountDr(amountDr);
-				bills.setAmountCr(amountCr);
-				bills.setAmountProfit(amountProfit);
-				bills.setAmountDrUsd(amountDrUsd);
-				bills.setAmountCrUsd(amountCrUsd);
-				bills.setAmountProfitUsd(amountProfitUsd);
-				bills.setAmountDrLoc(amountDrLoc);
-				bills.setAmountCrLoc(amountCrLoc);
-				bills.setAmountProfitLoc(amountProfitLoc);
-				billsMapper.updateById(bills);
+				this.updateBills(list1, bills, exrateType);
 			}
 		}
 		if (!list.isEmpty()) {
@@ -1464,10 +1312,22 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		if (billsList.isEmpty()) {
 			throw new RuntimeException("未查到单据信息");
 		}
+		List<Long> idList = billsList.stream().map(Bills::getId).collect(Collectors.toList());
+		List<Bills> billsListFD = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.in(Bills::getMasterId, billsList.stream().map(Bills::getId).collect(Collectors.toList())));
+		List<FeeCenter> feeCenterListFD = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
+			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FeeCenter::getIsDeleted, 0)
+			.in(FeeCenter::getPid, billsListFD.stream().map(Bills::getId).collect(Collectors.toList())));
+		if (!billsListFD.isEmpty()) {
+			idList.addAll(billsListFD.stream().map(Bills::getId).collect(Collectors.toList()));
+		}
 		List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
 			.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
 			.eq(PreContainers::getIsDeleted, 0)
-			.apply("find_in_set(pid,'" + billsIds + "')"));
+			.in(PreContainers::getPid, idList));
 		BFees fees = bFeesService.getOne(new LambdaQueryWrapper<BFees>()
 			.eq(BFees::getTenantId, AuthUtil.getTenantId())
 			.eq(BFees::getIsDeleted, 0)
@@ -1482,6 +1342,33 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		if (feesD == 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 agencyFeeCountWay = sysClient.getParamService("agency.fee.count.way");
+		if (ObjectUtils.isNull(agencyFeeCountWay) || "获取数据失败".equals(agencyFeeCountWay)) {
+			agencyFeeCountWay = "按收入";
+		}
+		String agencyFee;
+		if ("按收入".equals(agencyFeeCountWay)) {
+			String agencyFeeIncomeRatio = sysClient.getParamService("agency.fee.income.ratio");
+			if (ObjectUtils.isNull(agencyFeeIncomeRatio) || "获取数据失败".equals(agencyFeeIncomeRatio)) {
+				throw new RuntimeException("请先维护收入比例");
+			} else {
+				agencyFee = agencyFeeIncomeRatio;
+			}
+		} else {
+			String agencyFeeBoxNumberRrice = sysClient.getParamService("agency.fee.box.number.price");
+			if (ObjectUtils.isNull(agencyFeeBoxNumberRrice) || "获取数据失败".equals(agencyFeeBoxNumberRrice)) {
+				throw new RuntimeException("请先维护箱数单价");
+			} else {
+				agencyFee = agencyFeeBoxNumberRrice;
+			}
+		}
 		String deptName = "";
 		String branchId = AuthUtil.getDeptId();
 		if (ObjectUtils.isNotNull(branchId)) {
@@ -1490,6 +1377,13 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				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) {
@@ -1536,11 +1430,151 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					date = bills.getEta();
 				}
 			}
-
 			String exrateType = currencyUtils.standardCurrency(branchId);
 			List<BCurExrate> curExrateList = currencyUtils.obtainRate(date, "1", branchId);
-			int count = 1;
 			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()) {
+						List<FeeCenter> feeCenterSum = new ArrayList<>();
+						List<FeeCenter> feeCenters = feeCenterListFD.stream().filter(e -> e.getPid().equals(item.getId()) &&
+							"D".equals(e.getDc()) && "HYF".equals(e.getFeeCode())).collect(Collectors.toList());
+						if (!feeCenters.isEmpty()) {
+							for (FeeCenter feeCenter : feeCenters) {
+								FeeCenter feeCenterC = new FeeCenter();
+								feeCenterC.setBranchId(item.getBranchId());
+								feeCenterC.setBranchName(item.getBranchName());
+								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.setQuantity(feeCenter.getQuantity());
+								if ("按收入".equals(agencyFeeCountWay)) {
+									feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(agencyFee))
+										.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
+								} else {
+									feeCenterC.setPrice(feeCenterC.getPrice().subtract(new BigDecimal(agencyFee).multiply(feeCenterC.getQuantity()))
+										.setScale(2, RoundingMode.HALF_UP));
+								}
+								feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
+								feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
+								feeCentersFdC.add(feeCenterC);
+								feeCenterSum.add(feeCenterC);
+							}
+						}
+						if (!feeCenterSum.isEmpty()) {
+							this.updateBills(feeCenterSum, item, exrateType);
+							BigDecimal amount = feeCenterSum.stream().map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
+							FeeCenter feeCenterD = new FeeCenter();
+							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(bills.getHblno());
+							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(fees.getUnitNo());
+							feeCenterD.setCurCode(exrateType);
+							feeCenterD.setExrate(new BigDecimal("1"));
+							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.setQuantity(new BigDecimal("1"));
+							feeCenterD.setPrice(amount);
+							feeCenterD.setAmount(amount);
+							feeCenterD.setAmountLoc(amount);
+							list.add(feeCenterD);
+							list1.add(feeCenterD);
+						}
+					}
+				}
+			}
+			if (!feeCentersFdC.isEmpty()) {
+				this.saveBatch(feeCentersFdC);
+			}
+			int count = 1;
 			for (RouteCostItem items : routeCostItemList) {
 				if ("DD".equals(bills.getBillType())) {
 					FeeCenter feeCenter = this.addFeeCenter(bills, "C", count, fees, "船公司", items,
@@ -1571,14 +1605,26 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						list1.add(feeCenter);
 						count++;
 					}
-					FeeCenter feeCenterD = this.addFeeCenter(bills, "D", count, feesD, "国内直接客户", items,
-						curExrateList, preContainers, exrateType, "3");
-					if (feeCenterD != null) {
-						feeCenterD.setBranchId(branchId);
-						feeCenterD.setBranchName(deptName);
-						list.add(feeCenterD);
-						list1.add(feeCenterD);
-						count++;
+					if ("COC".equals(bills.getBoxBelongsTo())) {
+						FeeCenter feeCenterD = this.addFeeCenter(bills, "D", count, feesD, "国内直接客户", 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++;
+						}
 					}
 				} else if ("MH".equals(bills.getBillType())) {
 					throw new RuntimeException("只能提取主单,直单单据成本");
@@ -1596,59 +1642,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 
 			}
 			if (!list1.isEmpty()) {
-				//应付
-				int statusC = 0;
-				if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
-					statusC = 1;
-				}
-				//应收
-				int statusD = 0;
-				if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
-					statusD = 1;
-				}
-				if (1 == statusD && 0 == statusC) {
-					bills.setAccountStatus(1);
-				} else if (0 == statusD && 1 == statusC) {
-					bills.setAccountStatus(2);
-				}
-				BigDecimal amountDr;
-				BigDecimal amountCr;
-				BigDecimal amountProfit;
-				BigDecimal amountDrUsd;
-				BigDecimal amountCrUsd;
-				BigDecimal amountProfitUsd;
-				BigDecimal amountDrLoc;
-				BigDecimal amountCrLoc;
-				BigDecimal amountProfitLoc;
-				if ("D".equals(list.get(0).getDc())) {
-					amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCr = bills.getAmountCr();
-					amountCrUsd = bills.getAmountCrUsd();
-					amountCrLoc = bills.getAmountCrLoc();
-				} else {
-					amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDr = bills.getAmountDr();
-					amountDrUsd = bills.getAmountDrUsd();
-					amountDrLoc = bills.getAmountDrLoc();
-				}
-				//利润 = 收 - 付
-				amountProfit = amountDr.subtract(amountCr);
-				amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
-				amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
-				bills.setAmountDr(amountDr);
-				bills.setAmountCr(amountCr);
-				bills.setAmountProfit(amountProfit);
-				bills.setAmountDrUsd(amountDrUsd);
-				bills.setAmountCrUsd(amountCrUsd);
-				bills.setAmountProfitUsd(amountProfitUsd);
-				bills.setAmountDrLoc(amountDrLoc);
-				bills.setAmountCrLoc(amountCrLoc);
-				bills.setAmountProfitLoc(amountProfitLoc);
-				billsMapper.updateById(bills);
+				this.updateBills(list1, bills, exrateType);
 			}
 		}
 		if (!list.isEmpty()) {
@@ -1663,6 +1657,64 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		}
 	}
 
+	private void updateBills(List<FeeCenter> list, Bills bills, String exrateType) {
+		//应付
+		int statusC = 0;
+		if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
+			statusC = 1;
+		}
+		//应收
+		int statusD = 0;
+		if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
+			statusD = 1;
+		}
+		if (1 == statusD && 0 == statusC) {
+			bills.setAccountStatus(1);
+		} else if (0 == statusD && 1 == statusC) {
+			bills.setAccountStatus(2);
+		}
+		BigDecimal amountDr;
+		BigDecimal amountCr;
+		BigDecimal amountProfit;
+		BigDecimal amountDrUsd;
+		BigDecimal amountCrUsd;
+		BigDecimal amountProfitUsd;
+		BigDecimal amountDrLoc;
+		BigDecimal amountCrLoc;
+		BigDecimal amountProfitLoc;
+		BigDecimal oceanFreightDr;
+		BigDecimal oceanFreightCr;
+		BigDecimal oceanFreightProfit;
+		amountDr = bills.getAmountDr().add(list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+		amountDrUsd = bills.getAmountDrUsd().add(list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+		amountDrLoc = bills.getAmountDrLoc().add(list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
+		amountCr = bills.getAmountCr().add(list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+		amountCrUsd = bills.getAmountCrUsd().add(list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
+		amountCrLoc = bills.getAmountCrLoc().add(list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
+		oceanFreightDr = bills.getOceanFreightDr().add(list.stream().filter(e -> "D".equals(e.getDc()) &&
+			"HYF".equals(e.getFeeCode())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
+		oceanFreightCr = bills.getOceanFreightCr().add(list.stream().filter(e -> "C".equals(e.getDc()) &&
+			"HYF".equals(e.getFeeCode())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add));
+		oceanFreightProfit = oceanFreightDr.subtract(oceanFreightCr);
+		//利润 = 收 - 付
+		amountProfit = amountDr.subtract(amountCr);
+		amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
+		amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
+		bills.setAmountDr(amountDr);
+		bills.setOceanFreightDr(oceanFreightDr);
+		bills.setAmountCr(amountCr);
+		bills.setOceanFreightCr(oceanFreightCr);
+		bills.setAmountProfit(amountProfit);
+		bills.setOceanFreightProfit(oceanFreightProfit);
+		bills.setAmountDrUsd(amountDrUsd);
+		bills.setAmountCrUsd(amountCrUsd);
+		bills.setAmountProfitUsd(amountProfitUsd);
+		bills.setAmountDrLoc(amountDrLoc);
+		bills.setAmountCrLoc(amountCrLoc);
+		bills.setAmountProfitLoc(amountProfitLoc);
+		billsMapper.updateById(bills);
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public R quotationImportBatch(String billsIds, String quotationId) {
@@ -1794,59 +1846,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				}
 			}
 			if (!list1.isEmpty()) {
-				//应付
-				int statusC = 0;
-				if (list.stream().anyMatch(e -> "C".equals(e.getDc()))) {
-					statusC = 1;
-				}
-				//应收
-				int statusD = 0;
-				if (list.stream().anyMatch(e -> "D".equals(e.getDc()))) {
-					statusD = 1;
-				}
-				if (1 == statusD && 0 == statusC) {
-					bills.setAccountStatus(1);
-				} else if (0 == statusD && 1 == statusC) {
-					bills.setAccountStatus(2);
-				}
-				BigDecimal amountDr;
-				BigDecimal amountCr;
-				BigDecimal amountProfit;
-				BigDecimal amountDrUsd;
-				BigDecimal amountCrUsd;
-				BigDecimal amountProfitUsd;
-				BigDecimal amountDrLoc;
-				BigDecimal amountCrLoc;
-				BigDecimal amountProfitLoc;
-				if ("D".equals(list.get(0).getDc())) {
-					amountDr = list.stream().filter(e -> "D".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrUsd = list.stream().filter(e -> "D".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDrLoc = list.stream().filter(e -> "D".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCr = bills.getAmountCr();
-					amountCrUsd = bills.getAmountCrUsd();
-					amountCrLoc = bills.getAmountCrLoc();
-				} else {
-					amountCr = list.stream().filter(e -> "C".equals(e.getDc()) && exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrUsd = list.stream().filter(e -> "C".equals(e.getDc()) && !exrateType.equals(e.getCurCode())).map(FeeCenter::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountCrLoc = list.stream().filter(e -> "C".equals(e.getDc())).map(FeeCenter::getAmountLoc).reduce(BigDecimal.ZERO, BigDecimal::add);
-					amountDr = bills.getAmountDr();
-					amountDrUsd = bills.getAmountDrUsd();
-					amountDrLoc = bills.getAmountDrLoc();
-				}
-				//利润 = 收 - 付
-				amountProfit = amountDr.subtract(amountCr);
-				amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
-				amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
-				bills.setAmountDr(amountDr);
-				bills.setAmountCr(amountCr);
-				bills.setAmountProfit(amountProfit);
-				bills.setAmountDrUsd(amountDrUsd);
-				bills.setAmountCrUsd(amountCrUsd);
-				bills.setAmountProfitUsd(amountProfitUsd);
-				bills.setAmountDrLoc(amountDrLoc);
-				bills.setAmountCrLoc(amountCrLoc);
-				bills.setAmountProfitLoc(amountProfitLoc);
-				billsMapper.updateById(bills);
+				this.updateBills(list1, bills, exrateType);
 			}
 		}
 		if (!list.isEmpty()) {
@@ -2084,6 +2084,12 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 			} else {
 				feeCenter.setPrice(items.getSalesPrice());
 			}
+		} else if ("5".equals(type)) {
+			feeCenter.setCorpId(bills.getCarrierId());
+			feeCenter.setCorpCnName(bills.getCarrierShortName());
+			feeCenter.setCorpEnName(bills.getCarrierEnName());
+			feeCenter.setShortName(bills.getCarrierShortName());
+			feeCenter.setPrice(items.getAdditionalFee());
 		}
 		feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
 		if (ObjectUtils.isNull(feeCenter.getAmount())) {