Explorar el Código

Merge remote-tracking branch 'origin/dev' into dev

wfg hace 10 meses
padre
commit
744e5c8222

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

@@ -1986,5 +1986,51 @@ public class Bills implements Serializable {
 	@TableField(exist = false)
 	private BigDecimal equivalentToRmbCr;
 
+	/**
+	 * Amend本位币应收(CNY)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountDrAmend;
+	/**
+	 * Amend本位币应付(CNY)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountCrAmend;
+	/**
+	 * Amend本位币利润(CNY)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountProfitAmend;
+	/**
+	 * Amend综合 USD 应收(USD)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountDrUsdAmend;
+	/**
+	 * Amend USD 应付(USD)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountCrUsdAmend;
+	/**
+	 * Amend USD 利润(USD)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountProfitUsdAmend;
+	/**
+	 * Amend合计本位币应收(CNY )
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountDrLocAmend;
+	/**
+	 * Amend合计本位币应付(CNY)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountCrLocAmend;
+	/**
+	 * Amend合计本位币利润(CNY)
+	 */
+	@TableField(exist = false)
+	private BigDecimal amountProfitLocAmend;
+
 
 }

+ 75 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/entity/Agent.java

@@ -27,6 +27,7 @@ import org.springblade.los.business.files.entity.FilesCenter;
 import org.springblade.los.finance.fee.dto.FeeCenterReports;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.trade.dto.AgentItemsR;
+import org.springblade.los.trade.report.ReconciliationSummaryReport;
 import org.springblade.system.entity.Dept;
 
 import java.io.Serializable;
@@ -714,4 +715,78 @@ public class Agent implements Serializable {
 	private String whetherPaidAlready;
 
 
+	/**
+	 * 费用名称1
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName1;
+
+	/**
+	 * 费用名称2
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName2;
+
+	/**
+	 * 费用名称3
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName3;
+
+	/**
+	 * 费用名称4
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName4;
+
+
+	/**
+	 * 费用名称5
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName5;
+
+	/**
+	 * 费用名称6
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName6;
+
+	/**
+	 * 费用名称7
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName7;
+
+	/**
+	 * 费用名称8
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName8;
+
+	/**
+	 * 费用名称9
+	 */
+	@TableField(exist = false)
+	private BigDecimal costName9;
+
+	/**
+	 * 其他费用
+	 */
+	@TableField(exist = false)
+	private BigDecimal other;
+
+	/**
+	 * 合计
+	 */
+	@TableField(exist = false)
+	private BigDecimal total;
+
+	/**
+	 * 汇总明细
+	 */
+	@TableField(exist = false)
+	private List<ReconciliationSummaryReport> reportList;
+
+
 }

+ 182 - 0
blade-service-api/blade-los-api/src/main/java/org/springblade/los/trade/report/ReconciliationSummaryReport.java

@@ -0,0 +1,182 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.los.trade.report;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 对账汇总实体类
+ *
+ * @author BladeX
+ * @since 2024-07-12
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class ReconciliationSummaryReport implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+
+	/**
+	 * 序号
+	 */
+	@ExcelProperty(value = "序号")
+	private int sort;
+	/**
+	 * 进口日期
+	 */
+	@ExcelProperty(value = "进口日期")
+	private Date eta;
+
+	/**
+	 * 客户
+	 */
+	@ExcelProperty(value = "客户")
+	private String corpName;
+
+	/**
+	 * 箱型
+	 */
+	@ExcelProperty(value = "箱型")
+	private String boxType;
+
+	/**
+	 * 合同号
+	 */
+	@ExcelProperty(value = "合同号")
+	private String contractNo;
+
+	/**
+	 * 提单号
+	 */
+	@ExcelProperty(value = "提单号")
+	private String billNo;
+
+	/**
+	 * 箱号
+	 */
+	@ExcelProperty(value = "箱号")
+	private String boxNo;
+
+	/**
+	 * 品名
+	 */
+	@ExcelProperty(value = "品名")
+	private String goodsName;
+
+	/**
+	 * 到港时间
+	 */
+	@ExcelProperty(value = "到港时间")
+	private Date arrivalDate;
+
+	/**
+	 * 提箱时间
+	 */
+	@ExcelProperty(value = "提箱时间")
+	private Date suitcaseDate;
+
+	/**
+	 * 回空时间
+	 */
+	@ExcelProperty(value = "回空时间")
+	private Date haulbackDate;
+
+	/**
+	 * 免箱期
+	 */
+	@ExcelProperty(value = "免箱期")
+	private String freeBoxDate;
+
+	/**
+	 * 费用名称1
+	 */
+	@ExcelProperty(value = "包干费")
+	private BigDecimal costName1;
+
+	/**
+	 * 费用名称2
+	 */
+	@ExcelProperty(value = "滞箱费")
+	private BigDecimal costName2;
+
+	/**
+	 * 费用名称3
+	 */
+	@ExcelProperty(value = "修洗箱费")
+	private BigDecimal costName3;
+
+	/**
+	 * 费用名称4
+	 */
+	@ExcelProperty(value = "码头制冷费")
+	private BigDecimal costName4;
+
+
+	/**
+	 * 费用名称5
+	 */
+	@ExcelProperty(value = "陆运费")
+	private BigDecimal costName5;
+
+	/**
+	 * 费用名称6
+	 */
+	@ExcelProperty(value = "仓储费")
+	private BigDecimal costName6;
+
+	/**
+	 * 费用名称7
+	 */
+	@ExcelProperty(value = "出入库费")
+	private BigDecimal costName7;
+
+	/**
+	 * 费用名称8
+	 */
+	@ExcelProperty(value = "查验费")
+	private BigDecimal costName8;
+
+	/**
+	 * 费用名称9
+	 */
+	@ExcelProperty(value = "押车费")
+	private BigDecimal costName9;
+
+	/**
+	 * 其他费用
+	 */
+	@ExcelProperty(value = "其他")
+	private BigDecimal other;
+
+	/**
+	 * 合计
+	 */
+	@ExcelProperty(value = "合计")
+	private BigDecimal total;
+
+}

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

@@ -15,6 +15,7 @@ public class MagicValues {
 	public static final String COST = "费用";
 	public static final String PAID_APPLICATION = "付费申请";
 	public static final String RECONCILIATION_CENTER = "对账中心";
+	public static final String RECONCILIATION_SUMMARY = "对账汇总";
 	public static final String INVOICE_APPLICATION = "发票申请";
 	public static final String CHARGE_PAID_OFFSET = "收付相抵";
 	public static final String CHARGE_SETTLEMENT = "收费结算";

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

@@ -62,6 +62,11 @@ import org.springblade.los.finance.stl.entity.FinStlBills;
 import org.springblade.los.finance.stl.entity.FinStlBillsItems;
 import org.springblade.los.finance.stl.service.IFinStlBillsItemsService;
 import org.springblade.los.finance.stl.service.IFinStlBillsService;
+import org.springblade.los.trade.entity.Agent;
+import org.springblade.los.trade.entity.DispatchVehicles;
+import org.springblade.los.trade.report.ReconciliationSummaryReport;
+import org.springblade.los.trade.service.IDispatchVehiclesService;
+import org.springblade.los.trade.service.IReportDataTradeService;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
@@ -135,6 +140,10 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 
 	private final IHmmEdiService hmmEdiService;
 
+	private final IReportDataTradeService reportDataTradeService;
+
+	private final IDispatchVehiclesService dispatchVehiclesService;
+
 	@Override
 	public IPage<ReportsVO> selectReportsPage(IPage<ReportsVO> page, ReportsVO reports) {
 		return page.setRecords(baseMapper.selectReportsPage(page, reports));
@@ -699,6 +708,116 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				} else {
 					map.put(MagicValues.DATA, null);
 				}
+			} else if (MagicValues.RECONCILIATION_CENTER.equals(reportCode) && MagicValues.RECONCILIATION_SUMMARY.equals(groupCode)) {
+				List<FinStlBillsItems> finStlBillsItemsList = finStlBillsItemsService.list(new LambdaQueryWrapper<FinStlBillsItems>()
+					.eq(FinStlBillsItems::getTenantId, AuthUtil.getTenantId())
+					.eq(FinStlBillsItems::getIsDeleted, 0)
+					.eq(FinStlBillsItems::getPid, billId));
+				Agent agent = new Agent();
+				if (!finStlBillsItemsList.isEmpty()) {
+					List<Long> feeCenterIdList = finStlBillsItemsList.stream().map(FinStlBillsItems::getSourceId).collect(Collectors.toList());
+					List<FeeCenter> feeCenterList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+						.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
+						.eq(FeeCenter::getIsDeleted, 0)
+						.in(FeeCenter::getId, feeCenterIdList));
+					List<Long> idList = feeCenterList.stream().filter(e -> "SI".equals(e.getBusinessType()))
+						.map(FeeCenter::getPid).distinct().collect(Collectors.toList());
+					List<Bills> billsList = billsService.list(new LambdaQueryWrapper<Bills>()
+						.eq(Bills::getTenantId, AuthUtil.getTenantId())
+						.eq(Bills::getIsDeleted, 0)
+						.in(Bills::getId, idList));
+					List<PreContainers> preContainersList = preContainersService.list(new LambdaQueryWrapper<PreContainers>()
+						.eq(PreContainers::getTenantId, AuthUtil.getTenantId())
+						.eq(PreContainers::getIsDeleted, 0)
+						.in(PreContainers::getPid, idList));
+					List<DispatchVehicles> dispatchVehiclesList = dispatchVehiclesService.list(new LambdaQueryWrapper<DispatchVehicles>()
+						.eq(DispatchVehicles::getTenantId, AuthUtil.getTenantId())
+						.eq(DispatchVehicles::getIsDeleted, 0)
+						.in(DispatchVehicles::getPid, idList));
+					List<ReconciliationSummaryReport> list = new ArrayList<>();
+					int count = 1;
+					List<Long> preContainersId = new ArrayList<>();
+					for (PreContainers item : preContainersList) {
+						ReconciliationSummaryReport detail = new ReconciliationSummaryReport();
+						detail.setSort(count);
+						count++;
+						if (!billsList.isEmpty()) {
+							Bills bills = billsList.stream().filter(e -> e.getId().equals(item.getPid())).findFirst().orElse(null);
+							if (bills != null) {
+								detail.setEta(bills.getEta());
+								detail.setCorpName(bills.getCorpCnName());
+								detail.setContractNo(bills.getBookingNo());
+								detail.setBillNo(bills.getMblno());
+								detail.setFreeBoxDate(bills.getIqNo());
+								detail.setArrivalDate(bills.getEta());
+							}
+						}
+						detail.setBoxType(item.getCntrTypeCode());
+						detail.setBoxNo(item.getBoxNo());
+						detail.setGoodsName(item.getGoodsName());
+						if (!dispatchVehiclesList.isEmpty()) {
+							DispatchVehicles dispatchVehicles = dispatchVehiclesList.stream().filter(e -> e.getBoxItemsId().equals(item.getId())).findFirst().orElse(null);
+							if (dispatchVehicles != null) {
+								detail.setSuitcaseDate(dispatchVehicles.getPickupDate());
+								detail.setHaulbackDate(dispatchVehicles.getReturnDate());
+							}
+						}
+						if (preContainersId.isEmpty() || !preContainersId.contains(item.getPid())) {
+							detail.setCostName1(feeCenterList.stream().filter(e -> "BGF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName2(feeCenterList.stream().filter(e -> "ZXF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName3(feeCenterList.stream().filter(e -> "XXX".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName4(feeCenterList.stream().filter(e -> "MTZL".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName5(feeCenterList.stream().filter(e -> "LYF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName6(feeCenterList.stream().filter(e -> "CCF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName7(feeCenterList.stream().filter(e -> "CRKF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName8(feeCenterList.stream().filter(e -> "CYZY".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setCostName9(feeCenterList.stream().filter(e -> "YCF".equals(e.getFeeCode()) && e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setOther(feeCenterList.stream().filter(e -> !"BGF,ZXF,XXX,MTZL,LYF,CCF,CRKF,CYZY,YCF".contains(e.getFeeCode())
+								&& e.getPid().equals(item.getPid())).map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							detail.setTotal(feeCenterList.stream().filter(e -> e.getPid().equals(item.getPid()))
+								.map(FeeCenter::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+							preContainersId.add(item.getPid());
+						} else {
+							detail.setCostName1(new BigDecimal("0.00"));
+							detail.setCostName2(new BigDecimal("0.00"));
+							detail.setCostName3(new BigDecimal("0.00"));
+							detail.setCostName4(new BigDecimal("0.00"));
+							detail.setCostName5(new BigDecimal("0.00"));
+							detail.setCostName6(new BigDecimal("0.00"));
+							detail.setCostName7(new BigDecimal("0.00"));
+							detail.setCostName8(new BigDecimal("0.00"));
+							detail.setCostName9(new BigDecimal("0.00"));
+							detail.setOther(new BigDecimal("0.00"));
+							detail.setTotal(new BigDecimal("0.00"));
+						}
+						list.add(detail);
+					}
+					agent.setCostName1(list.stream().map(ReconciliationSummaryReport::getCostName1).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName2(list.stream().map(ReconciliationSummaryReport::getCostName2).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName3(list.stream().map(ReconciliationSummaryReport::getCostName3).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName4(list.stream().map(ReconciliationSummaryReport::getCostName4).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName5(list.stream().map(ReconciliationSummaryReport::getCostName5).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName6(list.stream().map(ReconciliationSummaryReport::getCostName6).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName7(list.stream().map(ReconciliationSummaryReport::getCostName7).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName8(list.stream().map(ReconciliationSummaryReport::getCostName8).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setCostName9(list.stream().map(ReconciliationSummaryReport::getCostName9).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setOther(list.stream().map(ReconciliationSummaryReport::getOther).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setTotal(list.stream().map(ReconciliationSummaryReport::getTotal).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+					agent.setReportList(list);
+					agent.setDept(dept);
+					map.put(MagicValues.DATA, agent);
+				} else {
+					map.put(MagicValues.DATA, null);
+				}
 			}
 		}
 		return R.data(map);
@@ -822,7 +941,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					bills.setGrossMargin(new BigDecimal(MagicValues.ZERO));
 				}
 
-				if(isDebug) {
+				if (isDebug) {
 					System.out.println("GrossMargin: " + bills.getGrossMargin().toString());
 				}
 
@@ -859,9 +978,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 								}
 							}
 							for (Bills item : billsList) {
-								List<FeeCenter> feeD = feeCenterListMh.stream().filter(e->MagicValues.D.equals(e.getDc())).collect(Collectors.toList());;
+								List<FeeCenter> feeD = feeCenterListMh.stream().filter(e -> MagicValues.D.equals(e.getDc())).collect(Collectors.toList());
+								;
 								item.setFeeCenterListD(feeD);
-								List<FeeCenter> feeC = feeCenterListMh.stream().filter(e->MagicValues.C.equals(e.getDc())).collect(Collectors.toList());;
+								List<FeeCenter> feeC = feeCenterListMh.stream().filter(e -> MagicValues.C.equals(e.getDc())).collect(Collectors.toList());
+								;
 								item.setFeeCenterListC(feeC);
 								List<FeeCenter> feeCenterList = feeCenterListMh.stream()
 									.collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(
@@ -935,9 +1056,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						.eq(FeeCenter::getIsDeleted, 0));
 					allFeeCenter.addAll(feeCenterList);
 
-					List<FeeCenter> feeD = feeCenterList.stream().filter(e->MagicValues.D.equals(e.getDc())).collect(Collectors.toList());;
+					List<FeeCenter> feeD = feeCenterList.stream().filter(e -> MagicValues.D.equals(e.getDc())).collect(Collectors.toList());
+					;
 					bills.setFeeCenterListD(feeD);
-					List<FeeCenter> feeC = feeCenterList.stream().filter(e->MagicValues.C.equals(e.getDc())).collect(Collectors.toList());;
+					List<FeeCenter> feeC = feeCenterList.stream().filter(e -> MagicValues.C.equals(e.getDc())).collect(Collectors.toList());
+					;
 					bills.setFeeCenterListC(feeC);
 
 					for (FeeCenter item : feeCenterList) {
@@ -1033,9 +1156,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							throw new RuntimeException("请先维护费用信息");
 						}
 						allFeeCenter.addAll(feeCenterList);
-						List<FeeCenter> feeD = feeCenterList.stream().filter(e->MagicValues.D.equals(e.getDc())).collect(Collectors.toList());;
+						List<FeeCenter> feeD = feeCenterList.stream().filter(e -> MagicValues.D.equals(e.getDc())).collect(Collectors.toList());
+						;
 						bills.setFeeCenterListD(feeD);
-						List<FeeCenter> feeC = feeCenterList.stream().filter(e->MagicValues.C.equals(e.getDc())).collect(Collectors.toList());;
+						List<FeeCenter> feeC = feeCenterList.stream().filter(e -> MagicValues.C.equals(e.getDc())).collect(Collectors.toList());
+						;
 						bills.setFeeCenterListC(feeC);
 						if (!feeCenterList.isEmpty()) {
 							for (FeeCenter item : feeCenterList) {
@@ -1120,9 +1245,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 
 						allFeeCenter.addAll(feeCenterListMh);
 
-						List<FeeCenter> feeD2 = feeCenterListMh.stream().filter(e->MagicValues.D.equals(e.getDc())).collect(Collectors.toList());;
+						List<FeeCenter> feeD2 = feeCenterListMh.stream().filter(e -> MagicValues.D.equals(e.getDc())).collect(Collectors.toList());
+						;
 						details.setFeeCenterListD(feeD2);
-						List<FeeCenter> feeC2 = feeCenterListMh.stream().filter(e->MagicValues.C.equals(e.getDc())).collect(Collectors.toList());;
+						List<FeeCenter> feeC2 = feeCenterListMh.stream().filter(e -> MagicValues.C.equals(e.getDc())).collect(Collectors.toList());
+						;
 						details.setFeeCenterListC(feeC2);
 						for (FeeCenter item : feeCenterListMh) {
 							if (ObjectUtils.isNotNull(item.getShortName())) {
@@ -1266,8 +1393,8 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							item.setGrossMargin(new BigDecimal(MagicValues.ZERO));
 						}
 
-						if(isDebug) {
-							System.out.println(item.getId().toString() + ", " + item.getBillNo() +  ", GrossMargin: " + bills.getGrossMargin().toString());
+						if (isDebug) {
+							System.out.println(item.getId().toString() + ", " + item.getBillNo() + ", GrossMargin: " + bills.getGrossMargin().toString());
 						}
 						// 费用名称
 						// 1722822288795000833	O/F		海运费	145
@@ -1304,18 +1431,18 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						// 高收退费客户 Id
 						Long hpsCorpId = 0L;
 
-						if(ObjectUtils.isNotNull(feeList)){
+						if (ObjectUtils.isNotNull(feeList)) {
 							for (FeeCenter fee : feeList) {
-								if(specPSCorpId==0 && ObjectUtils.isNotNull(fee.getCorpId())){
-									if(specPScorpIds.indexOf("," + fee.getCorpId().toString() + ",")>=0){
+								if (specPSCorpId == 0 && ObjectUtils.isNotNull(fee.getCorpId())) {
+									if (specPScorpIds.indexOf("," + fee.getCorpId().toString() + ",") >= 0) {
 										specPSCorpId = fee.getCorpId();
 									}
 								}
 								BigDecimal amt = fee.getAmount();
-								if(MagicValues.C.equals(fee.getDc())){
+								if (MagicValues.C.equals(fee.getDc())) {
 									amt = amt.multiply(new BigDecimal(-1));
 								}
-								if(MagicValues.USD.equals(fee.getCurCode())) {
+								if (MagicValues.USD.equals(fee.getCurCode())) {
 									if ("O/F".equals(fee.getFeeCode())) {
 										// 145
 										usdOFProfit = usdOFProfit.add(amt);
@@ -1325,14 +1452,14 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 										psProfit = psProfit.subtract(amt);
 									}
 									if ("HP/S".equals(fee.getFeeCode())) {
-										if(hpsCorpId==0 && ObjectUtils.isNotNull(fee.getCorpId())){
+										if (hpsCorpId == 0 && ObjectUtils.isNotNull(fee.getCorpId())) {
 											hpsCorpId = fee.getCorpId();
 										}
 										// 623
 										HPSProfit = HPSProfit.add(amt);
 										specProfit = specProfit.subtract(amt);
 									}
-								}else{
+								} else {
 									if ("O/F".equals(fee.getFeeCode())) {
 										// 145
 										ofInAmtProfit = ofInAmtProfit.add(amt.divide(new BigDecimal("6.8"), 2, BigDecimal.ROUND_HALF_UP));
@@ -1343,7 +1470,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 										psInAmtProfit = psInAmtProfit.add(amt);
 									}
 									if ("HP/S".equals(fee.getFeeCode())) {
-										if(hpsCorpId==0 && ObjectUtils.isNotNull(fee.getCorpId())){
+										if (hpsCorpId == 0 && ObjectUtils.isNotNull(fee.getCorpId())) {
 											hpsCorpId = fee.getCorpId();
 										}
 										// 623
@@ -1357,28 +1484,28 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						BCorps bCorps11 = bCorpsService.getById(item.getCorpId());
 						BigDecimal PsRate = new BigDecimal(BigInteger.ZERO);
 						Integer corpIsDC = 0;
-						if(ObjectUtils.isNotNull(bCorps11)) {
+						if (ObjectUtils.isNotNull(bCorps11)) {
 							PsRate = new BigDecimal(bCorps11.getPsRate());
-							if(ObjectUtils.isNotNull(bCorps11.getCorpTypeName()) && bCorps11.getCorpTypeName().indexOf("国内直接客户")>=0) {
+							if (ObjectUtils.isNotNull(bCorps11.getCorpTypeName()) && bCorps11.getCorpTypeName().indexOf("国内直接客户") >= 0) {
 								corpIsDC = 1;
 							}
 						}
 						BigDecimal specPsRate = new BigDecimal(BigInteger.ZERO);
 						Boolean isPS = false;
 
-						if(specPSCorpId>0){
+						if (specPSCorpId > 0) {
 							BCorps bCorps12 = bCorpsService.getById(specPSCorpId);
 							if (ObjectUtils.isNotNull(bCorps12)) {
 								specPsRate = new BigDecimal(bCorps12.getPsRate());
 							}
 						}
 
-						if(hpsCorpId>0){
+						if (hpsCorpId > 0) {
 							BCorps bCorps13 = bCorpsService.getById(hpsCorpId);
-							if(ObjectUtils.isNotNull(bCorps13)) {
+							if (ObjectUtils.isNotNull(bCorps13)) {
 								Long ownerCorpId = ObjectUtils.isNotNull(bCorps13.getCorpId()) ? bCorps13.getCorpId() : 0L;
-								if(ownerCorpId>0 && (ownerCorpId.equals(item.getCorpId()) || ownerCorpId.equals(item.getCarrierId()) || ownerCorpId.equals(hpsCorpId))){
-									isPS = ObjectUtils.isNotNull(bCorps13.getIsPs()) && bCorps13.getIsPs()==1;
+								if (ownerCorpId > 0 && (ownerCorpId.equals(item.getCorpId()) || ownerCorpId.equals(item.getCarrierId()) || ownerCorpId.equals(hpsCorpId))) {
+									isPS = ObjectUtils.isNotNull(bCorps13.getIsPs()) && bCorps13.getIsPs() == 1;
 								}
 							}
 						}
@@ -1397,54 +1524,54 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						specPsRate = specPsRate.setScale(2, RoundingMode.HALF_UP);
 						specProfit = specProfit.setScale(2, RoundingMode.HALF_UP);
 						specInAmtProfit = specInAmtProfit.setScale(2, RoundingMode.HALF_UP);
-						if(psInAmtProfit.compareTo(BigDecimal.ZERO)!=0){
+						if (psInAmtProfit.compareTo(BigDecimal.ZERO) != 0) {
 							ps_remarks += " PS不能出现 RMB 费用\r\n";
 						}
 
-						if("CC".equals(item.getMpaymode()) && psProfit.compareTo(BigDecimal.ZERO)!=0){
+						if ("CC".equals(item.getMpaymode()) && psProfit.compareTo(BigDecimal.ZERO) != 0) {
 							ps_remarks += " 主单付费方式为CC 不能出现PS\r\n";
 						}
 
-						if(("PP".equals(item.getMpaymode()) && (MagicValues.DD.equals(item.getBillType()) || MagicValues.MM.equals(item.getBillType())))
-    						||("PP".equals(item.getMpaymode()) && ObjectUtils.isNotNull(item.getHblno()))){
-							if(specPScorpIds.indexOf("," + specPSCorpId.toString() + ",")>=0) {
-								if(usdOFProfit.compareTo(BigDecimal.ZERO)!=0){
+						if (("PP".equals(item.getMpaymode()) && (MagicValues.DD.equals(item.getBillType()) || MagicValues.MM.equals(item.getBillType())))
+							|| ("PP".equals(item.getMpaymode()) && ObjectUtils.isNotNull(item.getHblno()))) {
+							if (specPScorpIds.indexOf("," + specPSCorpId.toString() + ",") >= 0) {
+								if (usdOFProfit.compareTo(BigDecimal.ZERO) != 0) {
 									BigDecimal tt1 = usdOFProfit.add(ofInAmtProfit).add(HPSProfit).setScale(2, BigDecimal.ROUND_HALF_UP);
-									if(tt1.compareTo(BigDecimal.ZERO)!=0) {
+									if (tt1.compareTo(BigDecimal.ZERO) != 0) {
 										BigDecimal pt1 = psProfit.divide(tt1, 2, BigDecimal.ROUND_HALF_UP);
-										if(pt1.compareTo(specPsRate)>0){
+										if (pt1.compareTo(specPsRate) > 0) {
 											BigDecimal psr1 = new BigDecimal(1).subtract(pt1).setScale(2, BigDecimal.ROUND_HALF_UP);
-											ps_remarks += " PS比例高,公司比例: "+psr1.toString() + " 系统比例为:" + specPsRate.toString() +"\r\n";
+											ps_remarks += " PS比例高,公司比例: " + psr1.toString() + " 系统比例为:" + specPsRate.toString() + "\r\n";
 											BigDecimal psr2 = new BigDecimal(1).subtract(specPsRate).setScale(2, BigDecimal.ROUND_HALF_UP);
-											ps_ps += "公司比例:"+psr1.toString()+" (" +psr2.toString()+")\r\n";
+											ps_ps += "公司比例:" + psr1.toString() + " (" + psr2.toString() + ")\r\n";
 										}
 									}
 								}
-							}else{
-								if(usdOFProfit.compareTo(BigDecimal.ZERO)!=0){
+							} else {
+								if (usdOFProfit.compareTo(BigDecimal.ZERO) != 0) {
 									BigDecimal tt1 = usdOFProfit.add(ofInAmtProfit).add(HPSProfit).setScale(2, BigDecimal.ROUND_HALF_UP);
-									if(tt1.compareTo(BigDecimal.ZERO)!=0) {
+									if (tt1.compareTo(BigDecimal.ZERO) != 0) {
 										BigDecimal pt1 = psProfit.divide(tt1, 4, BigDecimal.ROUND_HALF_UP);
-										if(pt1.compareTo(PsRate)>0){
+										if (pt1.compareTo(PsRate) > 0) {
 											BigDecimal psr1 = new BigDecimal(1).subtract(pt1).setScale(2, BigDecimal.ROUND_HALF_UP);
-											ps_remarks += " PS比例高,公司比例: "+psr1.toString() + " 系统比例为:" + specPsRate.toString() +"\r\n";
+											ps_remarks += " PS比例高,公司比例: " + psr1.toString() + " 系统比例为:" + specPsRate.toString() + "\r\n";
 											BigDecimal psr2 = new BigDecimal(1).subtract(PsRate).setScale(2, BigDecimal.ROUND_HALF_UP);
-											ps_ps += "公司比例:"+psr1.toString()+" (" +psr2.toString()+")\r\n";
+											ps_ps += "公司比例:" + psr1.toString() + " (" + psr2.toString() + ")\r\n";
 										}
 									}
 								}
 							}
-						}else{
-							if(psProfit.compareTo(BigDecimal.ZERO)!=0) {
+						} else {
+							if (psProfit.compareTo(BigDecimal.ZERO) != 0) {
 								ps_remarks += "只有预付、直单和主单,或分单和到付才可以输入PS\r\n";
 							}
 						}
 
 						BigDecimal tt2 = specProfit.add(specInAmtProfit).setScale(2, BigDecimal.ROUND_HALF_UP);
-						if(tt2.compareTo(BigDecimal.ZERO)==1) {
-							if(isPS==true) {
+						if (tt2.compareTo(BigDecimal.ZERO) == 1) {
+							if (isPS == true) {
 								ps_spec += "存在高收退费\r\n";
-							}else{
+							} else {
 								ps_remarks += "不应该存在高收退费\r\n";
 								ps_spec += "不应该存在高收退费\r\n";
 							}
@@ -1457,7 +1584,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						item.setProfitSpec(ps_ps.trim() + "\r\n" + ps_spec.trim());
 						item.setText(ps_text);
 						item.setCorpIsDC(corpIsDC);
-						item.setIfDCCorp(corpIsDC==1?"DC":"");
+						item.setIfDCCorp(corpIsDC == 1 ? "DC" : "");
 
 						//   FOverFeeLimit:=Trim(GetSysConst('SEA_ISSUEBILL_OVERFEE_LIMIT', '100000'));
 						// 判断是否国内直客
@@ -1471,7 +1598,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 						BigDecimal sumLocCr = new BigDecimal(BigInteger.ZERO);
 
 						BigDecimal sumOFPS = new BigDecimal(BigInteger.ZERO);
-						if(item.equals(bills)) {
+						if (item.equals(bills)) {
 							// 当前单据,计算 ProfitStatus
 							for (FeeCenter fee : allFeeCenter) {
 								if (MagicValues.C.equals(fee.getDc()) && "P/S".equals(fee.getFeeCode())) {
@@ -1531,7 +1658,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 							// if([WFPK_ProfitStatus]='L','Profit was low!',''))))]
 							//[IF([WFPK_ProfitStatus]='M', 'Profit was minus!',
 							// IF([WFPK_ProfitStatus]='U', 'P/S was unfair!', ''))]
-							switch (profitStatus){
+							switch (profitStatus) {
 								case "Z":
 									item.setProfitStatusText("利润为零");
 									item.setProfitStatusEnText("Profit was zero!");
@@ -1574,14 +1701,13 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 
 						String salesReportOverlimit = sysClient.getParamServiceNew(MagicValues.SALESREPORT_OVERLIMIT);
 						BigDecimal ro;
-						if(ObjectUtils.isNotNull(salesReportOverlimit)){
-							try{
+						if (ObjectUtils.isNotNull(salesReportOverlimit)) {
+							try {
 								ro = new BigDecimal(salesReportOverlimit);
-							}catch (Exception e){
+							} catch (Exception e) {
 								ro = new BigDecimal(BigInteger.ZERO);
 							}
-						}
-						else
+						} else
 							ro = new BigDecimal(BigInteger.ZERO);
 						item.setOverFeeLimit(ro.setScale(2, BigDecimal.ROUND_HALF_UP));
 
@@ -1705,7 +1831,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					bills.setMforwarderDetails(seaBillsDetail.getMforwarderDetails());
 				}
 //				bills.setFM(MagicValues.FM);
-				bills.setCapitalLetters("SAY "+BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() +" ONLY.");
+				bills.setCapitalLetters("SAY " + BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() + " ONLY.");
 				bills.setVesselCnName(bills.getVesselEnName() + "/" + bills.getVoyageNo());
 				BigDecimal boxWeightSum = BigDecimal.ZERO;
 				List<ContainersReports> containersReportsList = new ArrayList<>();
@@ -1816,7 +1942,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					bills.setIssueType(resDictBiz1.getData().getRemark());
 				}
 //				bills.setFM(MagicValues.FM);
-				bills.setCapitalLetters("SAY "+BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() +" ONLY.");
+				bills.setCapitalLetters("SAY " + BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() + " ONLY.");
 				bills.setVesselCnName(bills.getVesselEnName() + "/" + bills.getVoyageNo());
 				BigDecimal boxWeightSum = BigDecimal.ZERO;
 				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
@@ -2153,7 +2279,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setMoney(item.getAmount());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -2170,11 +2296,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				bills.setAmountCrUsd(amountCrUsd);
 				bills.setAmountProfitUsd(amountProfitUsd);
 				bills.setAmountDrLoc(amountDrLoc);
-				if ("USD".equals(curCode)){
+				if ("USD".equals(curCode)) {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountDrUsd));
-				}else if ("CNY".equals(curCode)){
+				} else if ("CNY".equals(curCode)) {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountDr));
-				}else{
+				} else {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountDrLoc));
 				}
 				bills.setAmountCrLoc(amountCrLoc);
@@ -2292,7 +2418,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setExrate(item.getExrate());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -2482,7 +2608,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setMoney(item.getAmount());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -2500,11 +2626,11 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 				bills.setAmountProfitUsd(amountProfitUsd);
 				bills.setAmountDrLoc(amountDrLoc);
 				bills.setAmountCrLoc(amountCrLoc);
-				if ("USD".equals(curCode)){
+				if ("USD".equals(curCode)) {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountCrUsd));
-				}else if ("CNY".equals(curCode)){
+				} else if ("CNY".equals(curCode)) {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountCr));
-				}else{
+				} else {
 					bills.setCapitalLetters(BigDecimalUtils.convertToEnglish(amountCrLoc));
 				}
 				bills.setAmountProfitLoc(amountProfitLoc);
@@ -2617,7 +2743,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setExrate(item.getExrate());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -2641,7 +2767,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 			} else {
 				map.put(MagicValues.DATA, null);
 			}
-		}else{
+		} else {
 			// 默认取单据数据,包括主表、预配箱、配箱、费用
 			Bills bills = billsService.getById(billId);
 			if (bills != null) {
@@ -2712,7 +2838,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					bills.setIssueType(resDictBiz1.getData().getRemark());
 				}
 //				bills.setFM(MagicValues.FM);
-				bills.setCapitalLetters("SAY "+BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() +" ONLY.");
+				bills.setCapitalLetters("SAY " + BigDecimalUtils.convertToEnglish(bills.getQuantity()) + " " + bills.getPackingUnit() + " ONLY.");
 				bills.setVesselCnName(bills.getVesselEnName() + "/" + bills.getVoyageNo());
 				BigDecimal boxWeightSum = BigDecimal.ZERO;
 				List<Containers> containersList = containersService.list(new LambdaQueryWrapper<Containers>()
@@ -3365,7 +3491,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -3494,7 +3620,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -3622,7 +3748,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -3741,7 +3867,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -3884,7 +4010,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -3997,7 +4123,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -4109,7 +4235,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -4222,7 +4348,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -6328,7 +6454,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -6442,7 +6568,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -6555,7 +6681,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}
@@ -6659,7 +6785,7 @@ public class ReportsServiceImpl extends ServiceImpl<ReportsMapper, Reports> impl
 					feeCenterReports.setAmount(item.getQuantity() + "*" + item.getPrice());
 					feeCenterReportsList.add(feeCenterReports);
 				}
-				if (!feeCenterList.isEmpty()){
+				if (!feeCenterList.isEmpty()) {
 					bills.setTo(feeCenterList.get(0).getCorpCnName());
 					bills.setAccNo(feeCenterList.stream().map(FeeCenter::getAccBillNo).filter(Objects::nonNull).distinct().collect(Collectors.joining(",")));
 				}

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

@@ -988,16 +988,56 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			.eq(Amends::getIsDeleted, 0)
 			.eq(Amends::getStatus, 3)
 			.eq(Amends::getOrigId, detail.getId()));
+		BigDecimal amountDr = new BigDecimal("0.00");
+		BigDecimal amountCr = new BigDecimal("0.00");
+		BigDecimal amountProfit;
+		BigDecimal amountDrUsd = new BigDecimal("0.00");
+		BigDecimal amountCrUsd = new BigDecimal("0.00");
+		BigDecimal amountProfitUsd;
+		BigDecimal amountDrLoc = new BigDecimal("0.00");
+		BigDecimal amountCrLoc = new BigDecimal("0.00");
+		BigDecimal amountProfitLoc;
 		if (!amendsList.isEmpty()) {
 			List<Long> ids = amendsList.stream().map(Amends::getId).distinct().collect(Collectors.toList());
-			detail.setFeeCenterAmendList(feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
+			List<FeeCenter> feeCenterAmendList = feeCenterService.list(new LambdaQueryWrapper<FeeCenter>()
 				.eq(FeeCenter::getIsDeleted, 0)
 				.eq(FeeCenter::getTenantId, AuthUtil.getTenantId())
-				.in(FeeCenter::getPid, ids)
-			));
+				.in(FeeCenter::getPid, ids));
+			detail.setFeeCenterAmendList(feeCenterAmendList.isEmpty() ? new ArrayList<>() : feeCenterAmendList);
+			for (FeeCenter item : feeCenterAmendList) {
+				if ("D".equals(item.getDc())) {
+					if ("CNY".equals(item.getCurCode())) {
+						amountDr = amountDr.add(item.getAmount());
+						amountDrLoc = amountDrLoc.add(item.getAmount());
+					} else {
+						amountDrUsd = amountDrUsd.add(item.getAmount());
+						amountDrLoc = amountDrLoc.add(item.getAmount().multiply(item.getExrate()));
+					}
+				} else {
+					if ("CNY".equals(item.getCurCode())) {
+						amountCr = amountCr.add(item.getAmount());
+						amountCrLoc = amountCrLoc.add(item.getAmount());
+					} else {
+						amountCrUsd = amountCrUsd.add(item.getAmount());
+						amountCrLoc = amountCrLoc.add(item.getAmount().multiply(item.getExrate()));
+					}
+				}
+			}
 		} else {
 			detail.setFeeCenterAmendList(new ArrayList<>());
 		}
+		amountProfit = amountDr.subtract(amountCr);
+		amountProfitUsd = amountDrUsd.subtract(amountCrUsd);
+		amountProfitLoc = amountDrLoc.subtract(amountCrLoc);
+		detail.setAmountDrAmend(amountDr);
+		detail.setAmountCrAmend(amountCr);
+		detail.setAmountProfitAmend(amountProfit);
+		detail.setAmountDrUsdAmend(amountDrUsd);
+		detail.setAmountCrUsdAmend(amountCrUsd);
+		detail.setAmountProfitUsdAmend(amountProfitUsd);
+		detail.setAmountDrLocAmend(amountDrLoc);
+		detail.setAmountCrLocAmend(amountCrLoc);
+		detail.setAmountProfitLocAmend(amountProfitLoc);
 		return detail;
 	}
 
@@ -1895,7 +1935,7 @@ public class BillsServiceImpl extends ServiceImpl<BillsMapper, Bills> implements
 			lambdaQueryWrapper.eq(Bills::getBranchId, deptUtils.getDeptPid());
 		}
 		List<Bills> billsList = baseMapper.selectList(lambdaQueryWrapper);
-		if (billsList.size() == 0) {
+		if (billsList.isEmpty()) {
 			throw new RuntimeException("未查到单据信息");
 		}
 		for (Bills detail : billsList) {

+ 2 - 12
blade-service/blade-los/src/main/java/org/springblade/los/trade/service/impl/AgentServiceImpl.java

@@ -43,14 +43,12 @@ import org.springblade.los.basic.fees.entity.BFees;
 import org.springblade.los.basic.fees.service.IBFeesService;
 import org.springblade.los.billno.entity.BusinessBillNo;
 import org.springblade.los.billno.service.IBusinessBillNoService;
-import org.springblade.los.business.amends.service.IAmendsService;
 import org.springblade.los.business.files.entity.FilesCenter;
 import org.springblade.los.business.files.service.IFilesCenterService;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.entity.PreContainers;
 import org.springblade.los.business.sea.entity.SeaBillsDetail;
 import org.springblade.los.business.sea.service.IBillsService;
-import org.springblade.los.business.sea.service.IContainersService;
 import org.springblade.los.business.sea.service.IPreContainersService;
 import org.springblade.los.business.sea.service.ISeaBillsDetailService;
 import org.springblade.los.check.dto.LosAuditProecessDTO;
@@ -59,8 +57,6 @@ import org.springblade.los.check.entity.LosAuditPathsLevels;
 import org.springblade.los.check.service.IAuditPathsActsService;
 import org.springblade.los.check.service.IAuditPathsLevelsService;
 import org.springblade.los.check.service.IAuditProecessService;
-import org.springblade.los.finance.agreement.service.IAgreementPriceItemsService;
-import org.springblade.los.finance.agreement.service.IAgreementPriceService;
 import org.springblade.los.finance.fee.dto.FeeCenterReports;
 import org.springblade.los.finance.fee.entity.FeeCenter;
 import org.springblade.los.finance.fee.entity.FinAccBills;
@@ -81,7 +77,6 @@ import org.springblade.los.trade.report.*;
 import org.springblade.los.trade.service.*;
 import org.springblade.los.trade.vo.AgentVO;
 import org.springblade.system.entity.Dept;
-import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
@@ -137,11 +132,6 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 	private final ISeaBillsDetailService seaBillsDetailService;
 	private final IBCurrencyService ibCurrencyService;
 	private final IRecordService recordService;
-	private final IAmendsService amendsService;
-	private final IDictBizClient dictBizClient;
-	private final IAgreementPriceService agreementPriceService;
-	private final IAgreementPriceItemsService agreementPriceItemsService;
-	private final IContainersService containersService;
 	private final IBCorpsService bCorpsService;
 	private final IReportDataTradeService reportDataTradeService;
 
@@ -2151,8 +2141,8 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
 		}
 		BigDecimal goodsValue = new BigDecimal("0.00");
 		BigDecimal serviceChargeDiscount = new BigDecimal("0.00");
-		for (FeeCenter item : feeCenters1){
-			if ("SFK,WK".contains(item.getFeeCode())){
+		for (FeeCenter item : feeCenters1) {
+			if ("SFK,WK".contains(item.getFeeCode())) {
 				goodsValue = goodsValue.add(item.getAmountLoc().multiply(item.getDiscountExrate()));
 			}
 		}

+ 8 - 6
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -4869,12 +4869,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						//计算成本
 						goodsName.append(goodsDesc.getCname()).append(",");
 						retrieval.append(goodsDesc.getCnameInt()).append(",");
-						item.setCostprie(item.getGoodsNum().multiply(inventoryCostPrice));
-						item.setCostpriePrice(inventoryCostPrice);
-						item.setRebateCostprie(item.getGoodsNum().multiply(rebateInventoryCostPrice));
-						//计算毛利
-						item.setGrossProfit(item.getSubTotalMoney().subtract(item.getCostprie()));
-						item.setRebateProfit(item.getSubTotalMoney().subtract(item.getRebateCostprie()));
+						if (new BigDecimal("0.00").compareTo(item.getSendNum()) == 0){
+							item.setCostprie(item.getGoodsNum().multiply(inventoryCostPrice));
+							item.setCostpriePrice(inventoryCostPrice);
+							item.setRebateCostprie(item.getGoodsNum().multiply(rebateInventoryCostPrice));
+							//计算毛利
+							item.setGrossProfit(item.getSubTotalMoney().subtract(item.getCostprie()));
+							item.setRebateProfit(item.getSubTotalMoney().subtract(item.getRebateCostprie()));
+						}
 					}
 					orderItemsService.saveOrUpdate(item);
 				}