Browse Source

1.模板导入-批量与明细单笔导入接口逻辑统一
2.收费模板和 付费付费模版 导入时 业务录入的箱型 和 模版的相同才导入
3.退舱时,分单释放放箱号的数量
4.海运出口增加字段集港码头
5.费用模板增加所属公司,多选,按照登陆人所属公司带出相应费用模板

纪新园 7 months ago
parent
commit
4614ea21ed

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

@@ -47,6 +47,16 @@ public class FeesTemplateItems implements Serializable {
 	@ApiModelProperty(value = "主键")
 	private Long id;
 	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 分公司
+	 */
+	@ApiModelProperty(value = "分公司")
+	private String branchName;
+	/**
 	 * 创建人 Id
 	 */
 	@ApiModelProperty(value = "创建人 Id")

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

@@ -41,6 +41,16 @@ public class FeesTemplateSonItems implements Serializable {
 
 	private Long id;
 	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 分公司
+	 */
+	@ApiModelProperty(value = "分公司")
+	private String branchName;
+	/**
 	 * 创建人 Id
 	 */
 	@ApiModelProperty(value = "创建人 Id")

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

@@ -46,6 +46,16 @@ public class LosBFeesTemplate implements Serializable {
 	@ApiModelProperty(value = "主键")
 	private Long id;
 	/**
+	 * 分公司 Id
+	 */
+	@ApiModelProperty(value = "分公司 Id")
+	private String branchId;
+	/**
+	 * 分公司
+	 */
+	@ApiModelProperty(value = "分公司")
+	private String branchName;
+	/**
 	 * 创建人 Id
 	 */
 	@ApiModelProperty(value = "创建人 Id")

+ 1 - 1
blade-service-api/blade-los-api/src/main/java/org/springblade/los/box/entity/RouteCost.java

@@ -172,7 +172,7 @@ public class RouteCost implements Serializable {
 	 */
 	@ApiModelProperty(value = "航线")
 	@TableField(updateStrategy = FieldStrategy.IGNORED)
-	private Long airlineId;
+	private String airlineId;
 	/**
 	 * 航线中文
 	 */

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

@@ -1515,6 +1515,47 @@ public class Bills implements Serializable {
 	private String customerServiceName;
 
 	/**
+	 * 集港码头 id
+	 */
+	@ApiModelProperty(value = "集港码头 id")
+	private Long portTerminalCyId;
+	/**
+	 * 集港码头代码
+	 */
+	@ApiModelProperty(value = "集港码头代码")
+	private String portTerminalCyCode;
+	/**
+	 * 集港码头中文名称
+	 */
+	@ApiModelProperty(value = "集港码头中文名称")
+	private String portTerminalCyCnName;
+	/**
+	 * 集港码头英文名称
+	 */
+	@ApiModelProperty(value = "集港码头英文名称")
+	private String portTerminalCyEnName;
+	/**
+	 * 集港码头联系人电话
+	 */
+	@ApiModelProperty(value = "集港码头联系人电话")
+	private String portTerminalCyTel;
+	/**
+	 * 集港码头地址
+	 */
+	@ApiModelProperty(value = "集港码头地址")
+	private String portTerminalCyAddress;
+	/**
+	 * 集港码头联系人
+	 */
+	@ApiModelProperty(value = "集港码头联系人")
+	private String portTerminalCyContacts;
+	/**
+	 * 集港码头备注
+	 */
+	@ApiModelProperty(value = "集港码头备注")
+	private String portTerminalCyRemarks;
+
+	/**
 	 * 到港日期
 	 */
 	@TableField(exist = false)

+ 11 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/fees/controller/LosBFeesTemplateController.java

@@ -34,6 +34,7 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.los.basic.corps.entity.BCorps;
 import org.springblade.los.basic.fees.entity.LosBFeesTemplate;
 import org.springblade.los.basic.fees.service.ILosBFeesTemplateService;
 import org.springblade.los.basic.fees.vo.LosBFeesTemplateVO;
@@ -95,6 +96,11 @@ public class LosBFeesTemplateController extends BladeController {
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getShippingCompanyCname()), LosBFeesTemplate::getShippingCompanyCname, losBFeesTemplate.getShippingCompanyCname())
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getTransportationTerms()), LosBFeesTemplate::getTransportationTerms, losBFeesTemplate.getTransportationTerms())
 			.orderByDesc(LosBFeesTemplate::getCreateTime);
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.apply("(find_in_set('" + AuthUtil.getDeptId() + "',branch_id) or branch_id is null)");
+		} else {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(losBFeesTemplate.getBranchId()), LosBFeesTemplate::getBranchId, losBFeesTemplate.getBranchId());
+		}
 		IPage<LosBFeesTemplate> pages = losBFeesTemplateService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}
@@ -221,6 +227,11 @@ public class LosBFeesTemplateController extends BladeController {
 			.like(ObjectUtils.isNotNull(losBFeesTemplate.getShippingCompanyCname()), LosBFeesTemplate::getShippingCompanyCname, losBFeesTemplate.getShippingCompanyCname())
 			.eq(ObjectUtils.isNotNull(losBFeesTemplate.getTransportationTerms()), LosBFeesTemplate::getTransportationTerms, losBFeesTemplate.getTransportationTerms())
 			.orderByDesc(LosBFeesTemplate::getCreateTime);
+		if (!AuthUtil.getUserRole().contains("总部") && !AuthUtil.getUserRole().contains("admin")) {
+			lambdaQueryWrapper.apply("(find_in_set('" + AuthUtil.getDeptId() + "',branch_id) or branch_id is null)");
+		} else {
+			lambdaQueryWrapper.eq(ObjectUtils.isNotNull(losBFeesTemplate.getBranchId()), LosBFeesTemplate::getBranchId, losBFeesTemplate.getBranchId());
+		}
 		IPage<LosBFeesTemplate> pages = losBFeesTemplateService.page(Condition.getPage(query), lambdaQueryWrapper);
 		return R.data(pages);
 	}

+ 10 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/fees/service/impl/LosBFeesTemplateServiceImpl.java

@@ -132,10 +132,12 @@ public class LosBFeesTemplateServiceImpl extends ServiceImpl<LosBFeesTemplateMap
 		List<LosBFeesTemplate> list = baseMapper.selectList(new LambdaQueryWrapper<LosBFeesTemplate>()
 			.eq(LosBFeesTemplate::getTenantId, AuthUtil.getTenantId())
 			.eq(LosBFeesTemplate::getIsDeleted, 0)
+			.like(LosBFeesTemplate::getBranchId, deptId)
 			.eq(LosBFeesTemplate::getCode, losBFeesTemplate.getCode()));
 		List<LosBFeesTemplate> nameList = baseMapper.selectList(new LambdaQueryWrapper<LosBFeesTemplate>()
 			.eq(LosBFeesTemplate::getTenantId, AuthUtil.getTenantId())
 			.eq(LosBFeesTemplate::getIsDeleted, 0)
+			.like(LosBFeesTemplate::getBranchId, deptId)
 			.eq(LosBFeesTemplate::getCnName, losBFeesTemplate.getCnName()));
 		if (losBFeesTemplate.getId() == null) {
 			if (!list.isEmpty()) {
@@ -149,6 +151,8 @@ public class LosBFeesTemplateServiceImpl extends ServiceImpl<LosBFeesTemplateMap
 			losBFeesTemplate.setCreateUserName(AuthUtil.getUserName());
 			losBFeesTemplate.setCreateDept(deptId);
 			losBFeesTemplate.setCreateDeptName(deptName);
+			losBFeesTemplate.setBranchId(deptId);
+			losBFeesTemplate.setBranchName(deptName);
 		} else {
 			List<Long> ids = list.stream().map(LosBFeesTemplate::getId).filter(e -> !e.equals(losBFeesTemplate.getId())).collect(Collectors.toList());
 			if (!ids.isEmpty()) {
@@ -176,6 +180,8 @@ public class LosBFeesTemplateServiceImpl extends ServiceImpl<LosBFeesTemplateMap
 				} else {
 					item.setCorpType("");
 				}
+				item.setBranchId(deptId);
+				item.setBranchName(deptName);
 				if (item.getId() == null) {
 					item.setCreateTime(new Date());
 					item.setCreateUser(AuthUtil.getUserId());
@@ -210,6 +216,8 @@ public class LosBFeesTemplateServiceImpl extends ServiceImpl<LosBFeesTemplateMap
 //						sonItems.setCurCode(item.getCurCode());
 						sonItems.setQuantityRule(item.getQuantityRule());
 						sonItems.setType(item.getCorpType());
+						item.setBranchId(deptId);
+						item.setBranchName(deptName);
 						if (sonItems.getId() == null) {
 							sonItems.setCreateTime(new Date());
 							sonItems.setCreateUser(AuthUtil.getUserId());
@@ -243,6 +251,8 @@ public class LosBFeesTemplateServiceImpl extends ServiceImpl<LosBFeesTemplateMap
 					sonItems.setUnitNo(item.getUnitNo());
 					sonItems.setUnitId(item.getUnitId());
 					sonItems.setQuantityRule(item.getQuantityRule());
+					item.setBranchId(deptId);
+					item.setBranchName(deptName);
 					sonItemsList.add(sonItems);
 				}
 			}

+ 26 - 0
blade-service/blade-los/src/main/java/org/springblade/los/basic/lines/controller/BLinesController.java

@@ -233,5 +233,31 @@ public class BLinesController extends BladeController {
 		return bLinesService.importBLines(excelList);
 	}
 
+	/**
+	 * 分页 基础资料-航线
+	 */
+	@GetMapping("/listAll")
+	public R<List<BLines>> listAll(BLines bLines) {
+		LambdaQueryWrapper<BLines> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(BLines::getTenantId, AuthUtil.getTenantId())
+			.eq(BLines::getIsDeleted, 0)
+			.and(ObjectUtils.isNotNull(bLines.getCnName()), i -> i.like(BLines::getCnName, bLines.getCnName()).or()
+				.like(BLines::getEnName, bLines.getEnName()).or().like(BLines::getCode, bLines.getCode()))
+			.like(ObjectUtils.isNotNull(bLines.getCode()), BLines::getCode, bLines.getCode())
+			.eq(ObjectUtils.isNotNull(bLines.getCarrierId()), BLines::getCarrierId, bLines.getCarrierId())
+			.like(ObjectUtils.isNotNull(bLines.getCnName()), BLines::getCnName, bLines.getCnName())
+			.like(ObjectUtils.isNotNull(bLines.getEnName()), BLines::getEnName, bLines.getEnName())
+			.like(ObjectUtils.isNotNull(bLines.getStatus()), BLines::getStatus, bLines.getStatus());
+		String status = sysClient.getParamService("basic.data.sort");
+		if ("name".equals(status)) {
+			lambdaQueryWrapper.orderByAsc(BLines::getCnName);
+		} else if ("letter".equals(status)) {
+			lambdaQueryWrapper.orderByAsc(BLines::getCode);
+		} else {
+			lambdaQueryWrapper.orderByDesc(BLines::getCreateTime);
+		}
+		return R.data(bLinesService.list(lambdaQueryWrapper));
+	}
+
 
 }

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

@@ -1517,7 +1517,11 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		List<Bills> billsList = baseMapper.selectList(new LambdaQueryWrapper<Bills>()
 			.eq(Bills::getTenantId, AuthUtil.getTenantId())
 			.eq(Bills::getIsDeleted, 0)
-			.in(Bills::getId, ids));
+			.in(Bills::getId, Func.toLongList(ids)));
+		List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
+			.eq(PreContainers::getIsDeleted, 0)
+			.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
+			.in(PreContainers::getPid, Func.toLongList(ids)));
 		for (Bills item : billsList) {
 			if ("MH".equals(item.getBillType()) && ObjectUtils.isNotNull(item.getMasterBillNo())) {
 				throw new RuntimeException("单号:" + item.getBillNo() + "已添加主单,请先撤销在退舱");
@@ -1531,6 +1535,16 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			if (item.getBillStatus() == 3) {
 				throw new RuntimeException("单据已完成,退舱失败");
 			}
+			if ("MH".equals(item.getBillType())) {
+				List<PreContainers> preContainers = new ArrayList<>();
+				if (!preContainersList.isEmpty()) {
+					preContainers = preContainersList.stream().filter(e -> e.getPid().equals(item.getId()))
+						.collect(Collectors.toList());
+				}
+				if (!preContainers.isEmpty()) {
+					this.revokeSelectedContainerNumber(item, preContainers);
+				}
+			}
 			item.setBillStatus(1);
 			item.setBookingWithdrawTime(new Date());
 		}
@@ -1538,6 +1552,12 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 		return R.data("操作成功");
 	}
 
+	private void revokeSelectedContainerNumber(Bills bills, List<PreContainers> preContainers) {
+		for (PreContainers item : preContainers) {
+			seaContainerNumberItemService.revokeSelectedContainerNumber(item.getCntrTypeCode(), bills.getId() + "");
+		}
+	}
+
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public Bills checkBills(Bills bills) {

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

@@ -220,8 +220,180 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					.eq(BCorps::getIsDeleted, 0)
 					.in(BCorps::getId, idList));
 			}
+			List<FeesTemplateSonItems> sonItemsList = feesTemplateSonItemsService.list(new LambdaQueryWrapper<FeesTemplateSonItems>()
+				.eq(FeesTemplateSonItems::getTenantId, AuthUtil.getTenantId())
+				.eq(FeesTemplateSonItems::getIsDeleted, 0)
+				.in(FeesTemplateSonItems::getPpid, losBFeesTemplate.getFeesTemplateItemsList().stream().map(FeesTemplateItems::getId).collect(Collectors.toList()))
+				.eq(ObjectUtils.isNotNull(losBFeesTemplate.getDc()), FeesTemplateSonItems::getDc, losBFeesTemplate.getDc()));
+			if (sonItemsList.isEmpty()) {
+				throw new RuntimeException("未查到模板明细");
+			}
 			int count = 1;
-			for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
+			for (FeesTemplateSonItems items : sonItemsList) {
+				FeesTemplateItems templateItems = losBFeesTemplate.getFeesTemplateItemsList().stream().filter(e -> e.getId().equals(items.getPpid()))
+					.findFirst().orElse(null);
+				if (templateItems == null) {
+					throw new RuntimeException("模版数据错误,请联系管理员");
+				}
+				FeeCenter feeCenter = new FeeCenter();
+				feeCenter.setPid(bills.getId());
+				feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
+				feeCenter.setBillNo(bills.getBillNo());
+				feeCenter.setBusinessType(bills.getBusinessType());
+				feeCenter.setBillType(bills.getBillType());
+				feeCenter.setBillDate(bills.getBillDate());
+				feeCenter.setBillCorpId(bills.getCorpId());
+				feeCenter.setBillCorpCnName(bills.getCorpCnName());
+				feeCenter.setBillCorpEnName(bills.getCorpEnName());
+				feeCenter.setBillShortName(bills.getCorpCnName());
+				feeCenter.setLineId(bills.getLineId());
+				feeCenter.setLineCnName(bills.getLineCnName());
+				feeCenter.setLineEnName(bills.getLineEnName());
+				feeCenter.setVesselId(bills.getVesselId());
+				feeCenter.setVesselCnName(bills.getVesselCnName());
+				feeCenter.setVesselEnName(bills.getVesselEnName());
+				feeCenter.setVoyageNo(bills.getVoyageNo());
+				feeCenter.setMblno(bills.getMblno());
+				feeCenter.setHblno(bills.getHblno());
+				feeCenter.setEtd(bills.getEtd());
+				feeCenter.setEta(bills.getEta());
+				feeCenter.setPolId(bills.getPolId());
+				feeCenter.setPolCode(bills.getPolCode());
+				feeCenter.setPolCnName(bills.getPolCnName());
+				feeCenter.setPolEnName(bills.getPolEnName());
+				feeCenter.setPodId(bills.getPodId());
+				feeCenter.setPodCode(bills.getPodCode());
+				feeCenter.setPodCnName(bills.getPodCnName());
+				feeCenter.setPodEnName(bills.getPodEnName());
+				feeCenter.setDc(items.getDc());
+				feeCenter.setPaymode(bills.getMpaymode());
+				feeCenter.setSort(count);
+				feeCenter.setCorpType(templateItems.getCorpType());
+				count++;
+				if ("国内直接客户,国外直接客户,国内同行及代理".contains(templateItems.getCorpType())) {
+					feeCenter.setCorpId(bills.getCorpId());
+					feeCenter.setCorpCnName(bills.getShortName());
+					feeCenter.setCorpEnName(bills.getCorpEnName());
+					feeCenter.setShortName(bills.getShortName());
+				} else if ("国外同行及代理".contains(templateItems.getCorpType())) {
+					feeCenter.setCorpId(bills.getForeignAgencyId());
+					feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
+					feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
+					feeCenter.setShortName(bills.getForeignAgencyCnName());
+				} else if ("船公司".contains(templateItems.getCorpType())) {
+					feeCenter.setCorpId(bills.getCarrierId());
+					feeCenter.setCorpCnName(bills.getCarrierShortName());
+					feeCenter.setCorpEnName(bills.getCarrierEnName());
+					feeCenter.setShortName(bills.getCarrierShortName());
+				} else if ("场站".contains(templateItems.getCorpType())) {
+					BCorps bCorps = null;
+					if (!corpsList.isEmpty()) {
+						bCorps = corpsList.stream().filter(e -> e.getId().equals(bills.getCyId())).findFirst().orElse(null);
+					}
+					feeCenter.setCorpId(bills.getCyId());
+					feeCenter.setCorpCnName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
+					feeCenter.setCorpEnName(bills.getCyEnName());
+					feeCenter.setShortName(bCorps == null ? bills.getCyCnName() : bCorps.getShortName());
+				} else if ("船代".contains(templateItems.getCorpType())) {
+					feeCenter.setCorpId(bills.getShippingAgencyId());
+					feeCenter.setCorpCnName(bills.getShippingAgencyCname());
+					feeCenter.setCorpEnName(bills.getShippingAgencyEname());
+					feeCenter.setShortName(bills.getShippingAgencyCname());
+				} else {
+					BCorps bCorps = null;
+					if (!corpsList.isEmpty()) {
+						bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
+					}
+					feeCenter.setCorpId(items.getCorpId());
+					feeCenter.setCorpCnName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
+					feeCenter.setCorpEnName(items.getCorpEnName());
+					feeCenter.setShortName(bCorps == null ? items.getCorpCnName() : bCorps.getShortName());
+				}
+				feeCenter.setFeeId(items.getFeeId());
+				feeCenter.setFeeCode(items.getFeeCode());
+				feeCenter.setFeeCnName(items.getFeeCnName());
+				feeCenter.setFeeEnName(items.getFeeEnName());
+				feeCenter.setUnitNo(items.getUnitNo());
+				feeCenter.setPrice(items.getSalesPrice());
+				feeCenter.setCurCode(items.getCurCode());
+				if (exrateType.equals(items.getCurCode())) {
+					feeCenter.setExrate(new BigDecimal("1.00"));
+				} else {
+					feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
+				}
+				if ("按箱型".equals(items.getQuantityRule())) {
+					if (preContainers.isEmpty()) {
+						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
+						continue;
+					}
+					if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
+						continue;
+					}
+					Integer quantity = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
+					if (quantity == 0) {
+						text.append("费用:").append(items.getFeeCnName()).append("集装箱数量为零!");
+						continue;
+					}
+					feeCenter.setQuantity(new BigDecimal(quantity + ""));
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("按票".equals(items.getQuantityRule())) {
+					feeCenter.setQuantity(new BigDecimal("1"));
+					feeCenter.setAmount(feeCenter.getPrice().multiply(new BigDecimal("1")));
+				} else if ("按重量".equals(items.getQuantityRule())) {
+					feeCenter.setQuantity(bills.getGrossWeight());
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("按TEU".equals(items.getQuantityRule())) {
+					if (preContainers.isEmpty()) {
+						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
+						continue;
+					}
+					if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
+						continue;
+					}
+					BigDecimal quantityTeu = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
+					Integer quantityGP = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
+					BigDecimal quantity = quantityTeu.multiply(new BigDecimal(quantityGP + ""));
+					if (quantity.compareTo(new BigDecimal("0")) == 0) {
+						text.append("费用:").append(items.getFeeCnName()).append("集装箱teu或数量为零!");
+						continue;
+					}
+					feeCenter.setQuantity(new BigDecimal(quantity + ""));
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("按箱量".equals(items.getQuantityRule())) {
+					if (preContainers.isEmpty()) {
+						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
+						continue;
+					}
+					Integer quantityGP = preContainers.stream().map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
+					BigDecimal quantity = new BigDecimal(quantityGP + "");
+					if (quantity.compareTo(new BigDecimal("0")) == 0) {
+						text.append("费用:").append(items.getFeeCnName()).append("集装箱箱量为零!");
+						continue;
+					}
+					feeCenter.setQuantity(new BigDecimal(quantity + ""));
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				} else if ("按尺码".equals(items.getQuantityRule())) {
+					feeCenter.setQuantity(bills.getMeasurement());
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				} else {
+					feeCenter.setQuantity(new BigDecimal("1"));
+					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
+				}
+				if (ObjectUtils.isNull(feeCenter.getAmount())) {
+					feeCenter.setAmount(new BigDecimal("0"));
+				}
+				if (exrateType.equals(feeCenter.getCurCode())) {
+					feeCenter.setAmountLoc(feeCenter.getAmount());
+				} else {
+					if (new BigDecimal("0").compareTo(feeCenter.getAmount()) != 0) {
+						feeCenter.setAmountLoc(feeCenter.getAmount().multiply(feeCenter.getExrate()));
+					} else {
+						feeCenter.setAmountLoc(new BigDecimal("0"));
+					}
+				}
+				list.add(feeCenter);
+			}
+			/*for (FeesTemplateItems items : losBFeesTemplate.getFeesTemplateItemsList()) {
 				FeeCenter feeCenter = new FeeCenter();
 				feeCenter.setPid(bills.getId());
 				feeCenter.setCntrNo(bills.getQuantityCntrTypesDescr());
@@ -267,7 +439,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
 					feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
 					feeCenter.setShortName(bills.getForeignAgencyCnName());
-				}else if ("船公司".contains(items.getCorpType())) {
+				} else if ("船公司".contains(items.getCorpType())) {
 					feeCenter.setCorpId(bills.getCarrierId());
 					feeCenter.setCorpCnName(bills.getCarrierShortName());
 					feeCenter.setCorpEnName(bills.getCarrierEnName());
@@ -286,7 +458,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setCorpCnName(bills.getShippingAgencyCname());
 					feeCenter.setCorpEnName(bills.getShippingAgencyEname());
 					feeCenter.setShortName(bills.getShippingAgencyCname());
-				}  else {
+				} else {
 					BCorps bCorps = null;
 					if (!corpsList.isEmpty()) {
 						bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
@@ -303,9 +475,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 				feeCenter.setUnitNo(items.getUnitNo());
 				feeCenter.setPrice(items.getPrice());
 				feeCenter.setCurCode(items.getCurCode());
-				if (exrateType.equals(items.getCurCode())){
+				if (exrateType.equals(items.getCurCode())) {
 					feeCenter.setExrate(new BigDecimal("1"));
-				}else{
+				} else {
 					feeCenter.setExrate(currencyUtils.obtainExrate(feeCenter.getDc(), curExrateList, feeCenter.getCurCode(), "1"));
 				}
 				if ("按箱型".equals(items.getQuantityRule())) {
@@ -353,7 +525,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					}
 					feeCenter.setQuantity(new BigDecimal(quantity + ""));
 					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
-				}else if ("按尺码".equals(items.getQuantityRule())) {
+				} else if ("按尺码".equals(items.getQuantityRule())) {
 					feeCenter.setQuantity(bills.getMeasurement());
 					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
 				} else {
@@ -373,7 +545,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					}
 				}
 				list.add(feeCenter);
-			}
+			}*/
 		}
 		this.saveOrUpdateBatch(list);
 		if (ObjectUtils.isNotNull(text.toString())) {
@@ -1090,7 +1262,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setCorpCnName(bills.getForeignAgencyCnName());
 					feeCenter.setCorpEnName(bills.getForeignAgencyEnName());
 					feeCenter.setShortName(bills.getForeignAgencyCnName());
-				}else if ("船公司".contains(templateItems.getCorpType())) {
+				} else if ("船公司".contains(templateItems.getCorpType())) {
 					feeCenter.setCorpId(bills.getCarrierId());
 					feeCenter.setCorpCnName(bills.getCarrierShortName());
 					feeCenter.setCorpEnName(bills.getCarrierEnName());
@@ -1109,7 +1281,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					feeCenter.setCorpCnName(bills.getShippingAgencyCname());
 					feeCenter.setCorpEnName(bills.getShippingAgencyEname());
 					feeCenter.setShortName(bills.getShippingAgencyCname());
-				}  else {
+				} else {
 					BCorps bCorps = null;
 					if (!corpsList.isEmpty()) {
 						bCorps = corpsList.stream().filter(e -> e.getId().equals(items.getCorpId())).findFirst().orElse(null);
@@ -1136,6 +1308,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
 						continue;
 					}
+					if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
+						continue;
+					}
 					Integer quantity = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).reduce(0, Integer::sum);
 					if (quantity == 0) {
 						text.append("费用:").append(items.getFeeCnName()).append("集装箱数量为零!");
@@ -1154,6 +1329,9 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
 						continue;
 					}
+					if (preContainers.stream().noneMatch(e -> items.getUnitNo().equals(e.getCntrTypeCode()))) {
+						continue;
+					}
 					BigDecimal quantityTeu = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getTeu).reduce(BigDecimal.ZERO, BigDecimal::add);
 					Integer quantityGP = preContainers.stream().filter(e -> items.getUnitNo().equals(e.getCntrTypeCode())).map(PreContainers::getQuantity).mapToInt(Integer::intValue).sum();
 					BigDecimal quantity = quantityTeu.multiply(new BigDecimal(quantityGP + ""));
@@ -1163,7 +1341,7 @@ public class FeeCenterServiceImpl extends ServiceImpl<FeeCenterMapper, FeeCenter
 					}
 					feeCenter.setQuantity(new BigDecimal(quantity + ""));
 					feeCenter.setAmount(feeCenter.getPrice().multiply(feeCenter.getQuantity()));
-				}else if ("按箱量".equals(items.getQuantityRule())) {
+				} else if ("按箱量".equals(items.getQuantityRule())) {
 					if (preContainers.isEmpty()) {
 						text.append("费用:").append(items.getFeeCnName()).append("未找到集装箱信息!");
 						continue;