Browse Source

1.合约接口调试及修改
2.箱池动态-按放箱号列表增加排序
3.箱池动态-按放箱号列表数据不对修改
4.箱池动态-空箱出场导入接口修改箱档案数据问题修改
5.箱池动态-空箱出场导入更新OW单据,放箱号明细数据修改
6.空箱返场接口更新OW单据,放箱号明细数据修改
7.生成的超期箱使费增加付款方式
8.放箱号,OW单据明细pol预出场日期等于提箱进场日期
9.POL提箱进场允许自有箱导入
10.空箱返场-分单号为空不能修改
11.空想返场-增加是否计算过超期箱使费状态
12.主单修改etd同步分单etd日期问题修改
13.海运进口复制接口清空来源单号
14.客户托书生成海运出口,超期箱使免费天使赋默认值,海运单号错误修改

纪新园 6 months ago
parent
commit
9dc4b1676c
15 changed files with 588 additions and 224 deletions
  1. 12 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/corps/entity/BCorps.java
  2. 18 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/TradingBox.java
  3. 5 0
      blade-service-api/blade-los-api/src/main/java/org/springblade/los/business/sea/entity/Containers.java
  4. 10 8
      blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/PutBoxMapper.xml
  5. 184 61
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java
  6. 5 2
      blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/TradingBoxServiceImpl.java
  7. 8 2
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/mapper/ContainersMapper.xml
  8. 97 147
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/BillsServiceImpl.java
  9. 6 0
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/ContainersServiceImpl.java
  10. 7 0
      blade-service/blade-los/src/main/java/org/springblade/los/excel/UpdatePodStationExcel.java
  11. 13 0
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/controller/TestController.java
  12. 31 0
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/dto/ContainerMovement.java
  13. 15 0
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/CyFtpService.java
  14. 173 0
      blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/impl/CyFtpServiceImpl.java
  15. 4 4
      blade-service/blade-los/src/main/resources/application-dev.yml

+ 12 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/basic/corps/entity/BCorps.java

@@ -575,6 +575,18 @@ public class BCorps implements Serializable {
 	private String corpSource;
 
 	/**
+	 * ftp用户名
+	 */
+	@ApiModelProperty(value = "ftp用户名")
+	private String usernameFtp;
+
+	/**
+	 * ftp密码
+	 */
+	@ApiModelProperty(value = "ftp密码")
+	private String passwordFtp;
+
+	/**
 	 * 客户更改授信等级记录
 	 */
 	@TableField(exist = false)

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

@@ -569,6 +569,24 @@ public class TradingBox implements Serializable {
 	private Integer notSuitcaseNum;
 
 	/**
+	 * 地址
+	 */
+	@ApiModelProperty(value = "地址")
+	private String address;
+
+	/**
+	 * 电话
+	 */
+	@ApiModelProperty(value = "电话")
+	private String tel;
+
+	/**
+	 * 联系人
+	 */
+	@ApiModelProperty(value = "联系人")
+	private String contacts;
+
+	/**
 	 * 临时数据
 	 */
 	@TableField(exist = false)

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

@@ -502,6 +502,11 @@ public class Containers implements Serializable {
 	 */
 	@ApiModelProperty(value = "放箱号")
 	private String containerNumber;
+	/**
+	 * 是否生成超期箱使费
+	 */
+	@ApiModelProperty(value = "是否生成超期箱使费")
+	private String whetherFee;
 
 	/**
 	 * 配箱类型

+ 10 - 8
blade-service/blade-los/src/main/java/org/springblade/los/box/mapper/PutBoxMapper.xml

@@ -97,6 +97,8 @@
             and DATE_FORMAT(effective_start_date,'%Y-%m-%d') >= DATE_FORMAT(CURDATE(), '%Y-%m-%d')
             and DATE_FORMAT(effective_end_date,'%Y-%m-%d') <= DATE_FORMAT(CURDATE(), '%Y-%m-%d')
         </if>
+        ORDER BY
+        create_time DESC
     </select>
     <select id="listPort" resultType="org.springblade.los.box.dto.BoxPoolPortDTO">
         SELECT
@@ -156,7 +158,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '好'
@@ -168,7 +170,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '好'
@@ -180,7 +182,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '好'
@@ -192,7 +194,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '好'
@@ -204,7 +206,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '坏'
@@ -216,7 +218,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '坏'
@@ -228,7 +230,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '坏'
@@ -240,7 +242,7 @@
         FROM
         logistics_put_box_items
         WHERE
-        tenant_id = '128478'
+        tenant_id = #{tenantId}
         AND is_deleted = '0'
         AND pid = lpb.id
         AND box_status = '坏'

+ 184 - 61
blade-service/blade-los/src/main/java/org/springblade/los/box/service/impl/PutBoxServiceImpl.java

@@ -527,23 +527,6 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 	@Override
 	public IPage<BoxPoolContainerNumberDTO> listContainerNumber(BoxPoolDTO boxPoolDTO, IPage<BoxPoolContainerNumberDTO> page) {
 		boxPoolDTO.setTenantId(AuthUtil.getTenantId());
-		LambdaQueryWrapper<PutBox> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-		lambdaQueryWrapper.eq(PutBox::getTenantId, AuthUtil.getTenantId())
-			.eq(PutBox::getIsDeleted, 0)
-			.eq(ObjectUtils.isNotNull(boxPoolDTO.getBoxType()), PutBox::getBoxType, boxPoolDTO.getBoxType())
-			.apply(ObjectUtils.isNotNull(boxPoolDTO.getBusType()), "find_in_set(bus_type,'" + boxPoolDTO.getBusType() + "')")
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getContainerNumber()), PutBox::getContainerNumber, boxPoolDTO.getContainerNumber())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getPodId()), PutBox::getPodId, boxPoolDTO.getPodId())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getPodName()), PutBox::getPodCname, boxPoolDTO.getPodName())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getPolId()), PutBox::getPolId, boxPoolDTO.getPolId())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getPolName()), PutBox::getPolCname, boxPoolDTO.getPolName())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastId()), PutBox::getBoxEastId, boxPoolDTO.getBoxEastId())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getBoxEastName()), PutBox::getBoxEastName, boxPoolDTO.getBoxEastName())
-			.like(ObjectUtils.isNotNull(boxPoolDTO.getStationId()), PutBox::getPolStationId, boxPoolDTO.getStationId());
-		if (ObjectUtils.isNotNull(boxPoolDTO.getWhetherLoseEfficacy())) {
-			lambdaQueryWrapper.ge(PutBox::getEffectiveStartDate, new Date())
-				.le(PutBox::getEffectiveEndDate, new Date());
-		}
 		List<BoxPoolContainerNumberDTO> putBoxList = baseMapper.selectPutBoxPage(page, boxPoolDTO);
 		if (!putBoxList.isEmpty()) {
 			List<Long> ids = putBoxList.stream().map(BoxPoolContainerNumberDTO::getId).collect(Collectors.toList());
@@ -553,10 +536,10 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				.in(PutBoxItems::getPid, ids));
 			for (BoxPoolContainerNumberDTO item : putBoxList) {
 				if ("OW(拿),OW(放)".contains(item.getBusType())) {
-					item.setGood(item.getRemainingNum());
-					item.setTotal(item.getRemainingNum());
+					item.setGood(item.getTotalNum());
+					item.setTotal(item.getTotalNum());
 					item.setOccupyNum(item.getOccupyNum());
-					item.setRemainingTotal(item.getTotalNum());
+					item.setRemainingTotal(item.getRemainingNum());
 				} else {
 					if (!boxItemsList.isEmpty()) {
 						List<PutBoxItems> itemsList = boxItemsList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
@@ -565,7 +548,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 							item.setBad(itemsList.stream().filter(e -> "坏".equals(e.getBoxStatus()) && item.getBoxType().equals(e.getBoxType())).count());
 							item.setTotal(item.getGood() + item.getBad());
 							item.setOccupyNum(item.getOccupyNum());
-							item.setRemainingTotal(item.getTotal());
+							item.setRemainingTotal(item.getRemainingNum());
 						}
 					}
 				}
@@ -784,10 +767,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				//箱档案数据处理
 				Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
 				if (archives != null) {
-					if ("OW(放)".equals(putBoxData.getBusType())) {
-						archives.setContainerNumberOw(item.getContainerNumber());
-						archives.setContainerNumberTypeOw("OW(放)");
-					}
+					archives.setContainerNumberOw(item.getContainerNumber());
+					archives.setContainerNumberTypeOw(putBoxData.getBusType());
 					if (!archives.getTypeName().equals(item.getBoxType())) {
 						throw new RemoteException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
 					}
@@ -823,6 +804,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					archives.setBoxBelongsTo("SOC");
 					archives.setContainerNumber(item.getContainerNumber());
 					archives.setContainerNumberType(putBoxData.getBusType());
+					archives.setContainerNumberOw(item.getContainerNumber());
+					archives.setContainerNumberTypeOw(putBoxData.getBusType());
 					archives.setTypeId(cntrTypes.getId());
 					archives.setTypeName(cntrTypes.getCnName());
 					archives.setBoxType(putBoxData.getBusType());
@@ -839,11 +822,23 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				if (ObjectUtils.isNotNull(putBoxData.getBoxType()) && !putBoxData.getBoxType().equals(item.getBoxType())) {
 					throw new RemoteException("放箱号:" + item.getContainerNumber() + "箱型不符合");
 				}
+				Bills bills = null;
+				if (!containersList.isEmpty()) {
+					List<Containers> containerItemList = containersList.stream().filter(e -> item.getMblno().equals(e.getMblno())
+						&& item.getBoxCode().equals(e.getCntrNo())).collect(Collectors.toList());
+					if (!containerItemList.isEmpty()) {
+						List<Long> billsIds = containerItemList.stream().map(Containers::getPid).distinct().collect(Collectors.toList());
+						bills = billsList.stream().filter(e -> "MH".equals(e.getBillType()) && billsIds.contains(e.getId())).findFirst().orElse(null);
+					}
+				}
+				if (bills == null) {
+					throw new RuntimeException("未查到提单号:" + item.getMblno() + "对应海运出口单据");
+				}
 				//放箱号明细数据处理
 				PutBoxItems putBoxItem;
 				if (!putBoxItemsList.isEmpty()) {
 					putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()) &&
-							e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
+						e.getPid().equals(putBoxData.getId())).findFirst().orElse(null);
 					if (putBoxItem != null) {
 						putBoxItem.setPid(putBoxData.getId());
 						putBoxItem.setMblno(item.getMblno());
@@ -852,6 +847,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						putBoxItem.setPolCyCode(corps.getCode());
 						putBoxItem.setPolCyCname(corps.getCnName());
 						putBoxItem.setPolCyEname(corps.getEnName());
+						putBoxItem.setCorpId(bills.getCorpId());
+						putBoxItem.setCorpName(bills.getCorpCnName());
+						putBoxItem.setHblno(bills.getHblno());
+						putBoxItem.setVoyage(bills.getVoyageNo());
+						putBoxItem.setShipNameId(bills.getVesselId());
+						putBoxItem.setShipCname(bills.getVesselCnName());
+						putBoxItem.setShipEname(bills.getVesselEnName());
+						putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+						putBoxItem.setEtd(bills.getEtd());
 						putBoxItem.setStatus("使用中");
 						putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
 					} else {
@@ -872,6 +876,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						putBoxItem.setPolCyCname(corps.getCnName());
 						putBoxItem.setPolCyEname(corps.getEnName());
 						putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+						putBoxItem.setCorpId(bills.getCorpId());
+						putBoxItem.setCorpName(bills.getCorpCnName());
+						putBoxItem.setHblno(bills.getHblno());
+						putBoxItem.setVoyage(bills.getVoyageNo());
+						putBoxItem.setShipNameId(bills.getVesselId());
+						putBoxItem.setShipCname(bills.getVesselCnName());
+						putBoxItem.setShipEname(bills.getVesselEnName());
+						putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+						putBoxItem.setEtd(bills.getEtd());
 					}
 				} else {
 					putBoxItem = new PutBoxItems();
@@ -891,6 +904,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					putBoxItem.setPolCyCname(corps.getCnName());
 					putBoxItem.setPolCyEname(corps.getEnName());
 					putBoxItem.setPolStationEmptyContainerExitDate(item.getBoxStatusDate());
+					putBoxItem.setCorpId(bills.getCorpId());
+					putBoxItem.setCorpName(bills.getCorpCnName());
+					putBoxItem.setHblno(bills.getHblno());
+					putBoxItem.setVoyage(bills.getVoyageNo());
+					putBoxItem.setShipNameId(bills.getVesselId());
+					putBoxItem.setShipCname(bills.getVesselCnName());
+					putBoxItem.setShipEname(bills.getVesselEnName());
+					putBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+					putBoxItem.setEtd(bills.getEtd());
 				}
 				if (ObjectUtils.isNotNull(putBoxData.getBoxEastId()) && !"null".equals(putBoxData.getBoxEastId())) {
 					putBoxItem.setBoxEastId(Long.parseLong(putBoxData.getBoxEastId()));
@@ -935,6 +957,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 										tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
 									}
 									tradingBoxItem.setStatus("待使用");
+									tradingBoxItem.setCorpId(bills.getCorpId());
+									tradingBoxItem.setCorpName(bills.getCorpCnName());
+									tradingBoxItem.setHblno(bills.getHblno());
+									tradingBoxItem.setVoyage(bills.getVoyageNo());
+									tradingBoxItem.setShipNameId(bills.getVesselId());
+									tradingBoxItem.setShipCname(bills.getVesselCnName());
+									tradingBoxItem.setShipEname(bills.getVesselEnName());
+									tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+									tradingBoxItem.setEtd(bills.getEtd());
 								} else {
 									tradingBoxItem = new TradingBoxItem();
 									tradingBoxItem.setBoxBelongsTo("SOC");
@@ -972,6 +1003,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 										tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
 									}
 									tradingBoxItem.setStatus("待使用");
+									tradingBoxItem.setCorpId(bills.getCorpId());
+									tradingBoxItem.setCorpName(bills.getCorpCnName());
+									tradingBoxItem.setHblno(bills.getHblno());
+									tradingBoxItem.setVoyage(bills.getVoyageNo());
+									tradingBoxItem.setShipNameId(bills.getVesselId());
+									tradingBoxItem.setShipCname(bills.getVesselCnName());
+									tradingBoxItem.setShipEname(bills.getVesselEnName());
+									tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+									tradingBoxItem.setEtd(bills.getEtd());
 								}
 							} else {
 								tradingBoxItem = new TradingBoxItem();
@@ -1009,6 +1049,15 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									tradingBoxItem.setPolStationEmptyContainerExitDate(new Date());
 								}
 								tradingBoxItem.setStatus("待使用");
+								tradingBoxItem.setCorpId(bills.getCorpId());
+								tradingBoxItem.setCorpName(bills.getCorpCnName());
+								tradingBoxItem.setHblno(bills.getHblno());
+								tradingBoxItem.setVoyage(bills.getVoyageNo());
+								tradingBoxItem.setShipNameId(bills.getVesselId());
+								tradingBoxItem.setShipCname(bills.getVesselCnName());
+								tradingBoxItem.setShipEname(bills.getVesselEnName());
+								tradingBoxItem.setPolFreeBoxUseDays(bills.getPolFreeBoxUseDays());
+								tradingBoxItem.setEtd(bills.getEtd());
 							}
 							tradingBoxItem.setBoxEastId(tradingBox.getPurchaseCompanyId());
 							tradingBoxItem.setBoxEastName(tradingBox.getPurchaseCompanyName());
@@ -1207,7 +1256,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				}
 			}
 		}
-		this.countOverdueFee(tradingBoxList, tradingBoxItems);
+		this.countOverdueFee(tradingBoxList, tradingBoxItems, containersListNew, putBoxItems);
 		return R.data("操作成功");
 	}
 
@@ -1564,21 +1613,24 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		if (!containersListNew.isEmpty()) {
 			containersService.updateBatchById(containersListNew);
 		}
-		if (!putBoxItemsOldList.isEmpty()) {
+		/*if (!putBoxItemsOldList.isEmpty()) {
 			putBoxItemsService.updateBatchById(putBoxItemsOldList);
-		}
-		if (!tradingBoxItemOldList.isEmpty()) {
+		}*/
+		/*if (!tradingBoxItemOldList.isEmpty()) {
 			tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
-		}
+		}*/
 		//计算超期箱使费
 		if (!billsList.isEmpty()) {
-			this.countOverdueFee(tradingBoxList, tradingBoxItemOldList);
+			this.countOverdueFee(tradingBoxList, tradingBoxItemOldList, containersListNew,putBoxItemsOldList);
 		}
 		return R.data("操作成功");
 	}
 
-	private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
+	private void countOverdueFee(List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList,
+								 List<Containers> containersListNew, List<PutBoxItems> putBoxItems) {
 		List<FeeCenter> feeCenterList = new ArrayList<>();
+		List<PutBoxItems> putBoxItemsList = new ArrayList<>();
+		List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
 		List<String> mblnoList = tradingBoxItemOldList.stream().map(TradingBoxItem::getMblno).collect(Collectors.toList());
 		if (!mblnoList.isEmpty()) {
 			//海运进出口单据
@@ -1586,6 +1638,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				.eq(Bills::getTenantId, AuthUtil.getTenantId())
 				.eq(Bills::getIsDeleted, 0)
 				.in(Bills::getMblno, mblnoList)
+				.eq(Bills::getBusinessType, "SE")
 				.apply("find_in_set(bill_type,'DD,MH')")
 			);
 			if (billsList.isEmpty()) {
@@ -1634,11 +1687,16 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				if (tradingBox == null) {
 					throw new RuntimeException("未查到OW单据");
 				}
-				if ("OW-F".equals(tradingBox.getType())){
+				if ("OW-F".equals(tradingBox.getType())) {
 					continue;
 				}
+				Containers containers = containersListNew.stream().filter(e -> e.getCntrNo().equals(item.getCode())).findFirst().orElse(null);
+				if (containers == null) {
+					throw new RuntimeException("箱号未在配箱信息中查到");
+				}
 				//查找OW明细提单号对应海运进出口单据
-				Bills bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno())).findFirst().orElse(null);
+				Bills bills = billsList.stream().filter(e -> e.getMblno().equals(item.getMblno()) && e.getId().equals(containers.getPid()))
+					.findFirst().orElse(null);
 				if (bills == null) {
 					throw new RuntimeException("未查到提单号:" + item.getMblno() + "海运进出口单据");
 				}
@@ -1670,7 +1728,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					long days = ChronoUnit.DAYS.between(ldt2, ldt1);
 					//超期天数
 					int overdueDays = 0;
-					if (ObjectUtils.isNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
+					if (ObjectUtils.isNotNull(bills.getPolFreeBoxUseDays()) || 0 == bills.getPolFreeBoxUseDays() ||
 						days > bills.getPolFreeBoxUseDays()) {
 						overdueDays = (int) (days - bills.getPolFreeBoxUseDays());
 					}
@@ -1681,21 +1739,38 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 							FeeCenter feeCenterC = new FeeCenter();
 							BeanUtil.copyProperties(feeCenter, feeCenterC);
 							feeCenterC.setDc("C");
-							feeCenter.setCorpType("国内直接客户");
-							feeCenter.setCorpId(bCorps.getId());
-							feeCenter.setCorpCnName(bCorps.getCnName());
-							feeCenter.setCorpEnName(bCorps.getEnName());
-							feeCenter.setShortName(bCorps.getShortName());
+							feeCenterC.setCorpType("国内直接客户");
+							feeCenterC.setCorpId(bCorps.getId());
+							feeCenterC.setCorpCnName(bCorps.getCnName());
+							feeCenterC.setCorpEnName(bCorps.getEnName());
+							feeCenterC.setShortName(bCorps.getShortName());
 							feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion))
-								.divide(new BigDecimal("100"),2,RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
+								.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
 							feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
 							feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
 							feeCenterList.add(feeCenterC);
 						}
+						item.setPolOverdueBoxUseDays(overdueDays);
+						PutBoxItems putBoxItems1 = putBoxItems.stream().filter(e -> e.getBoxCode().equals(item.getCode())).findFirst().orElse(null);
+						if (putBoxItems1 != null) {
+							putBoxItems1.setPolOverdueBoxUseDays(overdueDays);
+							putBoxItemsList.add(putBoxItems1);
+						}
+						tradingBoxItemList.add(item);
 					}
 				}
 			}
 		}
+		if (!putBoxItemsList.isEmpty()) {
+			putBoxItemsService.saveOrUpdateBatch(putBoxItemsList);
+		} else {
+			putBoxItemsService.saveOrUpdateBatch(putBoxItems);
+		}
+		if (!tradingBoxItemList.isEmpty()) {
+			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemList);
+		} else {
+			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemOldList);
+		}
 		if (!feeCenterList.isEmpty()) {
 			feeCenterService.saveBatch(feeCenterList);
 		}
@@ -1735,6 +1810,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 		feeCenter.setCreateTime(new Date());
 		feeCenter.setCreateUser(AuthUtil.getUserId());
 		feeCenter.setCreateUserName(AuthUtil.getUserName());
+		feeCenter.setPaymode(bills.getMpaymode());
 		feeCenter.setPid(bills.getId());
 		feeCenter.setDc("D");
 		feeCenter.setFeeId(fees.getId());
@@ -2569,10 +2645,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				//箱档案数据处理
 				Archives archives = archivesList.stream().filter(e -> e.getCode().equals(item.getBoxCode())).findFirst().orElse(null);
 				if (archives != null) {
-					if ("OW(放)".equals(putBox.getBusType())) {
-						archives.setContainerNumberOw(item.getContainerNumber());
-						archives.setContainerNumberTypeOw("OW(放)");
-					}
+					archives.setContainerNumberOw(item.getContainerNumber());
+					archives.setContainerNumberTypeOw(putBox.getBusType());
 					if (!archives.getTypeName().equals(item.getBoxType())) {
 						throw new RemoteException("箱号:" + item.getBoxCode() + "与箱档案中箱型不符");
 					}
@@ -2608,6 +2682,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					archives.setBoxBelongsTo("SOC");
 					archives.setContainerNumber(item.getContainerNumber());
 					archives.setContainerNumberType(putBox.getBusType());
+					archives.setContainerNumberOw(item.getContainerNumber());
+					archives.setContainerNumberTypeOw(putBox.getBusType());
 					archives.setTypeId(cntrTypes.getId());
 					archives.setTypeName(cntrTypes.getCnName());
 					archives.setBoxType(putBox.getBusType());
@@ -2630,8 +2706,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					putBoxItem = putBoxItemsList.stream().filter(e -> e.getBoxCode().equals(item.getBoxCode()))
 						.findFirst().orElse(null);
 					if (putBoxItem != null) {
-						throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
-						/*putBoxItem.setPid(putBox.getId());
+//						throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
+						putBoxItem.setPid(putBox.getId());
 						putBoxItem.setMblno(item.getMblno());
 						putBoxItem.setBoxDynamics("空箱提箱进场");
 						putBoxItem.setPolCyId(corps.getId());
@@ -2639,7 +2715,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						putBoxItem.setPolCyCname(corps.getCnName());
 						putBoxItem.setPolCyEname(corps.getEnName());
 						putBoxItem.setStatus("待使用");
-						putBoxItem.setPolPickUpDate(item.getBoxStatusDate());*/
+						putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+						putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 					} else {
 						putBoxItem = new PutBoxItems();
 						putBoxItem.setBoxClass(putBox.getBusType());
@@ -2658,6 +2735,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						putBoxItem.setPolCyCname(corps.getCnName());
 						putBoxItem.setPolCyEname(corps.getEnName());
 						putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+						putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 					}
 				} else {
 					putBoxItem = new PutBoxItems();
@@ -2677,6 +2755,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					putBoxItem.setPolCyCname(corps.getCnName());
 					putBoxItem.setPolCyEname(corps.getEnName());
 					putBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+					putBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 				}
 				if (ObjectUtils.isNotNull(putBox.getBoxEastId()) && !"null".equals(putBox.getBoxEastId())) {
 					putBoxItem.setBoxEastId(Long.parseLong(putBox.getBoxEastId()));
@@ -2700,8 +2779,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 								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());
+//									throw new RemoteException("箱号:" + item.getBoxCode() + "在放箱号:" + item.getContainerNumber() + "单据中已存在,不能重复导入");
+									tradingBoxItem.setPid(tradingBox.getId());
 									tradingBoxItem.setMblno(item.getMblno());
 									tradingBoxItem.setBoxDynamics("空箱提箱进场");
 									tradingBoxItem.setPortId(ports.getId());
@@ -2719,11 +2798,13 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
 										tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
 										tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+										tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 									} else {
 										tradingBoxItem.setRentEndDate(new Date());
 										tradingBoxItem.setPolPickUpDate(new Date());
+										tradingBoxItem.setPolPreAppearanceDate(new Date());
 									}
-									tradingBoxItem.setStatus("待使用");*/
+									tradingBoxItem.setStatus("待使用");
 								} else {
 									tradingBoxItem = new TradingBoxItem();
 									tradingBoxItem.setBoxBelongsTo("SOC");
@@ -2758,9 +2839,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
 										tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
 										tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+										tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 									} else {
 										tradingBoxItem.setRentEndDate(new Date());
 										tradingBoxItem.setPolPickUpDate(new Date());
+										tradingBoxItem.setPolPreAppearanceDate(new Date());
 									}
 									tradingBoxItem.setStatus("待使用");
 								}
@@ -2797,9 +2880,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 								if (ObjectUtils.isNotNull(item.getBoxStatusDate())) {
 									tradingBoxItem.setRentEndDate(item.getBoxStatusDate());
 									tradingBoxItem.setPolPickUpDate(item.getBoxStatusDate());
+									tradingBoxItem.setPolPreAppearanceDate(item.getBoxStatusDate());
 								} else {
 									tradingBoxItem.setRentEndDate(new Date());
 									tradingBoxItem.setPolPickUpDate(new Date());
+									tradingBoxItem.setPolPreAppearanceDate(new Date());
 								}
 								tradingBoxItem.setStatus("待使用");
 							}
@@ -3018,7 +3103,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				.in(Containers::getPid, idHYJKList)
 				.in(Containers::getCntrNo, boxNum));
 			List<Containers> containersListNew = new ArrayList<>();
-			for (Bills billsHYJK : billsHYJKListFD){
+			for (Bills billsHYJK : billsHYJKListFD) {
 				//目的港生成新放箱号单据
 				List<PutBox> putBoxNewList = new ArrayList<>();
 				//目的港生成新放箱号单据明细数据
@@ -3031,13 +3116,18 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				List<Archives> archivesArrayList = new ArrayList<>();
 				//OW(拿)、代理箱-箱档案数据删除
 				List<Long> archivesDateleList = new ArrayList<>();
-				List<Containers> containersList = containersHYJKList.stream().filter(e-> e.getPid().equals(billsHYJK.getId()))
+				List<Containers> containersList = containersHYJKList.stream().filter(e -> e.getPid().equals(billsHYJK.getId()))
 					.collect(Collectors.toList());
 				for (Containers item : containersList) {
+					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());
@@ -3051,9 +3141,11 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 							containers.setPodStationCname(podStationR.getPodStationCname());
 							containers.setPodStationEname(podStationR.getPodStationEname());
 							containers.setPodStationCode(podStationR.getPodStationCode());
+							containers.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
 							containers.setUpdateTime(new Date());
 							containers.setUpdateUser(AuthUtil.getUserId());
 							containers.setUpdateUserName(AuthUtil.getUserName());
+							item.setWhetherFee("1");
 							containersListNew.add(containers);
 						}
 					}
@@ -3094,6 +3186,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									putBoxItem.setPodStationCname(podStationR.getPodStationEname());
 									putBoxItem.setPodStationEname(podStationR.getPodStationCode());
 									putBoxItem.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
+									putBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
+									putBoxItem.setEta(billsHYJK.getEta());
 									putBoxItem.setStatus("待使用");
 									putBoxItem.setBoxDynamics("空箱进场");
 									putBoxItemsOldList.add(putBoxItem);
@@ -3129,6 +3223,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 												tradingBoxItem.setStationCode(podStationR.getPodStationCname());
 												tradingBoxItem.setStationCname(podStationR.getPodStationEname());
 												tradingBoxItem.setStationEname(podStationR.getPodStationCode());
+												tradingBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
+												tradingBoxItem.setEta(billsHYJK.getEta());
 												tradingBoxItemOldList.add(tradingBoxItem);
 											} else {
 												throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
@@ -3266,6 +3362,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 									putBoxItem.setPodStationCname(podStationR.getPodStationEname());
 									putBoxItem.setPodStationEname(podStationR.getPodStationCode());
 									putBoxItem.setPodEmptyContainerReturnDate(podStationR.getReturnEmptyTime());
+									putBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
+									putBoxItem.setEta(billsHYJK.getEta());
 									putBoxItem.setStatus("待使用");
 									putBoxItem.setBoxDynamics("空箱进场");
 									putBoxItemsOldList.add(putBoxItem);
@@ -3300,6 +3398,8 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 											tradingBoxItem.setStationCode(podStationR.getPodStationCname());
 											tradingBoxItem.setStationCname(podStationR.getPodStationEname());
 											tradingBoxItem.setStationEname(podStationR.getPodStationCode());
+											tradingBoxItem.setPodFreeBoxUseDays(billsHYJK.getPodFreeBoxUseDays());
+											tradingBoxItem.setEta(billsHYJK.getEta());
 											tradingBoxItemOldList.add(tradingBoxItem);
 										} else {
 											throw new RuntimeException("未查到原OW单据-放箱号:" + archives.getContainerNumber() + "中箱号是:" + item.getCntrNo() + "数据");
@@ -3325,9 +3425,9 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				if (!putBoxItemsOldList.isEmpty()) {
 					putBoxItemsService.updateBatchById(putBoxItemsOldList);
 				}
-				if (!tradingBoxItemOldList.isEmpty()) {
+				/*if (!tradingBoxItemOldList.isEmpty()) {
 					tradingBoxItemService.updateBatchById(tradingBoxItemOldList);
-				}
+				}*/
 				if (!archivesArrayList.isEmpty()) {
 					archivesService.updateBatchById(archivesArrayList);
 				}
@@ -3461,7 +3561,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 					}
 				}
 				//计算超期箱使费
-				this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList);
+				this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList,putBoxItemsOldList);
 			}
 		} else {
 			for (Containers item : containersHYJKList) {
@@ -3509,6 +3609,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R emptyContainerEntryAnalysis(MultipartFile file) throws IOException {
 		List<EmptyContainerAppearanceAnalysis> analysisList = new ArrayList<>();
 		//导入数据
@@ -3716,6 +3817,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public R emptyContainerAppearanceAnalysis(MultipartFile file) throws IOException {
 		List<EmptyContainerAppearanceAnalysis> analysisList = new ArrayList<>();
 		//导入数据
@@ -3764,6 +3866,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			billsList = billsMapper.selectList(new LambdaQueryWrapper<Bills>()
 				.eq(Bills::getTenantId, AuthUtil.getTenantId())
 				.eq(Bills::getIsDeleted, 0)
+				.eq(Bills::getBusinessType, "SE")
 				.in(Bills::getMblno, mblno));
 			if (!billsList.isEmpty()) {
 				containersList = containersService.list(new LambdaQueryWrapper<Containers>()
@@ -5031,13 +5134,16 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 			}
 		}
 		//计算超期箱使费
-		this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList);
+		this.countOverdueFeeV1(billsHYJK, tradingBoxList, tradingBoxItemOldList,putBoxItemsOldList);
 
 		return null;
 	}
 
-	private void countOverdueFeeV1(Bills billsHYJK, List<TradingBox> tradingBoxList, List<TradingBoxItem> tradingBoxItemOldList) {
+	private void countOverdueFeeV1(Bills billsHYJK, List<TradingBox> tradingBoxList,
+								   List<TradingBoxItem> tradingBoxItemOldList,List<PutBoxItems> putBoxItemsOldList) {
 		List<FeeCenter> feeCenterList = new ArrayList<>();
+		List<PutBoxItems> putBoxItemsList = new ArrayList<>();
+		List<TradingBoxItem> tradingBoxItemList = new ArrayList<>();
 		//超期标准
 		List<StorageFees> storageFeesList = storageFeesService.list(new LambdaQueryWrapper<StorageFees>()
 			.eq(StorageFees::getTenantId, AuthUtil.getTenantId())
@@ -5103,7 +5209,7 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 				long days = ChronoUnit.DAYS.between(ldt2, ldt1);
 				//超期天数
 				int overdueDays = 0;
-				if (ObjectUtils.isNull(billsHYJK.getPodFreeBoxUseDays()) || 0 == billsHYJK.getPodFreeBoxUseDays() ||
+				if (ObjectUtils.isNotNull(billsHYJK.getPodFreeBoxUseDays()) || 0 == billsHYJK.getPodFreeBoxUseDays() ||
 					days > billsHYJK.getPodFreeBoxUseDays()) {
 					overdueDays = (int) (days - billsHYJK.getPodFreeBoxUseDays());
 				}
@@ -5120,14 +5226,31 @@ public class PutBoxServiceImpl extends ServiceImpl<PutBoxMapper, PutBox> impleme
 						feeCenterC.setCorpEnName(bCorps.getEnName());
 						feeCenterC.setShortName(bCorps.getShortName());
 						feeCenterC.setPrice(feeCenterC.getPrice().multiply(new BigDecimal(overdueProportion))
-							.divide(new BigDecimal("100"),2,RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
+							.divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).setScale(2, RoundingMode.HALF_UP));
 						feeCenterC.setAmount(feeCenterC.getQuantity().multiply(feeCenterC.getPrice()));
 						feeCenterC.setAmountLoc(feeCenterC.getAmount().multiply(feeCenter.getExrate()));
 						feeCenterList.add(feeCenterC);
 					}
+					item.setPodBoxUseDays(overdueDays);
+					PutBoxItems putBoxItems1 = putBoxItemsOldList.stream().filter(e -> e.getBoxCode().equals(item.getCode())).findFirst().orElse(null);
+					if (putBoxItems1 != null) {
+						putBoxItems1.setPodBoxUseDays(overdueDays);
+						putBoxItemsList.add(putBoxItems1);
+					}
+					tradingBoxItemList.add(item);
 				}
 			}
 		}
+		if (!putBoxItemsList.isEmpty()) {
+			putBoxItemsService.saveOrUpdateBatch(putBoxItemsList);
+		} else {
+			putBoxItemsService.saveOrUpdateBatch(putBoxItemsOldList);
+		}
+		if (!tradingBoxItemList.isEmpty()) {
+			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemList);
+		} else {
+			tradingBoxItemService.saveOrUpdateBatch(tradingBoxItemOldList);
+		}
 		if (!feeCenterList.isEmpty()) {
 			feeCenterService.saveBatch(feeCenterList);
 		}

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

@@ -207,8 +207,11 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 		} else if ("DXCB".equals(tradingBox.getType())) {
 			billNoFormat = "DXCB";
 			businessTypeCode = "DXCB";
-		} else {
-			throw new Error("缺少必要参数类型");
+		} else if ("OW-HY".equals(tradingBox.getType())) {
+			billNoFormat = "OW-HY";
+			businessTypeCode = "OW-HY";
+		}else {
+			throw new RuntimeException("缺少必要参数类型");
 		}
 		BusinessType businessType = bBusinessTypeService.getOne(new LambdaQueryWrapper<BusinessType>()
 			.select(BusinessType::getId)

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

@@ -139,6 +139,9 @@
         <if test="data.podName != null and data.podName != ''">
             and se.pod_cn_name like concat('%', #{data.podName}, '%')
         </if>
+        <if test="data.whetherFee != null and data.whetherFee != ''">
+            and sc.whether_fee = #{data.whetherFee}
+        </if>
         <if test="data.businessType != null and data.businessType != '' and data.businessType == 'SE'">
             <if test='data.actualEtdList != null and data.actualEtdList[0] != null and data.actualEtdList[0]!= ""'>
                 and se.etd &gt;= #{data.actualEtdList[0]}
@@ -222,8 +225,11 @@
         <if test="data.podName != null and data.podName != ''">
             and se.pod_cn_name like concat('%', #{data.podName}, '%')
         </if>
-        <if test="data.billType != null and data.billType != ''">
-            and se.bill_type = #{data.billType}
+        <if test="data.businessType != null and data.businessType != ''">
+            and se.business_type = #{data.businessType}
+        </if>
+        <if test="data.whetherFee != null and data.whetherFee != ''">
+            and sc.whether_fee = #{data.whetherFee}
         </if>
         <if test="data.businessType != null and data.businessType != '' and data.businessType == 'SE'">
             <if test='data.actualEtdList != null and data.actualEtdList[0] != null and data.actualEtdList[0]!= ""'>

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

@@ -1124,6 +1124,10 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 				}
 			}
 		}
+		if ("MM".equals(bills.getBillType()) && ObjectUtils.isNotNull(bills.getId())) {
+			bills.setMasterBillNo(bills.getBillNo());
+			this.synchronous(bills);
+		}
 		if (!bills.getPreContainersList().isEmpty()) {
 			preContainersService.saveOrUpdateBatch(bills.getPreContainersList());
 		}
@@ -2150,6 +2154,8 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		copyBills.setBookingNo("");
 		copyBills.setMasterBillNo(null);
 		copyBills.setMasterId(null);
+		copyBills.setTemporaryNo("");
+		copyBills.setTemporaryId(null);
 		copyBills.setSplitOrderSum(0);
 		copyBills.setTeuTotal(0);
 		copyBills.setStatus(0);
@@ -2447,7 +2453,93 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			BigDecimal amountDrLoc = new BigDecimal("0.00");
 			BigDecimal amountCrLoc = new BigDecimal("0.00");
 			BigDecimal amountProfitLoc;
-
+			//主单应加上分单费用
+			if ("MM".equals(bills.getBillType())) {
+				List<Bills> details = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
+					.eq(Bills::getTenantId, AuthUtil.getTenantId())
+					.eq(Bills::getIsDeleted, 0)
+					.eq(Bills::getMasterId, bills.getId()));
+				if (!details.isEmpty()) {
+					List<Long> billIds = details.stream().map(Bills::getId).distinct().collect(Collectors.toList());
+					List<FeeCenter> feeCenterListMH = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+						.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+						.eq(FeeCenter::getIsDeleted, 0)
+						.in(FeeCenter::getPid, billIds));
+					for (Bills item : details) {
+						BigDecimal amountDrMH = new BigDecimal("0.00");
+						BigDecimal amountCrMH = new BigDecimal("0.00");
+						BigDecimal amountProfitMH;
+						BigDecimal amountDrUsdMH = new BigDecimal("0.00");
+						BigDecimal amountCrUsdMH = new BigDecimal("0.00");
+						BigDecimal amountProfitUsdMH;
+						BigDecimal amountDrLocMH = new BigDecimal("0.00");
+						BigDecimal amountCrLocMH = new BigDecimal("0.00");
+						BigDecimal amountProfitLocMH;
+						item.setUpdateUserName(AuthUtil.getUserName());
+						item.setUpdateTime(new Date());
+						item.setUpdateUser(AuthUtil.getUserId());
+						if ("SE".equals(item.getBusinessType())) {
+							item.setEtd(date1);
+						} else if ("SI".equals(item.getBusinessType())) {
+							item.setEta(date1);
+						}
+						item.setBillDate(date1);
+						if (!feeCenterListMH.isEmpty()) {
+							for (FeeCenter itemMH : feeCenterListMH) {
+								itemMH.setEtd(bills.getEtd());
+								itemMH.setEta(bills.getEta());
+								if ("D".equals(itemMH.getDc())) {
+									if (exrateType.equals(itemMH.getCurCode())) {
+										amountDr = amountDr.add(itemMH.getAmount());
+										amountDrMH = amountDrMH.add(itemMH.getAmount());
+										amountDrLoc = amountDrLoc.add(itemMH.getAmount());
+										amountDrLocMH = amountDrLocMH.add(itemMH.getAmount());
+									} else {
+										amountDrUsd = amountDrUsd.add(itemMH.getAmount());
+										amountDrUsdMH = amountDrUsdMH.add(itemMH.getAmount());
+										amountDrLoc = amountDrLoc.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
+										amountDrLocMH = amountDrLocMH.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
+									}
+								} else {
+									if (exrateType.equals(itemMH.getCurCode())) {
+										amountCr = amountCr.add(itemMH.getAmount());
+										amountCrMH = amountCrMH.add(itemMH.getAmount());
+										amountCrLoc = amountCrLoc.add(itemMH.getAmount());
+										amountCrLocMH = amountCrLocMH.add(itemMH.getAmount());
+									} else {
+										amountCrUsd = amountCrUsd.add(itemMH.getAmount());
+										amountCrUsdMH = amountCrUsdMH.add(itemMH.getAmount());
+										amountCrLoc = amountCrLoc.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
+										amountCrLocMH = amountCrLocMH.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
+									}
+								}
+								if (!exrateType.equals(itemMH.getCurCode())) {
+									itemMH.setExrate(currencyUtils.obtainExrate(itemMH.getDc(), curExrateList, itemMH.getCurCode(), "1"));
+									itemMH.setAmountNetLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmountNet(), itemMH.getCurCode(), "1"));
+									itemMH.setAmountTaxLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmountTax(), itemMH.getCurCode(), "1"));
+									itemMH.setAmountLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
+									itemMH.setAmountDiscountLoc(itemMH.getAmountLoc());
+								}
+								feeCenterListSum.add(itemMH);
+							}
+						}
+						//利润 = 收 - 付
+						amountProfitMH = amountDrMH.subtract(amountCrMH);
+						amountProfitUsdMH = amountDrUsdMH.subtract(amountCrUsdMH);
+						amountProfitLocMH = amountDrLocMH.subtract(amountCrLocMH);
+						item.setAmountDr(amountDrMH);
+						item.setAmountCr(amountCrMH);
+						item.setAmountProfit(amountProfitMH);
+						item.setAmountDrUsd(amountDrUsdMH);
+						item.setAmountCrUsd(amountCrUsdMH);
+						item.setAmountProfitUsd(amountProfitUsdMH);
+						item.setAmountDrLoc(amountDrLocMH);
+						item.setAmountCrLoc(amountCrLocMH);
+						item.setAmountProfitLoc(amountProfitLocMH);
+					}
+					this.updateBatchById(details);
+				}
+			}
 			List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
 				.eq(FeeCenter::getIsDeleted, 0)
@@ -2482,150 +2574,6 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 					}
 					feeCenterListSum.add(item);
 				}
-				//主单应加上分单费用
-				if ("MM".equals(bills.getBillType())) {
-					List<Bills> details = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
-						.select(Bills::getAmountDr, Bills::getAmountCr, Bills::getAmountDrUsd, Bills::getAmountCrUsd, Bills::getAmountDrLoc, Bills::getAmountCrLoc
-							, Bills::getQuantity, Bills::getGrossWeight, Bills::getMeasurement)
-						.eq(Bills::getTenantId, AuthUtil.getTenantId())
-						.eq(Bills::getIsDeleted, 0)
-						.eq(Bills::getMasterId, bills.getId()));
-					if (!details.isEmpty()) {
-						List<Long> billIds = details.stream().map(Bills::getId).distinct().collect(Collectors.toList());
-						List<FeeCenter> feeCenterListMH = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
-							.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-							.eq(FeeCenter::getIsDeleted, 0)
-							.in(FeeCenter::getPid, billIds));
-						for (Bills item : details) {
-							BigDecimal amountDrMH = new BigDecimal("0.00");
-							BigDecimal amountCrMH = new BigDecimal("0.00");
-							BigDecimal amountProfitMH;
-							BigDecimal amountDrUsdMH = new BigDecimal("0.00");
-							BigDecimal amountCrUsdMH = new BigDecimal("0.00");
-							BigDecimal amountProfitUsdMH;
-							BigDecimal amountDrLocMH = new BigDecimal("0.00");
-							BigDecimal amountCrLocMH = new BigDecimal("0.00");
-							BigDecimal amountProfitLocMH;
-							item.setUpdateUserName(AuthUtil.getUserName());
-							item.setUpdateTime(new Date());
-							item.setUpdateUser(AuthUtil.getUserId());
-							if ("SE".equals(item.getBusinessType())) {
-								item.setEtd(date1);
-							} else if ("SI".equals(item.getBusinessType())) {
-								item.setEta(date1);
-							}
-							item.setBillDate(date1);
-							if (!feeCenterListMH.isEmpty()) {
-								for (FeeCenter itemMH : feeCenterListMH) {
-									itemMH.setEtd(bills.getEtd());
-									itemMH.setEta(bills.getEta());
-									if ("D".equals(itemMH.getDc())) {
-										if (exrateType.equals(itemMH.getCurCode())) {
-											amountDr = amountDr.add(itemMH.getAmount());
-											amountDrMH = amountDrMH.add(itemMH.getAmount());
-											amountDrLoc = amountDrLoc.add(itemMH.getAmount());
-											amountDrLocMH = amountDrLocMH.add(itemMH.getAmount());
-										} else {
-											amountDrUsd = amountDrUsd.add(itemMH.getAmount());
-											amountDrUsdMH = amountDrUsdMH.add(itemMH.getAmount());
-											amountDrLoc = amountDrLoc.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
-											amountDrLocMH = amountDrLocMH.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
-										}
-									} else {
-										if (exrateType.equals(itemMH.getCurCode())) {
-											amountCr = amountCr.add(itemMH.getAmount());
-											amountCrMH = amountCrMH.add(itemMH.getAmount());
-											amountCrLoc = amountCrLoc.add(itemMH.getAmount());
-											amountCrLocMH = amountCrLocMH.add(itemMH.getAmount());
-										} else {
-											amountCrUsd = amountCrUsd.add(itemMH.getAmount());
-											amountCrUsdMH = amountCrUsdMH.add(itemMH.getAmount());
-											amountCrLoc = amountCrLoc.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
-											amountCrLocMH = amountCrLocMH.add(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
-										}
-									}
-									if (!exrateType.equals(itemMH.getCurCode())) {
-										itemMH.setExrate(currencyUtils.obtainExrate(itemMH.getDc(), curExrateList, itemMH.getCurCode(), "1"));
-										itemMH.setAmountNetLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmountNet(), itemMH.getCurCode(), "1"));
-										itemMH.setAmountTaxLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmountTax(), itemMH.getCurCode(), "1"));
-										itemMH.setAmountLoc(currencyUtils.converter(itemMH.getDc(), curExrateList, itemMH.getAmount(), itemMH.getCurCode(), "1"));
-										itemMH.setAmountDiscountLoc(itemMH.getAmountLoc());
-									}
-									feeCenterListSum.add(itemMH);
-								}
-							}
-							//利润 = 收 - 付
-							amountProfitMH = amountDrMH.subtract(amountCrMH);
-							amountProfitUsdMH = amountDrUsdMH.subtract(amountCrUsdMH);
-							amountProfitLocMH = amountDrLocMH.subtract(amountCrLocMH);
-							item.setAmountDr(amountDrMH);
-							item.setAmountCr(amountCrMH);
-							item.setAmountProfit(amountProfitMH);
-							item.setAmountDrUsd(amountDrUsdMH);
-							item.setAmountCrUsd(amountCrUsdMH);
-							item.setAmountProfitUsd(amountProfitUsdMH);
-							item.setAmountDrLoc(amountDrLocMH);
-							item.setAmountCrLoc(amountCrLocMH);
-							item.setAmountProfitLoc(amountProfitLocMH);
-						}
-						this.updateBatchById(details);
-					}
-				} else if ("MH".equals(bills.getBillType()) && ObjectUtils.isNotNull(bills.getId())) {
-					Bills details = baseMapper.selectOne(new LambdaQueryWrapper<Bills>()
-						.select(Bills::getAmountDr, Bills::getAmountCr, Bills::getAmountProfit, Bills::getAmountDrUsd, Bills::getAmountCrUsd
-							, Bills::getAmountProfitUsd, Bills::getAmountDrLoc, Bills::getAmountCrLoc, Bills::getAmountProfitLoc
-							, Bills::getQuantity, Bills::getGrossWeight, Bills::getMeasurement)
-						.eq(Bills::getMasterId, bills.getMasterId()));
-					//重新计算主单合计
-					if (details != null) {
-						BigDecimal amountDrM = new BigDecimal("0.00");
-						BigDecimal amountCrM = new BigDecimal("0.00");
-						BigDecimal amountProfitM;
-						BigDecimal amountDrUsdM = new BigDecimal("0.00");
-						BigDecimal amountCrUsdM = new BigDecimal("0.00");
-						BigDecimal amountProfitUsdM;
-						BigDecimal amountDrLocM = new BigDecimal("0.00");
-						BigDecimal amountCrLocM = new BigDecimal("0.00");
-						BigDecimal amountProfitLocM;
-						amountDrM = amountDrM.add(details.getAmountDr());
-						amountCrM = amountCrM.add(details.getAmountCr());
-						amountDrUsdM = amountDrUsdM.add(details.getAmountDrUsd());
-						amountCrUsdM = amountCrUsdM.add(details.getAmountCrUsd());
-						List<Bills> billsList = this.list(new LambdaQueryWrapper<Bills>()
-							.select(Bills::getAmountDr, Bills::getAmountCr, Bills::getAmountDrUsd, Bills::getAmountCrUsd, Bills::getAmountDrLoc
-								, Bills::getAmountCrLoc, Bills::getQuantity, Bills::getQuantity, Bills::getGrossWeight, Bills::getMeasurement)
-							.eq(Bills::getTenantId, AuthUtil.getTenantId())
-							.eq(Bills::getIsDeleted, 0)
-							.eq(Bills::getMasterId, details.getId()));
-						List<Bills> billsLists = billsList.stream().filter(e -> !e.getId().equals(bills.getId())).collect(Collectors.toList());
-						if (!billsLists.isEmpty()) {
-							amountDrM = amountDrM.add(billsLists.stream().map(Bills::getAmountDr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-							amountDrLocM = amountDrLocM.add(billsLists.stream().map(Bills::getAmountDrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-							amountCrM = amountCrM.add(billsLists.stream().map(Bills::getAmountCr).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-							amountCrLocM = amountCrLocM.add(billsLists.stream().map(Bills::getAmountCrLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-							amountDrUsdM = amountDrUsdM.add(billsLists.stream().map(Bills::getAmountDrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-							amountCrUsdM = amountCrUsdM.add(billsLists.stream().map(Bills::getAmountCrUsd).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
-						}
-						amountDrM = amountDrM.add(amountDr);
-						amountCrM = amountCrM.add(amountCr);
-						amountDrUsdM = amountDrUsdM.add(amountDrUsd);
-						amountCrUsdM = amountCrUsdM.add(amountCrUsd);
-						//利润 = 收 - 付
-						amountProfitM = amountDrM.subtract(amountCrM);
-						amountProfitUsdM = amountDrUsdM.subtract(amountCrUsdM);
-						amountProfitLocM = amountDrLocM.subtract(amountCrLocM);
-						details.setAmountDr(amountDrM);
-						details.setAmountCr(amountCrM);
-						details.setAmountProfit(amountProfitM);
-						details.setAmountDrUsd(amountDrUsdM);
-						details.setAmountCrUsd(amountCrUsdM);
-						details.setAmountProfitUsd(amountProfitUsdM);
-						details.setAmountDrLoc(amountDrLocM);
-						details.setAmountCrLoc(amountCrLocM);
-						details.setAmountProfitLoc(amountProfitLocM);
-						baseMapper.updateById(details);
-					}
-				}
 				//利润 = 收 - 付
 				amountProfit = amountDr.subtract(amountCr);
 				amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
@@ -4167,7 +4115,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		copyBills.setId(null);
 		BusinessBillNo businessBillNo = new BusinessBillNo();
 		businessBillNo.setBusinessTypeId(businessType.getId());
-		businessBillNo.setCode("HYCK-PH");
+		businessBillNo.setCode("HYCK");
 		businessBillNo.setBranchId(detail.getBranchId());
 		R clientBillNo = businessBillNoService.getBillNoLos(businessBillNo);
 		if (!clientBillNo.isSuccess()) {
@@ -4175,9 +4123,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			throw new RuntimeException("生成订单编号失败");
 		}
 		copyBills.setBusinessType("SE");
-		copyBills.setBusinessTypes("HYCK");
+		copyBills.setBusinessTypes("海运");
 		copyBills.setSeaType("E");
 		copyBills.setBillType(billType);
+		copyBills.setPodFreeBoxUseDays(14);
+		copyBills.setPolFreeBoxUseDays(7);
 		copyBills.setBillNo((String) clientBillNo.getData());
 		copyBills.setCarrierId(detail.getActualShippingCompanyId());
 		copyBills.setCarrierCnName(detail.getActualShippingCompanyCname());

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

@@ -673,6 +673,9 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
 			excel.setBranchId(AuthUtil.getDeptId());
 		}
+		if ("SE".equals(excel.getBusinessType())){
+			excel.setWhetherFee("1");
+		}
 		return page.setRecords(baseMapper.updatePodStationPage(page, excel));
 	}
 
@@ -682,6 +685,9 @@ public class ContainersServiceImpl extends ServiceImpl<ContainersMapper, Contain
 		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
 			excel.setBranchId(AuthUtil.getDeptId());
 		}
+		if ("SE".equals(excel.getBusinessType())){
+			excel.setWhetherFee("1");
+		}
 		return baseMapper.updatePodStationList(excel);
 	}
 

+ 7 - 0
blade-service/blade-los/src/main/java/org/springblade/los/excel/UpdatePodStationExcel.java

@@ -2,6 +2,7 @@ package org.springblade.los.excel;
 
 import com.alibaba.excel.annotation.ExcelIgnore;
 import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
@@ -133,4 +134,10 @@ public class UpdatePodStationExcel {
 	@ExcelIgnore
 	private String branchId;
 
+	/**
+	 * 是否生成超期箱使费
+	 */
+	@ExcelIgnore
+	private String whetherFee;
+
 }

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

@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.springblade.core.tool.api.R;
 import org.springblade.los.ftp.dto.FtpDto;
+import org.springblade.los.ftp.service.CyFtpService;
 import org.springblade.los.ftp.service.FtpService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -23,6 +24,9 @@ public class TestController {
 	@Autowired
 	private final FtpService ftpService;
 
+	@Autowired
+	private final CyFtpService cyFtpService;
+
 	/**
 	 * 测试ftp文件上传
 	 *
@@ -46,4 +50,13 @@ public class TestController {
 	public R detectionChannel(FtpDto ftpDto) {
 		return ftpService.detectionChannel(ftpDto);
 	}
+
+	/**
+	 * POL空箱提箱进场-FTP
+	 */
+	@SneakyThrows
+	@GetMapping("/emptyContainerEntryFtp")
+	public R emptyContainerEntryFtp(@RequestParam("corpId") Long corpId) {
+		return cyFtpService.ftpFilesHandle(corpId);
+	}
 }

+ 31 - 0
blade-service/blade-los/src/main/java/org/springblade/los/ftp/dto/ContainerMovement.java

@@ -0,0 +1,31 @@
+package org.springblade.los.ftp.dto;
+
+import lombok.Data;
+
+/**
+ * @author :jixinyuan
+ * @date : 2025/7/10
+ */
+@Data
+public class ContainerMovement {
+
+	private String messageReference;
+	private String messageType;
+	private String movementNumber;
+	private String vesselName;
+	private String voyageNumber;
+	private String yardCode;
+	private String containerNumber;
+	private String containerType;
+	private String containerSize;
+	private String billOfLading;
+	private String bookingNumber;
+	private String movementDateTime;
+	private String fromLocation;
+	private String toLocation;
+	private String cargoWeight;
+	private String sealNumber;
+	private String truckNumber;
+
+
+}

+ 15 - 0
blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/CyFtpService.java

@@ -0,0 +1,15 @@
+package org.springblade.los.ftp.service;
+
+import org.springblade.core.tool.api.R;
+import org.springblade.los.ftp.dto.FtpDto;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/5
+ */
+public interface CyFtpService {
+
+
+	R ftpFilesHandle(Long corpId);
+}

+ 173 - 0
blade-service/blade-los/src/main/java/org/springblade/los/ftp/service/impl/CyFtpServiceImpl.java

@@ -0,0 +1,173 @@
+package org.springblade.los.ftp.service.impl;
+
+import com.alibaba.cloud.commons.io.IOUtils;
+import lombok.AllArgsConstructor;
+import org.apache.commons.net.ftp.FTP;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+import org.springblade.core.tool.api.R;
+import org.springblade.los.basic.corps.entity.BCorps;
+import org.springblade.los.basic.corps.service.IBCorpsService;
+import org.springblade.los.ftp.dto.ContainerMovement;
+import org.springblade.los.ftp.service.CyFtpService;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author :jixinyuan
+ * @date : 2024/3/5
+ */
+@Service
+@AllArgsConstructor
+public class CyFtpServiceImpl implements CyFtpService {
+
+	private final IBCorpsService bCorpsService;
+
+	@Override
+	public R ftpFilesHandle(Long corpId) {
+		BCorps bCorps = bCorpsService.getById(corpId);
+		String server = bCorps.getEdiFtp();
+		int port = 21;
+		String user = bCorps.getUsernameFtp();
+		String pass = bCorps.getPasswordFtp();
+		String remoteDir = "/WFL";
+		FTPClient ftpClient = new FTPClient();
+		try {
+			// 连接FTP服务器
+			ftpClient.connect(server, port);
+			ftpClient.login(user, pass);
+			ftpClient.enterLocalPassiveMode();
+			ftpClient.setFileType(FTP.BINARY_FILE_TYPE);
+
+			// 获取文件列表
+			FTPFile[] files = ftpClient.listFiles(remoteDir);
+
+			for (FTPFile file : files) {
+				if (file.isFile() && file.getName().endsWith(".txt")) {
+					System.out.println("\nProcessing file: " + file.getName());
+					// 下载文件
+					InputStream inputStream = ftpClient.retrieveFileStream(remoteDir + "/" + file.getName());
+
+					// 解析EDIFACT内容
+					List<ContainerMovement> movements = parseEdifactMessage(inputStream);
+
+					// 输出解析结果
+					for (ContainerMovement movement : movements) {
+						System.out.println(movement);
+						System.out.println("----------------------------------------");
+					}
+
+					inputStream.close();
+					ftpClient.completePendingCommand();
+				}
+			}
+		} catch (IOException ex) {
+			ex.printStackTrace();
+		} finally {
+			try {
+				if (ftpClient.isConnected()) {
+					ftpClient.logout();
+					ftpClient.disconnect();
+				}
+			} catch (IOException ex) {
+				ex.printStackTrace();
+			}
+		}
+		return null;
+	}
+
+	public static List<ContainerMovement> parseEdifactMessage(InputStream inputStream) throws IOException {
+		List<ContainerMovement> movements = new ArrayList<>();
+		String content = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
+
+		// 分割每个消息(以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] + " " + elements[4]);
+						}
+						break;
+					case "SEL":
+						if (elements.length > 1) {
+							movement.setSealNumber(elements[1]);
+						}
+						break;
+				}
+			}
+			movements.add(movement);
+		}
+
+		return movements;
+	}
+
+}

+ 4 - 4
blade-service/blade-los/src/main/resources/application-dev.yml

@@ -13,11 +13,11 @@ spring:
 #swagger文档
 ftp:
   client:
-    workingDirectory: /
-    host: sftp.north.inttra.cn
+    workingDirectory: /WFL
+    host: ftp://221.215.48.2
     port: 22
-    username: j1229351
-    password: Yg5YwPCe
+    username: WFL
+    password: WFL001
     privateKey:
     encoding: utf-8
     passiveMode: true