Browse Source

1.久置柜列表,导出接口增加动态时间字段
2.客户增加合并客户并同步业务数据接口
3.海运进出口同步国外代理到分单
4.进出场记录同步增加判断,无货返空港口与出场港口必须一致,客户还箱港口不能与出场港口不能一样
5.pod场站导出接口放箱号类型bug修改
6.增加费用明细保存为模板接口
7.海运出口获取占用放箱号列表接口bug修改
8.用箱计划增加判断是否修改内容字段

纪新园 3 days ago
parent
commit
482b1b0bc2
19 changed files with 706 additions and 41 deletions
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/entity/FeesTemplateItems.java
  2. 7 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/entity/FeesTemplateSonItems.java
  3. 5 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/vo/LosBFeesTemplateVO.java
  4. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/UseBoxPlanItem.java
  5. 7 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/LongTermCabinetExcel.java
  6. 6 1
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/ReturnContainerReminderExcel.java
  7. 396 0
      blade-service/blade-los/src/main/java/org/springblade/los/Util/MergeCorpsUtils.java
  8. 12 0
      blade-service/blade-los/src/main/java/org/springblade/los/basic/corps/controller/BCorpsController.java
  9. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/PutBoxController.java
  10. 8 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/service/impl/BoxDynamicsRecordServiceImpl.java
  11. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/UseBoxPlanItemMapper.xml
  12. 4 2
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/ArchivesServiceImpl.java
  13. 2 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java
  14. 10 4
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/UseBoxPlanServiceImpl.java
  15. 6 2
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/ContainersMapper.xml
  16. 65 24
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  17. 11 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FeeCenterController.java
  18. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/IFeeCenterService.java
  19. 149 5
      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/basic/fees/entity/FeesTemplateItems.java

@@ -245,5 +245,11 @@ public class FeesTemplateItems implements Serializable {
 	@TableField(exist = false)
 	private List<FeesTemplateSonItems> sonItemsList;
 
+	/**
+	 * 临时id
+	 */
+	@TableField(exist = false)
+	private String temporaryId;
+
 
 }

+ 7 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/entity/FeesTemplateSonItems.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.los.basic.fees.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -207,5 +208,11 @@ public class FeesTemplateSonItems implements Serializable {
 	@ApiModelProperty(value = "税率 %")
 	private BigDecimal taxRate;
 
+	/**
+	 * 临时id
+	 */
+	@TableField(exist = false)
+	private String temporaryId;
+
 
 }

+ 5 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/fees/vo/LosBFeesTemplateVO.java

@@ -20,6 +20,9 @@ import io.swagger.annotations.ApiModel;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+
+import java.util.List;
 
 /**
  * 基础资料-费用模版及明细视图实体类
@@ -33,4 +36,6 @@ import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 public class LosBFeesTemplateVO extends LosBFeesTemplate {
 	private static final long serialVersionUID = 1L;
 
+	private List<FeeCenter> feeCenterList;
+
 }

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

@@ -144,6 +144,12 @@ public class UseBoxPlanItem implements Serializable {
 	private String tenantId;
 
 	/**
+	 * 判断数据是否修改字符串
+	 */
+	@ApiModelProperty(value = "判断数据是否修改字符串")
+	private String data;
+
+	/**
 	 * 年
 	 */
 	@TableField(exist = false)

+ 7 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/excel/LongTermCabinetExcel.java

@@ -6,6 +6,8 @@ import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
 import lombok.Data;
 
+import java.util.Date;
+
 /**
  * @author :jixinyuan
  * @date : 2025/9/2
@@ -57,6 +59,11 @@ public class LongTermCabinetExcel {
 	@ExcelProperty(value = "分单号")
 	private String billNo;
 	/**
+	 * 动态日期
+	 */
+	@ExcelProperty(value = "动态日期")
+	private Date newDate;
+	/**
 	 * 久置天数
 	 */
 	@ExcelProperty(value = "久置天数")

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

@@ -68,6 +68,11 @@ public class ReturnContainerReminderExcel {
 	@ExcelProperty(value = "HBLNO")
 	private String hblno;
 	/**
+	 * ATA
+	 */
+	@ExcelProperty(value = "ATA")
+	private String actualEta;
+	/**
 	 * 租户号
 	 */
 	@ExcelIgnore
@@ -75,7 +80,7 @@ public class ReturnContainerReminderExcel {
 	/**
 	 * 所属公司
 	 */
-	@ExcelIgnore
+	@ExcelProperty(value = "所属公司")
 	private String branchId;
 	/**
 	 * 放箱号类型

+ 396 - 0
blade-service/blade-los/src/main/java/org/springblade/los/Util/MergeCorpsUtils.java

@@ -0,0 +1,396 @@
+package org.springblade.los.Util;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.service.IBCorpsService;
+import org.springblade.los.basic.cur.service.IBCurExrateService;
+import org.springblade.los.box.entity.PutBox;
+import org.springblade.los.box.entity.PutBoxItems;
+import org.springblade.los.box.entity.TradingBox;
+import org.springblade.los.box.entity.TradingBoxItem;
+import org.springblade.los.box.mapper.TradingBoxMapper;
+import org.springblade.los.box.service.IPutBoxItemsService;
+import org.springblade.los.box.service.IPutBoxService;
+import org.springblade.los.box.service.ITradingBoxItemService;
+import org.springblade.los.box.service.ITradingBoxService;
+import org.springblade.los.business.amends.entity.Amends;
+import org.springblade.los.business.amends.service.IAmendsService;
+import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.mapper.BillsMapper;
+import org.springblade.los.business.sea.service.IBillsService;
+import org.springblade.los.finance.fee.entity.FeeCenter;
+import org.springblade.los.finance.fee.entity.FinAccBills;
+import org.springblade.los.finance.fee.service.ICostProfitCalculationService;
+import org.springblade.los.finance.fee.service.IFeeCenterService;
+import org.springblade.los.finance.fee.service.IFinAccBillsService;
+import org.springblade.los.finance.invoices.entity.FinInvoices;
+import org.springblade.los.finance.invoices.entity.FinInvoicesItems;
+import org.springblade.los.finance.invoices.mapper.FinInvoicesMapper;
+import org.springblade.los.finance.invoices.service.IFinInvoicesItemsService;
+import org.springblade.los.finance.invoices.service.IFinInvoicesService;
+import org.springblade.los.finance.stl.entity.FinStlBills;
+import org.springblade.los.finance.stl.entity.FinStlBillsItems;
+import org.springblade.los.finance.stl.mapper.FinStlBillsMapper;
+import org.springblade.los.finance.stl.service.IFinStlBillsItemsService;
+import org.springblade.los.finance.stl.service.IFinStlBillsService;
+import org.springframework.stereotype.Component;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author :jixinyuan
+ * @date : 2026/3/25
+ */
+@Component
+@AllArgsConstructor
+public class MergeCorpsUtils {
+
+	private final IFeeCenterService feeCenterService;
+
+	private final IFinAccBillsService finAccBillsService;
+
+	private final IBillsService billsService;
+
+	private final IAmendsService amendsService;
+
+	private final IBCorpsService bCorpsService;
+
+	private final ITradingBoxService tradingBoxService;
+
+	private final ITradingBoxItemService tradingBoxItemService;
+
+	private final IPutBoxService putBoxService;
+
+	private final IPutBoxItemsService putBoxItemsService;
+
+	private final IFinStlBillsService finStlBillsService;
+
+	private final IFinStlBillsItemsService finStlBillsItemsService;
+
+	private final IFinInvoicesService finInvoicesService;
+
+	private final IFinInvoicesItemsService finInvoicesItemsService;
+
+
+	public R mergeCorps(Long id, Long mergeId) {
+		BCorps corps = bCorpsService.getById(id);
+
+		BCorps mergeCorps = bCorpsService.getById(mergeId);
+		mergeCorps.setStatus(1);
+		mergeCorps.setUpdateTime(new Date());
+		mergeCorps.setUpdateUser(AuthUtil.getUserId());
+		mergeCorps.setUpdateUserName(AuthUtil.getUserName());
+		bCorpsService.updateById(mergeCorps);
+
+		List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+			.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+			.eq(FeeCenter::getIsDeleted, 0)
+			.and(i -> i.eq(FeeCenter::getCorpId, mergeId).or()
+				.eq(FeeCenter::getBillCorpId, mergeId).or()
+				.eq(FeeCenter::getBookingAgentId, mergeId).or()
+				.eq(FeeCenter::getGenerationCorpId, mergeId)));
+		if (!feeCenterList.isEmpty()){
+			for (FeeCenter item : feeCenterList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getCorpId())){
+					item.setCorpId(corps.getId());
+					item.setCorpCnName(corps.getCnName());
+					item.setCorpEnName(corps.getEnName());
+					item.setShortName(corps.getShortName());
+				}
+				if (mergeId.equals(item.getBillCorpId())){
+					item.setBillCorpId(corps.getId());
+					item.setBillCorpCnName(corps.getCnName());
+					item.setBillCorpEnName(corps.getEnName());
+					item.setBillShortName(corps.getShortName());
+				}
+				if (mergeId.equals(item.getBookingAgentId())){
+					item.setBookingAgentId(corps.getId());
+					item.setBookingAgentCnName(corps.getCnName());
+					item.setBookingAgentEnName(corps.getEnName());
+				}
+				if (mergeId.equals(item.getGenerationCorpId())){
+					item.setGenerationCorpId(corps.getId());
+					item.setGenerationCorpCnName(corps.getCnName());
+					item.setGenerationCorpEnName(corps.getEnName());
+				}
+			}
+			feeCenterService.updateBatchById(feeCenterList);
+		}
+		List<FinAccBills> finAccBillsList = finAccBillsService.list(new LambdaQueryWrapper<FinAccBills>()
+			.eq(FinAccBills::getTenantId, AuthUtil.getTenantId())
+			.eq(FinAccBills::getIsDeleted, 0)
+			.and(i -> i.eq(FinAccBills::getCorpId, mergeId).or()
+				.eq(FinAccBills::getBillCorpId, mergeId).or()
+				.eq(FinAccBills::getBookingAgentId, mergeId).or()
+				.eq(FinAccBills::getGenerationCorpId, mergeId)));
+		if (!finAccBillsList.isEmpty()){
+			for (FinAccBills item : finAccBillsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getCorpId())){
+					item.setCorpId(corps.getId());
+					item.setCorpCnName(corps.getCnName());
+					item.setCorpEnName(corps.getEnName());
+				}
+				if (mergeId.equals(item.getBillCorpId())){
+					item.setBillCorpId(corps.getId());
+					item.setBillCorpCnName(corps.getCnName());
+					item.setBillCorpEnName(corps.getEnName());
+				}
+				if (mergeId.equals(item.getBookingAgentId())){
+					item.setBookingAgentId(corps.getId());
+					item.setBookingAgentCnName(corps.getCnName());
+					item.setBookingAgentEnName(corps.getEnName());
+				}
+				if (mergeId.equals(item.getGenerationCorpId())){
+					item.setGenerationCorpId(corps.getId());
+					item.setGenerationCorpCnName(corps.getCnName());
+					item.setGenerationCorpEnName(corps.getEnName());
+				}
+			}
+			finAccBillsService.updateBatchById(finAccBillsList);
+		}
+		List<Bills> billsList = billsService.list(new LambdaQueryWrapper<Bills>()
+			.eq(Bills::getTenantId, AuthUtil.getTenantId())
+			.eq(Bills::getIsDeleted, 0)
+			.and(i -> i.eq(Bills::getCorpId, mergeId).or()
+				.eq(Bills::getForeignAgencyId, mergeId).or()
+				.eq(Bills::getBookingAgentId, mergeId).or()
+				.eq(Bills::getCyId, mergeId).or()
+				.eq(Bills::getCarrierId, mergeId)));
+		if (!billsList.isEmpty()){
+			for (Bills item : billsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getCorpId())){
+					item.setCorpId(corps.getId());
+					item.setCorpCnName(corps.getCnName());
+					item.setCorpEnName(corps.getEnName());
+					item.setShortName(corps.getShortName());
+				}
+				if (mergeId.equals(item.getForeignAgencyId())){
+					item.setForeignAgencyId(corps.getId());
+					item.setForeignAgencyCnName(corps.getCnName());
+					item.setForeignAgencyEnName(corps.getEnName());
+					item.setForeignAgencyCode(corps.getCode());
+				}
+				if (mergeId.equals(item.getBookingAgentId())){
+					item.setBookingAgentId(corps.getId());
+					item.setBookingAgentCnName(corps.getCnName());
+					item.setBookingAgentEnName(corps.getEnName());
+				}
+				if (mergeId.equals(item.getCyId())){
+					item.setCyId(corps.getId());
+					item.setCyCnName(corps.getCnName());
+					item.setCyEnName(corps.getEnName());
+					item.setCyCode(corps.getCode());
+				}
+				if (mergeId.equals(item.getCarrierId())){
+					item.setCarrierId(corps.getId());
+					item.setCarrierCnName(corps.getCnName());
+					item.setCarrierEnName(corps.getEnName());
+					item.setCarrierShortName(corps.getShortName());
+				}
+			}
+			billsService.updateBatchById(billsList);
+		}
+		List<Amends> amendsList = amendsService.list(new LambdaQueryWrapper<Amends>()
+			.eq(Amends::getTenantId, AuthUtil.getTenantId())
+			.eq(Amends::getIsDeleted, 0)
+			.eq(Amends::getCorpId, mergeId));
+		if (!amendsList.isEmpty()){
+			for (Amends item : amendsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setCorpId(corps.getId());
+				item.setCorpCnName(corps.getCnName());
+				item.setCorpEnName(corps.getEnName());
+			}
+			amendsService.updateBatchById(amendsList);
+		}
+		List<FinStlBills> finStlBillsList = finStlBillsService.list(new LambdaQueryWrapper<FinStlBills>()
+			.eq(FinStlBills::getTenantId, AuthUtil.getTenantId())
+			.eq(FinStlBills::getIsDeleted, 0)
+			.eq(FinStlBills::getCorpId, mergeId));
+		if (!finStlBillsList.isEmpty()){
+			for (FinStlBills item : finStlBillsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setCorpId(corps.getId());
+				item.setCorpCnName(corps.getCnName());
+				item.setCorpEnName(corps.getEnName());
+			}
+			finStlBillsService.updateBatchById(finStlBillsList);
+		}
+		List<FinStlBillsItems> finStlBillsItemsList = finStlBillsItemsService.list(new LambdaQueryWrapper<FinStlBillsItems>()
+			.eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
+			.eq(FinStlBillsItems::getIsDeleted, 0)
+			.eq(FinStlBillsItems::getCorpId, mergeId));
+		if (!finStlBillsItemsList.isEmpty()){
+			for (FinStlBillsItems item : finStlBillsItemsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setCorpId(corps.getId());
+				item.setCorpCnName(corps.getCnName());
+				item.setCorpEnName(corps.getEnName());
+			}
+			finStlBillsItemsService.updateBatchById(finStlBillsItemsList);
+		}
+		List<FinInvoices> finInvoicesList = finInvoicesService.list(new LambdaQueryWrapper<FinInvoices>()
+			.eq(FinInvoices::getTenantId, AuthUtil.getTenantId())
+			.eq(FinInvoices::getIsDeleted, 0)
+			.eq(FinInvoices::getCorpId, mergeId));
+		if (!finInvoicesList.isEmpty()){
+			for (FinInvoices item : finInvoicesList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setCorpId(corps.getId());
+				item.setCorpCnName(corps.getCnName());
+				item.setCorpEnName(corps.getEnName());
+			}
+			finInvoicesService.updateBatchById(finInvoicesList);
+		}
+		List<FinInvoicesItems> finInvoicesItemsList = finInvoicesItemsService.list(new LambdaQueryWrapper<FinInvoicesItems>()
+			.eq(FinInvoicesItems::getTenantId, AuthUtil.getTenantId())
+			.eq(FinInvoicesItems::getIsDeleted, 0)
+			.eq(FinInvoicesItems::getCorpId, mergeId));
+		if (!finInvoicesItemsList.isEmpty()){
+			for (FinInvoicesItems item : finInvoicesItemsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				item.setCorpId(corps.getId());
+				item.setCorpCnName(corps.getCnName());
+				item.setCorpEnName(corps.getEnName());
+			}
+			finInvoicesItemsService.updateBatchById(finInvoicesItemsList);
+		}
+		List<TradingBox> tradingBoxList = tradingBoxService.list(new LambdaQueryWrapper<TradingBox>()
+			.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
+			.eq(TradingBox::getIsDeleted, 0)
+			.and(i -> i.eq(TradingBox::getPurchaseCompanyId, mergeId).or()
+				.eq(TradingBox::getOwnerId, mergeId)));
+		if (!tradingBoxList.isEmpty()){
+			for (TradingBox item : tradingBoxList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getPurchaseCompanyId())){
+					item.setPurchaseCompanyId(corps.getId());
+					item.setPurchaseCompanyName(corps.getCnName());
+				}
+				if (mergeId.equals(item.getOwnerId())){
+					item.setOwnerId(corps.getId());
+					item.setOwnerName(corps.getCnName());
+				}
+			}
+			tradingBoxService.updateBatchById(tradingBoxList);
+		}
+		List<TradingBoxItem> tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
+			.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
+			.eq(TradingBoxItem::getIsDeleted, 0)
+			.and(i -> i.eq(TradingBoxItem::getCorpId, mergeId).or()
+				.eq(TradingBoxItem::getBoxEastId, mergeId).or()
+				.eq(TradingBoxItem::getStationId, mergeId).or()
+				.eq(TradingBoxItem::getPolCyId, mergeId).or()
+				.eq(TradingBoxItem::getPodStationId, mergeId).or()
+			));
+		if (!tradingBoxItemList.isEmpty()){
+			for (TradingBoxItem item : tradingBoxItemList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getCorpId())){
+					item.setCorpId(corps.getId());
+					item.setCorpName(corps.getCnName());
+				}
+				if (mergeId.equals(item.getBoxEastId())){
+					item.setBoxEastId(corps.getId());
+					item.setBoxEastName(corps.getCnName());
+				}
+				if (mergeId.equals(item.getStationId())){
+					item.setStationId(corps.getId());
+					item.setStationCname(corps.getCnName());
+				}
+				if (mergeId.equals(item.getPolCyId())){
+					item.setPolCyId(corps.getId());
+					item.setPolCyCname(corps.getCnName());
+				}
+				if (mergeId.equals(item.getPodStationId())){
+					item.setPodStationId(corps.getId());
+					item.setPodStationCname(corps.getCnName());
+				}
+			}
+			tradingBoxItemService.updateBatchById(tradingBoxItemList);
+		}
+		List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
+			.eq(PutBox::getTenantId, AuthUtil.getTenantId())
+			.eq(PutBox::getIsDeleted, 0)
+			.and(i -> i.eq(PutBox::getPolStationId, mergeId).or()
+				.eq(PutBox::getPodStationId, mergeId).or()));
+		if (!putBoxList.isEmpty()){
+			for (PutBox item : putBoxList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getPolStationId())){
+					item.setPolStationId(corps.getId());
+					item.setPolStationCname(corps.getCnName());
+				}
+				if (mergeId.equals(item.getPodStationId())){
+					item.setPodStationId(corps.getId());
+					item.setPodStationCname(corps.getCnName());
+				}
+			}
+			putBoxService.updateBatchById(putBoxList);
+		}
+		List<PutBoxItems> putBoxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
+			.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
+			.eq(PutBoxItems::getIsDeleted, 0)
+			.and(i -> i.eq(PutBoxItems::getPolCyId, mergeId).or()
+				.eq(PutBoxItems::getPodStationId, mergeId).or()
+				.eq(PutBoxItems::getCorpId, mergeId).or()
+				.eq(PutBoxItems::getBoxEastId, mergeId).or()));
+		if (!putBoxItemsList.isEmpty()){
+			for (PutBoxItems item : putBoxItemsList){
+				item.setUpdateTime(new Date());
+				item.setUpdateUserName(AuthUtil.getUserName());
+				item.setUpdateUser(AuthUtil.getUserId());
+				if (mergeId.equals(item.getPolCyId())){
+					item.setPolCyId(corps.getId());
+					item.setPolCyCname(corps.getCnName());
+				}
+				if (mergeId.equals(item.getPodStationId())){
+					item.setPodStationId(corps.getId());
+					item.setPodStationCname(corps.getCnName());
+				}
+				if (mergeId.equals(item.getCorpId())){
+					item.setCorpId(corps.getId());
+					item.setCorpName(corps.getCnName());
+				}
+				if (mergeId.equals(item.getBoxEastId())){
+					item.setBoxEastId(corps.getId());
+					item.setBoxEastName(corps.getCnName());
+				}
+			}
+			putBoxItemsService.updateBatchById(putBoxItemsList);
+		}
+
+		return R.data(null);
+	}
+
+
+}

+ 12 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/corps/controller/BCorpsController.java

@@ -36,6 +36,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.Func;
+import org.springblade.los.Util.MergeCorpsUtils;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.corps.entity.BCorpsAttn;
 import org.springblade.los.basic.corps.entity.BCorpsTypeDefine;
@@ -99,6 +100,8 @@ public class BCorpsController extends BladeController {
 
 	private final IBCorpsAttnService corpsAttnService;
 
+	private final MergeCorpsUtils mergeCorpsUtils;
+
 	/**
 	 * 详情
 	 */
@@ -657,4 +660,13 @@ public class BCorpsController extends BladeController {
 		return bCorpsService.submit(bCorps);
 	}
 
+	/**
+	 * 合并客户并同步业务数据
+	 */
+	@GetMapping("/mergeCorps")
+	@RepeatSubmit
+	public R mergeCorps(@RequestParam("id") Long id,@RequestParam("mergeId") Long mergeId)  {
+		return mergeCorpsUtils.mergeCorps(id,mergeId);
+	}
+
 }

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

@@ -224,7 +224,7 @@ public class PutBoxController extends BladeController {
 			seaContainerNumberItem.setBoxEastId(item.getBoxEastId());
 			seaContainerNumberItem.setBoxEastName(item.getBoxEastName());
 			seaContainerNumberItem.setContainerNumber(item.getContainerNumber());
-			seaContainerNumberItem.setBusType(item.getBusType());
+			seaContainerNumberItem.setBusType(item.getBoxClass());
 			seaContainerNumberItem.setPolId(item.getPolId());
 			seaContainerNumberItem.setPolCname(item.getPolCname());
 			seaContainerNumberItem.setPodId(item.getPodId());

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

@@ -2328,6 +2328,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							&& e.getPolId().equals(finalArchives.getAddressId()) && e.getPolStationId().equals(finalArchives.getStationId())
 							&& e.getBoxType().equals(finalArchives.getTypeName())).findFirst().orElse(null);
 						if (putBoxOld != null) {
+							if(putBoxOld.getPolId().equals(recordItems.getPortId())){
+								failureHandling(type, boxDynamicsRecord, "箱号:" + recordItems.getBoxCode() + "还箱港口与出场港口一致,数据错误");
+								return false;
+							}
 							recordItems.setSrcPutBoxId(putBoxOld.getId());
 							if (!putBoxes.isEmpty()) {
 								if (!putBoxes.stream().map(PutBox::getId).collect(Collectors.toList()).contains(putBoxOld.getId())) {
@@ -3111,6 +3115,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 								failureHandling(type, boxDynamicsRecord, "放箱号:" + recordItems.getContainerNumber() + "类型为OW(放),数据错误请校验");
 								return false;
 							}
+							if(!putBox.getPolId().equals(recordItems.getPortId())){
+								failureHandling(type, boxDynamicsRecord, "箱号:" + recordItems.getBoxCode() + "无货返空港口与出场港口不一致,数据错误");
+								return false;
+							}
 							//放箱号明细数据处理
 							PutBoxItems putBoxItem;
 							if (!putBoxItemsList.isEmpty()) {

+ 2 - 2
blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/UseBoxPlanItemMapper.xml

@@ -67,7 +67,7 @@
         <if test="data.endDate !=null and data.endDate != ''">
             AND plan.end_date &lt;= #{data.endDate}
         </if>
-        ORDER BY item.create_time DESC
+        ORDER BY IF(item.update_time,item.create_time,item.update_time) DESC
     </select>
     <select id="exportUseBoxPlanItem" resultType="org.springblade.los.box.excel.UseBoxPlanItemExcel">
         SELECT
@@ -110,7 +110,7 @@
         <if test="data.endDate !=null and data.endDate != ''">
             AND plan.end_date &lt;= #{data.endDate}
         </if>
-        ORDER BY item.create_time DESC
+        ORDER BY IF(item.update_time,item.create_time,item.update_time) DESC
     </select>
 
 </mapper>

+ 4 - 2
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/ArchivesServiceImpl.java

@@ -467,11 +467,12 @@ public class ArchivesServiceImpl extends ServiceImpl<ArchivesMapper, Archives> i
 			excel.setAddressCname(item.getAddressCname());
 			excel.setStationCname(item.getStationCname());
 			excel.setBillNo(item.getBillNo());
+			excel.setNewDate(item.getNewDate());
 			if (ObjectUtils.isNotNull(item.getNewDate())) {
 				// 解析目标日期
 				Instant instant = item.getNewDate().toInstant();
 				ZoneId zoneId = ZoneId.systemDefault();
-				excel.setLongTermDays(ChronoUnit.DAYS.between(currentDate, instant.atZone(zoneId).toLocalDate()));
+				excel.setLongTermDays(ChronoUnit.DAYS.between(instant.atZone(zoneId).toLocalDate(), currentDate));
 			}
 			excelList.add(excel);
 		}
@@ -507,11 +508,12 @@ public class ArchivesServiceImpl extends ServiceImpl<ArchivesMapper, Archives> i
 			excel.setAddressCname(item.getAddressCname());
 			excel.setStationCname(item.getStationCname());
 			excel.setBillNo(item.getBillNo());
+			excel.setNewDate(item.getNewDate());
 			if (ObjectUtils.isNotNull(item.getNewDate())) {
 				// 解析目标日期
 				Instant instant = item.getNewDate().toInstant();
 				ZoneId zoneId = ZoneId.systemDefault();
-				excel.setLongTermDays(ChronoUnit.DAYS.between(currentDate, instant.atZone(zoneId).toLocalDate()));
+				excel.setLongTermDays(ChronoUnit.DAYS.between(instant.atZone(zoneId).toLocalDate(), currentDate));
 			}
 			excelList.add(excel);
 		}

+ 2 - 0
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -441,6 +441,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					archives1.setNewDate(new Date());
 					archives1.setContainerNumber(putBox1.getContainerNumber());
 					archives1.setContainerNumberType(putBox1.getBoxClass());
+					archives1.setContainerNumberOw(putBox1.getContainerNumber());
+					archives1.setContainerNumberTypeOw(putBox1.getBoxClass());
 					archives.add(archives1);
 				} else {
 					throw new RuntimeException("箱号:" + item.getBoxCode() + "不在箱档案中");

+ 10 - 4
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/UseBoxPlanServiceImpl.java

@@ -85,7 +85,8 @@ public class UseBoxPlanServiceImpl extends ServiceImpl<UseBoxPlanMapper, UseBoxP
 		List<UseBoxPlanItem> useBoxPlanItemList = useBoxPlanItemService.list(new LambdaQueryWrapper<UseBoxPlanItem>()
 			.eq(UseBoxPlanItem::getTenantId, AuthUtil.getTenantId())
 			.eq(UseBoxPlanItem::getIsDeleted, 0)
-			.eq(UseBoxPlanItem::getPid, useBoxPlan.getId()));
+			.eq(UseBoxPlanItem::getPid, useBoxPlan.getId())
+			.orderByDesc(UseBoxPlanItem::getUpdateTime));
 		detail.setUseBoxPlanItemList(useBoxPlanItemList.isEmpty() ? new ArrayList<>() : useBoxPlanItemList);
 		return detail;
 	}
@@ -147,10 +148,15 @@ public class UseBoxPlanServiceImpl extends ServiceImpl<UseBoxPlanMapper, UseBoxP
 					item.setCreateTime(new Date());
 					item.setCreateUser(AuthUtil.getUserId());
 					item.setCreateUserName(AuthUtil.getUserName());
+					item.setData(item.getPodId()+"-"+item.getPrice20gp()+"-"+item.getPrice40gp()+"-"+item.getPrice40hc());
 				} else {
-					item.setUpdateUser(AuthUtil.getUserId());
-					item.setUpdateTime(new Date());
-					item.setUpdateUserName(AuthUtil.getUserName());
+					String data = item.getPodId()+"-"+item.getPrice20gp()+"-"+item.getPrice40gp()+"-"+item.getPrice40hc();
+					if (ObjectUtils.isNull(item.getData()) || !data.equals(item.getData())){
+						item.setUpdateUser(AuthUtil.getUserId());
+						item.setUpdateTime(new Date());
+						item.setUpdateUserName(AuthUtil.getUserName());
+						item.setData(item.getPodId()+"-"+item.getPrice20gp()+"-"+item.getPrice40gp()+"-"+item.getPrice40hc());
+					}
 				}
 			}
 			useBoxPlanItemService.saveOrUpdateBatch(useBoxPlan.getUseBoxPlanItemList());

+ 6 - 2
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/ContainersMapper.xml

@@ -88,7 +88,7 @@
         se.pod_cn_name as podName,
         sc.container_number as containerNumber,
         se.box_belongs_to as boxBelongsTo,
-        cn.bus_type as busType,
+        sc.box_src_type as busType,
         sc.cntr_no as cntrNo,
         sc.seal_no as sealNo,
         sc.cntr_type_code as cntrTypeCode,
@@ -197,7 +197,7 @@
         se.pod_cn_name as podName,
         sc.container_number as containerNumber,
         se.box_belongs_to as boxBelongsTo,
-        cn.bus_type as busType,
+        sc.box_src_type as busType,
         sc.cntr_no as cntrNo,
         sc.seal_no as sealNo,
         sc.cntr_type_code as cntrTypeCode,
@@ -309,6 +309,8 @@
         lsc.pod_cy_email as podCyEmail,
         lsc.hblno as hblno,
         lsc.mblno as mblno,
+        lsb.actual_eta as actualEta,
+        lsb.branch_name as branchId,
         lsc.pod_empty_container_return_date as podEmptyContainerReturnDate
         FROM
         los_sea_containers lsc
@@ -354,6 +356,8 @@
         lsc.pod_cy_email as podCyEmail,
         lsc.hblno as hblno,
         lsc.mblno as mblno,
+        lsb.actual_eta as actualEta,
+        lsb.branch_name as branchId,
         lsc.pod_empty_container_return_date as podEmptyContainerReturnDate
         FROM
         los_sea_containers lsc

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

@@ -736,11 +736,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				details.setGrossWeight(grossWeightM);
 				details.setMeasurement(measurementM);
 				this.updateById(details);
-			}else{
+			} else {
 				String isOccupyNum = sysClient.getParamService("is.occupyNum");
-				if (!"获取数据失败".equals(isOccupyNum)){
+				if (!"获取数据失败".equals(isOccupyNum)) {
 					Bills bills1 = baseMapper.selectById(bills.getId());
-					if (bills1 != null){
+					if (bills1 != null) {
 						boolean status = false;
 						if ("SE".equals(bills.getBusinessType())) {
 							if (ObjectUtils.isNotNull(bills1.getActualEtd()) && ObjectUtils.isNotNull(bills.getActualEtd()) &&
@@ -749,11 +749,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 							}
 						} else if ("SI".equals(bills.getBusinessType())) {
 							if (ObjectUtils.isNotNull(bills1.getActualEta()) && ObjectUtils.isNotNull(bills.getActualEta()) &&
-								!bills1.getEtd().equals(bills.getActualEta())) {
+								!bills1.getEta().equals(bills.getActualEta())) {
 								status = true;
 							}
 						}
-						if (status){
+						if (status) {
 							archivesTrajectoryUtils.saveTrajectoryAndContainers(bills);
 						}
 					}
@@ -813,7 +813,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				|| statusPodId || statusCyTrailerTime || statusCyReturnTime || statusLineId || statusForwarding || statusBookingAgentId
 				|| shippingAgencyId || bookingDate || carrierId || foreignAgencyId || issueDate || boxBelongsTo || issueAtId) {
 				String isOccupyNum = sysClient.getParamService("is.occupyNum");
-				if (!"获取数据失败".equals(isOccupyNum)){
+				if (!"获取数据失败".equals(isOccupyNum)) {
 					boolean status = false;
 					if ("SE".equals(bills.getBusinessType())) {
 						if (ObjectUtils.isNotNull(details.getActualEtd()) && ObjectUtils.isNotNull(bills.getActualEtd()) &&
@@ -826,7 +826,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 							status = true;
 						}
 					}
-					if (status){
+					if (status) {
 						archivesTrajectoryUtils.saveTrajectoryAndContainers(bills);
 					}
 				}
@@ -1097,7 +1097,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					for (Bills item : billsList) {
 						item.setEtd(bills.getEtd());
 						item.setEta(bills.getEta());
-						if (!"获取数据失败".equals(isOccupyNum)){
+						if (!"获取数据失败".equals(isOccupyNum)) {
 							boolean status = false;
 							if ("SE".equals(bills.getBusinessType())) {
 								if (ObjectUtils.isNotNull(details.getActualEtd()) && ObjectUtils.isNotNull(bills.getActualEtd()) &&
@@ -1110,7 +1110,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 									status = true;
 								}
 							}
-							if (status){
+							if (status) {
 								archivesTrajectoryUtils.saveTrajectoryAndContainers(item);
 							}
 						}
@@ -1153,6 +1153,12 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 						item.setIssueAtId(bills.getIssueAtId());
 						item.setIssueAt(bills.getIssueAt());
 						item.setCabinType(bills.getCabinType());
+						item.setForeignAgencyId(bills.getForeignAgencyId());
+						item.setForeignAgencyCode(bills.getForeignAgencyCode());
+						item.setForeignAgencyCnName(bills.getForeignAgencyCnName());
+						item.setForeignAgencyEnName(bills.getForeignAgencyEnName());
+						item.setForeignAgencyDetails(bills.getForeignAgencyDetails());
+						item.setForeignCntyName(bills.getForeignCntyName());
 					}
 					this.updateBatchById(billsList);
 					billIds = billsList.stream().map(Bills::getId).collect(Collectors.toList());
@@ -1717,6 +1723,35 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					}
 				}
 			}
+			List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+				.eq(FeeCenter::getIsDeleted, 0)
+				.in(FeeCenter::getPid, idArr));
+			if (!feeCenterList.isEmpty()) {
+				for (FeeCenter item : feeCenterList) {
+					item.setUpdateTime(new Date());
+					item.setUpdateUserName(AuthUtil.getUserName());
+					item.setUpdateUser(AuthUtil.getUserId());
+					item.setMblno("");
+				}
+				feeCenterService.updateBatchById(feeCenterList);
+				List<Long> accIdList = feeCenterList.stream().map(FeeCenter::getAccBillId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+				if (!accIdList.isEmpty()) {
+					List<FinAccBills> finAccBillsList = finAccBillsService.list(new LambdaQueryWrapper<FinAccBills>()
+						.eq(FinAccBills::getTenantId, AuthUtil.getTenantId())
+						.eq(FinAccBills::getIsDeleted, 0)
+						.in(FinAccBills::getId, accIdList));
+					if (!feeCenterList.isEmpty()) {
+						for (FinAccBills item : finAccBillsList) {
+							item.setUpdateTime(new Date());
+							item.setUpdateUserName(AuthUtil.getUserName());
+							item.setUpdateUser(AuthUtil.getUserId());
+							item.setMblno("");
+						}
+						finAccBillsService.updateBatchById(finAccBillsList);
+					}
+				}
+			}
 			bills.setTeuTotal(teuTotal);
 			bills.setGrossWeight(grossWeight);
 			bills.setQuantity(quantity);
@@ -1751,13 +1786,13 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			}
 			String type = "";
 			if ("SE".equals(item.getBusinessType())) {
-				type = "海运出口-"+(ObjectUtils.isNull(item.getHblno()) ? item.getBillNo() : item.getHblno());
+				type = "海运出口-" + (ObjectUtils.isNull(item.getHblno()) ? item.getBillNo() : item.getHblno());
 			} else if ("SI".equals(item.getBusinessType())) {
-				type = "海运进口-"+(ObjectUtils.isNull(item.getHblno()) ? item.getBillNo() : item.getHblno());
+				type = "海运进口-" + (ObjectUtils.isNull(item.getHblno()) ? item.getBillNo() : item.getHblno());
 			} else if ("YDC".equals(item.getBusinessType())) {
-				type = "预定舱-"+item.getBillNo();
+				type = "预定舱-" + item.getBillNo();
 			} else if ("KHTS".equals(item.getBusinessType())) {
-				type = "客户订舱-"+item.getBillNo();
+				type = "客户订舱-" + item.getBillNo();
 			}
 			logUtils.saveOperationLog(OperatorType.DELETE, type, item.getId());
 			LocalDateTime now = LocalDateTime.now();
@@ -1777,8 +1812,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				sendMessage.setUrl("/iosBasicData/SeafreightExportF/bills/index");
 				sendMessage.setPageLabel("海运出口");
 				sendMessage.setPageStatus("this.$store.getters.domSaleStatus");
-				sendMessage.setMessageBody(type+":" + (ObjectUtils.isNull(item.getHblno())
-					? item.getBillNo() : item.getHblno()) + "已删除!操作人:"+AuthUtil.getUserName()+"时间:" + formatted);
+				sendMessage.setMessageBody(type + ":" + (ObjectUtils.isNull(item.getHblno())
+					? item.getBillNo() : item.getHblno()) + "已删除!操作人:" + AuthUtil.getUserName() + "时间:" + formatted);
 				R save = messageClient.save(sendMessage);
 				if (!save.isSuccess()) {
 					throw new SecurityException("发送消息失败");
@@ -1789,7 +1824,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			item.setUpdateTime(new Date());
 			item.setIsDeleted(1);
 		}
-		if (!billsList.isEmpty()){
+		if (!billsList.isEmpty()) {
 			this.updateBatchById(billsList);
 		}
 		List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
@@ -1800,7 +1835,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			if (feeCenterList.stream().anyMatch(e -> !"0".equals(e.getAuditStatus()))) {
 				throw new RuntimeException("费用已审核,禁止删除");
 			} else {
-				for (FeeCenter item : feeCenterList){
+				for (FeeCenter item : feeCenterList) {
 					item.setUpdateUserName(AuthUtil.getUserName());
 					item.setUpdateUser(AuthUtil.getUserId());
 					item.setUpdateTime(new Date());
@@ -1821,8 +1856,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			.in(PreContainers::getPid, ids));
 		if (!preContainersList.isEmpty()) {
 			for (PreContainers item : preContainersList) {
-				Bills bills = billsList.stream().filter(e-> e.getId().equals(item.getPid())).findFirst().orElse(null);
-				if (bills != null && "SE".equals(bills.getBusinessType())){
+				Bills bills = billsList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
+				if (bills != null && "SE".equals(bills.getBusinessType())) {
 					if ("已选择".equals(item.getContainerNumberStatus())) {
 						throw new RuntimeException("已占用放箱号,请先撤销后再删除");
 					}
@@ -1966,7 +2001,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				sendMessage.setPageLabel("海运出口");
 				sendMessage.setPageStatus("this.$store.getters.domSaleStatus");
 				sendMessage.setMessageBody("单号:" + (ObjectUtils.isNull(item.getHblno())
-					? item.getBillNo() : item.getHblno()) + "已退舱请及时待处理!操作人:"+AuthUtil.getUserName()+"时间:" + formatted);
+					? item.getBillNo() : item.getHblno()) + "已退舱请及时待处理!操作人:" + AuthUtil.getUserName() + "时间:" + formatted);
 				R save = messageClient.save(sendMessage);
 				if (!save.isSuccess()) {
 					throw new SecurityException("发送消息失败");
@@ -2720,7 +2755,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				sendMessage.setPageLabel("海运出口");
 				sendMessage.setPageStatus("this.$store.getters.domSaleStatus");
 				sendMessage.setMessageBody("单号:" + (ObjectUtils.isNull(item.getHblno())
-					? item.getBillNo() : item.getHblno()) + "已取消退舱请及时待处理!操作人:"+AuthUtil.getUserName()+"时间:" + formatted);
+					? item.getBillNo() : item.getHblno()) + "已取消退舱请及时待处理!操作人:" + AuthUtil.getUserName() + "时间:" + formatted);
 				R save = messageClient.save(sendMessage);
 				if (!save.isSuccess()) {
 					throw new SecurityException("发送消息失败");
@@ -5484,9 +5519,9 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				}
 			}
 		}
-		List<User> userList = userClient.selectListByRoleAndDept("secondaryAdmin",bills.getBranchId(),AuthUtil.getTenantId());
-		if (!userList.isEmpty()){
-			for (User datum : userList){
+		List<User> userList = userClient.selectListByRoleAndDept("secondaryAdmin", bills.getBranchId(), AuthUtil.getTenantId());
+		if (!userList.isEmpty()) {
+			for (User datum : userList) {
 				Message sendMessage = new Message();
 				sendMessage.setParameter(bills.getId() + "");
 				sendMessage.setUserName(AuthUtil.getUserName());
@@ -5971,6 +6006,12 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					item.setCabinType(bills.getCabinType());
 					item.setCyReturnTime(bills.getCyReturnTime());
 					item.setCyTrailerTime(bills.getCyTrailerTime());
+					item.setForeignAgencyId(bills.getForeignAgencyId());
+					item.setForeignAgencyCode(bills.getForeignAgencyCode());
+					item.setForeignAgencyCnName(bills.getForeignAgencyCnName());
+					item.setForeignAgencyEnName(bills.getForeignAgencyEnName());
+					item.setForeignAgencyDetails(bills.getForeignAgencyDetails());
+					item.setForeignCntyName(bills.getForeignCntyName());
 					if (!bookingList.isEmpty() && ObjectUtils.isNotNull(item.getTemporaryId())) {
 						Bills bills1 = bookingList.stream().filter(e -> e.getId().equals(item.getTemporaryId())).findFirst().orElse(null);
 						if (bills1 != null) {

+ 11 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/controller/FeeCenterController.java

@@ -33,6 +33,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
+import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
 import org.springblade.los.business.mktSlot.entity.MktSlotQuotation;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.finance.fee.entity.FeeCenter;
@@ -304,4 +305,14 @@ public class FeeCenterController extends BladeController {
 	}
 
 
+	/**
+	 * 保存模板
+	 */
+	@PostMapping("/saveTemplate")
+	@RepeatSubmit
+	public R saveTemplate(@Valid @RequestBody LosBFeesTemplateVO losBFeesTemplateVO) {
+		return feeCenterService.saveTemplate(losBFeesTemplateVO);
+	}
+
+
 }

+ 3 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/IFeeCenterService.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import org.springblade.core.tool.api.R;
 import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
+import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.vo.FeeCenterVO;
 
@@ -96,4 +97,6 @@ public interface IFeeCenterService extends IService<FeeCenter> {
 	R synchronizationPrompt(Long billId, String dc);
 
 	R synchronizationSettlementObject(Long billId, String dc);
+
+	R saveTemplate(LosBFeesTemplateVO losBFeesTemplateVO);
 }

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

@@ -25,6 +25,9 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.los.Util.CurrencyUtils;
+import org.springblade.los.Util.StringTools;
+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.mapper.CorpsMapper;
 import org.springblade.los.basic.corps.service.IBCorpsService;
@@ -36,6 +39,8 @@ import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.basic.fees.service.IBFeesService;
 import org.springblade.los.basic.fees.service.IFeesTemplateItemsService;
 import org.springblade.los.basic.fees.service.IFeesTemplateSonItemsService;
+import org.springblade.los.basic.fees.service.ILosBFeesTemplateService;
+import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
 import org.springblade.los.box.entity.RouteCostItem;
 import org.springblade.los.box.entity.TradingBox;
 import org.springblade.los.box.mapper.TradingBoxMapper;
@@ -91,6 +96,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 
 	private final IFeesTemplateItemsService feesTemplateItemsService;
 
+	private final ILosBFeesTemplateService losBFeesTemplateService;
+
 	private final IFeesTemplateSonItemsService feesTemplateSonItemsService;
 
 	private final IRouteCostItemService routeCostItemService;
@@ -105,6 +112,8 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 
 	private final ICostProfitCalculationService costProfitCalculationService;
 
+	private final IBusinessTypeService bBusinessTypeService;
+
 	@Override
 	public IPage<FeeCenterVO> selectFeeCenterPage(IPage<FeeCenterVO> page, FeeCenterVO feeCenter) {
 		return page.setRecords(baseMapper.selectFeeCenterPage(page, feeCenter));
@@ -844,7 +853,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					int version = StringUtil.isBlank(feeCenter.getVersion()) ? 1 : Integer.parseInt(feeCenter.getVersion());
 					feeCenter.setVersion(String.valueOf(version + 1));
 					feeCenterIdList.add(feeCenter.getId());
-					if (!"4".equals(feeCenter.getAuditStatus())){
+					if (!"4".equals(feeCenter.getAuditStatus())) {
 						feeCenter.setUpdateUser(AuthUtil.getUserId());
 						feeCenter.setUpdateTime(new Date());
 						feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -985,7 +994,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					}
 					int version = StringUtil.isBlank(feeCenter.getVersion()) ? 1 : Integer.parseInt(feeCenter.getVersion());
 					feeCenter.setVersion(String.valueOf(version + 1));
-					if (!"4".equals(feeCenter.getAuditStatus())){
+					if (!"4".equals(feeCenter.getAuditStatus())) {
 						feeCenter.setUpdateUser(AuthUtil.getUserId());
 						feeCenter.setUpdateTime(new Date());
 						feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -1277,7 +1286,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						feeCenter.setCreateDeptName(deptName);
 					}
 				} else {
-					if (!"4".equals(feeCenter.getAuditStatus())){
+					if (!"4".equals(feeCenter.getAuditStatus())) {
 						feeCenter.setUpdateUser(AuthUtil.getUserId());
 						feeCenter.setUpdateTime(new Date());
 						feeCenter.setUpdateUserName(AuthUtil.getUserName());
@@ -2666,7 +2675,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					map.put("corpCnNameNew", feeCenter.getCorpCnName());
 					mapList.add(map);
 				}
-			}else if ("订舱代理".contains(feeCenter.getCorpType())) {
+			} else if ("订舱代理".contains(feeCenter.getCorpType())) {
 				if (!feeCenter.getCorpId().equals(bills.getBookingAgentId())) {
 					BCorps bCorps = null;
 					if (!corpsList.isEmpty()) {
@@ -2804,7 +2813,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					}
 					feeCenters.add(feeCenter);
 				}
-			}else if ("订舱代理".contains(feeCenter.getCorpType())) {
+			} else if ("订舱代理".contains(feeCenter.getCorpType())) {
 				if (!feeCenter.getCorpId().equals(bills.getBookingAgentId())) {
 					BCorps bCorps = null;
 					if (!corpsList.isEmpty()) {
@@ -2829,6 +2838,141 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 		return R.data(feeCenters);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public R saveTemplate(LosBFeesTemplateVO losBFeesTemplateVO) {
+		if (ObjectUtils.isNull(losBFeesTemplateVO.getFeeCenterList()) ||
+			losBFeesTemplateVO.getFeeCenterList().isEmpty()) {
+			throw new RuntimeException("费用明细不能为空");
+		}
+		LosBFeesTemplate losBFeesTemplate = new LosBFeesTemplate();
+		String deptId = losBFeesTemplateVO.getBranchId();
+		String deptName = losBFeesTemplateVO.getBranchName();
+		List<LosBFeesTemplate> list = losBFeesTemplateService.list(new LambdaQueryWrapper<LosBFeesTemplate>()
+			.eq(LosBFeesTemplate::getTenantId, AuthUtil.getTenantId())
+			.eq(LosBFeesTemplate::getIsDeleted, 0)
+			.like(LosBFeesTemplate::getBranchId, deptId)
+			.eq(LosBFeesTemplate::getCode, losBFeesTemplateVO.getCode()));
+		List<LosBFeesTemplate> nameList = losBFeesTemplateService.list(new LambdaQueryWrapper<LosBFeesTemplate>()
+			.eq(LosBFeesTemplate::getTenantId, AuthUtil.getTenantId())
+			.eq(LosBFeesTemplate::getIsDeleted, 0)
+			.like(LosBFeesTemplate::getBranchId, deptId)
+			.eq(LosBFeesTemplate::getCnName, losBFeesTemplateVO.getCnName()));
+		if (!list.isEmpty()) {
+			throw new RuntimeException("编码不允许重复");
+		}
+		if (!nameList.isEmpty()) {
+			throw new RuntimeException("中文名称不允许重复");
+		}
+		losBFeesTemplate.setCreateTime(new Date());
+		losBFeesTemplate.setCreateUser(AuthUtil.getUserId());
+		losBFeesTemplate.setCreateUserName(AuthUtil.getUserName());
+		losBFeesTemplate.setCreateDept(deptId);
+		losBFeesTemplate.setCreateDeptName(deptName);
+		losBFeesTemplate.setBranchId(deptId);
+		losBFeesTemplate.setBranchName(deptName);
+		BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
+			.eq(BusinessType::getTenantId, AuthUtil.getTenantId())
+			.eq(BusinessType::getIsDeleted, 0)
+			.eq(BusinessType::getCode, losBFeesTemplateVO.getBusinessTypeCode()));
+		if (businessType != null) {
+			losBFeesTemplate.setBusinessTypeId(businessType.getId());
+			losBFeesTemplate.setBusinessTypeCnName(businessType.getCnName());
+			losBFeesTemplate.setBusinessTypeEnName(businessType.getEnName());
+			losBFeesTemplate.setBusinessTypeCode(businessType.getCode());
+		}
+		losBFeesTemplate.setCode(losBFeesTemplateVO.getCode());
+		losBFeesTemplate.setCnName(losBFeesTemplateVO.getCnName());
+		losBFeesTemplate.setEnName(losBFeesTemplateVO.getEnName());
+		losBFeesTemplate.setDc(losBFeesTemplateVO.getDc());
+		losBFeesTemplate.setIsShared("0");
+		losBFeesTemplate.setShippingCompanyId(losBFeesTemplateVO.getShippingCompanyId());
+		losBFeesTemplate.setShippingCompanyCname(losBFeesTemplateVO.getShippingCompanyCname());
+		losBFeesTemplate.setShippingCompanyCode(losBFeesTemplateVO.getShippingCompanyCode());
+		losBFeesTemplate.setAddressId(losBFeesTemplateVO.getAddressId());
+		losBFeesTemplate.setAddressCname(losBFeesTemplateVO.getAddressCname());
+		losBFeesTemplate.setAddressCode(losBFeesTemplateVO.getAddressCode());
+		losBFeesTemplate.setTransportationTerms(losBFeesTemplateVO.getTransportationTerms());
+		losBFeesTemplateService.save(losBFeesTemplate);
+		List<FeesTemplateItems> feesTemplateItemsList = new ArrayList<>();
+		List<FeesTemplateSonItems> sonItemsList = new ArrayList<>();
+		for (FeeCenter item : losBFeesTemplateVO.getFeeCenterList()) {
+			FeesTemplateItems feesTemplateItems = new FeesTemplateItems();
+			if ("件数".equals(item.getUnitNo())) {
+				feesTemplateItems.setQuantityRule("按件数");
+			} else if ("票".equals(item.getUnitNo())) {
+				feesTemplateItems.setQuantityRule("按票");
+			} else if ("吨".equals(item.getUnitNo())) {
+				feesTemplateItems.setQuantityRule("按重量");
+			} else if ("箱量".equals(item.getUnitNo())) {
+				feesTemplateItems.setQuantityRule("按箱型");
+			} else if ("体积".equals(item.getUnitNo())) {
+				feesTemplateItems.setQuantityRule("按尺码");
+			}
+			feesTemplateItems.setUnitNo(item.getUnitNo());
+			if (ObjectUtils.isNull(item.getCorpType())) {
+				feesTemplateItems.setCorpId(item.getCorpId());
+				feesTemplateItems.setCorpCnName(item.getCorpCnName());
+				feesTemplateItems.setCorpEnName(item.getCorpEnName());
+			}
+			feesTemplateItems.setPrice(item.getPrice());
+			feesTemplateItems.setQuantity(new BigDecimal("1"));
+			feesTemplateItems.setTaxRate(item.getTaxRate());
+			feesTemplateItems.setCurCode(item.getCurCode());
+			feesTemplateItems.setCorpType(item.getCorpType());
+			feesTemplateItems.setFeeId(item.getFeeId());
+			feesTemplateItems.setFeeCode(item.getFeeCode());
+			feesTemplateItems.setFeeCnName(item.getFeeCnName());
+			feesTemplateItems.setFeeEnName(item.getFeeEnName());
+			feesTemplateItems.setPid(losBFeesTemplate.getId());
+			feesTemplateItems.setDc(losBFeesTemplate.getDc());
+			feesTemplateItems.setBranchId(deptId);
+			feesTemplateItems.setBranchName(deptName);
+			feesTemplateItems.setCreateTime(new Date());
+			feesTemplateItems.setCreateUser(AuthUtil.getUserId());
+			feesTemplateItems.setCreateUserName(AuthUtil.getUserName());
+			feesTemplateItems.setCreateDept(deptId);
+			feesTemplateItems.setCreateDeptName(deptName);
+			String temporaryId = StringTools.generateRandomString(32);
+			feesTemplateItems.setTemporaryId(temporaryId);
+			feesTemplateItemsList.add(feesTemplateItems);
+
+			FeesTemplateSonItems sonItems = new FeesTemplateSonItems();
+			sonItems.setDc(feesTemplateItems.getDc());
+			sonItems.setPid(losBFeesTemplate.getId());
+			sonItems.setTaxRate(feesTemplateItems.getTaxRate());
+			sonItems.setCreateTime(new Date());
+			sonItems.setCreateUser(AuthUtil.getUserId());
+			sonItems.setCreateUserName(AuthUtil.getUserName());
+			sonItems.setType(feesTemplateItems.getCorpType());
+			sonItems.setCorpId(feesTemplateItems.getCorpId());
+			sonItems.setCorpCnName(feesTemplateItems.getCorpCnName());
+			sonItems.setCorpEnName(feesTemplateItems.getCorpEnName());
+			sonItems.setFeeId(feesTemplateItems.getFeeId());
+			sonItems.setFeeCode(feesTemplateItems.getFeeCode());
+			sonItems.setFeeCnName(feesTemplateItems.getFeeCnName());
+			sonItems.setFeeEnName(feesTemplateItems.getFeeEnName());
+			sonItems.setCostPrice(feesTemplateItems.getCostPrice());
+			sonItems.setSalesPrice(feesTemplateItems.getPrice());
+			sonItems.setCurCode(feesTemplateItems.getCurCode());
+			sonItems.setUnitNo(feesTemplateItems.getUnitNo());
+			sonItems.setQuantityRule(feesTemplateItems.getQuantityRule());
+			sonItems.setBranchId(deptId);
+			sonItems.setBranchName(deptName);
+			feesTemplateItems.setTemporaryId(temporaryId);
+			sonItemsList.add(sonItems);
+		}
+		if (!feesTemplateItemsList.isEmpty()) {
+			feesTemplateItemsService.saveBatch(feesTemplateItemsList);
+			for (FeesTemplateSonItems item : sonItemsList) {
+				feesTemplateItemsList.stream().filter(e -> e.getTemporaryId().equals(item.getTemporaryId()))
+					.findFirst().ifPresent(templateItems -> item.setPpid(templateItems.getId()));
+			}
+			feesTemplateSonItemsService.saveBatch(sonItemsList);
+		}
+		return R.data("操作成功");
+	}
+
 	private FeeCenter addFeeCenterQuotation(Bills bills, String dc, int count, BFees fees, String corpType,
 											PreContainers items, List<BCurExrate> curExrateList,
 											MktSlotQuotation mktSlotQuotations, String exrateType, String type) {