Browse Source

1.空箱进场-新箱进场api自动同步
2.费用报表打印负数大写问题修改
3.箱管费用增加应收应付报表打印接口
4.箱管费用报表打印-未选明细按客户分组接口修改
5.箱管报表打印之前打印人,打印日期接口问题修改
6.进出场记录主表增加放箱号字段
1.海运进出口增加银行信息相关字段
2.空箱返场-增加返场箱逻辑
3.配箱信息增加字段

纪新园 3 weeks ago
parent
commit
b4a56a6899
19 changed files with 1389 additions and 181 deletions
  1. 6 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/dynamics/entity/BoxDynamicsRecord.java
  2. 18 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBox.java
  3. 42 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Bills.java
  4. 18 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Containers.java
  5. 42 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/SeaBillsDetail.java
  6. 1 1
      blade-service/blade-los/src/main/java/org/springblade/los/Util/BigDecimalUtils.java
  7. 178 1
      blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsBoxServiceImpl.java
  8. 5 4
      blade-service/blade-los/src/main/java/org/springblade/los/box/controller/TradingBoxController.java
  9. 1 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/controller/BoxDynamicsRecordController.java
  10. 3 0
      blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/service/IBoxDynamicsRecordService.java
  11. 912 19
      blade-service/blade-los/src/main/java/org/springblade/los/box/dynamics/service/impl/BoxDynamicsRecordServiceImpl.java
  12. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/ExpenseApplicationServiceImpl.java
  13. 101 89
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java
  14. 2 2
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  15. 12 0
      blade-service/blade-los/src/main/java/org/springblade/los/finance/fee/service/impl/FeeCenterServiceImpl.java
  16. 11 4
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/controller/ApiCyCtnrController.java
  17. 4 4
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/controller/TestController.java
  18. 2 5
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/CyFtpService.java
  19. 29 50
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/impl/CyFtpServiceImpl.java

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

@@ -177,6 +177,12 @@ public class BoxDynamicsRecord implements Serializable {
 	private String boxCode;
 
 	/**
+	 * 放箱号
+	 */
+	@ApiModelProperty(value = "放箱号")
+	private String containerNumber;
+
+	/**
 	 * 数据类型 1=业务数据,2=请求记录
 	 */
 	@ApiModelProperty(value = "数据类型")

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

@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.springblade.los.finance.fee.dto.ExpenseApplicationFeeReports;
+import org.springblade.los.finance.fee.dto.FeeCenterReports;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.entity.FeeCenterItems;
 import org.springblade.system.entity.Dept;
@@ -687,6 +688,12 @@ public class TradingBox implements Serializable {
 	@TableField(exist = false)
 	private List<FeeCenter> feeCenterList;
 
+	/**
+	 * 物流-费用中心(总)
+	 */
+	@TableField(exist = false)
+	private List<FeeCenterReports> feeCenterReportsList;
+
 	@TableField(exist = false)
 	private List<ExpenseApplicationFeeReports> reportsListC;
 
@@ -840,4 +847,15 @@ public class TradingBox implements Serializable {
 	@TableField(exist = false)
 	private BigDecimal amountProfitLoc;
 
+	/**
+	 * 件数大写+包装
+	 */
+	@TableField(exist = false)
+	private String capitalLetters;
+	/**
+	 * 件数大写+包装
+	 */
+	@TableField(exist = false)
+	private String capitalLettersUsd;
+
 }

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

@@ -2685,4 +2685,46 @@ public class Bills implements Serializable {
 	@TableField(exist = false)
 	private String commodityDescrs;
 
+	/**
+	 * RELEASE RE
+	 */
+	@TableField(exist = false)
+	private String releaseRef;
+
+	/**
+	 * COMMODITY
+	 */
+	@TableField(exist = false)
+	private String commodity;
+
+	/**
+	 * PLACE OF STUFFING
+	 */
+	@TableField(exist = false)
+	private String placeOfStuffing;
+
+	/**
+	 * FULL RETURN LOCATION
+	 */
+	@TableField(exist = false)
+	private String fullReturnLocation;
+
+	/**
+	 * DLINE AMEND BILL
+	 */
+	@TableField(exist = false)
+	private String dlineAmendBill;
+
+	/**
+	 * PLACE OF STUFFING
+	 */
+	@TableField(exist = false)
+	private String placeOfStuffing2;
+
+	/**
+	 * ADDRESS
+	 */
+	@TableField(exist = false)
+	private String address2;
+
 }

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

@@ -616,6 +616,24 @@ public class Containers implements Serializable {
 	private String offhireReference;
 
 	/**
+	 * 箱来源类型
+	 */
+	@ApiModelProperty(value = "箱来源类型")
+	private String boxSrcType;
+
+	/**
+	 * 实际开船日期
+	 */
+	@ApiModelProperty(value = "实际开船日期")
+	private String actualEtd;
+
+	/**
+	 * 实际到港日期
+	 */
+	@ApiModelProperty(value = "实际到港日期")
+	private String actualEta;
+
+	/**
 	 * 配箱类型
 	 */
 	@TableField(exist = false)

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

@@ -685,5 +685,47 @@ public class SeaBillsDetail implements Serializable {
 	@ApiModelProperty(value = "提交时间")
 	private Date submitterDate;
 
+	/**
+	 * 所属公司
+	 */
+	@ApiModelProperty(value = "所属公司")
+	private Long affiliatedCompanyId;
+
+	/**
+	 * 所属公司
+	 */
+	@ApiModelProperty(value = "所属公司")
+	private String affiliatedCompanyName;
+
+	/**
+	 * 信用代码
+	 */
+	@ApiModelProperty(value = "信用代码")
+	private String creditCode;
+
+	/**
+	 * 账户名称
+	 */
+	@ApiModelProperty(value = "账户名称")
+	private String accountName;
+
+	/**
+	 * 开户银行
+	 */
+	@ApiModelProperty(value = "开户银行")
+	private String bankOfDeposit;
+
+	/**
+	 * 银行账号
+	 */
+	@ApiModelProperty(value = "银行账号")
+	private String bankAccountNumber;
+
+	/**
+	 * 税号
+	 */
+	@ApiModelProperty(value = "税号")
+	private String taxId;
+
 
 }

+ 1 - 1
blade-service/blade-los/src/main/java/org/springblade/los/Util/BigDecimalUtils.java

@@ -39,7 +39,7 @@ public class BigDecimalUtils {
 			}
 			return data;
 		}*/
-		if (new BigDecimal("0.00").compareTo(amount) < 0) {
+		if (new BigDecimal("0.00").compareTo(amount) > 0) {
 			amount = amount.abs();
 		}
 		if (amount.compareTo(BigDecimal.ZERO) == 0) return "ZERO";

+ 178 - 1
blade-service/blade-los/src/main/java/org/springblade/los/basic/reports/service/impl/ReportsBoxServiceImpl.java

@@ -21,9 +21,12 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.Util.BigDecimalUtils;
 import org.springblade.los.Util.CurrencyUtils;
 import org.springblade.los.Util.MagicValues;
 import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.entity.BCorpsBank;
+import org.springblade.los.basic.corps.service.IBCorpsBankService;
 import org.springblade.los.basic.corps.service.IBCorpsService;
 import org.springblade.los.basic.cur.entity.BCurExrate;
 import org.springblade.los.basic.reports.service.IReportsBoxService;
@@ -31,6 +34,7 @@ import org.springblade.los.box.entity.ExpenseApplication;
 import org.springblade.los.box.entity.TradingBox;
 import org.springblade.los.box.service.IExpenseApplicationService;
 import org.springblade.los.box.service.ITradingBoxService;
+import org.springblade.los.business.amends.entity.Amends;
 import org.springblade.los.business.mktSlot.entity.MktSlot;
 import org.springblade.los.business.mktSlot.entity.MktSlotItem;
 import org.springblade.los.business.mktSlot.entity.MktSlotQuotation;
@@ -40,10 +44,12 @@ import org.springblade.los.business.mktSlot.service.IMktSlotService;
 import org.springblade.los.business.receipt.entity.Receipt;
 import org.springblade.los.business.receipt.service.IReceiptService;
 import org.springblade.los.business.sea.entity.Bills;
+import org.springblade.los.business.sea.entity.Containers;
 import org.springblade.los.business.sea.entity.SeaBillsDetail;
 import org.springblade.los.business.sea.service.IBillsService;
 import org.springblade.los.business.sea.service.ISeaBillsDetailService;
 import org.springblade.los.finance.fee.dto.ExpenseApplicationFeeReports;
+import org.springblade.los.finance.fee.dto.FeeCenterReports;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.entity.FeeCenterItems;
 import org.springblade.los.finance.fee.service.IFeeCenterItemsService;
@@ -65,6 +71,7 @@ import java.math.RoundingMode;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 基础资料-报表打印记录 服务实现类
@@ -110,6 +117,8 @@ public class ReportsBoxServiceImpl implements IReportsBoxService {
 
 	private final IReceiptService receiptService;
 
+	private final IBCorpsBankService bankService;
+
 
 	@Override
 	public R getReportData(String billId, String reportCode, String groupCode, String corpIds, String itemIds,
@@ -513,12 +522,180 @@ public class ReportsBoxServiceImpl implements IReportsBoxService {
 			} else {
 				map.put(MagicValues.DATA, null);
 			}
-		} else {
+		} else if (MagicValues.COST.equals(reportCode) &&
+			(MagicValues.RECEIVABLE_BILL.equals(groupCode) || MagicValues.RECEIVABLE.equals(groupCode)) &&
+			MagicValues.XGFY.equals(type) ) {
+			TradingBox bills = tradingBoxService.getById(billId);
+			if (bills != null) {
+				String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
+				List<BCurExrate> curExrateList = currencyUtils.obtainRate(bills.getPurchaseDate(), "1", AuthUtil.getDeptId());
+				List<FeeCenter> feeCenterList;
+				LambdaQueryWrapper<FeeCenter> lambdaQueryWrapper = new LambdaQueryWrapper<FeeCenter>()
+					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+					.eq(FeeCenter::getDc, MagicValues.D)
+					.eq(FeeCenter::getIsDeleted, 0)
+					.in(FeeCenter::getPid, bills.getId());
+				if (MagicValues.RECEIVABLE_BILL.equals(groupCode)) {
+					lambdaQueryWrapper.eq(FeeCenter::getAccStatus, 1);
+				}
+				if (ObjectUtils.isNotNull(corpIds)) {
+					lambdaQueryWrapper.eq(FeeCenter::getCorpId, corpIds);
+				} else {
+					if (ObjectUtils.isNotNull(itemIds)) {
+						lambdaQueryWrapper.apply("find_in_set(id,'" + itemIds + "')");
+					}
+				}
+				if (ObjectUtils.isNotNull(curCode)) {
+					lambdaQueryWrapper.eq(FeeCenter::getCurCode, curCode);
+				}
+				feeCenterList = feeCenterService.list(lambdaQueryWrapper);
+				this.assignmentDc(bills, feeCenterList, curCode, exrateType, curExrateList);
+				bills.setDept(dept);
+				map.put(MagicValues.DATA, bills);
+			} else {
+				map.put(MagicValues.DATA, null);
+			}
+		} else if (MagicValues.COST.equals(reportCode) &&
+			(MagicValues.MEET.equals(groupCode) || MagicValues.MEET_BILL.equals(groupCode)) &&
+			MagicValues.XGFY.equals(type) ) {
+			TradingBox bills = tradingBoxService.getById(billId);
+			if (bills != null) {
+				String exrateType = currencyUtils.standardCurrency(AuthUtil.getDeptId());
+				List<BCurExrate> curExrateList = currencyUtils.obtainRate(bills.getPurchaseDate(), "1", AuthUtil.getDeptId());
+				List<FeeCenter> feeCenterList;
+				LambdaQueryWrapper<FeeCenter> lambdaQueryWrapper = new LambdaQueryWrapper<FeeCenter>()
+					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+					.eq(FeeCenter::getDc, MagicValues.C)
+					.in(FeeCenter::getPid, bills.getId());
+				if (MagicValues.MEET_BILL.equals(groupCode)) {
+					lambdaQueryWrapper.eq(FeeCenter::getAccStatus, 1);
+				}
+				if (ObjectUtils.isNotNull(corpIds)) {
+					lambdaQueryWrapper.eq(FeeCenter::getCorpId, corpIds);
+				} else {
+					if (ObjectUtils.isNotNull(itemIds)) {
+						lambdaQueryWrapper.apply("find_in_set(id,'" + itemIds + "')");
+					}
+				}
+				if (ObjectUtils.isNotNull(curCode)) {
+					lambdaQueryWrapper.eq(FeeCenter::getCurCode, curCode);
+				}
+				feeCenterList = feeCenterService.list(lambdaQueryWrapper);
+				this.assignmentDc(bills, feeCenterList, curCode, exrateType, curExrateList);
+				bills.setDept(dept);
+				map.put(MagicValues.DATA, bills);
+			} else {
+				map.put(MagicValues.DATA, null);
+			}
+		}else {
 			map.put(MagicValues.DATA, null);
 		}
 		return R.data(map);
 	}
 
+	private TradingBox assignmentDc(TradingBox bills, List<FeeCenter> feeCenterList, String curCode, String exrateType, List<BCurExrate> curExrateList) {
+		BigDecimal amountDr = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountCr = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountProfit;
+		BigDecimal amountDrUsd = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountCrUsd = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountProfitUsd;
+		BigDecimal amountDrLoc = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountCrLoc = new BigDecimal(MagicValues.ZERO);
+		BigDecimal amountProfitLoc;
+		List<FeeCenterReports> feeCenterReportsList = new ArrayList<>();
+		for (FeeCenter item : feeCenterList) {
+			if (ObjectUtils.isNotNull(item.getShortName())) {
+				item.setCorpCnName(item.getShortName());
+			} else {
+				item.setCorpCnName("无");
+			}
+			if (ObjectUtils.isNotNull(item.getBillShortName())) {
+				item.setBillCorpCnName(item.getBillShortName());
+			} else {
+				item.setBillCorpCnName("无");
+			}
+			if (MagicValues.D.equals(item.getDc())) {
+				if (!exrateType.equals(item.getCurCode())) {
+					amountDrUsd = amountDrUsd.add(item.getAmount());
+					amountDrLoc = amountDrLoc.add(item.getAmount().multiply(item.getExrate()));
+				} else {
+					amountDr = amountDr.add(item.getAmount());
+					amountDrLoc = amountDrLoc.add(item.getAmount());
+				}
+			} else {
+				if (!exrateType.equals(item.getCurCode())) {
+					amountCrUsd = amountCrUsd.add(item.getAmount());
+					amountCrLoc = amountCrLoc.add(item.getAmount().multiply(item.getExrate()));
+				} else {
+					amountCr = amountCr.add(item.getAmount());
+					amountCrLoc = amountCrLoc.add(item.getAmount());
+				}
+			}
+			FeeCenterReports feeCenterReports = new FeeCenterReports();
+			feeCenterReports.setStorageDate(item.getStorageDate());
+			feeCenterReports.setOutboundDate(item.getOutboundDate());
+			feeCenterReports.setRemarks(item.getRemarks());
+			feeCenterReports.setPid(item.getPid());
+			feeCenterReports.setCorpCnName(item.getCorpCnName());
+			feeCenterReports.setBillCorpCnName(item.getBillCorpCnName());
+			feeCenterReports.setFeeCnName(item.getFeeCnName());
+			feeCenterReports.setFeeEnName(item.getFeeEnName());
+			if (MagicValues.D.equals(item.getDc())) {
+				if (exrateType.equals(item.getCurCode())) {
+					feeCenterReports.setAmountD(item.getAmount());
+				} else {
+					feeCenterReports.setAmountUsdD(item.getAmount());
+				}
+				feeCenterReports.setAmountLocD(item.getAmountLoc());
+			} else {
+				if (exrateType.equals(item.getCurCode())) {
+					feeCenterReports.setAmountC(item.getAmount());
+				} else {
+					feeCenterReports.setAmountUsdC(item.getAmount());
+				}
+				feeCenterReports.setAmountLocC(item.getAmountLoc());
+			}
+			feeCenterReports.setHblno(item.getHblno());
+			feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
+			feeCenterReports.setExrate(item.getExrate());
+			feeCenterReports.setQuantity(item.getQuantity());
+			feeCenterReports.setUnitNo(item.getUnitNo());
+			feeCenterReports.setPrice(item.getPrice());
+			feeCenterReports.setMoney(item.getAmount());
+			feeCenterReports.setTaxRate(item.getTaxRate());
+			feeCenterReports.setAmountTax(item.getAmountTax());
+			feeCenterReports.setAmountNet(item.getAmount().subtract(item.getAmountTax()));
+			feeCenterReports.setCurCode(item.getCurCode());
+			feeCenterReports.setPriceVND(item.getPrice().multiply(item.getExrate()));
+			feeCenterReports.setMoneyVND(item.getAmount().multiply(item.getExrate()));
+			feeCenterReports.setAmountTaxVND(item.getAmountTax().multiply(item.getExrate()));
+			feeCenterReports.setAmountNetVND(feeCenterReports.getMoneyVND().subtract(feeCenterReports.getAmountTaxVND()));
+			feeCenterReportsList.add(feeCenterReports);
+		}
+		bills.setFeeCenterReportsList(feeCenterReportsList);
+		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);
+		if (exrateType.equals(curCode)) {
+			bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountDr));
+			bills.setCapitalLettersUsd("0.00");
+		} else {
+			bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountDrUsd));
+			bills.setCapitalLettersUsd(BigDecimalUtils.convertToEnglish(amountDrUsd));
+		}
+		bills.setAmountCrLoc(amountCrLoc);
+		bills.setAmountProfitLoc(amountProfitLoc);
+		return bills;
+	}
+
 	/**
 	 * 海运进出口字典值转换
 	 *

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

@@ -356,10 +356,11 @@ public class TradingBoxController extends BladeController {
 	@ApiOperationSupport(order = 6)
 	@RepeatSubmit
 	public R update(TradingBox tradingBox) {
-		tradingBox.setPrintingPersonId(AuthUtil.getUserId());
-		tradingBox.setPrintingPersonName(AuthUtil.getUserName());
-		tradingBox.setPrintingPersonDate(new Date());
-		tradingBoxService.updateById(tradingBox);
+		TradingBox tradingBox1 = tradingBoxService.getById(tradingBox.getId());
+		tradingBox1.setPrintingPersonId(AuthUtil.getUserId());
+		tradingBox1.setPrintingPersonName(AuthUtil.getUserName());
+		tradingBox1.setPrintingPersonDate(new Date());
+		tradingBoxService.updateById(tradingBox1);
 		return R.data(tradingBox);
 	}
 

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

@@ -88,6 +88,7 @@ public class BoxDynamicsRecordController extends BladeController {
 			.like(ObjectUtils.isNotNull(boxDynamicsRecord.getPortCname()),BoxDynamicsRecord::getPortCname,boxDynamicsRecord.getPortCname())
 			.like(ObjectUtils.isNotNull(boxDynamicsRecord.getStationCname()),BoxDynamicsRecord::getStationCname,boxDynamicsRecord.getStationCname())
 			.like(ObjectUtils.isNotNull(boxDynamicsRecord.getBoxCode()),BoxDynamicsRecord::getBoxCode,boxDynamicsRecord.getBoxCode())
+			.like(ObjectUtils.isNotNull(boxDynamicsRecord.getContainerNumber()),BoxDynamicsRecord::getContainerNumber,boxDynamicsRecord.getContainerNumber())
 			.eq(ObjectUtils.isNotNull(boxDynamicsRecord.getBoxDynamics()),BoxDynamicsRecord::getBoxDynamics,boxDynamicsRecord.getBoxDynamics())
 			.orderByDesc(BoxDynamicsRecord::getImportDate);
 		lambdaQueryWrapper.eq(ObjectUtils.isNotNull(boxDynamicsRecord.getDescription()),BoxDynamicsRecord::getDescription, boxDynamicsRecord.getDescription());

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

@@ -21,6 +21,7 @@ import org.springblade.los.box.dynamics.entity.BoxDynamicsRecord;
 import org.springblade.los.box.dynamics.vo.BoxDynamicsRecordVO;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.los.ftp.dto.ApiRequest;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
@@ -46,4 +47,6 @@ public interface IBoxDynamicsRecordService extends IService<BoxDynamicsRecord> {
     R importExcel(MultipartFile file,String type) throws IOException;
 
 	R synchronous(String id, String ids) throws IOException;
+
+	R cyctnrItem(ApiRequest apiRequest) throws IOException;
 }

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

@@ -22,6 +22,9 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
+import org.apache.commons.io.IOUtils;
+import org.springblade.client.entity.Message;
+import org.springblade.client.feign.IMessageClient;
 import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -65,13 +68,20 @@ import org.springblade.los.business.sea.mapper.BillsMapper;
 import org.springblade.los.business.sea.service.IContainersService;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.service.IFeeCenterService;
+import org.springblade.los.ftp.dto.ApiItem;
+import org.springblade.los.ftp.dto.ApiRequest;
+import org.springblade.los.ftp.dto.ContainerMovement;
 import org.springblade.resource.feign.IOssClient;
 import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.rmi.RemoteException;
@@ -82,6 +92,8 @@ import java.time.LocalDateTime;
 import java.time.ZoneId;
 import java.time.temporal.ChronoUnit;
 import java.util.*;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 
 /**
@@ -98,6 +110,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 
 	private final ISysClient sysClient;
 
+	private final IUserClient userClient;
+
 	private final IOssClient ossClient;
 
 	private final IBCorpsService bCorpsService;
@@ -136,6 +150,8 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 
 	private final IBCntrTypesService cntrTypesService;
 
+	private final IMessageClient messageClient;
+
 	@Override
 	public IPage<BoxDynamicsRecordVO> selectBoxDynamicsRecordPage(IPage<BoxDynamicsRecordVO> page, BoxDynamicsRecordVO boxDynamicsRecord) {
 		return page.setRecords(baseMapper.selectBoxDynamicsRecordPage(page, boxDynamicsRecord));
@@ -299,7 +315,7 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 		}
 		if ("JC".equals(boxDynamicsRecord.getApproachExit())) {
 			List<BoxDynamicsRecordItems> itemsListJC = itemsList.stream().filter(e -> !"C,ZJ".contains(e.getObjective())).collect(Collectors.toList());
-			if (!itemsListJC.isEmpty()) {
+			/*if (!itemsListJC.isEmpty()) {
 				List<String> boxCodeList = itemsListJC.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
 					.distinct().collect(Collectors.toList());
 				//箱档案数据
@@ -633,10 +649,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 				if (!putBoxes.isEmpty()) {
 					for (PutBox item : putBoxes) {
 						long count = 0;
-						if (ObjectUtils.isNotNull(item.getCode())){
+						if (ObjectUtils.isNotNull(item.getCode())) {
 							count = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
 								!item.getCode().contains(e.getBoxCode())).count();
-						}else {
+						} else {
 							count = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
 						}
 						if (ObjectUtils.isNotNull(item.getCode())) {
@@ -666,10 +682,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							TradingBox tradingBox = tradingBoxes.stream().filter(e -> e.getId().equals(item.getSrcId())).findFirst().orElse(null);
 							if (tradingBox != null) {
 								long count1 = 0;
-								if (ObjectUtils.isNotNull(tradingBox.getCode())){
+								if (ObjectUtils.isNotNull(tradingBox.getCode())) {
 									count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
 										!tradingBox.getCode().contains(e.getBoxCode())).count();
-								}else {
+								} else {
 									count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
 								}
 								if (ObjectUtils.isNotNull(item.getCode())) {
@@ -761,6 +777,9 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 				if (!tradingBoxItems.isEmpty()) {
 					tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
 				}
+			}*/
+			if (!itemsListJC.isEmpty()){
+				this.synchronization(itemsListJC);
 			}
 			List<BoxDynamicsRecordItems> itemsListFC = itemsList.stream().filter(e -> "C".equals(e.getObjective())).collect(Collectors.toList());
 			if (!itemsListFC.isEmpty()) {
@@ -876,16 +895,6 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 						if (recordItems == null) {
 							throw new RuntimeException("未查到对应箱号记录");
 						}
-						item.setPodStationId(recordItems.getStationId());
-						item.setPodStationCname(recordItems.getStationCname());
-						item.setPodStationEname(recordItems.getStationEname());
-						item.setPodStationCode(recordItems.getStationCode());
-						item.setPodEmptyContainerReturnDate(recordItems.getApproachExitDate());
-						item.setWhetherFee("1");
-						item.setUpdateTime(new Date());
-						item.setUpdateUser(AuthUtil.getUserId());
-						item.setUpdateUserName(AuthUtil.getUserName());
-						containersListNew.add(item);
 						//进口分单配箱信息处理
 						//箱档案信息处理
 						Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getCntrNo())).findFirst().orElse(null);
@@ -1161,7 +1170,18 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							} else {
 								throw new RuntimeException("放箱号:" + archives.getContainerNumberOw() + "单据类型错误,请联系管理员");
 							}
+							item.setBoxSrcType(putBox1.getBoxClass());
 						}
+						item.setPodStationId(recordItems.getStationId());
+						item.setPodStationCname(recordItems.getStationCname());
+						item.setPodStationEname(recordItems.getStationEname());
+						item.setPodStationCode(recordItems.getStationCode());
+						item.setPodEmptyContainerReturnDate(recordItems.getApproachExitDate());
+						item.setWhetherFee("1");
+						item.setUpdateTime(new Date());
+						item.setUpdateUser(AuthUtil.getUserId());
+						item.setUpdateUserName(AuthUtil.getUserName());
+						containersListNew.add(item);
 					}
 					if (!containersListNew.isEmpty()) {
 						containersService.updateBatchById(containersListNew);
@@ -1674,10 +1694,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 				if (!putBoxes.isEmpty()) {
 					for (PutBox item : putBoxes) {
 						long count = 0;
-						if (ObjectUtils.isNotNull(item.getCode())){
+						if (ObjectUtils.isNotNull(item.getCode())) {
 							count = itemsListZJ.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
 								!item.getCode().contains(e.getBoxCode())).count();
-						}else {
+						} else {
 							count = itemsListZJ.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
 						}
 						if (ObjectUtils.isNotNull(item.getCode())) {
@@ -1707,10 +1727,10 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 							TradingBox tradingBox = tradingBoxes.stream().filter(e -> e.getId().equals(item.getSrcId())).findFirst().orElse(null);
 							if (tradingBox != null) {
 								long count1 = 0;
-								if (ObjectUtils.isNotNull(tradingBox.getCode())){
+								if (ObjectUtils.isNotNull(tradingBox.getCode())) {
 									count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
 										!tradingBox.getCode().contains(e.getBoxCode())).count();
-								}else {
+								} else {
 									count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
 								}
 								if (ObjectUtils.isNotNull(item.getCode())) {
@@ -2886,6 +2906,695 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 		return R.success("操作成功");
 	}
 
+	@Override
+	public R cyctnrItem(ApiRequest apiRequest) throws IOException {
+		StringBuilder msg = new StringBuilder();
+		// 1. 执行基础参数校验
+		validateBasicParams(apiRequest, msg);
+		// 2. 场站代码有效性校验
+		BCorps bCorps = bCorpsService.getOne(new LambdaQueryWrapper<BCorps>()
+			.eq(BCorps::getTenantId, AuthUtil.getTenantId())
+			.eq(BCorps::getIsDeleted, 0)
+			.eq(BCorps::getCode, apiRequest.getStationCode())
+			.last("LIMIT 1"));
+		if (bCorps == null) {
+			msg.append("场站代码:").append(apiRequest.getStationCode()).append("不正确;");
+		}
+		// 3. 港口代码有效性校验
+		BPorts ports = bPortsService.getOne(new LambdaQueryWrapper<BPorts>()
+			.eq(BPorts::getTenantId, AuthUtil.getTenantId())
+			.eq(BPorts::getIsDeleted, 0)
+			.in(BPorts::getUnCode, apiRequest.getPortNo())
+			.last("LIMIT 1"));
+		if (ports == null) {
+			msg.append("港口代码:").append(apiRequest.getPortNo()).append("不正确;");
+		}
+		// 4. 箱型代码有效性校验
+		List<String> boxType = apiRequest.getItem().stream().map(ApiItem::getCtnrType).filter(Objects::nonNull)
+			.distinct().collect(Collectors.toList());
+		List<BCntrTypes> boxTypeList = new ArrayList<>();
+		if (!boxType.isEmpty()) {
+			boxTypeList = cntrTypesService.list(new LambdaQueryWrapper<BCntrTypes>()
+				.eq(BCntrTypes::getTenantId, AuthUtil.getTenantId())
+				.eq(BCntrTypes::getIsDeleted, 0)
+				.in(BCntrTypes::getCode95, boxType));
+			if (boxTypeList.isEmpty()) {
+				msg.append("箱型").append(String.join(",", boxType)).append("不正确;");
+			}
+		}
+		List<String> boxCodeList = apiRequest.getItem().stream().map(ApiItem::getCtnrNo).filter(Objects::nonNull)
+			.distinct().collect(Collectors.toList());
+		// 5. 放箱号有效性校验
+		List<String> releaseNoList = apiRequest.getItem().stream().map(ApiItem::getReleaseNo).filter(Objects::nonNull)
+			.distinct().collect(Collectors.toList());
+		List<PutBox> putBoxList = new ArrayList<>();
+		if (!releaseNoList.isEmpty()) {
+			putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
+				.eq(PutBox::getTenantId, AuthUtil.getTenantId())
+				.eq(PutBox::getIsDeleted, 0)
+				.in(PutBox::getContainerNumber, releaseNoList));
+			if (putBoxList.isEmpty()) {
+				msg.append("放箱号").append(String.join(",", releaseNoList)).append("不存在;");
+			}
+		}
+		// 6.提单号有效性校验
+		List<String> mblnoList = apiRequest.getItem().stream().map(ApiItem::getMblno).filter(Objects::nonNull)
+			.distinct().collect(Collectors.toList());
+		List<Bills> billsList = new ArrayList<>();
+		if (!mblnoList.isEmpty()) {
+			billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+				.eq(Bills::getTenantId, AuthUtil.getTenantId())
+				.eq(Bills::getIsDeleted, 0)
+				.apply("find_in_set(bill_type,'DD,MH')")
+				.and(i -> i.in(Bills::getHblno, mblnoList).or().in(Bills::getMblno, mblnoList)));
+			if (billsList.isEmpty()) {
+				msg.append("提单号").append(String.join(",", mblnoList)).append("不存在;");
+			}
+		}
+		BoxDynamicsRecord boxDynamicsRecord = new BoxDynamicsRecord();
+		// 7.设置基础信息
+		boxDynamicsRecord.setCreateTime(new Date());
+		boxDynamicsRecord.setCreateUserName(AuthUtil.getUserName());
+		boxDynamicsRecord.setCreateUser(AuthUtil.getUserId());
+		boxDynamicsRecord.setBranchId(AuthUtil.getDeptId());
+		boxDynamicsRecord.setFileType("edi");
+		boxDynamicsRecord.setImportDate(new Date());
+		// 8.处理进出场类型
+		if ("JC".equals(apiRequest.getApproachExit())) {
+			boxDynamicsRecord.setBoxDynamics("进场");
+			boxDynamicsRecord.setApproachExit("JC");
+		} else {
+			boxDynamicsRecord.setBoxDynamics("出场");
+			boxDynamicsRecord.setApproachExit("CC");
+		}
+		boxDynamicsRecord.setBoxCode(String.join(",", boxCodeList));
+		boxDynamicsRecord.setContainerNumber(String.join(",", releaseNoList));
+		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
+		List<BoxDynamicsRecordItems> itemsList = new ArrayList<>();
+		// 9. 执行明细参数校验
+		validateBasicParamsItem(apiRequest, msg, billsList, putBoxList, boxTypeList);
+		for (ApiItem item : apiRequest.getItem()) {
+			// 10.构建明细记录对象
+			BoxDynamicsRecordItems recordItems = new BoxDynamicsRecordItems();
+			// 1).明细设置基础信息
+			recordItems.setCreateTime(new Date());
+			recordItems.setCreateUserName(AuthUtil.getUserName());
+			recordItems.setCreateUser(AuthUtil.getUserId());
+			recordItems.setBranchId(AuthUtil.getDeptId());
+			recordItems.setContainerNumber(item.getReleaseNo());
+			recordItems.setBoxCode(item.getCtnrNo());
+			recordItems.setObjective(item.getObjective());
+			// 2).明细处理箱类型
+			if ("1".equals(item.getBoxStatus())) {
+				recordItems.setBoxStatus("坏箱");
+			} else {
+				recordItems.setBoxStatus("好箱");
+			}
+			// 3).明细港口数据赋值
+			if (ports != null) {
+				recordItems.setPortCode(ports.getCode());
+				recordItems.setPortCname(ports.getCnName());
+				recordItems.setPortEname(ports.getEnName());
+				recordItems.setPortId(ports.getId());
+			}
+			// 4).明细箱型数据赋值
+			if (!boxTypeList.isEmpty()) {
+				boxTypeList.stream().filter(e -> e.getCode95().equals(item.getCtnrType())).findFirst().ifPresent(cntrTypes -> recordItems.setBoxType(cntrTypes.getCnName()));
+			}
+			// 5).明细场站数据赋值
+			if (bCorps != null) {
+				recordItems.setStationCname(bCorps.getCnName());
+				recordItems.setStationEname(bCorps.getEnName());
+				recordItems.setStationCode(bCorps.getCode());
+				recordItems.setStationId(bCorps.getId());
+			}
+			recordItems.setHblno(item.getMblno());
+			// 6).明细日期字段处理
+			try {
+				recordItems.setApproachExitDate(formatter.parse(item.getApproachExitDate()));
+			} catch (ParseException e) {
+				msg.append("进出场日期格式不正确,请传入格式为‘yyyy-MM-dd’正确格式日期;");
+			}
+			itemsList.add(recordItems);
+		}
+		// 11.主表港口数据赋值
+		if (ports != null) {
+			boxDynamicsRecord.setPortCode(ports.getCode());
+			boxDynamicsRecord.setPortCname(ports.getCnName());
+			boxDynamicsRecord.setPortEname(ports.getEnName());
+			boxDynamicsRecord.setPortId(ports.getId());
+		}
+		// 12.主表场站数据赋值
+		if (bCorps != null) {
+			boxDynamicsRecord.setStationCname(bCorps.getCnName());
+			boxDynamicsRecord.setStationEname(bCorps.getEnName());
+			boxDynamicsRecord.setStationCode(bCorps.getCode());
+			boxDynamicsRecord.setStationId(bCorps.getId());
+		}
+		boxDynamicsRecord.setReason(msg.toString());
+		boxDynamicsRecord.setRequestContent(apiRequest.toString());
+		if (ObjectUtils.isNotNull(msg.toString())) {
+			boxDynamicsRecord.setType("2");
+			boxDynamicsRecord.setDescription("接收失败");
+		} else {
+			boxDynamicsRecord.setType("1");
+			boxDynamicsRecord.setDescription("接收成功");
+		}
+		//发送消息
+		R<String> res = sysClient.getRoleIds(bCorps.getTenantId(), "箱管");
+		if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
+			R<List<User>> userListR = userClient.listUserByRoleIds(res.getData());
+			if (userListR.isSuccess() && ObjectUtils.isNotNull(userListR.getData())) {
+				for (User item : userListR.getData()) {
+					Message sendMessage = new Message();
+					sendMessage.setParameter(boxDynamicsRecord.getId() + "");
+					sendMessage.setUserName(AuthUtil.getUserName());
+					sendMessage.setUserId(null);
+					sendMessage.setToUserId(item.getId());
+					sendMessage.setToUserName(item.getName());
+					sendMessage.setMessageType(1);
+					sendMessage.setTenantId(AuthUtil.getTenantId());
+					sendMessage.setCreateUser(null);
+					sendMessage.setCreateTime(new Date());
+					sendMessage.setPageLabel("");
+					sendMessage.setPageStatus("");
+					sendMessage.setMessageBody(boxDynamicsRecord.getStationCname() + "场站已推送" + boxDynamicsRecord.getBoxDynamics()
+						+ "记录,推送时间:" + formatter.format(boxDynamicsRecord.getImportDate()) + ",推送结果:" + boxDynamicsRecord.getDescription());
+					messageClient.save(sendMessage);
+				}
+			}
+		}
+		// 13. 数据保存处理
+		baseMapper.insert(boxDynamicsRecord);
+		// 14. 错误处理:如果有错误信息则直接返回
+		if (ObjectUtils.isNotNull(msg.toString())) {
+			return R.fail(500, msg + " 请联系相关人员!");
+		} else {
+			for (BoxDynamicsRecordItems item : itemsList) {
+				item.setPid(boxDynamicsRecord.getId());
+				boxDynamicsRecordItemsService.save(item);
+			}
+			// 创建线程池
+			ExecutorService executor = Executors.newSingleThreadExecutor();
+			// 启动任务并提交给线程池
+			executor.submit(() -> {
+				try {
+					if ("JC".equals(boxDynamicsRecord.getApproachExit())) {
+						List<BoxDynamicsRecordItems> itemsListJC = itemsList.stream().filter(e -> !"C,ZJ".contains(e.getObjective())).collect(Collectors.toList());
+						if (!itemsListJC.isEmpty()) {
+							this.synchronization(itemsListJC);
+						}
+					}
+				} catch (Exception e) {
+					System.out.println("业务处理成功,发送消息异常,时间:" + new Date());
+					System.out.println(e.getMessage());
+					// 关闭线程池
+					executor.shutdown();
+					throw new RuntimeException(e);
+				} finally {
+					// 关闭线程池
+					executor.shutdown();
+				}
+			});
+			// 关闭线程池
+			executor.shutdown();
+			return R.success("成功");
+		}
+	}
+
+	private void synchronization(List<BoxDynamicsRecordItems> itemsListJC) throws IOException {
+		if (itemsListJC.stream().anyMatch(e -> ObjectUtils.isNull(e.getObjective()))) {
+			throw new RemoteException("进出场目的不能为空");
+		}
+		if (!itemsListJC.isEmpty()) {
+			List<String> boxCodeList = itemsListJC.stream().map(BoxDynamicsRecordItems::getBoxCode).filter(Objects::nonNull)
+				.distinct().collect(Collectors.toList());
+			//箱档案数据
+			List<Archives> archivesList = archivesService.list(new LambdaQueryWrapper<Archives>()
+				.eq(Archives::getTenantId, AuthUtil.getTenantId())
+				.eq(Archives::getIsDeleted, 0)
+				.in(Archives::getCode, boxCodeList));
+			List<String> containerNumberList = itemsListJC.stream().map(BoxDynamicsRecordItems::getContainerNumber)
+				.distinct().collect(Collectors.toList());
+			List<PutBox> putBoxList = putBoxService.list(new LambdaQueryWrapper<PutBox>()
+				.eq(PutBox::getTenantId, AuthUtil.getTenantId())
+				.eq(PutBox::getIsDeleted, 0)
+				.in(PutBox::getContainerNumber, containerNumberList));
+			if (putBoxList.isEmpty()) {
+				throw new RuntimeException("未查到放箱号单据");
+			}
+			List<Long> putBoxIdList = putBoxList.stream().map(PutBox::getId).collect(Collectors.toList());
+			List<PutBoxItems> putBoxItemsList = putBoxItemsService.list(new LambdaQueryWrapper<PutBoxItems>()
+				.eq(PutBoxItems::getIsDeleted, 0)
+				.eq(PutBoxItems::getTenantId, AuthUtil.getTenantId())
+				.in(PutBoxItems::getPid, putBoxIdList));
+			String blacklist = sysClient.getParamService("box.blacklist");
+			if (ObjectUtils.isNotNull(blacklist)) {
+				StringBuilder text = new StringBuilder();
+				for (String item : boxCodeList) {
+					if (item.length() > 3) {
+						String head = item.substring(0, 4);
+						if (blacklist.contains(head)) {
+							text.append(item).append(",");
+						}
+					}
+				}
+				if (ObjectUtils.isNotNull(text.toString())) {
+					throw new RuntimeException("箱号:" + text + "为黑名单箱,请修改数据后再操作");
+				}
+			}
+			List<Long> srcIdList = putBoxList.stream().map(PutBox::getSrcId).collect(Collectors.toList());
+			List<TradingBox> tradingBoxList = new ArrayList<>();
+			if (!srcIdList.isEmpty()) {
+				tradingBoxList = tradingBoxMapper.selectList(new LambdaQueryWrapper<TradingBox>()
+					.eq(TradingBox::getTenantId, AuthUtil.getTenantId())
+					.eq(TradingBox::getIsDeleted, 0)
+					.in(TradingBox::getId, srcIdList));
+			}
+			List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
+			if (!tradingBoxList.isEmpty()) {
+				List<Long> tradingBoxIdList = tradingBoxList.stream().map(TradingBox::getId).collect(Collectors.toList());
+				tradingBoxItemList = tradingBoxItemService.list(new LambdaQueryWrapper<TradingBoxItem>()
+					.eq(TradingBoxItem::getIsDeleted, 0)
+					.eq(TradingBoxItem::getTenantId, AuthUtil.getTenantId())
+					.in(TradingBoxItem::getPid, tradingBoxIdList));
+			}
+			List<PutBoxItems> putBoxItems = new ArrayList<>();
+			List<TradingBoxItem> tradingBoxItems = new ArrayList<>();
+			List<Archives> archivesArrayList = new ArrayList<>();
+			List<PutBox> putBoxes = new ArrayList<>();
+			List<TradingBox> tradingBoxes = new ArrayList<>();
+			for (BoxDynamicsRecordItems item : itemsListJC) {
+				PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())
+					&& ObjectUtils.isNotNull(e.getPolId()) && e.getPolId().equals(item.getPortId())
+					&& ObjectUtils.isNotNull(e.getPolStationId()) && e.getPolStationId().equals(item.getStationId())).findFirst().orElse(null);
+				if (putBox != null) {
+					if (!putBoxes.isEmpty()) {
+						if (!putBoxes.stream().map(PutBox::getId).collect(Collectors.toList()).contains(putBox.getId())) {
+							putBoxes.add(putBox);
+						}
+					} else {
+						putBoxes.add(putBox);
+					}
+					//箱档案数据处理
+					Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
+					if (archives != null) {
+						archives.setContainerNumberOw(item.getContainerNumber());
+						archives.setContainerNumberTypeOw(putBox.getBusType());
+						if (!archives.getTypeName().equals(item.getBoxType())) {
+							throw new RuntimeException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
+						}
+						if ("使用中".equals(archives.getStatus())) {
+							throw new RuntimeException("箱号:" + item.getBoxCode() + "状态为使用中");
+						}
+						archives.setBoxStatus(item.getBoxStatus());
+						archives.setUpdateTime(new Date());
+						archives.setUpdateUser(AuthUtil.getUserId());
+						archives.setUpdateUserName(AuthUtil.getUserName());
+						archives.setStatus("待使用");
+						archives.setNewDate(item.getApproachExitDate());
+						archives.setBoxDynamics("空箱提箱进场");
+						archives.setAddressId(item.getPortId());
+						archives.setAddressCode(item.getPortCode());
+						archives.setAddressCname(item.getPortCname());
+						archives.setAddressEname(item.getPortEname());
+						archives.setStationId(item.getStationId());
+						archives.setStationCode(item.getStationCode());
+						archives.setStationCname(item.getStationCname());
+						archives.setStationEname(item.getStationEname());
+					} else {
+						if (!"OW(拿)".equals(putBox.getBusType())) {
+							throw new RuntimeException("箱档案中未查到箱号:" + item.getBoxCode());
+						}
+						archives = new Archives();
+						archives.setCode(item.getBoxCode());
+						archives.setCreateTime(new Date());
+						archives.setCreateUser(AuthUtil.getUserId());
+						archives.setCreateUserName(AuthUtil.getUserName());
+						archives.setStatus("待使用");
+						archives.setBoxStatus(item.getBoxStatus());
+						archives.setNewDate(item.getApproachExitDate());
+						archives.setBoxDynamics("空箱提箱进场");
+						archives.setBoxBelongsTo("SOC");
+						archives.setContainerNumber(item.getContainerNumber());
+						archives.setContainerNumberType(putBox.getBusType());
+						archives.setContainerNumberOw(item.getContainerNumber());
+						archives.setContainerNumberTypeOw(putBox.getBusType());
+						archives.setTypeName(item.getBoxType());
+						archives.setBoxType(putBox.getBusType());
+						archives.setAddressId(item.getPortId());
+						archives.setAddressCode(item.getPortCode());
+						archives.setAddressCname(item.getPortCname());
+						archives.setAddressEname(item.getPortEname());
+						archives.setStationId(item.getStationId());
+						archives.setStationCode(item.getStationCode());
+						archives.setStationCname(item.getStationCname());
+						archives.setStationEname(item.getStationEname());
+					}
+					archivesArrayList.add(archives);
+					if (ObjectUtils.isNotNull(putBox.getBoxType()) && !putBox.getBoxType().equals(item.getBoxType())) {
+						throw new RuntimeException("放箱号:" + item.getContainerNumber() + "箱型不符合");
+					}
+					//放箱号明细数据处理
+					PutBoxItems putBoxItem;
+					if (!putBoxItemsList.isEmpty()) {
+						putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
+							.findFirst().orElse(null);
+						if (putBoxItem != null) {
+							putBoxItem.setPid(putBox.getId());
+							putBoxItem.setMblno(item.getMblno());
+							putBoxItem.setBoxDynamics("空箱提箱进场");
+							putBoxItem.setStatus("待使用");
+							putBoxItem.setPolCyId(item.getStationId());
+							putBoxItem.setPolCyCode(item.getStationCode());
+							putBoxItem.setPolCyCname(item.getStationCname());
+							putBoxItem.setPolCyEname(item.getPortEname());
+							putBoxItem.setPolPickUpDate(item.getApproachExitDate());
+							putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+							putBoxItem.setBoxStatus(item.getBoxStatus());
+						} else {
+							putBoxItem = new PutBoxItems();
+							putBoxItem.setBoxClass(putBox.getBusType());
+							putBoxItem.setBoxBelongsTo("SOC");
+							putBoxItem.setBoxCondition("新");
+							putBoxItem.setBoxStatus(item.getBoxStatus());
+							putBoxItem.setStatus("待使用");
+							putBoxItem.setPid(putBox.getId());
+							putBoxItem.setContainerNumber(item.getContainerNumber());
+							putBoxItem.setBoxCode(item.getBoxCode());
+							putBoxItem.setBoxType(item.getBoxType());
+							putBoxItem.setBoxClass(putBox.getBusType());
+							putBoxItem.setMblno(item.getMblno());
+							putBoxItem.setBoxDynamics("空箱提箱进场");
+							putBoxItem.setPolCyId(item.getStationId());
+							putBoxItem.setPolCyCode(item.getStationCode());
+							putBoxItem.setPolCyCname(item.getStationCname());
+							putBoxItem.setPolCyEname(item.getPortEname());
+							putBoxItem.setPolPickUpDate(item.getApproachExitDate());
+							putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+						}
+					} else {
+						putBoxItem = new PutBoxItems();
+						putBoxItem.setBoxClass(putBox.getBusType());
+						putBoxItem.setBoxBelongsTo("SOC");
+						putBoxItem.setBoxCondition("新");
+						putBoxItem.setBoxStatus(item.getBoxStatus());
+						putBoxItem.setStatus("待使用");
+						putBoxItem.setBoxClass(putBox.getBusType());
+						putBoxItem.setPid(putBox.getId());
+						putBoxItem.setContainerNumber(item.getContainerNumber());
+						putBoxItem.setBoxCode(item.getBoxCode());
+						putBoxItem.setBoxType(item.getBoxType());
+						putBoxItem.setMblno(item.getMblno());
+						putBoxItem.setBoxDynamics("空箱提箱进场");
+						putBoxItem.setPolCyId(item.getStationId());
+						putBoxItem.setPolCyCode(item.getStationCode());
+						putBoxItem.setPolCyCname(item.getStationCname());
+						putBoxItem.setPolCyEname(item.getPortEname());
+						putBoxItem.setPolPickUpDate(item.getApproachExitDate());
+						putBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+					}
+					if (ObjectUtils.isNotNull(putBox.getBoxEastId()) && !"null".equals(putBox.getBoxEastId())) {
+						putBoxItem.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
+						putBoxItem.setBoxEastName(putBox.getBoxEastName());
+					}
+					putBoxItems.add(putBoxItem);
+					if ("OW(拿),OW(放)".contains(putBox.getBusType())) {
+						if (!tradingBoxList.isEmpty()) {
+							TradingBox tradingBox = tradingBoxList.stream().filter(e -> e.getId().equals(putBox.getSrcId()))
+								.findFirst().orElse(null);
+							if (tradingBox != null) {
+								if (!tradingBoxes.isEmpty()) {
+									if (!tradingBoxes.stream().map(TradingBox::getId).collect(Collectors.toList()).contains(tradingBox.getId())) {
+										tradingBoxes.add(tradingBox);
+									}
+								} else {
+									tradingBoxes.add(tradingBox);
+								}
+								TradingBoxItem tradingBoxItem;
+								if (!tradingBoxItemList.isEmpty()) {
+									tradingBoxItem = tradingBoxItemList.stream().filter(e -> e.getCode().equals(item.getBoxCode()))
+										.findFirst().orElse(null);
+									if (tradingBoxItem != null) {
+//									throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
+										tradingBoxItem.setPid(tradingBox.getId());
+										tradingBoxItem.setMblno(item.getMblno());
+										tradingBoxItem.setBoxDynamics("空箱提箱进场");
+										tradingBoxItem.setPortId(item.getPortId());
+										tradingBoxItem.setPortCode(item.getPortCode());
+										tradingBoxItem.setPortCname(item.getPortCname());
+										tradingBoxItem.setPortEname(item.getPortEname());
+										tradingBoxItem.setStationId(item.getStationId());
+										tradingBoxItem.setStationCode(item.getStationCode());
+										tradingBoxItem.setStationCname(item.getStationCname());
+										tradingBoxItem.setStationEname(item.getStationEname());
+										tradingBoxItem.setPolCyId(item.getStationId());
+										tradingBoxItem.setPolCyCode(item.getStationCode());
+										tradingBoxItem.setPolCyCname(item.getStationCname());
+										tradingBoxItem.setPolCyEname(item.getStationEname());
+										if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
+											tradingBoxItem.setRentEndDate(item.getApproachExitDate());
+											tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
+											tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+										} else {
+											tradingBoxItem.setRentEndDate(new Date());
+											tradingBoxItem.setPolPickUpDate(new Date());
+											tradingBoxItem.setPolPreAppearanceDate(new Date());
+										}
+										tradingBoxItem.setStatus("待使用");
+									} else {
+										tradingBoxItem = new TradingBoxItem();
+										tradingBoxItem.setBoxBelongsTo("SOC");
+										if ("OW-N".equals(tradingBox.getType())) {
+											tradingBoxItem.setBoxCategory("OW(拿)");
+										} else if ("OW-F".equals(tradingBox.getType())) {
+											tradingBoxItem.setBoxCategory("OW(放)");
+										}
+										putBoxItem.setBoxClass(putBox.getBusType());
+										tradingBoxItem.setBoxCondition("新");
+										tradingBoxItem.setBoxStatus(item.getBoxStatus());
+										tradingBoxItem.setPid(tradingBox.getId());
+										tradingBoxItem.setContainerNumber(item.getContainerNumber());
+										tradingBoxItem.setCode(item.getBoxCode());
+										tradingBoxItem.setMblno(item.getMblno());
+										tradingBoxItem.setBoxDynamics("空箱提箱进场");
+										tradingBoxItem.setBoxType(item.getBoxType());
+										tradingBoxItem.setPortId(item.getPortId());
+										tradingBoxItem.setPortCode(item.getPortCode());
+										tradingBoxItem.setPortCname(item.getPortCname());
+										tradingBoxItem.setPortEname(item.getPortEname());
+										tradingBoxItem.setStationId(item.getStationId());
+										tradingBoxItem.setStationCode(item.getStationCode());
+										tradingBoxItem.setStationCname(item.getStationCname());
+										tradingBoxItem.setStationEname(item.getStationEname());
+										tradingBoxItem.setPolCyId(item.getStationId());
+										tradingBoxItem.setPolCyCode(item.getStationCode());
+										tradingBoxItem.setPolCyCname(item.getStationCname());
+										tradingBoxItem.setPolCyEname(item.getStationEname());
+										tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
+										if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
+											tradingBoxItem.setRentEndDate(item.getApproachExitDate());
+											tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
+											tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+										} else {
+											tradingBoxItem.setRentEndDate(new Date());
+											tradingBoxItem.setPolPickUpDate(new Date());
+											tradingBoxItem.setPolPreAppearanceDate(new Date());
+										}
+										tradingBoxItem.setStatus("待使用");
+									}
+								} else {
+									tradingBoxItem = new TradingBoxItem();
+									if ("OW-N".equals(tradingBox.getType())) {
+										tradingBoxItem.setBoxCategory("OW(拿)");
+									} else if ("OW-F".equals(tradingBox.getType())) {
+										tradingBoxItem.setBoxCategory("OW(放)");
+									}
+									tradingBoxItem.setBoxBelongsTo("SOC");
+									tradingBoxItem.setBoxCondition("新");
+									tradingBoxItem.setBoxStatus(item.getBoxStatus());
+									tradingBoxItem.setPid(tradingBox.getId());
+									tradingBoxItem.setContainerNumber(item.getContainerNumber());
+									tradingBoxItem.setCode(item.getBoxCode());
+									tradingBoxItem.setMblno(item.getMblno());
+									tradingBoxItem.setBoxDynamics("空箱提箱进场");
+									tradingBoxItem.setBoxType(item.getBoxType());
+									tradingBoxItem.setPortId(item.getPortId());
+									tradingBoxItem.setPortCode(item.getPortCode());
+									tradingBoxItem.setPortCname(item.getPortCname());
+									tradingBoxItem.setPortEname(item.getPortEname());
+									tradingBoxItem.setStationId(item.getStationId());
+									tradingBoxItem.setStationCode(item.getStationCode());
+									tradingBoxItem.setStationCname(item.getStationCname());
+									tradingBoxItem.setStationEname(item.getStationEname());
+									tradingBoxItem.setPolCyId(item.getStationId());
+									tradingBoxItem.setPolCyCode(item.getStationCode());
+									tradingBoxItem.setPolCyCname(item.getStationCname());
+									tradingBoxItem.setPolCyEname(item.getStationEname());
+									tradingBoxItem.setActivationDate(tradingBox.getActivationDate());
+									if (ObjectUtils.isNotNull(item.getApproachExitDate())) {
+										tradingBoxItem.setRentEndDate(item.getApproachExitDate());
+										tradingBoxItem.setPolPickUpDate(item.getApproachExitDate());
+										tradingBoxItem.setPolPreAppearanceDate(item.getApproachExitDate());
+									} else {
+										tradingBoxItem.setRentEndDate(new Date());
+										tradingBoxItem.setPolPickUpDate(new Date());
+										tradingBoxItem.setPolPreAppearanceDate(new Date());
+									}
+									tradingBoxItem.setStatus("待使用");
+								}
+								tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
+								tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
+								tradingBoxItems.add(tradingBoxItem);
+							} else {
+								throw new RuntimeException("放箱号:" + item.getContainerNumber() + "未查到OW单据");
+							}
+						} else {
+							throw new RuntimeException("放箱号:" + item.getContainerNumber() + "未查到OW单据");
+						}
+					}
+				} else {
+					throw new RuntimeException("未查到放箱号:" + item.getContainerNumber() + "单据");
+				}
+			}
+			if (!putBoxes.isEmpty()) {
+				for (PutBox item : putBoxes) {
+					long count;
+					if (ObjectUtils.isNotNull(item.getCode())) {
+						count = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
+							!item.getCode().contains(e.getBoxCode())).count();
+					} else {
+						count = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
+					}
+					if (ObjectUtils.isNotNull(item.getCode())) {
+						for (BoxDynamicsRecordItems e : itemsListJC) {
+							if (e.getContainerNumber().equals(item.getContainerNumber()) && ObjectUtils.isNotNull(item.getCode())
+								&& !item.getCode().contains(e.getBoxCode())) {
+								item.setCode(item.getCode() + "," + e.getBoxCode());
+							} else {
+								item.setCode(e.getBoxCode());
+							}
+						}
+					} else {
+						item.setCode(itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()))
+							.map(BoxDynamicsRecordItems::getBoxCode).collect(Collectors.joining(",")));
+					}
+					if ("0".equals(item.getWhetherManuallyCreate())) {
+						item.setTotalNum(item.getTotalNum() + Integer.parseInt(count + ""));
+						item.setRemainingNum(item.getRemainingNum() + Integer.parseInt(count + ""));
+						item.setStorageNum(item.getStorageNum() + Integer.parseInt(count + ""));
+					}
+					if ("OW(拿)".equals(item.getBusType())) {
+						item.setSuitcaseNum(item.getSuitcaseNum() + Integer.parseInt(count + ""));
+						item.setNotSuitcaseNum(item.getTotalNum() - item.getSuitcaseNum());
+						item.setStorageNum(item.getStorageNum() + Integer.parseInt(count + ""));
+					}
+					if (!tradingBoxes.isEmpty()) {
+						TradingBox tradingBox = tradingBoxes.stream().filter(e -> e.getId().equals(item.getSrcId())).findFirst().orElse(null);
+						if (tradingBox != null) {
+							long count1;
+							if (ObjectUtils.isNotNull(tradingBox.getCode())) {
+								count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()) &&
+									!tradingBox.getCode().contains(e.getBoxCode())).count();
+							} else {
+								count1 = itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber())).count();
+							}
+							if (ObjectUtils.isNotNull(item.getCode())) {
+								for (BoxDynamicsRecordItems e : itemsListJC) {
+									if (e.getContainerNumber().equals(item.getContainerNumber()) && ObjectUtils.isNotNull(tradingBox.getCode())
+										&& !tradingBox.getCode().contains(e.getBoxCode())) {
+										tradingBox.setCode(tradingBox.getCode() + "," + e.getBoxCode());
+									} else {
+										tradingBox.setCode(e.getBoxCode());
+									}
+								}
+							} else {
+								tradingBox.setCode(itemsListJC.stream().filter(e -> e.getContainerNumber().equals(item.getContainerNumber()))
+									.map(BoxDynamicsRecordItems::getBoxCode).collect(Collectors.joining(",")));
+							}
+							if ("OW(拿)".contains(item.getBusType())) {
+								tradingBox.setSuitcaseNum(tradingBox.getSuitcaseNum() + Integer.parseInt(count1 + ""));
+								tradingBox.setNotSuitcaseNum(tradingBox.getBoxNumber() - tradingBox.getSuitcaseNum());
+							}
+							tradingBoxMapper.updateById(tradingBox);
+						}
+					}
+				}
+				putBoxService.saveOrUpdateBatch(putBoxes);
+			}
+			if (!putBoxItems.isEmpty()) {
+				putBoxItemsService.saveOrUpdateBatch(putBoxItems);
+				for (PutBoxItems item : putBoxItems) {
+					PutBox tradingBox = putBoxes.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
+					if (tradingBox != null) {
+						//记录箱轨迹信息
+						ArchivesTrajectory archivesTrajectory = new ArchivesTrajectory();
+						archivesTrajectory.setPortId(tradingBox.getPolId());
+						archivesTrajectory.setPortCode(tradingBox.getPolCode());
+						archivesTrajectory.setPortCname(tradingBox.getPodCname());
+						archivesTrajectory.setPortEname(tradingBox.getPodEname());
+						archivesTrajectory.setStationId(tradingBox.getPolStationId());
+						archivesTrajectory.setStationCode(tradingBox.getPolStationCode());
+						archivesTrajectory.setStationCname(tradingBox.getPolStationCname());
+						archivesTrajectory.setStationEname(tradingBox.getPolStationEname());
+						archivesTrajectory.setContainerNumber(item.getContainerNumber());
+						archivesTrajectory.setBoxType(item.getBoxType());
+						archivesTrajectory.setBoxCategory(item.getBoxClass());
+						archivesTrajectory.setBoxEastId(item.getBoxEastId());
+						archivesTrajectory.setBoxEastName(item.getBoxEastName());
+						archivesTrajectory.setMblno(item.getMblno());
+						archivesTrajectory.setBoxDynamics("空箱进场");
+						archivesTrajectory.setStatus(tradingBox.getBusType());
+						archivesTrajectory.setCorpId(item.getBoxEastId());
+						archivesTrajectory.setCorpName(item.getBoxEastName());
+						archivesTrajectory.setBillType(tradingBox.getBoxType());
+						archivesTrajectory.setCode(item.getBoxCode());
+						archivesTrajectory.setNewDate(new Date());
+						archivesTrajectory.setCreateTime(new Date());
+						archivesTrajectory.setCreateUser(AuthUtil.getUserId());
+						archivesTrajectory.setCreateUserName(AuthUtil.getUserName());
+						archivesTrajectory.setTenantId(AuthUtil.getTenantId());
+						archivesTrajectory.setSrcId(tradingBox.getId());
+						archivesTrajectory.setEtd(item.getEtd());
+						archivesTrajectory.setPolCyId(item.getPolCyId());
+						archivesTrajectory.setPolCyCode(item.getPolCyCode());
+						archivesTrajectory.setPolCyCname(item.getPolCyCname());
+						archivesTrajectory.setPolCyEname(item.getPolCyEname());
+						archivesTrajectory.setPolFreeBoxUseDays(item.getPolFreeBoxUseDays());
+						archivesTrajectory.setPolPreAppearanceDate(item.getPolPreAppearanceDate());
+						archivesTrajectory.setPolStationEmptyContainerExitDate(item.getPolStationEmptyContainerExitDate());
+						archivesTrajectory.setPolReturnDate(item.getPolReturnDate());
+						archivesTrajectory.setPolOverdueBoxUseDays(item.getPolOverdueBoxUseDays());
+						archivesTrajectory.setEta(item.getEta());
+						archivesTrajectory.setPodEmptyContainerReturnDate(item.getPodEmptyContainerReturnDate());
+						archivesTrajectory.setPodStationId(item.getPodStationId());
+						archivesTrajectory.setPodStationCode(item.getPodStationCode());
+						archivesTrajectory.setPodStationCname(item.getPodStationCname());
+						archivesTrajectory.setPodStationEname(item.getPodStationEname());
+						archivesTrajectory.setPodFreeBoxUseDays(item.getPodFreeBoxUseDays());
+						archivesTrajectory.setPodBoxUseDays(item.getPodBoxUseDays());
+						archivesTrajectory.setShipNameId(item.getShipNameId());
+						archivesTrajectory.setShipCname(item.getShipCname());
+						archivesTrajectory.setShipEname(item.getShipEname());
+						archivesTrajectory.setShipCode(item.getShipCode());
+						archivesTrajectory.setVoyage(item.getVoyage());
+						archivesTrajectoryMapper.insert(archivesTrajectory);
+					}
+				}
+			}
+			if (!archivesArrayList.isEmpty()) {
+				archivesService.saveOrUpdateBatch(archivesArrayList);
+			}
+			if (!tradingBoxItems.isEmpty()) {
+				tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
+			}
+		}
+		for (BoxDynamicsRecordItems item : itemsListJC) {
+			item.setWhetherSynchronous("1");
+		}
+		boxDynamicsRecordItemsService.updateBatchById(itemsListJC);
+	}
+
 	private void countOverdueFee(List<PutBox> putBoxList, List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList,
 								 List<Containers> containersListNew, List<PutBoxItems> putBoxItems) {
 		List<FeeCenter> feeCenterList = new ArrayList<>();
@@ -3294,4 +4003,188 @@ public class BoxDynamicsRecordServiceImpl extends ServiceImpl<BoxDynamicsRecordM
 		}
 	}
 
+	/**
+	 * 明细参数校验方法
+	 *
+	 * @param apiRequest 请求对象
+	 * @param msg        错误信息收集器
+	 */
+	private void validateBasicParamsItem(ApiRequest apiRequest, StringBuilder msg, List<Bills> billsList,
+										 List<PutBox> putBoxList, List<BCntrTypes> boxTypeList) {
+		for (ApiItem item : apiRequest.getItem()) {
+			if (ObjectUtils.isNull(item.getReleaseNo())) {
+				msg.append("放箱号不能为空;");
+			}
+			if (ObjectUtils.isNull(item.getCtnrNo())) {
+				msg.append("箱号不能为空;");
+			}
+			if (ObjectUtils.isNull(item.getCtnrType())) {
+				msg.append("箱型不能为空;");
+			}
+			if (ObjectUtils.isNull(item.getApproachExitDate())) {
+				msg.append("进出场日期不能为空;");
+			}
+			if (ObjectUtils.isNull(item.getObjective())) {
+				msg.append("进出场目的不能为空;");
+			}
+			if ("CC".equals(apiRequest.getApproachExit())) {
+				if (ObjectUtils.isNull(item.getMblno())) {
+					msg.append("提单号不能为空;");
+				}
+				if (!billsList.isEmpty()) {
+					List<Bills> bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno()) ||
+						e.getHblno().equals(item.getMblno())).collect(Collectors.toList());
+					if (bills.isEmpty()) {
+						msg.append("提单号:").append(item.getMblno()).append("不存在;");
+					}
+				}
+			}
+			if (!boxTypeList.isEmpty()) {
+				BCntrTypes cntrTypes = boxTypeList.stream().filter(e -> e.getCode95().equals(item.getCtnrType())).findFirst().orElse(null);
+				if (cntrTypes == null) {
+					msg.append("箱型:").append(item.getCtnrType()).append("不正确;");
+				}
+			}
+			if (!putBoxList.isEmpty()) {
+				PutBox putBox = putBoxList.stream().filter(e -> e.getContainerNumber().equals(item.getReleaseNo())).findFirst().orElse(null);
+				if (putBox == null) {
+					msg.append("放箱号:").append(item.getReleaseNo()).append("不存在;");
+				}
+			}
+		}
+	}
+
+	/**
+	 * 基础参数校验方法
+	 *
+	 * @param apiRequest 请求对象
+	 * @param msg        错误信息收集器
+	 */
+	private void validateBasicParams(ApiRequest apiRequest, StringBuilder msg) {
+		// 校验明细数据不能为空
+		if (apiRequest.getItem() == null || apiRequest.getItem().isEmpty()) {
+			msg.append("集装箱明细不能为空;");
+		}
+		// 校验港口代码不能为空
+		if (apiRequest.getPortNo() == null) {
+			msg.append("港口代码不能为空;");
+		}
+		// 校验场站代码不能为空
+		if (ObjectUtils.isNull(apiRequest.getStationCode())) {
+			msg.append("场站代码不能为空;");
+		}
+		// 校验进出场类型不能为空
+		if (ObjectUtils.isNull(apiRequest.getApproachExit())) {
+			msg.append("进出场类型不能为空;");
+		}
+		// 校验推送时间不能为空
+		if (ObjectUtils.isNull(apiRequest.getImportDate())) {
+			msg.append("推送时间不能为空;");
+		}
+	}
+
+	public static List<ContainerMovement> parseEdifactMessage(InputStream inputStream) throws IOException {
+		List<ContainerMovement> movements = new ArrayList<>();
+		if (inputStream == null) {
+			return new ArrayList<>();
+		}
+//		String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+		InputStreamReader reader = new InputStreamReader(inputStream, "GBK");  // 根据实际编码调整
+		String content = IOUtils.toString(reader);
+
+		// 分割每个消息(以UNH开头,UNT结尾)
+		String[] messages = content.split("(?=UNH\\+)");
+
+		for (String message : messages) {
+			if (message.trim().isEmpty()) continue;
+
+			ContainerMovement movement = new ContainerMovement();
+			String[] segments = message.split("'\\s*");
+
+			for (String segment : segments) {
+				if (segment.isEmpty()) continue;
+
+				String[] elements = segment.split("\\+");
+				String segmentTag = elements[0];
+
+				switch (segmentTag) {
+					case "UNH":
+						movement.setMessageReference(elements[1]);
+						break;
+					case "BGM":
+						movement.setMessageType(elements[1]);
+						movement.setMovementNumber(elements[2]);
+						break;
+					case "TDT":
+						if (elements.length > 2 && elements[1].equals("20")) {
+							movement.setVesselName(elements[2]);
+							if (elements.length > 6) {
+								movement.setVoyageNumber(elements[6].split(":")[0]);
+							}
+						}
+						break;
+					case "NAD":
+						if (elements.length > 2 && elements[1].equals("MS")) {
+							movement.setYardCode(elements[2].split(":")[0]);
+						}
+						break;
+					case "EQD":
+						if (elements.length > 2) {
+							movement.setContainerNumber(elements[2]);
+							movement.setContainerType(elements[3].split(":")[0]);
+							movement.setContainerSize(elements[4]);
+						}
+						break;
+					case "RFF":
+						if (elements.length > 1) {
+							if (elements[1].startsWith("BM:")) {
+								movement.setBillOfLading(elements[1].substring(3));
+							} else if (elements[1].startsWith("BN:")) {
+								movement.setBookingNumber(elements[1].substring(3));
+							}
+						}
+						break;
+					case "DTM":
+						if (elements.length > 1 && elements[1].startsWith("7")) {
+							String[] dateParts = elements[1].split(":");
+							movement.setMovementDateTime(dateParts[1]);
+						}
+						break;
+					case "LOC":
+						if (elements.length > 2) {
+							if (elements[1].equals("9")) {
+								movement.setFromLocation(elements[2].split(":")[0]);
+							} else if (elements[1].equals("11")) {
+								movement.setToLocation(elements[2].split(":")[0]);
+							}
+						}
+						break;
+					case "MEA":
+						if (elements.length > 1 && elements[1].equals("AAE")) {
+							movement.setCargoWeight(elements[3]);
+						}
+						break;
+					case "SEL":
+						if (elements.length > 1) {
+							movement.setSealNumber(elements[1]);
+						}
+						break;
+					case "FTX":
+						if (elements.length > 1) {
+							movement.setObjective(elements[1]);
+						}
+						break;
+					case "DAM":
+						if (elements.length > 1) {
+							movement.setBoxGoodBad(elements[1]);
+						}
+						break;
+				}
+			}
+			movements.add(movement);
+		}
+
+		return movements;
+	}
+
 }

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

@@ -964,11 +964,11 @@ public class ExpenseApplicationServiceImpl extends ServiceImpl<ExpenseApplicatio
 		} else {
 			StringBuilder text = new StringBuilder();
 			List<FeeCenter> feeCenterList = new ArrayList<>();
-			List<Long> idList = expenseApplication.getFeeCenterList().stream().map(FeeCenter::getStlPid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+			List<Long> idList = expenseApplication.getFeeCenterList().stream().map(FeeCenter::getId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
 			List<FeeCenter> feeCenterListOld = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 				.eq(FeeCenter::getIsDeleted, 0)
 				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-				.in(FeeCenter::getStlPid, idList));
+				.in(FeeCenter::getId, idList));
 			for (FeeCenter item : expenseApplication.getFeeCenterList()) {
 				if (!feeCenterListOld.isEmpty()) {
 					FeeCenter feeCenter1 = feeCenterListOld.stream().filter(e -> e.getId().equals(item.getId())).findFirst().orElse(null);

+ 101 - 89
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -67,7 +67,6 @@ import org.springblade.los.excel.RouteCostProfitExcel;
 import org.springblade.los.excel.UpdatePodStationExcel;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.service.IFeeCenterService;
-import org.springblade.los.ftp.service.CyFtpService;
 import org.springblade.resource.feign.IOssClient;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.stereotype.Service;
@@ -135,7 +134,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 
 	private final IFeeCenterService feeCenterService;
 
-	private final CyFtpService cyFtpService;
+//	private final CyFtpService cyFtpService;
 
 	@Override
 	public IPage<PutBoxVO> selectPutBoxPage(IPage<PutBoxVO> page, PutBoxVO putBox) {
@@ -1291,11 +1290,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
 		}
 		this.countOverdueFee(putBoxList, tradingBoxList, tradingBoxItems, containersListNew, putBoxItems);
-		List<String> fileName = excelList.stream().map(EmptyContainerAppearanceAnalysis::getSrcFile).distinct()
+		/*List<String> fileName = excelList.stream().map(EmptyContainerAppearanceAnalysis::getSrcFile).distinct()
 			.filter(Objects::nonNull).collect(Collectors.toList());
 		if (!fileName.isEmpty()) {
 			cyFtpService.ftpFilescopy(excelList.get(0).getCorpId(), fileName, "OUT");
-		}
+		}*/
 		return R.data("操作成功");
 	}
 
@@ -3060,11 +3059,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		if (!tradingBoxItems.isEmpty()) {
 			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItems);
 		}
-		List<String> fileName = excelList.stream().map(EmptyContainerAppearanceAnalysis::getSrcFile).distinct()
+		/*List<String> fileName = excelList.stream().map(EmptyContainerAppearanceAnalysis::getSrcFile).distinct()
 			.filter(Objects::nonNull).collect(Collectors.toList());
 		if (!fileName.isEmpty()) {
 			cyFtpService.ftpFilescopy(excelList.get(0).getCorpId(), fileName, "IN");
-		}
+		}*/
 		return R.data("操作成功");
 	}
 
@@ -3076,6 +3075,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			throw new RuntimeException("缺少必要请求参数");
 		}
 		List<Long> containersIds = podStationR.getList().stream().map(UpdatePodStationExcel::getContainersId).collect(Collectors.toList());
+		List<String> cntrNo = podStationR.getList().stream().map(UpdatePodStationExcel::getCntrNo).collect(Collectors.toList());
 		List<Long> billsIds = podStationR.getList().stream().map(UpdatePodStationExcel::getId).distinct().collect(Collectors.toList());
 		List<Containers> containersHYJKList = containersService.list(new LambdaQueryWrapper<Containers>()
 			.eq(Containers::getTenantId, AuthUtil.getTenantId())
@@ -3085,7 +3085,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			throw new RuntimeException("未查到配箱信息");
 		}
 		if ("SI".equals(podStationR.getBusinessType())) {
-			/*if ("1".equals(podStationR.getType())) {
+			if ("1".equals(podStationR.getType())) {
 				List<String> boxNum = containersHYJKList.stream().map(Containers::getCntrNo).filter(Objects::nonNull)
 					.collect(Collectors.toList());
 				if (boxNum.isEmpty()) {
@@ -3190,16 +3190,6 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						if (ObjectUtils.isNull(item.getHblno())) {
 							throw new RuntimeException("分单号不能为空");
 						}
-						item.setPodStationId(podStationR.getPodStationId());
-						item.setPodStationCname(podStationR.getPodStationCname());
-						item.setPodStationEname(podStationR.getPodStationEname());
-						item.setPodStationCode(podStationR.getPodStationCode());
-						item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
-						item.setWhetherFee("1");
-						item.setUpdateTime(new Date());
-						item.setUpdateUser(AuthUtil.getUserId());
-						item.setUpdateUserName(AuthUtil.getUserName());
-						containersListNew.add(item);
 						//进口分单配箱信息处理
 						//箱档案信息处理
 						Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getCntrNo())).findFirst().orElse(null);
@@ -3338,16 +3328,17 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 											putBox2.setPolStationEname(podStationR.getPodStationCode());
 											putBox2.setBoxType(archives.getTypeName());
 											putBox2.setBoxClass(archives.getBoxType());
-											putBox2.setTotalNum(1);
-											putBox2.setOccupyNum(0);
-											putBox2.setRemainingNum(1);
-											putBox2.setStorageNum(1);
+//											putBox2.setTotalNum(1);
+//											putBox2.setOccupyNum(0);
+//											putBox2.setRemainingNum(1);
+//											putBox2.setStorageNum(1);
 											putBoxNewList.add(putBox2);
 										} else {
-											putBox2.setTotalNum(putBox1.getTotalNum() + 1);
-											putBox2.setOccupyNum(0);
-											putBox2.setRemainingNum(putBox1.getRemainingNum() + 1);
-											putBox2.setStorageNum(putBox1.getStorageNum() + 1);
+//											putBox2.setTotalNum(putBox1.getTotalNum() + 1);
+//											putBox2.setOccupyNum(0);
+//											putBox2.setRemainingNum(putBox1.getRemainingNum() + 1);
+//											putBox2.setStorageNum(putBox1.getStorageNum() + 1);
+											putBoxNewList.add(putBox2);
 										}
 									} else {
 										putBox = new PutBox();
@@ -3389,16 +3380,16 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 										putBox.setPolStationEname(podStationR.getPodStationCode());
 										putBox.setBoxType(archives.getTypeName());
 										putBox.setBoxClass(archives.getBoxType());
-										putBox.setTotalNum(1);
-										putBox.setOccupyNum(0);
-										putBox.setRemainingNum(1);
-										putBox.setStorageNum(1);
+//										putBox.setTotalNum(1);
+//										putBox.setOccupyNum(0);
+//										putBox.setRemainingNum(1);
+//										putBox.setStorageNum(1);
 										putBoxNewList.add(putBox);
 									}
 								} else {
-									putBox.setTotalNum(putBox.getTotalNum() + 1);
-									putBox.setRemainingNum(putBox.getTotalNum() + 1 - putBox.getOccupyNum());
-									putBox.setStorageNum(putBox.getStorageNum() + 1 - putBox.getOccupyNum());
+//									putBox.setTotalNum(putBox.getTotalNum() + 1);
+//									putBox.setRemainingNum(putBox.getTotalNum() + 1 - putBox.getOccupyNum());
+//									putBox.setStorageNum(putBox.getStorageNum() + 1 - putBox.getOccupyNum());
 									putBoxNewList.add(putBox);
 								}
 							} else if ("OW(拿)".equals(putBox1.getBoxClass())) {
@@ -3469,7 +3460,18 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 							} else {
 								throw new RuntimeException("放箱号:" + archives.getContainerNumberOw() + "单据类型错误,请联系管理员");
 							}
+							item.setBoxSrcType(putBox1.getBoxClass());
 						}
+						item.setPodStationId(podStationR.getPodStationId());
+						item.setPodStationCname(podStationR.getPodStationCname());
+						item.setPodStationEname(podStationR.getPodStationEname());
+						item.setPodStationCode(podStationR.getPodStationCode());
+						item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
+						item.setWhetherFee("1");
+						item.setUpdateTime(new Date());
+						item.setUpdateUser(AuthUtil.getUserId());
+						item.setUpdateUserName(AuthUtil.getUserName());
+						containersListNew.add(item);
 					}
 					if (!containersListNew.isEmpty()) {
 						containersService.updateBatchById(containersListNew);
@@ -3631,72 +3633,81 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 								archivesTrajectoryMapper.insert(archivesTrajectory);
 							}
 						}
+						for (PutBox item : putBoxNewList) {
+							long count = putBoxItemsNewList.stream().filter(e -> e.getPid().equals(item.getId())).count();
+							item.setTotalNum((ObjectUtils.isNull(item.getTotalNum()) ? 0 : item.getTotalNum())
+								+ Integer.parseInt(count + ""));
+							item.setRemainingNum((ObjectUtils.isNull(item.getRemainingNum()) ? 0 : item.getRemainingNum()) + Integer.parseInt(count + ""));
+							item.setStorageNum((ObjectUtils.isNull(item.getStorageNum()) ? 0 : item.getStorageNum()) + Integer.parseInt(count + ""));
+						}
+						this.saveOrUpdateBatch(putBoxNewList);
 					}
 					//计算超期箱使费
 					this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList, putBoxItemsOldList, putBoxList);
 				}
-			} else {*/
-			for (Containers item : containersHYJKList) {
-				if (ObjectUtils.isNull(item.getHblno())) {
-					throw new RuntimeException("分单号不能为空");
+			} else {
+				for (Containers item : containersHYJKList) {
+					if (ObjectUtils.isNull(item.getHblno())) {
+						throw new RuntimeException("分单号不能为空");
+					}
+					item.setPodStationId(podStationR.getPodStationId());
+					item.setPodStationCname(podStationR.getPodStationCname());
+					item.setPodStationEname(podStationR.getPodStationEname());
+					item.setPodStationCode(podStationR.getPodStationCode());
+					item.setPodCyAddress(podStationR.getPodCyAddress());
+					item.setPodCyContact(podStationR.getPodCyContact());
+					item.setPodCyEmail(podStationR.getPodCyEmail());
+					item.setPodCyTel(podStationR.getPodCyTel());
+					item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
+					item.setMarks(podStationR.getMarks());
+					item.setUpdateTime(new Date());
+					item.setUpdateUser(AuthUtil.getUserId());
+					item.setUpdateUserName(AuthUtil.getUserName());
 				}
-				item.setPodStationId(podStationR.getPodStationId());
-				item.setPodStationCname(podStationR.getPodStationCname());
-				item.setPodStationEname(podStationR.getPodStationEname());
-				item.setPodStationCode(podStationR.getPodStationCode());
-				item.setPodCyAddress(podStationR.getPodCyAddress());
-				item.setPodCyContact(podStationR.getPodCyContact());
-				item.setPodCyEmail(podStationR.getPodCyEmail());
-				item.setPodCyTel(podStationR.getPodCyTel());
-				item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
-				item.setMarks(podStationR.getMarks());
-				item.setUpdateTime(new Date());
-				item.setUpdateUser(AuthUtil.getUserId());
-				item.setUpdateUserName(AuthUtil.getUserName());
-			}
-			containersService.updateBatchById(containersHYJKList);
-			List<Bills> billsHYJKList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
-				.eq(Bills::getTenantId, AuthUtil.getTenantId())
-				.eq(Bills::getIsDeleted, 0)
-				.in(Bills::getId, billsIds));
-			if (billsHYJKList.isEmpty()) {
-				throw new RuntimeException("未查到海运出口单据");
-			}
-/*			for (Bills item : billsHYJKList) {
-				if (ObjectUtils.isNotNull(item.getEtd()) && new Date().compareTo(item.getEtd()) > 0) {
-					throw new RuntimeException("提单号:" + item.getMblno() + "已开船,修改失败");
+				containersService.updateBatchById(containersHYJKList);
+				List<Bills> billsHYJKList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+					.eq(Bills::getTenantId, AuthUtil.getTenantId())
+					.eq(Bills::getIsDeleted, 0)
+					.in(Bills::getId, billsIds));
+				if (billsHYJKList.isEmpty()) {
+					throw new RuntimeException("未查到海运出口单据");
 				}
-			}*/
-			List<Long> idHYJKList = billsHYJKList.stream().map(Bills::getMasterId).distinct().collect(Collectors.toList());
-			List<Bills> billsHYJKListFD = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
-				.eq(Bills::getTenantId, AuthUtil.getTenantId())
-				.eq(Bills::getIsDeleted, 0)
-				.in(Bills::getId, idHYJKList));
-			if (!billsHYJKListFD.isEmpty()) {
-				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
-					.eq(Containers::getTenantId, AuthUtil.getTenantId())
-					.eq(Containers::getIsDeleted, 0)
-					.in(Containers::getPid, billsHYJKListFD.stream().map(Bills::getId).collect(Collectors.toList())));
-				if (!containersList.isEmpty()) {
-					for (Containers item : containersList) {
-						item.setPodStationId(podStationR.getPodStationId());
-						item.setPodStationCname(podStationR.getPodStationCname());
-						item.setPodStationEname(podStationR.getPodStationEname());
-						item.setPodStationCode(podStationR.getPodStationCode());
-						item.setMarks(podStationR.getPodStationCode());
-						item.setPodCyAddress(podStationR.getPodCyAddress());
-						item.setPodCyContact(podStationR.getPodCyContact());
-						item.setPodCyEmail(podStationR.getPodCyEmail());
-						item.setPodCyTel(podStationR.getPodCyTel());
-						item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
-						item.setUpdateTime(new Date());
-						item.setUpdateUser(AuthUtil.getUserId());
-						item.setUpdateUserName(AuthUtil.getUserName());
+				for (Bills item : billsHYJKList) {
+					if (ObjectUtils.isNotNull(item.getEtd()) && new Date().compareTo(item.getEtd()) > 0) {
+						throw new RuntimeException("提单号:" + item.getMblno() + "已开船,修改失败");
+					}
+				}
+				List<Long> idHYJKList = billsHYJKList.stream().map(Bills::getMasterId).distinct().collect(Collectors.toList());
+				List<Bills> billsHYJKListFD = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
+					.eq(Bills::getTenantId, AuthUtil.getTenantId())
+					.eq(Bills::getIsDeleted, 0)
+					.in(Bills::getId, idHYJKList));
+				if (!billsHYJKListFD.isEmpty()) {
+					List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
+						.eq(Containers::getTenantId, AuthUtil.getTenantId())
+						.eq(Containers::getIsDeleted, 0)
+						.in(Containers::getCntrNo, cntrNo)
+						.in(Containers::getPid, billsHYJKListFD.stream().map(Bills::getId).collect(Collectors.toList())));
+					if (!containersList.isEmpty()) {
+						for (Containers item : containersList) {
+							item.setPodStationId(podStationR.getPodStationId());
+							item.setPodStationCname(podStationR.getPodStationCname());
+							item.setPodStationEname(podStationR.getPodStationEname());
+							item.setPodStationCode(podStationR.getPodStationCode());
+							item.setMarks(podStationR.getPodStationCode());
+							item.setPodCyAddress(podStationR.getPodCyAddress());
+							item.setPodCyContact(podStationR.getPodCyContact());
+							item.setPodCyEmail(podStationR.getPodCyEmail());
+							item.setPodCyTel(podStationR.getPodCyTel());
+							item.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
+							item.setUpdateTime(new Date());
+							item.setUpdateUser(AuthUtil.getUserId());
+							item.setUpdateUserName(AuthUtil.getUserName());
+						}
+						containersService.updateBatchById(containersList);
 					}
-					containersService.updateBatchById(containersList);
 				}
 			}
-//			}
 		} else {
 			for (Containers item : containersHYJKList) {
 				if (ObjectUtils.isNull(item.getHblno())) {
@@ -3737,6 +3748,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
 					.eq(Containers::getTenantId, AuthUtil.getTenantId())
 					.eq(Containers::getIsDeleted, 0)
+					.in(Containers::getCntrNo, cntrNo)
 					.in(Containers::getPid, billsHYJKListFD.stream().map(Bills::getId).collect(Collectors.toList())));
 				if (!containersList.isEmpty()) {
 					for (Containers item : containersList) {

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

@@ -3204,8 +3204,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				item.setBusinessType(billsJk.getBusinessType());
 				item.setDc("C");
 				item.setCreateTime(new Date());
-				item.setCreateUser(AuthUtil.getUserId());
-				item.setCreateUserName(AuthUtil.getUserName());
+				item.setCreateUser(billsJk.getOperatorId());
+				item.setCreateUserName(billsJk.getOperatorName());
 				item.setBranchId(billsJk.getBranchId());
 				item.setCreateDept(billsJk.getCreateDept());
 				item.setCreateDeptName(billsJk.getCreateDeptName());

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

@@ -1052,6 +1052,18 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					corpIds = feeCenterList.stream().map(FeeCenter::getCorpId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
 				}
 			}
+		}else if ("XGFY".equals(type)){
+			TradingBox bills = tradingBoxMapper.selectById(billId);
+			if (bills != null) {
+				List<FeeCenter> feeCenterList = baseMapper.selectList(new LambdaQueryWrapper<FeeCenter>()
+					.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+					.eq(FeeCenter::getIsDeleted, 0)
+					.eq(FeeCenter::getDc, dc)
+					.eq(FeeCenter::getPid, billId));
+				if (!feeCenterList.isEmpty()) {
+					corpIds = feeCenterList.stream().map(FeeCenter::getCorpId).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+				}
+			}
 		}
 		if (!corpIds.isEmpty()) {
 			return bCorpsService.list(new LambdaQueryWrapper<BCorps>()

+ 11 - 4
blade-service/blade-los/src/main/java/org/springblade/los/ftp/controller/ApiCyCtnrController.java

@@ -3,10 +3,13 @@ package org.springblade.los.ftp.controller;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.springblade.core.tool.api.R;
+import org.springblade.los.box.dynamics.service.IBoxDynamicsRecordService;
 import org.springblade.los.ftp.dto.ApiRequest;
-import org.springblade.los.ftp.service.CyFtpService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 import springfox.documentation.annotations.ApiIgnore;
 
 /**
@@ -18,8 +21,11 @@ import springfox.documentation.annotations.ApiIgnore;
 @RequestMapping("/apicyctnr")
 public class ApiCyCtnrController {
 
+	/*@Autowired
+	private final CyFtpService cyFtpService;*/
+
 	@Autowired
-	private final CyFtpService cyFtpService;
+	private final IBoxDynamicsRecordService boxDynamicsRecordService;
 
 	/**
 	 * 场站api
@@ -28,6 +34,7 @@ public class ApiCyCtnrController {
 	@ApiIgnore
 	@PostMapping("/cyctnrItem")
 	public R cyctnrItem(@RequestBody ApiRequest apiRequest) {
-		return cyFtpService.cyctnrItem(apiRequest);
+//		return cyFtpService.cyctnrItem(apiRequest);
+		return boxDynamicsRecordService.cyctnrItem(apiRequest);
 	}
 }

+ 4 - 4
blade-service/blade-los/src/main/java/org/springblade/los/ftp/controller/TestController.java

@@ -54,11 +54,11 @@ public class TestController {
 	/**
 	 * POL空箱提箱进场-FTP
 	 */
-	@SneakyThrows
+	/*@SneakyThrows
 	@GetMapping("/emptyContainerEntryFtp")
 	public R emptyContainerEntryFtp(@RequestParam("corpId") Long corpId,@RequestParam("type") String type) {
 		return cyFtpService.ftpFilesHandle(corpId,type);
-	}
+	}*/
 
 	/**
 	 * ftp文件导入
@@ -66,10 +66,10 @@ public class TestController {
 	 * @param file
 	 * @return
 	 */
-	@SneakyThrows
+	/*@SneakyThrows
 	@PostMapping("/ftpFileImport")
 	public R ftpFileImport(@RequestParam("file") MultipartFile file,
 								   @RequestParam("corpId") Long corpId,@RequestParam("type") String type) {
 		return R.data(cyFtpService.ftpFileImport(file,corpId,type));
-	}
+	}*/
 }

+ 2 - 5
blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/CyFtpService.java

@@ -16,11 +16,8 @@ import java.util.List;
 public interface CyFtpService {
 
 
-	R ftpFilesHandle(Long corpId,String type);
-
+	/*R ftpFilesHandle(Long corpId,String type);
 	R ftpFilescopy(Long corpId,List<String> filesName, String type);
-
 	R ftpFileImport(MultipartFile file, Long corpId, String type);
-
-	R cyctnrItem(ApiRequest apiRequest);
+	R cyctnrItem(ApiRequest apiRequest);*/
 }

+ 29 - 50
blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/impl/CyFtpServiceImpl.java

@@ -2,56 +2,17 @@ package org.springblade.los.ftp.service.impl;
 
 //import com.alibaba.cloud.commons.io.IOUtils;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import lombok.AllArgsConstructor;
 import org.apache.commons.io.IOUtils;
-import org.apache.commons.net.ftp.FTP;
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPFile;
-import org.springblade.client.entity.Message;
-import org.springblade.client.feign.IMessageClient;
-import org.springblade.core.oss.model.BladeFile;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.tool.api.R;
-import org.springblade.los.basic.cntr.entity.BCntrTypes;
-import org.springblade.los.basic.cntr.service.IBCntrTypesService;
-import org.springblade.los.basic.corps.entity.BCorps;
-import org.springblade.los.basic.corps.service.IBCorpsService;
-import org.springblade.los.basic.ports.entity.BPorts;
-import org.springblade.los.basic.ports.service.IBPortsService;
-import org.springblade.los.box.dynamics.entity.BoxDynamicsRecord;
-import org.springblade.los.box.dynamics.entity.BoxDynamicsRecordItems;
-import org.springblade.los.box.dynamics.mapper.BoxDynamicsRecordItemsMapper;
-import org.springblade.los.box.dynamics.mapper.BoxDynamicsRecordMapper;
-import org.springblade.los.box.entity.PutBox;
-import org.springblade.los.box.excel.EmptyContainerAppearanceAnalysis;
-import org.springblade.los.box.mapper.PutBoxMapper;
-import org.springblade.los.business.sea.entity.Bills;
-import org.springblade.los.business.sea.mapper.BillsMapper;
-import org.springblade.los.ftp.dto.ApiItem;
-import org.springblade.los.ftp.dto.ApiRequest;
 import org.springblade.los.ftp.dto.ContainerMovement;
 import org.springblade.los.ftp.service.CyFtpService;
-import org.springblade.resource.feign.IOssClient;
-import org.springblade.system.feign.ISysClient;
-import org.springblade.system.user.entity.User;
-import org.springblade.system.user.feign.IUserClient;
-import org.springframework.mock.web.MockMultipartFile;
 import org.springframework.stereotype.Service;
-import org.springframework.web.multipart.MultipartFile;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
 
 /**
  * @author :jixinyuan
@@ -61,7 +22,7 @@ import java.util.stream.Collectors;
 @AllArgsConstructor
 public class CyFtpServiceImpl implements CyFtpService {
 
-	private final IBCorpsService bCorpsService;
+	/*private final IBCorpsService bCorpsService;
 
 	private final IBPortsService bPortsService;
 
@@ -81,9 +42,9 @@ public class CyFtpServiceImpl implements CyFtpService {
 
 	private final IUserClient userClient;
 
-	private final ISysClient sysClient;
+	private final ISysClient sysClient;*/
 
-	@Override
+	/*@Override
 	public R ftpFilesHandle(Long corpId, String type) {
 		BCorps bCorps = bCorpsService.getById(corpId);
 		String server = bCorps.getEdiFtp();
@@ -450,9 +411,9 @@ public class CyFtpServiceImpl implements CyFtpService {
 			throw new RuntimeException(ex);
 		}
 		return R.data(new ArrayList<>());
-	}
+	}*/
 
-	@Override
+	/*@Override
 	public R cyctnrItem(ApiRequest apiRequest) {
 		StringBuilder msg = new StringBuilder();
 		// 1. 执行基础参数校验
@@ -639,9 +600,28 @@ public class CyFtpServiceImpl implements CyFtpService {
 				item.setPid(boxDynamicsRecord.getId());
 				boxDynamicsRecordItemsService.insert(item);
 			}
+			// 创建线程池
+			ExecutorService executor = Executors.newSingleThreadExecutor();
+			// 启动任务并提交给线程池
+			executor.submit(() -> {
+				try {
+//					this.sendMessage(boxDynamicsRecord, itemsList);
+				} catch (Exception e) {
+					System.out.println("业务处理成功,发送消息异常,时间:" + new Date());
+					System.out.println(e.getMessage());
+					// 关闭线程池
+					executor.shutdown();
+					throw new RuntimeException(e);
+				} finally {
+					// 关闭线程池
+					executor.shutdown();
+				}
+			});
+			// 关闭线程池
+			executor.shutdown();
 			return R.success("成功");
 		}
-	}
+	}*/
 
 	/**
 	 * 明细参数校验方法
@@ -649,7 +629,7 @@ public class CyFtpServiceImpl implements CyFtpService {
 	 * @param apiRequest 请求对象
 	 * @param msg        错误信息收集器
 	 */
-	private void validateBasicParamsItem(ApiRequest apiRequest, StringBuilder msg, List<Bills> billsList,
+	/*private void validateBasicParamsItem(ApiRequest apiRequest, StringBuilder msg, List<Bills> billsList,
 										 List<PutBox> putBoxList, List<BCntrTypes> boxTypeList) {
 		for (ApiItem item : apiRequest.getItem()) {
 			if (ObjectUtils.isNull(item.getReleaseNo())) {
@@ -692,7 +672,7 @@ public class CyFtpServiceImpl implements CyFtpService {
 				}
 			}
 		}
-	}
+	}*/
 
 	/**
 	 * 基础参数校验方法
@@ -700,7 +680,7 @@ public class CyFtpServiceImpl implements CyFtpService {
 	 * @param apiRequest 请求对象
 	 * @param msg        错误信息收集器
 	 */
-	private void validateBasicParams(ApiRequest apiRequest, StringBuilder msg) {
+	/*private void validateBasicParams(ApiRequest apiRequest, StringBuilder msg) {
 		// 校验明细数据不能为空
 		if (apiRequest.getItem() == null || apiRequest.getItem().isEmpty()) {
 			msg.append("集装箱明细不能为空;");
@@ -721,8 +701,7 @@ public class CyFtpServiceImpl implements CyFtpService {
 		if (ObjectUtils.isNull(apiRequest.getImportDate())) {
 			msg.append("推送时间不能为空;");
 		}
-	}
-
+	}*/
 	public static List<ContainerMovement> parseEdifactMessage(InputStream inputStream) throws IOException {
 		List<ContainerMovement> movements = new ArrayList<>();
 		if (inputStream == null) {